#multiplayer

1 messages · Page 152 of 1

thin stratus
#

Some peeps here already stated they are using it

solar stirrup
#

mayb

#

maybe that's why the replication feels off this season

#

It's all very short range heh

twin juniper
#

Guys, i have a question.
Can i rollback with replication?

#

And also, is my question even make sense?

fossil spoke
#

The Character Movement Component implements Rollback.

true stream
#

If I want my actors to be in sync when it comes to their positions, I should mark their location as replicated? or there is a different way

#

(RTS game, actors spawned from barracks)

solar stirrup
#

I just thought of something @thin stratus - wouldn't replicating a UDataAsset* be cheaper than replicating a FPrimaryAssetId or FName

#

The engine will assign an FNetGUID after the first time it sends it right?

#

So "expensive" first replication but then it'd just be 4 8 bytes it's uint64 now

thin stratus
#

But it would make sense I guess

#

easy to test by breakpointing the packagemap

solar stirrup
#

defo gonna check

#

if so i'm saving myself tons of trouble heh

thin stratus
true stream
#

I noticed that I was causing some difference in performance for the client (half the framerate when on back apparently) and even though the units were getting killed in time, the movement was off.

solar stirrup
#
/**
 *    Generate a new NetGUID for this object and assign it.
 */
FNetworkGUID FNetGUIDCache::AssignNewNetGUID_Server( UObject* Object )
{
    check( IsNetGUIDAuthority() );

    // Generate new NetGUID and assign it
    const int32 IsStatic = IsDynamicObject( Object ) ? 0 : 1;

    const FNetworkGUID NewNetGuid = FNetworkGUID::CreateFromIndex(++NetworkGuidIndex[IsStatic], IsStatic != 0);
#

so yeah i could literally make my life easier by just replicating the item asset

twin juniper
magic vessel
#

Trying to handle when the host drops in a game instance subsystem. Is there a way I can listen for when the host disconnects and can handle it on the client?

thin stratus
#

Epic strangely enough made a very specific decision to expose a callback for this to BP GameInstance 😅

But ultimately it's a (or rather two) core delegate callback iirc.

#

You can just bind to it in c++ where you want (more or less)

#

TravelFailure and NetworkFailure are the keywords iirc

#

Also keep in mind there is no HostMigration support in UE without altering the Engine. And I have yet to see someone actually do or even attempt this.

magic vessel
#

I can't find any delegates in c++ for either network or travel failure from the game instance

magic vessel
#

I just want to get it so that it destroys the EOS session on all clients when it occurs

true stream
lucid badger
#

So if I use Data Assets to populate fields on an Object (say an item), when the server creates the Object, the data asset assignment is separate from the construction of the object. This means that the data asset has to replicate separately from the object itself, so you have to wait for it on the client before you can load in values.

But if you use a Child BP Class of your item Object, then when the server creates the Object, its class is an implicit part of what is created. Client recieves the object and always knows the class, so it has all the defined values of that BP Class. Instantly. No waiting for a second rep.

#

Is there ANY way to have Data Assets do that?

#

Short of literally having the child BP class just reference the data asset heh

#

or is Class just sort of privileged in that way

thin stratus
thin stratus
#

Epic has 2 BP events in the GameInstance bound to it

#

Check the FCoreDelegates for example

#

Or try to find the BP ones and follow it backwards

thin stratus
magic vessel
safe marsh
#

hi, so I need to find the cleanest way to trigger an event in the HUD class of all connected clients when a new player joins, has to be done in BP, so I cannot set OnRep for the player array. this seems to be working but it feels bad to get controller by local index, is it correct?

#

playerstate beginplay

#

running this in the widget, and it seems to be working fine, but the player array var isnt marked as replicated, is that because its replicated in its base class?

#

I saw its also possible to use OnPostLogin in the game mode, but I still need to route it forward to all connected controllers

flat halo
#

hey folks, I am trying to implement Seamless ServerTravel in my game, and noticed that after enabling it, when I travel to the new map, it is spawning a new pawn and I endup with 2 player pawns. I havent changed the default spawning/possessing logic of gamemodes and player controllers.

do you know what I am missing?
should I change the default spawning logic to accomodate seamless travel? I havent found much online on how to properly integrate seamless server travel.

fossil spoke
#

Unless you have done something to cause them to be retained

#

You should not end up with a duplicate after a Seamless Travel.

flat halo
#

I want to keep my original pawn, thats why I am integrating seamless travel.
for that, I am adding my pawn to AGameplayGameMode::GetSeamlessTravelActorList ActorList.

fossil spoke
#

If thats the case then of course you are going to have to manage default spawning of the Pawn differently.

#

You cant expect Unreal to understand that you need it to not do that just because you have retained a Pawn from a previous level.

flat halo
#

okay. Thank you.
I will look into it. If you know some functions I should check at the top of your head I would appreciate.

#

This is what I found on the wizardcell.

Pawn: Created by GameMode inside AGameModeBase::RestartPlayer(), called by AGameMode(Base)::HandleStartingNewPlayer(), called by either AGameMode(Base)::PostLogin() in case of hard travel, or AGameMode(Base)::HandleSeamlessTravelPlayer() in case of seamless travel.

fossil spoke
#

Or alternatively, just return nullptr from the function if you have a different possession mechanism.

#

Probably a good idea to look at AGameModeBase::SpawnDefaultPawnAtTransform as well.

true stream
#

Why the A before stuff

#

I thought it was for actor

#

But, everything carries it for what I see

#

Unimportant, just curious.

fossil spoke
#

@true stream Becuase they are derived from AActor class?

#

The GameMode is an Actor

#

You will see U infront of classes derived from UObject

#

UObject and AActor are the 2 main classes for Unreal.

#

That you use to make Objects and Actors from.

true stream
fossil spoke
#

Yes?

true stream
#

I thought they have to had a visual representation

#

I remember reading that

fossil spoke
#

Not necessarily.

#

They dont HAVE to.

#

The PlayerController is an Actor, its not visual.

#

The Pawn is the visual for a PlayerController.

true stream
#

Ah ok well I learned something new then

fossil spoke
#

An Actor is simply an Object that exists within a World.

true stream
#

And it's a requirement for being networked right?

fossil spoke
#

Actors typically share the lifetime of the World.

#

UObjects do not

#

AActor is the only class that is default Networked.

true stream
fossil spoke
#

In the case of Seamless Travel, some are retained across the level transition.

true stream
#

Right I'm talking from a RTS point of view where rarely actors stay alive

fossil spoke
#

What do you mean?

true stream
#

Units get destroyed all the time

fossil spoke
#

Ok

#

Im not sure how that relates to what we were talking about?

#

If a Unit is an Actor and the Unit dies, yeah, it will be destroyed at some point.

true stream
#

Because I'm not familiar with more than one level

fossil spoke
#

It means that at most, an Actor will live as long as the World is loaded

true stream
#

Got it, and objects won't ?

fossil spoke
#

If the World is unloaded, like during a level transition, all of the Actors that remain in that World will be destroyed.

#

Anything derived from UObject that isnt an AActor wont be tied to a World. Generally speaking.

#

Unless its a USceneComponent or UActorComponent

#

Those share the lifetime of the AActor they are attached to.

true stream
#

As well as any components attached right ?

fossil spoke
#

Thats literally what I said above.

#

USceneComponent and UActorComponent are the 2 types of overarching components

#

These are attached to Actors

#

Whether thats a SkeletalMesh Component or a MovementComponent

#

Whatever

#

They are all derived from either of those 2 types

wintry crane
#

guys in my custom gamemode i am trying to create widgets for 2 players once there are 2 players in the lobby i used multicast and then created the widget and it only creates 1 for the server but not for the client, why is that is it supposed to be like that?

nocturne quail
#

by default OnConstruction(const FTransform& Transform) called on server/client ? or just server?

fossil spoke
#

The GameMode only exists on the Server

#

So the RPC has no where to go.

wintry crane
# fossil spoke You cannot call RPCs in the GameMode

damn it should have asked earlier would have saved some time, ig i will move my logic to player controller then.. actually whats the usual spot to call rpcs? i saw on yt people tend to to them in pawns but i guess its fine if i call it from player state or player controller right?

fossil spoke
#

The PlayerController is the NetOwningConnection

#

So any Actor that has its Owner chain back to a PlayerController can call an RPC

#

Pawn and PlayerState are both owned by a PlayerController

#

So they can call RPCs

wintry crane
#

ohhh

#

thats good to know

#

so like the player controller is the big boss

fossil spoke
#

The Server can always call RPCs on replicated Actors as it has Authority.

#

The GameState for example

wintry crane
#

um also what about game state?

#

oh yea

fossil spoke
#

You can call RPCs on that from the Server

#

But not from a Client

#

Because the GameState isnt owned by a PlayerController

wintry crane
#

oh so i kinda can do the same logic as in ss but use game state instead

#

because game state exists on the server and the client..

#

right?

fossil spoke
#

It does yes.

#

But what are you trying to achieve?

#

It looks like you are trying to bring up a selection menu?

#

Of some kind?

wintry crane
#

i mean at the moment i am just trying to overall understand RPCs because i am lacking in this area but at the moment i am doing steam sessions and when there are 2 players in the session i am trying to display the same widget on both server client and the client

#

i mean my ultimate goal is to make something like

#

this where you can choose your character to play

fossil spoke
#

Sure. Im guessing this appears immediately?

wintry crane
#

huh?

fossil spoke
#

Do you want to bring up this Widget straight away for each Player

#

When they Join?

wintry crane
#

i mean if there is 1 player i have widget with a text awaiting player, and when second players find the session and joins it the same widget appears on both instances

fossil spoke
#

Ah ok, then sure, the GameState would be fine for that.

wintry crane
#

lets goo

#

i am really suprised how this text channel is so talkative

#

thanks for the answers man

fossil spoke
#

Well the server does have over 100k users

fossil spoke
mental crag
#

Hey! Running into an issue with Steam Advanced Sessions. I used this video to set it up: https://www.youtube.com/watch?v=_U0BK0olC-I&list=PLNb7FZ2Nw2HTBgWggHGaMtHAOygKcXIyW&index=9

The server browser is not able to find the session half of the time. Sometime it appears, other times it doesn't. I've made sure that both of the computers are on the same project version and on different Steam accounts.

It's confusing because for the past 3 hours, it's has been working, and then 10 minutes ago, it stops working completely, making my development a stand-still. Does anyone have a solution for this issue?

👨‍🏫 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/


In this tutorial we implement/setup Steam for our game. We take a look at the Steam Advanced Sessions plugin and set it up for the projec...

▶ Play video
regal storm
#

Hey folks. I'm replicating an actor's transform and wanted to try to debug the potential difference between the server and client(s) representation of this actor. Is there perhaps a way to view the bounds of and object on all clients/server at the same time (overlaid within one viewport/client)?

stray snow
#

Hello! Does anyone happen to know a workaround for Skip Assigning Gamepad to Player 1 not working? Been banging my head against a wall for a few days. I found this but it seems the functions have been changed, currently working on figuring these functions out with the new ones

jade ibex
regal storm
jade ibex
#

do you know about server reconciliation?

#

if you read up on that, it would be helpful as well.

jade ibex
#

yeah, for the character movement component it does it for you

dark edge
#

I'm pretty sure for physics replication you can get something similar too

jade ibex
#

although you never know, he could be trying to implement his own solution for something else

dark edge
#

If not then just replicating a transform is enough.

jade ibex
#

not really

regal storm
#

Sorry, for context, it's a buoyancy calculation on the server

jade ibex
#

not if you want a smooth experience

regal storm
#

Which then gets sent as an actor transform to clients

dark edge
dark edge
jade ibex
#

does ue5 replicate buoyancy?

dark edge
#

It has quadratic smoothing etc

#

It will replicate any sort of physics, it doesn't care about how the physics got that way. Although I've never tried doing stuff JUST on server. All my physics stuff happens on both ends.

#

It's old, from ue4 days

regal storm
jade ibex
#

from what ive seen and heard phys replication is solid

regal storm
#

But yeah, trying to avoid mismatch between client and server by just running it server side at this stage

dark edge
#

It's not bad as long as you don't need prediction

#

And you'll want to mess with the settings, the stock settings are very strict and result in corrections all the time.

dark edge
regal storm
# dark edge That's 100% mismatch unless you mean your waves aren't synced.

Right now waves aren't synced, but the intention is to have ship buoyancy running server side (using whatever waves the server has access to), and replicating the transform of the ships directly. The main reason was to avoid any possible situation where the waves might fall out of sync and then the ship buoyancy calculations on the clients would fall apart from each other

#

Eventually it'd be that server waves gets synced to clients too of course

#

But that's just visually

fast mason
#

to whoever may be useful, adding a definition of DO_BLUEPRINT_GUARD=1, helps a lot to debug blueprint errors on shipping and test releases

#

our production server was on test release and we been having several days with a infinite loop in blueprint that kicked everybody..

#

without any kind of warning or message

#

log was right there, but server was without activity

#

so with the BLUEPRINT_GUARD we saw a beautiful LogScript: Warning: Runaway loop detected (over 1,000,000 iterations) - see log for stack trace

shrewd carbon
#

I was wondering if someone has any experience doing grid movement in multiplayer.. my initial thought was to use a timeline to move between the tiles, but this introduces some pretty glaring jitter on clients.

#

Open to other ways of doing this :C

upbeat basin
#

Do I need to create my own multicast delegate or OnRep variable in order to let clients know there is a player who enters or leaves the server or is there any prebuilt solution for this that I'm not aware?

upbeat basin
#

Or like overriding PlayerArray as a ReplicatedUsing Uproprerty instead of a Replicated one would be so much better

#

I guess I'll override the AGameStateBase::AddPlayerState and AGameStateBase::RemovePlayerState to call multicast RPC and broadcast the updated array to everyone with a custom multicast delegate? Please let me know if there is a better solution for this

thorn musk
#

Hi, when I test my game as the server my Player spawns with normal rotations, but when I test it as a client the rotations are wrong by 180°
Any Idea why?

thin stratus
#

Try setting the ControlRotation to the same rotation as the Pawn you spawn. It's a property on the Controller you use to possess the Pawn

#

That's all given that you do this manually (the spawning code)

shrewd carbon
# shrewd carbon

So following this up, it looks like the client and the server are fighting with each other, the client's set actor location is 0,0,0... im not sure why.. .

#

i turned off replication in the timeline and that prevents teh client 0,0,0 but theres still jitter in the player movement

nova wasp
#

is this a realtime game? are turns atomic things that can't be "between?"

#

it might be possible to only send over where they moved and why and to just represent that on their client

shrewd carbon
#

its kind of realtime. as im doing this im realizing i just need server to know their new tile position

#

when the player has arrived at the tile

#

or rather "start moving" and "arrived"

#

so that can be replicated to other players

nova wasp
#

if instant response times are not required you could just consider the current and previous

#

as is common in most physics replication etc between snapshots

#

this will add an inherent delay to visual feedback as there must be two states to consider before visuals change

#

but you may not need to care

#

but I think if it's always a set speed etc you might not need to go that far

#

if it's just "most recent square they are on"

shrewd carbon
#

it might end up being that

#

im wondering how i would structure that in this actor

#

just a vector2D of their current tile location?

nova wasp
#

why do tiles need to be stored as floats?

shrewd carbon
#

vector2DInt then i guess

#

just wanting to consoldate X+Y

nova wasp
#

I assume they are like a chessboard here and not that they just happen to move 1 meter in steps etc

shrewd carbon
#

you are correct, they is only tile step sizes

nova wasp
#

I suppose that should work but that might not be the only thing that needs to store a position, I guess

#

keep in mind there may be more kinds of things who care about being on a grid square

#

should be fine to stuff this on an actor for now, but prepare to need to reconsider this at some point

#

it could be easier to have them in a single manager or stored on something easier to share code with other parts

shrewd carbon
#

I suppose but the core issue still stands, on a more granular level, moving the actor without the jitters

nova wasp
#

you can't gaurantee packets coming in at a nice constant rate but you are in a a nice situation here I think, as the size of the packet will be extremely small

shrewd carbon
#

I guess rephrasing this

nova wasp
#

as for the visuals that depends on a few things

#

if there's a giant row of these things and they all move "forward" to a square

shrewd carbon
#

I want to send the "move to location" to all the clients and then have the clients to the interpolation locally so im not waiting on smooth packets from server

nova wasp
#

do they need to smoothly all move at once or is it okay if a few of them start moving a handful of frames or so later etc?

#

the clients can react to receiving the new position in an OnRep

#

and after that, consider the "visual" and "real" location

#

and move between that every update with the visual mesh

#

this does not consider the rules of the game, it purely lerps between their previous and next state on demand

#

if business logic depends on the visual move being a consisent speed you may need finer control over it and might have to get fancy with considering when the packet arrived and even what time it was "for"

shrewd carbon
#

Yea I figure i can...

Player hits button -> Ask server to change location -> Server changes the location -> location var replicated to all clients -> clients perform visual movement

nova wasp
#

this is kind of a rabbithole in some sense, but I think the naive linear setup should be okay

shrewd carbon
#

if the server says thats not possible the clients wont update their position

nova wasp
#

the "real" location could just be said grid location while the "visual" could be the visual component in world space etc

shrewd carbon
#

yea that'd be idea.

nova wasp
#

I am doing something similar for my weird interp setup but my situation is more realtime with full previous/current frames

(my case is a fixed 60fps tick with the main thread "rendering" the state, for everything and not a specific gameplay feature)

#

rotations can be interpolated with quaternion spherical interpolation (SLERP) fwiw

shrewd carbon
#

yea im just trying to get multiple characters jumping around a grid :C

nova wasp
#

also: please test your game with some network emulation to see what happens with bad network situations

#

just to get in front of bad situations early

shrewd carbon
#

lmao i cant even get this to go well locally

#

i appreciate the looking out though

nova wasp
#

FWIW the unreal network emulation presets are rather extreme but you never know with NA internet lol

chrome bay
#
  • @solar stirrup it's because they replicate as blobs, so any change means resending both the struct type + all the data. It's not meant for efficiency really.
solar stirrup
#

Well that's a bummer

#

If it becomes an issue I'll see what I can do

#

Might modify net serialization of it if the data's type is guaranteed so it doesn't have to serialize that

#

The data is relatively small so i'm not worried

rich crag
#

Figured out my foliage spawning issue. it wasn't my replication, that was fine. I just didn't understand how the static mesh components worked inside the foliage actor.

grizzled stirrup
burnt wadi
#

Hey guys I was curious, to store player data such as ranks and stuff should we use EOS or create our own database or something like that? what would be a "better" solution?
also if you can tell drawbacks of using one over another, thanks.

solar stirrup
#

Only the modified props get replicated

#

Doesnt matter in my case I marked my item instances as Atomic and later just implement custom serialization, I dont want desync

sudden dock
#

I saw a video that reported that you can't make an online multiplayer game all in Blueprints because of some ping/lag/sync issues. Is that true?

solar stirrup
#

Depends on your game's requirements

lost inlet
#

Would be good to know what the video is and what it actually says in context

lost inlet
#

so yeah this video actually provides adequate context

#

but you interpreted that as a blanket statement

#

it says standard RPC flow and property replication is fine in BP, but then moves onto custom CMC stuff

solar stirrup
#

Does Mover support blueprints

lost inlet
#

well it's experimental and this video predates that, but I think it's supposed to

solar stirrup
#

Else there's also GMC I guess since you can do custom blueprint movement with it, but a pricey plugin

#

Ay, guess vanilla unreal is finally gonna solve that problem

lost inlet
#

though I wouldn't want to lean on BP too much for networking, maybe basic things, but beyond that it becomes a bit of a nightmare for debugging

#

also GAS has prediction and you could implement a slide ability (example mentioned in video) as a gameplay ability, though GAS's prediction is fairly basic compared to CMC

sudden dock
#

I am really new to game development and right now I am building basic mechanics to learn but eventually I want to do a multiplayer game. Would something like a marketplace multiplayer template be something I should consider. My game would be a third person shooter and would have some custom animations but the core would be default UE animations. I don't need any crazy customization. I would probably have just the standard needs for a multiplayer game

rich crag
#

Question about arrays of structs... is there a way to match based on part of the struct or do i have to match the entire struct exactly? Problem is, i have a value that changes with a timer inside the entries in the struct, and i don't necessarily have a way to match the time for the item on Find.

stoic wing
#

Hello!
I'm trying to start a multiplayer pixel art game. within the player character i render the scene with a scene capture 2D component to a low resolution render target. i snap the scene capture component to a grid based of the render target resolution to make the camera movement pixel perfect. to make the camera movement smooth, i move the pixel perfect render in a widget with the world location of the scene capture component every tick (i know i know). this works fine in single player but in multiplayer it completely falls apart. characters are spawned in game mode, the widget in question is created in HUD BP.

do you think there is a way to make the widget work in multiplayer?

silver pendant
#
  • I have this custom event **(RunOnServer) **on a class (replicates enabled) in the world

  • I use the M key from my character as shown, but it doesn't fire on server from the client

  • instead it only works from a server

  • which is weird because (RunOnServer) is made to give the clients the ability to run events from the server, I really need help here.

pastel escarp
#

I have a function that gets called on all connected player controllers to demorec , when I play the replay, it works only on the player host, for the client, it spawns incorrect Player controller and incorrect spectator pawn

#

and thus, I am stuck at the middile of the map with no control

#

any idea what might be causing this ?

twin juniper
#

Hey guys, if the Owner is set to COND_SkipOwner, but the child have no COND, would the child replicates?

twin juniper
silver pendant
lost inlet
#

Well as a client you wouldn't know what's going on the server?

#

But the output log typically shows failed RPCs. Usually because the player controlling doesn't have ownership

#

Back to the reason I hate BP for significant networking tasks, debugability

quasi tide
solar stirrup
#

nice

deft onyx
#

What kind of network method did you use on The Ascent?

I'll try to check on Alien Swarm and The Ascent soon. I'd really prefer to not limit clients' the movement range.

silver pendant
#

I have a question, can't I as the player run a (RunOnServer) event in another actor class in the world

I'm trying that but doesn't work

dark parcel
#

and in general you don't want that as it opens more way for cheating

#

Most RPC calls can be made from what the player own.
Controller && The Character

#

You can read about ownership in the pinned section

silver pendant
#

thanks, I get it now

dark parcel
#

RPC gets dropped when you call it from an actor you don't own

silver pendant
#

so when I change the owner should that be replicated as well, or It's already is

silver pendant
dark parcel
#

if u want the actor to replicate set bReplicate to true

#

setting owner must be done by server too btw

silver pendant
#

ok

dark parcel
#

I mean practically you can do Server -> Set Owner of an Actor to Target Player. Then TargetPlayer-> Run RPC from that actor that is now owned by it.
but I won't recommend doing it that way

thin stratus
silver pendant
dark parcel
silver pendant
dark parcel
#

Yup but normally you don't need to go outside for RPC call for client machine. Route it via controller/character

#

maybe there is edge case like weapon, but I don't know. Haven't done much mp

silver pendant
dark parcel
#

It's better if you read the pinned article as I may give you wrong info.
But afaik Reliable means, that it's reliable and will reach client one way or another.
If for some reason Reliable RPC didn't reach client, it will get resend.

Of course it comes with overhead. You don't want to clutter your bandwith by spamming reliable RPC.
Something like setting rotation of character, deffinitly use unreliable

deft onyx
rich crag
#

would you use reliable or unreliable for events like respawning instanced tree meshes?

#

is it dependent on how much it matters that players have the same copies of trees?

#

lol

silver pendant
dark parcel
mystic estuary
#

Hello, does anyone know how to make cheat manager work in a dedicated server environment? Anytime clients try to use any cheat, it says that the command is not recognized, even default commands, such as ToggleDebugCamera

thin stratus
mystic estuary
quasi tide
#

I think it's a build.cs thing?

thin stratus
#

Yeah, that's for Clients in general

mystic estuary
thin stratus
#

I know we had to do that on builds in The Ascent too and that was ListenServer

mystic estuary
mystic estuary
thin stratus
#

Just keep in mind that the console is usually not shipped

thin stratus
quasi tide
#

I think it can also be enabled in the gamemode or something like that

#

Or playercontroller?

#

I can't remember

#

It's ancient, so it is everywhere

mystic estuary
#

GM doesn't seem to have anything with "cheat" in it

thin stratus
#

Just check what EnableCheats does haha

mystic estuary
#

Yeah, true, but I guess I have to do that every time I start PIE

quasi tide
#

Or just write your own

mystic estuary
#

I guess I can make so that PC does what EnableCheats do on BeginPlay when it's an editor build, and it'll work fine

thin stratus
#

Cheats are just some function run on an actor

#

I think they can't even be RPCs by default

mystic estuary
#

They kind of can using ClientMessage(ConsoleCommand(FString))

#

That's what Lyra does

thin stratus
#

What does client message ultimately run through

#

Probably the PlayerController or so

mystic estuary
#

Yeah, it's a PC function

rich crag
#

Ey my dynamic open world replicated harvestable foliage/ resource sytem is working now! Not possible without this discord, and especially Cedrics Compendium

silver pendant
#

I have most of my actors and components usable functions starts by a (RunOnServer) events, so it only be executed on server from owning client, and only server may execute Multicast events when only needed, so checking of data will be on server, and setting things might be on Multicast or only server

using rep notify for variables these are related to refresh functions and etc.

using switch authority, on begin play events that executes a spawn actor, so it doesn't spawn it twice.

I assume that that will prevent cheating by checking the data on server, and only owner will execute the operation + these events are things like : {shooting, set ammo amount}

I read more about replication in the unreal source and a link in the pinned messages above.

the question is am I on the right path?

dark parcel
#

if you spawn a replicated actor with multicast you are already doing it wrong

#

unless there is some uses that I am not aware off

silver pendant
rich crag
#

So i lied. swapping to open world with multiple foliage actors breaks my harvestable foliage system... sigh

#

works fine in a map with a single foliage actor

twin juniper
#

Hey, should i predict actor creation and destruction?

#

How would i destroy an actor on the client, then tell the server to destroy that actor later though? The pointer is gone when i destroy it on the client

#

Use something like NetID?

solar stirrup
#

tell the server to destroy the actor then destroy it

twin juniper
#

A forum said that i should toggle visibility and disable collision on the client

solar stirrup
#

or that yeah

#

probs saner

solar stirrup
#

nah

#

not a sane option

#

im tired ignore that

twin juniper
#

but how about spawning though

#

can't just let it freeze mid-air

solar stirrup
#

what are you trying to achieve

twin juniper
#

trying to remove the delay by prediction

#

picking up item and drop item

solar stirrup
#

you can play cosmetic animations like fortnite does when you send the request

twin juniper
#

what..?

#

cosmetic animations?

solar stirrup
#

If your pickup simply just destroys the actor, make it invisible clientside while you send the request to the server

#

If that's absolutely necessary

#

as for dropping, I would really suggest not predicting that

twin juniper
#

yeah the picking with visibility sound fine

#

but the drop

solar stirrup
#

if you must you can always spawn the actor locally but unless it's pretty simple you're gonna mispredict most of the time

twin juniper
#

does fortnite predict dropping though

#

i don't play that much of the game
anyway i am overthinking, i'll just make it spawn on the server till my game become AAA, thanks for the help

thin stratus
thin stratus
#

pretty sure if you google Unreal Engine Mover 2.0

#

you'll find a blog post by vorixo

grim dove
#

sweet, thanks

lucid badger
#

"Unreal Engine introduced Mover 2.0 in 5.4" hmm

#

introduced

#

Shouldn't it be "is introducing" or is 5.4 out and I missed it?

#

ReallyMad wait a minute this is a scam, it's a video not an article at all, what a bait

bronze glade
#

Would anyone be able to help me understand why my player controller for the server is different from the client when the only thing changing them is the game mode switching during server travel? The client keeps the initial player controller from before server travel but the host gets the new one from the new game mode

lucid badger
# pallid mesa 🙄

He actually said "blog post" so that one's on me. I was just dreaming of a bygone age where we didn't have to slog through videos to get news. Don't mind me...

pallid mesa
#

its an overview of a kinematic system, so a writeup wouldnt work as best as a video

lucid badger
#

Text alone sure, but screenshots would've sufficed for me heh but I know that's a lot more work to edit. Thanks for keeping it succinct at least Okay

pallid mesa
#

a moving screenshot? a gif?

#

hahaha

lucid badger
#

I didn't need to see movement Shrugeg

#

I just wanted to know what was different. Words was plenty tbh

#

Screenshots just to show the ui and stuff

pallid mesa
#

well, its a... movement system 😄

lucid badger
#

Yeah but I can visualize movement heh

#

Like I said, don't mind me. I'm just too hyperactive. 2x speed is never enough for me SPEEDERS

lucid badger
lost tinsel
#

I'm experiencing a weird thing, focus on the green sphere, it's the sphere drawn at the center of the socket that I have on my pistol, on the left you can see that it's near to the pistol (client), on the right you can see that the socket is really not at that location (server), does anyone have clue about this?

#
USkeletalMeshComponent* SkeletalMeshComponent = GetWeaponMesh();

if (SkeletalMeshComponent == nullptr) return;

const USkeletalMeshSocket* SkeletalMeshSocket = SkeletalMeshComponent->GetSocketByName(FName("MuzzleFlash"));

if (SkeletalMeshSocket == nullptr) return;

FTransform SocketTransform = SkeletalMeshSocket->GetSocketTransform(SkeletalMeshComponent);
DrawDebugSphere(GetWorld(), SocketTransform.GetLocation(), 10.f, 12, FColor::Emerald, true);

that's the socket in question

#

I don't even know what to debug to find out the root issue..

wintry crane
#

So in my player state i noticed that when i host session my Beginplay is runned once on server, but when the client joins the session the beginplay is runned once by a server and twice by a client, can someone explain why is that happening?

lucid badger
#

Are you sure you're not seeing the server's playerstate? playerstate is on all clients @wintry crane

#

Like if you have a log out on beginplay for playerstate, when a client joins they'll see it once per player

#

You'd branch with IsLocallyControlled to limit to just the local one, I think

wintry crane
twin juniper
#

LoL how ObjectType of an UStatcMeshComponent is not replicated, so annoying to do a multicast

solar stirrup
#

why a multicast

#

make a new component that derives from UStaticMeshComponent and add a replicated prop

twin juniper
#

then add OnRep to that

#

then wake up tomorrow wondering what the hell this extra component class even for

#

XD

solar stirrup
#

✨ comments ✨

hollow eagle
#

...because you may not want to keep those values synced on client and server. Modifying collision properties is well outside the scope of what a mesh component manages, and that state can usually be derived from other properties that belong to an actor making it less efficient for the mesh component to replicate it.
Honestly even the static mesh itself being replicated is weird, but at least that you can turn off by simply not replicating the component.

twin juniper
#

i mean too much code for a single thing

#

what..?

twin juniper
#

soon enough my project will be filled with 100 random component XD
(oh i can actually throw it in my actor class) (yay)

solar stirrup
#

welcome to game dev

#

don't use RPCs for stateful stuff

twin juniper
#

I am having some problem with OnRep

#

Apparently OnRep only fire if the value on the server change

#

But my value don't change (idk why)

#

Is there any way to force an update next NetUpdate?

fossil spoke
#

If you are using C++ you can change this behavior in GetLifetimeReplicatedProps

#

By changing the rep condition

#

To Always

#

If you change a value on the Server and need it to be updated to Clients as soon as possible you can call ForceNetUpdate on the Actor that owns the replicated variable

wintry crane
#

When i host session why is there only server execution and not server and client? i mean i host the server but i am also a client right?

wintry crane
#

D:

fossil spoke
#

The Host is the Server

#

The Clients are not a Host and therefore also not a Server

#

A Server cannot be a Client

#

Therefore a Host cannot be a Client

wintry crane
#

omg so like when i do replication i dont need to replicate for the host because he is the server

fossil spoke
#

Correct

wintry crane
#

not the client

#

thank you 🙂

fossil spoke
#

You dont need to send an RPC to the Host from the Server, because it is the Server

#

Mind you, calling a Server RPC on the Server will just run it as the function it is, it costs you nothing from a Network persepctive

wintry crane
#

note that

#

also i had problem before with execution which showed me that there are 2 clients, but then i changed from preview mode to standalone and it fixed it i guess i should only test stuff in standalone

modern heron
#

Anybody know why this works in PIE but not a standalone instance? If so how would i fix this These are in the player controller and Game mode. Post login and start game is in the game mode and then the client turn is in the controller.

dark parcel
#

@modern heron Is this local multiplayer game? (eg Split Screen)

modern heron
#

lan but not split screen

#

will add dedicated servers later on once more stuff was going but was using lan to test lobby etc

dark parcel
#

well just wondering if it's local multiplayer or Networked multiplayer

#

local multiplayer don't require any networking

#

but that don't seems to be the case for you

echo bough
#

LAN = networked

dark parcel
#

@modern heron what doesn't work?

#

It's weird that you get Player Controller that way, Player index only matter if you are doing Local Multiplayer

modern heron
dark parcel
#

What do you actualy want to do?

#

and is the delay necessary?

modern heron
#

added delays for debugging.

echo bough
#

No matter whos turn it is, you have to tell all the players whether if its your turn

#

Also, PostLogin is already in GameMode, you could've just call GetNumPlayers straight away.

modern heron
modern heron
sweet sage
#

How can Pax DEI have 150?

dark parcel
twin juniper
#

Mainly want to do this for optimization.

dark parcel
#

@twin juniper RepNotify gets called on Server and Client if you are using BP

#

in C++ only get called on Client and it's more proper imo

#

for IsCrouching you just need replicated variable, it's already replicated by default

#

I think IsGrounded should run locally, no networking required

sweet sage
#

is unreal Iris using PushModel?

#

How do i know if Iris is running?

#

It does not change anything

thin stratus
fossil spoke
#

Got nothing to do with Iris.

twin juniper
#

IsGrounded in my case is a custom variable, not part of the movement comp

#

But that's just an example.

thin stratus
#

I don't see a very good reason for not using PushModel

fossil spoke
silent valley
#

I have a couple of Actor types (not pawns) that adjust bone rotations on the server. Replicating these to clients and applying them directly results in jerky motion for clients.
Is there anything built in I can use to smooth this?

#

Network Prediction plugin perhaps?

#

would prefer something simpler tbh 🙂

thin stratus
#

There is generally nothing build into the engine to handle that for you aside the existing classes such as Character.

#

NPP is for prediction. Not sure it handles smoothing.

#

It might provide you with info you can use to smooth but I don't think it directly smooths anything

silent valley
#

It's kinda both. I tried smoothing the values but it does not result in nice looking rotations, when it is missing the prediction part.

thin stratus
#

Means you are mostly required to code this yourself

silent valley
#

ugh :/

dark edge
#

Ignoring the overhead of being in blueprint to begin with, if you're getting one thing on tick, you might as well get it all.

nova wasp
#

the true cost of things done in your average game engine is often moving around memory rather than actual work

#

this runs counter to typical big O notation thinking, which still always means something but often ignores the nature of how computers work

orchid eagle
#

Hey there
so im kinda new to online and still don't perfectly know how to replicate and what stuff can be replicated and what can not
so a simple question for now can we use root motion anim montages in multiplayer i tried with root motion movement and that didn't work but will it work for attack/combo attacks anim montages that has root motion

orchid eagle
#

so here i have a replication issue
idk if that's the root motion or i did set something wrong

#

so as the Attack combo and Combo End was being Called in Animation BP using the AnimNotify i tried first to call them on server then do the multicast and that kinda worked so i can see the animation now playing on both the same
but still some animation get's cut or skipped or maybe glitched idk

twin juniper
#

I've watched maybe 10 videos on replication basics and so on, including the ones linked in here. Can't wrap my head around a basic concept.

#

This is inside a pawn blueprint

#

Now is this getting called on the client or on the server?

#

And for the listen server, is it getting called twice, cuz the listen server is both a client and a server?

orchid eagle
#

that how i made it

#

you would need to call your code on the server then on the owning client

twin juniper
#

Is this currently getting called on the client or on the server?

orchid eagle
#

none

#

you didn't called it on any

#

if you want we can get in a voice channel and try to explain it

#

i didn't get what you mean but
to get it to work as i understand you would need to call a event on the server then that event would call another event which will be on Multicast means any active clients at the time it runs or on owning client means the Client who will fire this event will only be effected and none other will be

#

im not that good at explaining in words so i hope i didn't make it much harder 😅

twin juniper
#

xD

#

I understand what you are saying, and I know that, but my question is entirely different.

nova wasp
#

the ultimate answer is: it depends

#

the fastest way to find out is to just add a quick stupid print log or something that shows the PIE context of who is calling it

twin juniper
nova wasp
#

this is kind of a weird one as it's a global input event thingy... you generally use actual input bindings

#

this is probably sending input to all UWorlds created by the editor instance

twin juniper
nova wasp
#

does beginplay run on both client and server?

twin juniper
#

I do not know, it is the pawn begin play.

#

I have a listen server, and a client.

dark parcel
#

Oh sorry we're u asking him?

nova wasp
#

I'm posing a rhetorical question here

#

I'm painfully aware of how beginplay works in sometimes more detail than I want lol

nova wasp
twin juniper
dark parcel
#

@twin juniper I think you should be aware that each machine run their own world. It's Ur job to place what runs on the server and what runs on the client computer

nova wasp
#

sorry, just trying to lead towards the problem solving I guess

#

actors that are created dynamically (yellow in the world outlier I think) that are replicated and relevant will show up on both and beginplay

twin juniper
# dark parcel <@456226577798135808> I think you should be aware that each machine run their ow...

I do understand that. There is a Server, and there are clients, everything that happens on the server, happens for the clients. In case of a listen server, the host (listen server), is both a server, and a client.

My question is much more basic, and still unanswered.

A print string node attached to begin play inside a Pawn, does it get called on client, on server, or both? And if it is inside the Listen Server pawn, does it get called twice?

dark parcel
#

Everyone run their own world

#

U decide what to sync

nova wasp
#

by default you probably have things like replicating movement enabled

#

that works via a series of replicated values that have everyone receive a roughly close enough idea of where something is at a given moment and how fast it is moving

nova wasp
orchid eagle
#

i know i can but did you see my setup

twin juniper
orchid eagle
#

something is not working there there is a lag or like some animations are not being played or skipped

nova wasp
nova wasp
#

the listen server will not do things twice... in the common case

twin juniper
#

A print string node attached to begin play inside a Pawn, does it get called on client, on server, or both? And if it is inside the Listen Server pawn, does it get called twice?

orchid eagle
#

im not using GAS + im not doing a movement there 😅

nova wasp
#

it's working both as a client and a server, but it doesn't really need to replicated to itself etc

orchid eagle
#

anyway will keep looking for why is that

nova wasp
nova wasp
#

if you are not doing this on the server and client then discrepencies will occur I guess

orchid eagle
#

im doing it on server and client

nova wasp
#

doesn't change the fact that it could happen at a slightly different time than you intend afaik...

dark parcel
nova wasp
#

a listen server does not do things twice in this sense if that helps

#

a listen server is a client that also runs server code and replicates stuff to clients, but they still have one UWorld just like a dedicated or client

nova wasp
orchid eagle
#

im not using the Release at the moment just the click or start

twin juniper
#

If I have to replicate it manually, by calling on both client and server, then what exactly does the CMC replicate Automatically?

nova wasp
#

there are conditional things in RPCs that are not being sent as part of that RPC, like that "saved" thing

dark parcel
#

Cmc is too complex for me. I am just a beginner.
But here's a spoiler, you can't do sprinting in blueprin for network cmc

#

@twin juniper delgoodie goes over how to setup sprinting in multiplayer using cmc.

The rest of tutorial you see in yt using blueprint is a scam

nova wasp
#

overriding GetMaxSpeed should get pretty far at least

dark parcel
#

I think setting walk speed might be safe but deff need to flip the flag for sprinting imo. Could be wrong, I don't know much

#

I got it working thru copy paste 😔

orchid eagle
orchid eagle
nova wasp
orchid eagle
#

what do you mean ?

nova wasp
#

I can't see what you are actually doing in PIE, if this is a listen server or a dedicated where both viewports are clients

orchid eagle
#

its dedicated

nova wasp
#

yeah you seem to be on a dedicated here

dark parcel
#

They already have the frame work for networked movement. It's just can't be extended using blueprint

#

Blueprint multiplayer is very limited. Don't quote me on this, ask the mod that actually work on multiplayer games

twin juniper
#

Which if it can't handle replication of it's own built in variables, then I don't get the point of it.

dark parcel
#

That's not gonna work

twin juniper
#

Forget the sprint for now.

dark parcel
#

I haven't seen your code

nova wasp
twin juniper
#

Thanks for trying to help,

nova wasp
#

if all else fails you can cheese things by turning off cmc corrections temporarily, but that's more for the overall "shift" between positions not being weird and less for it even happened

#

I gotta go, I've never had to deal with root motion stuff (in depth) but I wonder if UAbilityTask_ApplyRootMotionConstantForce has some ideas

orchid eagle
wanton copper
#

Hi all,
I'm currently in the process of implementing a menu for a local/online multiplayer game. The setup I currently have is a Game Mode with a Player Controller class but no Default Pawn class. To me this makes sense since I don't need a physical entity for the menu but in various tutorials I've watched they're all using pawn classes. The issue I'm having is that by default my game mode is creating a single player controller and I want to create more, but without a player controller I'm not sure what the appropriate way to listen for a controller input is (i.e. "Press X To Join").

So 2 questions really:
1 - Am I missing something about the player setup I've seen in these tutorials where I should be using a pawn for some reason or does it make sense to just have the player controller for a menu scene?
2 - Are there any ways for me to listen for controller input before creating more local players, or should I do something like:

- add / remove local players as gamepads get connected or disconnected
- use those player controllers to listen for inputs to join a lobby system or something```
tardy fossil
#

I want to create more but without a player controller im not sure i follow.. more what?

wanton copper
#

Create more local player controllers

without a player controller I'm not sure what the appropriate way to listen for a controller input is (i.e. "Press X To Join").

#

sorry

#

bit of an unclear sentence

grim hill
#

hey guys, i’m trying to make a local multiplayer game in ue but the assign player 1 to game pad option is broken in the engine. ue5.3 is there anyway to fix this with like c++ or something?

safe marsh
#

Hi, I have a question about sending player data on connect, Is it possible to send a data payload to the server when the PlayerController connects via OnPostLogin ? Or are there any other methods to send data as early as possible
Currently I am using BeginPlay on client-side playercontroller to send the data via RPC to server-side playerstate to verify it and then set/replicate it to all connected clients, is there another way? mainly in BP

dark parcel
#

use AcknowledgePossesion to run something on client when they Posses a character

#

you can send Server RPC to send data from client to server machine

#

Or Alternatively you can let the server call Client RPC

#

OnPostLogin -> Get New Controller as Target -> Run Client RPC

safe marsh
#

right, I meant when they are joining a server, if its possible to send a struct or something which would arrive with OnPostLogin

#

similar to how you can send initalization parameters when opening a new map

dark parcel
#

wdym arrive in OnPostLogin and no

#

OnPostLogin->Get Controller -> Run Client RPC
In the Client RPC -> Run Server RPC to send server data

#

Data "readiness" depend on ping

#

don't account for something to be available instantly between server and client in networked environment

safe marsh
#

ok, I will get the server to run the client rpc onpostlogin, looks like that is the earliest way to do it in BP. as for sending data during the auth process, it looks like it is not possible in BP alone

dark parcel
#

not sure what auth process is

orchid eagle
#

so im really tired of this root motion animation montage issues when replicating
like really no video or a docs or any info anywhere to do that
it should work just fine but it doesn't same for the Motion warping it should be replicated the same way but it wont and my character would just be snapped to the target location and do lot of flickering
please someone watch the video and see if i have my replication setup is correct and if that a replication issue or a root motion or a motion warping issue

#

also i can share my screen if anyone want to go trough my code and check

worthy wasp
#

in an OnRep function - is there a way to tell what the change was - some overloaded function that i could be doing instead of the below?

    UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_LearnedAbilitySet, Category = "VI|Abilities")
    TArray<FLearnedAbilities> LearnedAbilitySet;

    UFUNCTION()
    void OnRep_LearnedAbilitySet();
dark parcel
#

You can get the old values

worthy wasp
dark parcel
cursive steeple
#

Actually dont think it needs the same name even just same type probly.

cursive steeple
worthy wasp
cursive steeple
dark parcel
worthy wasp
#

workign on it - having some C++ stuff with making a ToString on a custom struct i made

#

for debuggin ganyways

copper pendant
#

pls help, why its stop working i dont understand

worthy wasp
#

shit ... i retract that - obviously its being ran on server - BeginPlay runs 2x - AsClient & AsServer

copper pendant
dark parcel
#

@copper pendant You have to understand that begin play will get called when ever a controller is spawned

#

So in your server, when a client join, a controller is added to server thus the begin play is called (On Server)

#

and inside that PlayerController that doesn;t belong to server, it's trying to create widget and add thhe viewport

#

which obviously won't work because it;s not the local player

#

You can fix it by adding IsLocallyControlled and a branch

#

this way the code only runs if the controller is owned by the local player

worthy wasp
# dark parcel You figured how to pass the old value?

hell yes! @cursive steeple was right ont he money ....

void AVI_PlayerController::OnRep_LearnedAbilitySet(TArray<FLearnedAbilities> OldValue)
{
    for(auto each : OldValue)
    {
        UE_LOG(LogVIPlayerController, Log, TEXT("%s LEARNED ABILITY SET OLD VALUE => %s"), NETMODE_WORLD, *each.ToString());
    }
}

ONLY PRINTS old values - i'm certain i can put in the newest value (LearnedAbilitySet) - and do the same but i'm not interested. this works!

dark parcel
#
void AAGPlayerCharacter::OnRep_Health(double OldValues)
{
    GEngine->AddOnScreenDebugMessage(-1,10.f,FColor::Green,FString::Printf(TEXT("Old Values : %d"), OldValues));
    GEngine->AddOnScreenDebugMessage(-1,10.f,FColor::Green,FString::Printf(TEXT("New Values : %d"), Health));
}

@worthy wasp was trying for you but haven't test it

#

but yeah, I know it can be done, just never actually do it

worthy wasp
#

i have some lifecycle things happening - and replication events that need to happen first... i was callin ga delegate before the OnREp funciton was firing for htis TArray .... so when the delegate fired (client) - the TArray wasnt updated - and i wasnt getting expected results.

#

i'm just going to move to the OnRep with the delegate that i was doing before.

#

i hate programming for ListenServer - its complex :/

#

or i should say - dedicated server programming is much easier lol

dark parcel
#

oh nvm it's a pawn function

#

try IsLocalController

#

@copper pendant

copper pendant
finite spindle
#

Hey i was wondering if anyone knows how could i execute gamemode event on a player controller (such as kick a player on a dedicated server)

#

Or send a message from a widget to another player

dark parcel
finite spindle
#

the only documentation if found is with an hosting player (so you are the server)

copper pendant
twin juniper
#

I have this code:

#

And this is the part I don't get. When I press G as one of the clients, Shouldn't on one of the clients it print "Simulated Proxy", and on the server "Authority"?

copper pendant
dark parcel
dark parcel
twin juniper
#

The clients shouldn't print authority according to your logic, and the logic that I understand.

dark parcel
#

@twin juniper I don't really remember Local Role / Remote role. better print it and take it as the truth

quartz iris
#

Why does it not save the mouse sens variable on restarting the game in the editor?

#

This is the code within the game instance

dark parcel
#

@quartz iris #blueprint show me where you call Save Game function

quartz iris
dark parcel
#

but you never save it?

quartz iris
#

?

dark parcel
#

you are only setting the variable in the save game object but you never called Save Game To slot to write the .sav file

quartz iris
#

ah i see

#

like this?

#

what do I use for the save game? this one?

dark parcel
#

well not just that, there is quite a few mistake

#

you load the save file over and over

quartz iris
dark parcel
#

You should just load once and refer to the same save game object instead loading a new one all the time

quartz iris
#

ok

finite spindle
#

Hey guys, if i have an admin in my game and want to send message to other player how can i do this ? Only the admin could do this (using a dedicated server)

torpid girder
#

hello, i am trying to understand why my client call isn't working, (i have other calls working but i just added a new one)

    UFUNCTION(Client, Reliable, WithValidation)
    void ClientUpdateBuildingList(const TArray<FGuid>& Buildings);

i've put a break point on the call to ClientUpdateBuildingList, but i never see a break point being hit on the implmentation

#

and nothing in the logs either

twin juniper
#

Hey guys, i have a chest in the server, and each player opening the chest in client side, creating their own widget. One player put an item in it. How do i update all other chest widget with new item?

twin juniper
solar stirrup
#

It's more like you're not supposed to use WithValidation with anything but Server RPCs

silver pendant
#

when I spawn a component on server then a player joins, I can't find it there, it only works with actors, is there a way to fix that?

graceful flame
torpid girder
#

i had thought reliable added extra overhead like TCP, and validation checks if the data is sensible

#

ok lets try that

solar stirrup
#

barely and no

#

depends on what you try to do

twin juniper
#

the player own the widget

#

the chest don't know about it

graceful flame
graceful flame
torpid girder
graceful flame
twin juniper
graceful flame
#

Which can be problematic when bound to user input because they can spam the input and overflow the relaible buffer which causes a DC

twin juniper
#

that's a questionable design

#

like the player suppose to open the chest, not store it

graceful flame
twin juniper
#

im not talking about the inventory, im talking about the chest

torpid girder
#

even so that those changes didn't do anything, i've done something dumb

void AAvalonPlayerController::InitializeBuildingList()
{
    if (GetLocalRole() == ROLE_Authority)
    {
        AStormbaneGameModeBase* GameMode = Cast<AStormbaneGameModeBase>(GetWorld()->GetAuthGameMode());
        if (GameMode)
        {
            TArray<FGuid> Buildings = GameMode->GetSuitableBuildingsForPlayer(this);
            ClientUpdateBuildingList(Buildings);
        }
    }
}
twin juniper
#

like an actor on the ground

#

not belong to playerstate or playercharacter

torpid girder
#

these simply gets a list of possible spawn points based on game rules, and should push them to the client

#

so this is called at beginplay

#

i wonder if this is the wrong time to call this

graceful flame
twin juniper
#

but the chest doesn't belong to playerstate, how does the playerstate changes

#

what are you talking about

graceful flame
#

where does the item go once they open the chest and take it?

twin juniper
#

ok, for clarification, let's just say the player didn't take or add item, but just move it to another slot in the chest

#

like organize it

#

how would other players get the widget changes?

graceful flame
#

So then the chest has replicated state for its own inventory, you can dispatch an event (item moved for example) and pass along the item index and its new location. Then any player who has the chest open can bind an event to that dispatched event inside of their widget.

twin juniper
#

then ill have too many event dispatcher

graceful flame
#

just need one

twin juniper
#

i dont use bllueprint, but i guess that's delegate in c++

graceful flame
#

or two or three i guess for how ever may unique events, move item, take item, add item...etc

twin juniper
#

yes

#

and it's not 3 lol at least 10

graceful flame
#

How?

copper pendant
twin juniper
#

i have many feature that's how

torpid girder
#

i bet i have the sequence of events wrong, i probably shouldn't make a call from the server to the client to push the spawn locations, i should have the client request it from the player controller

solar stirrup
#

You can set the available buildings on the server and they'll get replicated down to the client

torpid girder
#

it is no different that character selection

#

if i iterate and make multiple inserts, that won't cause multiple replication events will it?

inner hearth
#

hi, help someone figure out how to set up replication correctly, pls) I have Units (Characters) that are combined into groups - for this I create a separate actor where I save links to all Units of this group and also save a link to this actor in each unit. and also in the player controller I want to store references to the player's unit groups(as array for example), and the question is how to replicate these groups?

If I pass to client a link to a group object when creating it, then this object may not yet be replicated on the client and the link will be invalid. Is the only way to get the correct links to actors to search for all the actors every time you need to select something?

solar stirrup
#

So dw

torpid girder
torpid girder
#

i have a feeling i should still make a client to server call to force the server to give the client the spawn locations rather than the server's player controller pushing it on beginplay

silver pendant
#

I have an actor which is the owner of a component, but still I can't use (RunOnServer) events from that actor in the component, unless I use a (RunOnServer) in the actor

twin juniper
#

did you set owner

#

and make the component replicates

silver pendant
#

the component isn't spawned, and It's set to replicates, and I'm also using that check which returns true

solar stirrup
#

If it's a default subobject it's already got the correct owner

#

Where are you trying to call the server RPC

silver pendant
#

from the begin play of that actor it self

solar stirrup
#

What kind of actor is it

silver pendant
#

just a blueprint actor, and It's set to replicates

solar stirrup
#

Okay but what kind of actor

#

just AActor?

#

or pawn, player controller etc

silver pendant
silver pendant
solar stirrup
#

okay i see where you got confused

silver pendant
solar stirrup
#

you can only call server RPCs on actor and actor components you, the player, owns

#

print the actor's owner

silver pendant
#

ok

silver pendant
solar stirrup
#

actor not component

twin juniper
#

but he said the server call run on the actor

#

so that's weird

solar stirrup
#

servers can run servers rpc fine

#

not clients

twin juniper
#

they both client..?

silver pendant
#

so it should always be owned by the player pawn or controller?

solar stirrup
#

If you wanna be able to call Server RPCs on an actor it needs to be owned by the player controller yes

twin juniper
#

you should read the ownership document

solar stirrup
#

so on the server when you spawn the actor set the actor's owner to the PC of the player

silver pendant
#

but It's placed there, not spawned, what is the solution for that

#

the weapon actor

#

which is trying to call that function on It's own component

twin juniper
#

beginplay setowner getplayercontroller 0

silver pendant
#

what if It's a split screen game

#

you sure there is no other way?

lost inlet
#

iirc it can be the pawn too (since the PC owns that)

twin juniper
#

what..

lost inlet
#

what's splitscreen to do with it?

twin juniper
#

split screen multiplayer game?

silver pendant
lost inlet
#

yeah, and?

silver pendant
silver pendant
twin juniper
#

but then you only need the replication

#

any controller would be fine

lost inlet
#

well using controller 0 is objectively bad advice

#

for mp

#

you clearly have a place where your weapon is spawned and you would need context there for what player it's being awarded to

silver pendant
#

what I mean that I want a way without making an onwer for the weapon actor

lost inlet
#

so that's your owner

#

what? you need an owner

#

and I don't know why you'd want to fight that

silver pendant
lost inlet
#

that sounds like bizzarre architecture

twin juniper
#

if every single actor on the map has its own connection, it would be hard to manage i guess. So unreal engine design it the other way

silver pendant
#

then I have to call on server always 🤔

twin juniper
#

you don't make server the owner, you make the connection the owner

silver pendant
# twin juniper

I think I have to set owner on begin play for each actor trying to call RPCs of It's components

silver pendant
twin juniper
silver pendant
#

that seems correct

solar stirrup
#

yes

#

It goes up the chain of ownership until it finds a player controller

silver pendant
#

I found also that add component isn't replicated at all

#

I need to replicate it on multicast

solar stirrup
#

that's bad

silver pendant
#

why?

solar stirrup
#

make sure the actor is replicated and the component is replicated

solar stirrup
#

show code

silver pendant
#

I was testing and I found this is the only way to replicate add component so it shows up for all clients and server

#

so now how can I set the owner of the actor while testing in Unreal, because I might have 4 controllers?

because I'm testing on one PC

rain crown
#

I am beginner in ue5, however i wanna make a simple first person shooter with multiplayer AND... the multiplayer is my issue. Could someone suggest something with it?

dark parcel
#

Suggestion would be to start single player

#

Multiplayer fps is not simple by any means

twin juniper
#

Yep

bronze glade
#

When I get the player array from gamestate, I get a warning it is pending kill or garbage unless I add a delay before checking. Is there any variable or function I could use to wait until the player is fully ready before trying to access them? I'd prefer to not just wait a set amount of seconds in case someone has a really bad connection or so people don't have to wait if they don't have to

bronze glade
# solar stirrup PlayerState's BeginPlay

Okay 😄 This function is in the gamemode. So in playerstate begin play I would set a variable to true or something and in the gamemode just loop until I get that as true? Or is there a better way?

sinful tree
bronze glade
sinful tree
#

If it's happening on the game mode, then it's not happening on clients.

bronze glade
#

I'm not sure I understand. I am just trying to access the player state but it's too soon because the player hasn't fully joined I think. The player array from game state has 2 players, but the new player says it's pending garbage or kill unless I wait an extra 2 seconds for example for it to fully load (at least I think it's due to loading). The host player state is working fine, just the client is saying that when I try to reference it

#

I am trying to figure out when the client is fully ready

solar stirrup
#

What function are you doing this in

bronze glade
#

This is in game mode, I am getting game state player array and then trying to access the player controller from the player state. But when I run Get Player Controller on the client's player state from the array I get a warning unless I add a 2 second delay

#

I know game mode is server only. I am not doing anything to run or change things for server/client. Just trying to wait until client player controller is loaded into the game world properly

sinful tree
#

Begin Play of the PlayerState is the correct time for when PlayerStates become valid. If you're trying to trigger logic in the Game Mode when this happens, then the only place you need to trigger it is on the server as clients do not have access to the Game Mode.

If you're trying to do something clientside, like say, display something in UI when a player joins, it's still the Begin Play of the PlayerState that you probably need to use. You could have it call into a function on your GameState which clients do have access to, and have an event dispatcher in the GameState that other actors or UI could bind to know a PlayerState has started. So it could be like:

PlayerState Begin Play > Get GameState > Cast To your custom GameState > Call "PlayerStarted" event passing along the "Self" reference of the Playerstate > "PlayerStarted" event calls OnPlayerStarted event dispatcher in the GameState.

Earlier in some UI or some other actor:
On Construct (Or Begin Play) Get GameState > Cast to your custom GameState > Sequence (Part 1) > Bind Event To OnPlayerStarted > Have it Update UI or actor based on the new playerstate starting
Sequence (Part 2) > Read the current PlayerArray from the GameState and update your UI or actor as needed with the PlayerStates available.

bronze glade
#

The game state makes sense, I could try that. I was hoping there was just a node or something similar to "is Valid" for this scenario but probably not.

Like I said I am not trying to display UI or anything like that. I am just waiting to start any of the game until all players are loaded in after a server travel

#

I'll go with game state, thank you for the detail! Just wanted to verify if there was another way to confirm all players are fully connected and loaded before implementing anything. Thanks guys!

solar stirrup
#

And whatever else you need

bronze glade
#

Okay thank you 🙂
Sorry for not communicating my issue well

sterile prism
#

sorry for not zooming in

#

I guess it is replicating by making it appear and disappear. just not playing the flipbook

vagrant grail
#

Why does my raycast not detect the other player please ? All of this logic is in my BP_ThirdPersonCharacter and the collision of the BP_Character is set to "Pawn", so I'm kinda confused 🤔 Please ping me if any answer 🙂

icy jetty
#

And is anything printing on hit actor

vagrant grail
icy jetty
vagrant grail
icy jetty
#

It means it’ll hit anything that has that channel checked as Block

#

So usually visibility should do the trick for Pawn (on default collision settings) unless that’s set to ignore or something else is in front of it etc

vagrant grail
icy jetty
#

There’s prly some docs on collision, I had to learn the hard way tho

#

Very many things can go wrong with collision, many of them don’t seem to make sense at all until you find the issue

icy jetty
vagrant grail
vagrant grail
orchid eagle
#

so im still having the same issue when replicating the system
its so clear in the videos a lot of movement correction
also i have another issue where the Combo end event would be called most of the time and i repeatedly keeps clicking the attack button
but still it would be triggered
is there any idea how to prevent that?
something like after each animation
i would have like 0.5s and then the combo end would be called if no attack animation is playing and also have like after playing the first attack you would wait for like 0.2s before doing the next one so i would have a more clear combo

icy jetty
vagrant grail
dark parcel
#

@orchid eagle Multicast and delay?

orchid eagle
#

im still trying to learn about replication 😅
so still dont know what should work and what wont

dark parcel
#

me too but imo you should have close to no multicast in a project

#

Gas uses Repnotify to play montages

#

If you are talking about root motion, it's already supported in CMC

orchid eagle
#

also i tried to call the motion warping event on server then do a multicast and that seems to work for like a few second and after that it would go back to the movement correction again

dark parcel
#

I wouldn't have delay too, I seen that pattern of doing combo from youtube.
You probably want to implement input buffer

#

no comment on motion wrapping, never touched it. I can play montages with root motion just fine tho

orchid eagle
orchid eagle
dark parcel
#

well in my opinion you shouldn't be multicasting about anything, especially animation

#

probably want to implement GAS to play your montage, that;s my plan for my game

orchid eagle
#

does GAS work with blueprints ?

dark parcel
#

yes but the boiler plate must be done in cpp

#

which isn't much

#

Pure blueprint for multiplayer is probably good enough for chess or any games that doesn't depend on ping

orchid eagle
#

my game is a dedicated servers game and not everyone would be on at the same time so will the repNotify work with that ??

dark parcel
#

No one will always be at the same time

#

everyone ping is different

frail temple
#

What's the difference between possessing a Pawn and a Character? I can possess Pawns fine but I can't Possess a Character as a Client.

meager tiger
#

#cpp said I might get better help here, so I'm extremely confused by something while exploring how multiplayer and replication works in unreal. I'm having an OnRep function being called on both the server and client when everything I'm reading says it should only be getting automatically called on the client and not the server.

UPROPERTY(ReplicatedUsing = OnRep_OverlappingWeapon)
AWeapon* OverlappingWeapon;

UFUNCTION()
void OnRep_OverlappingWeapon(AWeapon* LastWeapon);

...

void ATestCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
  Super::GetLifetimeReplicatedProps(OutLifetimeProps);
  DOREPLIFETIME_CONDITION(ATestCharacter, OverlappingWeapon, COND_OwnerOnly);
}

// this gets called on server only
void ATestCharacter::SetOverlappingWeapon(AWeapon* Weapon) {
  DbgPrint("setting value");
  if (this->OverlappingWeapon) {
    this->OverlappingWeapon->ShowPickupWidget(false);
  }

  // this should trigger the call to OnRep on only the client but its getting called on the server as well
  this->OverlappingWeapon = Weapon;
}

void ATestCharacter::OnRep_OverlappingWeapon(AWeapon* LastWeapon) {
  DbgPrint("replacated OverlappingWeapon");
  if (this->OverlappingWeapon) {
    this->OverlappingWeapon->ShowPickupWidget(true);
  }
  else if (LastWeapon) {
    LastWeapon->ShowPickupWidget(false);
  }
}

The debug prints are being printed on both server and client when the client should be the only one receiving them. When the server triggers it, OnRep is not called at all, but when the client triggers it, OnRep is called on both. Am I missing something, did something change with how this works recently?

dark parcel
#

Character is a child of pawn, you can possess it

orchid eagle
dark parcel
frail temple
#

This works perfectly fine on another project that is just spawning a Pawn, on this project I'm trying to spawn a Character and I can't Possess it.(don't mind the disconnected pin, I just had to move a pin real fast for the SS and didn't notice it but it still doesn't work even when connected)

meager tiger
dark parcel
dark parcel
#

what;s your print look like?

#

@orchid eagle GAS comes with built in prediction system or so I heard. That's crucial for many multiplayer game. I would suggest to just to use that to build your game

frail temple
#

It spawns the characters correctly, the client juts doesn't seem to register that it has possessed it (I run the OnPossessed event and it comes back null)

orchid eagle
frail temple
#

No, no. It is connected

meager tiger
#

the prints are

DbgPrint("replacated OverlappingWeapon");

which essentially expands to a call to AddOnScreenDebugMessage

When a normal client (not the server client) triggers it, its printed to both the client that triggered it and the server client. When there are multiple other clients, it only gets printed on the triggering client and server client and not the other clients. When the server triggers it, its not printed at all (expected)

frail temple
#

It just doesn't work. It's just I had to move it for the SS

#

@dark parcel It's connected, client on the right still returns null

dark parcel
meager tiger
#

hmm

dark parcel
#

I print on Rep stuff yesterday, it only get called only on client when the value replicates to client

#

will try to do a quick one

meager tiger
#

yeah its really confusing because everything I'm reading says thats exactly what should happen, but then I'm seeing the print fire on both client and server client, including the behavior that should only be happening on the triggering client

frail temple
#

@dark parcel A delay fixed it, not sure why I have to add a delay to this project but my other project I don't need one...

dark parcel
#

actually I have no idea

frail temple
#

But both projects have the exact same code for spawning and possessing, the only difference was that this one spawned a character while the other was a pawn. Like it registered that it spawned a character and set the players camera in the correct location, it just didn't register "Ohhh this is my character" haha

dark parcel
#

@meager tiger ```cpp
void AAGPlayerCharacter::OnRep_Health(int oldValue)
{
GEngine->AddOnScreenDebugMessage(-1,10.f,FColor::Yellow,FString::Printf(TEXT("Old value is : %i"), oldValue));
GEngine->AddOnScreenDebugMessage(-1,10.f,FColor::Yellow,FString::Printf(TEXT("New value is : %i"), health));
}

This only get printed once, no matter if the server or the client call it.
#

my OnRep not called if you are dedicated server tho

meager tiger
#

ok, so are you saying when you are the server and press v, its not printed. but when you are the client and press v, its printed once on both server and client?

dark parcel
#

Listen server I guess

meager tiger
#

gotcha

dark parcel
#

when I am the client and I press V. it only print once too, the server doesn't print

meager tiger
#

interesting

#

somethings messed up here

#

I guess I'll keep poking around, thanks for looking though

dark parcel
#

can you try with more players?

grand kestrel
#

Got a question about FFastArraySerializer. If I change the value of an item already in the array, do I still need to call MarkItemDirty() ? The header that has a mini-guide doesn't say I have to, but I'm wondering if it was missed.

dark parcel
#

@meager tiger My bad man, turns out my listen server never called OnRep

#

it's actually called on client

#

So health for my the player 0 character changes and it replicate to client since the client have a copy of that character

#
void AAGPlayerCharacter::OnRep_Health(int oldValue)
{
    UKismetSystemLibrary::PrintString(GetWorld(), FString(" is calling on Rep"));
}
#

taht's what happend when server press v

meager tiger
#

I might've figured out the issue, it seems the clients are returning true for HasAuthority, which is letting them setup callbacks to call SetOverlappingWeapon

#
void AWeapon::BeginPlay()
{
  Super::BeginPlay();

  if (this->HasAuthority()) {
    DbgPrint("has authority");
    this->AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    this->AreaSphere->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);

    // bind callback delegate (on server only)
    this->AreaSphere->OnComponentBeginOverlap.AddDynamic(this, &AWeapon::OnSphereOverlap);
    this->AreaSphere->OnComponentEndOverlap.AddDynamic(this, &AWeapon::OnSphereEndOverlap);
  }    
}
orchid eagle
dark parcel
#

@orchid eagle multiplayer is not easy.

#

For non programmer like me

orchid eagle
#

yep i know
but for GAS its just not that easy thing or normal for non programmers

dark parcel
#

I'm following tutorial for that from udemy

#

But a lot of programmers think it's not good

orchid eagle
#

yep i saw a lot of people laughing about using GAS with blueprint 🙂

orchid eagle
orchid eagle
#

i know it wont be that good with blueprints but i still don't know C++ im good with c# but not yet C++

twin juniper
#

that's already good

orchid eagle
#

so here is a new video
i tried to have another combo so i can see if all clients are in sync and when one plays a combo the other one can see it
but what i see is it doesn't sync i see one playing an combo and on the other view which is the server i see another combo playing
can someone verify if i have done the replication correctly and if not then give me like a hint or a clue on where my issue is

#

i would really appreciate any help

#

also if anyone would know a better way to achieve the same thing that would work too

wintry crane
# fossil spoke No you are not

u said that the host cannot be a server and a client, today i made it so that from my widget a call a function on a pc on a server and then server got my 2 clients' pcs and called function to run on owning client. from what i understood is that clent and server cannot be the same but the OWNING client can be also server? please correct me if i am wrong am really getting confused right now

#

Since widgets exist only on owning client so it would make sense? i hope im not stupid

fossil spoke
#

If you are referring to the “Owning Client” on the RPC event node, in that case it means the Machine that Owns that Object.

#

If thats a Host then its just an oversight on the naming

#

The Host will still have this called on it

#

Even though the Host cant be a Client

#

Any RPC you call on the Host from itself (Server context) it will be called normally

meager tiger
# dark parcel <@209196587560337410> My bad man, turns out my listen server never called OnRep

turns out the issue was really stupid. When you run the game in the editor with multiple clients, by default it runs the different clients all under one process, which apparently means the messages from AddOnScreenDebugMessage appear on all instances of the game, no matter which client executed the code. Unchecking "Run Under One Process" in advanced play settings makes the messages print on their correct clients

dark parcel
#

Doing it with debug msg got me fooled

meager tiger
#

yeah thats a really confusing thing to do

#

thats partly why I have all my debug messages wrapped because I had a feeling I was going to need to switch how they're logged at some point

wintry crane
#

thanks

tiny scaffold
#

Is Someone able to help me understand what im doing wrong. on both the blueprint interface and server custom events the "Interacted Container Data" is correct however when it gets to the client event the data is blank. I am referencing a custom actor component. Are they not replicatable?

thin stratus
#

Your code looks quite strange I gotta say

tiny scaffold
#

Yeah kinda forgot the blue print interface function is fired by the server

orchid eagle
vagrant grail
#

I have 2 cameras on my player to switch between FPS and TPS view, so I'm supposed to handle all of this on the client however, I need the active camera to start a Raycast when I left click to attack, so should I repNotify my variable named "currentCamera" that contains the current active camera ?

Also should I also handle the camera switching (beween FPS and TPS view) on the server too as if I set my variable to repNotify it has to be set on the server and also to avoid cheating (even that I don't see how can the client cheat with this).

twin juniper
#

Trying to simulate lag to fix bugs for my multiplayer

#

Can you explain what do these settings mean in terms of ping? Is this the equivalent of 400 ping?

#

Or is it 200 ping?

solar stirrup
#

You get lag on clients because you slow down what the server sends and receives

#

so it's gonna affect clients with something this bad

#

And yes it's equivalent to 400 ms of latency for the client because you're delaying incoming packets by 200ms and outgoing by 200ms on the server

#

@twin juniper

twin juniper
#

Thanks

lost inlet
lost inlet
#

This sounds like micro-optimisation a little bit, but with structs you can have a custom NetSerialize

#

well I say a little bit, it just is

#

if order matters, then you don't want to use option 2. until Iris is the default, RPCs are not guaranteed to be received in order

#

rate limiting is likely going to be a more worthwhile optimisation

finite spindle
#

Hey did anyone already replicated a media sound component ? Seems like the component replication does nothing

lost inlet
#

why is that something that needs replication

finite spindle
#

Because only the server can hear the sound

#

Maybe it's because when i have different windows in PIE unreal block the sounds from the other window

tardy fossil
#

i dont think the media sound component does any replication in that way.. usually you use a RPC or replicated variable that makes the audio component play on the client side

finite spindle
#

There is a component replication in the add media sound component

thin stratus
#

@finite spindle Replicating a Class doesn't do much by default. If the Component isn't actually supporting Replication by actively replicating variables etc. then you won't get anything from toggling that.

boreal wadi
#

Has anyone had any experience with SnapNet ? I’m interested in it but wondering how far will I have to deviate from the replication techniques I already know

https://www.snapnet.dev

A complete netcode solution for Unreal Engine, Unity, and even custom engines. Stop losing development time networking every mechanic, effect, and interaction.

upbeat basin
#

If I add a newly spawned replicated object to a replicated array, is it possible that on the array's onrep function the added object is not yet available or fully initialized?

tardy fossil
thin stratus
# boreal wadi Has anyone had any experience with SnapNet ? I’m interested in it but wondering ...

Looking at the feature list, the "Intergration" part is wrothless, cause why would one need Unity integration from a UE Engine o.o
Mid Match Instant Replays should be possbile with UE, so that's not really true.

UE has the NetworkPredictionPlugin (NPP) since recent, which can be used for a lot of stuff.
The CharacterMovementComponent is also going to be mostly replaced via Mover 2.0, which uses the NPP.

I give it credit for some of the Compensation features I guess. I don't quite get why they think their system AND UE can use Physics for Networking, cause despite replicating some bone locations, I would not dare to use physics in my network game.

Mostly seems like UE is very much equal to this. UE is also free on that end and doesn't require some random company's license. The missing features, despite maybe the physics part, could be coded if you know how, but I guess that's their selling point.
Speaking of selling, they don't even list prices.

Also they don't seem to post any videos of those features or?

finite spindle
#

Okay thanks guys !

snow trail
lost inlet
#

Thought the name would be obvious