#multiplayer
1 messages · Page 152 of 1
mayb
maybe that's why the replication feels off this season
It's all very short range heh
Guys, i have a question.
Can i rollback with replication?
And also, is my question even make sense?
Rollback is a very broad term, you typically implement rollback on a per feature basis. Its not something that you just generically add to everything.
The Character Movement Component implements Rollback.
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)
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
Not entirely sure if it maps already stably named assets to guids
But it would make sense I guess
easy to test by breakpointing the packagemap
If it's just actors and we ignore the whole smoothing part, it's enough to mark them as ReplicateMovement in their settings
Ah, ok I guess by default its not on.
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.
Seems so: seems like it actually has two caches, one for static (stable) objects and one for dynamic objects
/**
* 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
Oh, ok. I never made any rollback so i am keep getting nervous about the future. Because my prediction just never go wrong right now, as i only have simple attacks and inventory managing. Do you know good way to make prediction goes wrong so i can try implement rollback?
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?
C++?
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.
I can't find any delegates in c++ for either network or travel failure from the game instance
Yeah
I just want to get it so that it destroys the EOS session on all clients when it occurs
is there something like that but for replicating rotation?.
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 
or is Class just sort of privileged in that way
That should include rotation
It's not part of the GameInstance
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
Fwiw put a DestroySession call into the MainMenu GameMode BeginPlay
Perfect, that is exactly what I needed
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
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.
All Pawns should get destroyed during Travel.
Unless you have done something to cause them to be retained
You should not end up with a duplicate after a Seamless Travel.
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.
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.
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.
AGameModeBase::SpawnDefaultPawnFor is probably what you want to override, as you can easily then return your existing Pawn which would then get automatically possessed.
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.
Why the A before stuff
I thought it was for actor
But, everything carries it for what I see
Unimportant, just curious.
@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.
Is it?
Yes?
Not necessarily.
They dont HAVE to.
The PlayerController is an Actor, its not visual.
The Pawn is the visual for a PlayerController.
Ah ok well I learned something new then
An Actor is simply an Object that exists within a World.
And it's a requirement for being networked right?
Actors typically share the lifetime of the World.
UObjects do not
AActor is the only class that is default Networked.
Don't actors get destroyed ?
Most do when the World is destroyed yes.
In the case of Seamless Travel, some are retained across the level transition.
Right I'm talking from a RTS point of view where rarely actors stay alive
What do you mean?
Units get destroyed all the time
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.
Right, maybe I don't understand what sharing the lifetime of the world means
Because I'm not familiar with more than one level
It means that at most, an Actor will live as long as the World is loaded
Got it, and objects won't ?
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.
As well as any components attached right ?
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
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?
by default OnConstruction(const FTransform& Transform) called on server/client ? or just server?
You cannot call RPCs in the GameMode
The GameMode only exists on the Server
So the RPC has no where to go.
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?
An RPC requires a NetOwningConnection.
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
The Server can always call RPCs on replicated Actors as it has Authority.
The GameState for example
You can call RPCs on that from the Server
But not from a Client
Because the GameState isnt owned by a PlayerController
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?
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?
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
Sure. Im guessing this appears immediately?
huh?
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
Ah ok, then sure, the GameState would be fine for that.
lets goo
i am really suprised how this text channel is so talkative
thanks for the answers man
Well the server does have over 100k users
No problem.
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...
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)?
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
well... if the server could tell where the client is, it wouldnt have a discrepency would it? you could display last server reported location on the clients though.
Absolutely. The problem is that it's an object that is simulating physics, and so I wanted to be sure the clients weren't adding some kind of lag/offset to the transform that is received from the server every tick. I'll look into reporting the last server location, thanks!
do you know about server reconciliation?
if you read up on that, it would be helpful as well.
That's built in
yeah, for the character movement component it does it for you
I'm pretty sure for physics replication you can get something similar too
although you never know, he could be trying to implement his own solution for something else
If not then just replicating a transform is enough.
not really
Sorry, for context, it's a buoyancy calculation on the server
not if you want a smooth experience
Which then gets sent as an actor transform to clients
I'm mean to visualize
Why not just use the built in physics replication?
does ue5 replicate buoyancy?
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
Hmm, I was under the (probably incorrect) assumption that physics replication was pretty dreadful in UE, and that it was getting a fairly large overhaul in the somewhat near future. Have I missed that update, or am I just completely misinformed?
from what ive seen and heard phys replication is solid
But yeah, trying to avoid mismatch between client and server by just running it server side at this stage
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.
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
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
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
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?
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
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?
Aloah, random assumption: Your Pawns use "ControlRotationYaw" and the spawning logic only sets the Actor/Pawns Rotation, which gets overridden by the local ControlRotation of the Client.
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)
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
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
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
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"
it might end up being that
im wondering how i would structure that in this actor
just a vector2D of their current tile location?
why do tiles need to be stored as floats?
I assume they are like a chessboard here and not that they just happen to move 1 meter in steps etc
you are correct, they is only tile step sizes
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
I suppose but the core issue still stands, on a more granular level, moving the actor without the jitters
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
I guess rephrasing this
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
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
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"
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
this is kind of a rabbithole in some sense, but I think the naive linear setup should be okay
if the server says thats not possible the clients wont update their position
the "real" location could just be said grid location while the "visual" could be the visual component in world space etc
yea that'd be idea.
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
yea im just trying to get multiple characters jumping around a grid :C
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
FWIW the unreal network emulation presets are rather extreme but you never know with NA internet lol
- @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.
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
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.
Regular structs don't work like this though right? If you had an FMyInventory that's a regular UStruct, and changed only one member in it, only that member would replicate?
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.
Yeah they have delta changes
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
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?
Depends on your game's requirements
Would be good to know what the video is and what it actually says in context
This is the video I watched: https://www.youtube.com/watch?v=YB_ew3j_HFw
Wishlist our game Spanky! https://store.steampowered.com/app/1732420/Spanky/
GMC: https://www.unrealengine.com/marketplace/en-US/product/general-movement-component?sessionInvalidated=true
Smooth Sync: https://www.unrealengine.com/marketplace/en-US/product/smooth-sync
In this video we address the topic of multiplayer games made with unreal engi...
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
well it's experimental and this video predates that, but I think it's supposed to
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
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
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
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.
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?
-
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.
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 ?
Hey guys, if the Owner is set to COND_SkipOwner, but the child have no COND, would the child replicates?
It worked on the client to server, as it print, wdym?
on the server, there is 3 prints, but when I try the client I only get the 2 that's already in the player cahracter before using the event
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
https://portal.productboard.com/epicgames/1-unreal-engine-public-roadmap/c/1281-mover-2-0
while empowering non-engineers to craft their own movement.
This, to me, would imply they want it to be BP friendly
nice
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.
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
The client has to own that actor
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
thanks, I get it now
RPC gets dropped when you call it from an actor you don't own
so when I change the owner should that be replicated as well, or It's already is
it explains alot
if u want the actor to replicate set bReplicate to true
setting owner must be done by server too btw
ok
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
I can't recall tbh but I don't think we had a limit despite having to server travel together
after I set the owner it worked
Ye but I don't think it's a good practice to do that. Just from what I heard
I'm just testing my events, I didn't know that I have to be the owner
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
about replication, do you know anything about reliable option
I read that It's for events that will do much tasks
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
nevermind, I'm just going to run some tests then.
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
where is the pinned article again?
https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium
https://wizardcell.com/unreal/multiplayer-tips-and-tricks/
2 must read
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
Might need an EnableCheats command first
Is it a console command I can enter in ~?
I think it's a build.cs thing?
Yeah, that's for Clients in general
I know we had to do that on builds in The Ascent too and that was ListenServer
Yeah, it makes it work. Thank you
But how would you enable it in a build?
Just keep in mind that the console is usually not shipped
Idk
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
GM doesn't seem to have anything with "cheat" in it
Just check what EnableCheats does haha
Yeah, true, but I guess I have to do that every time I start PIE
Or just write your own
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
Cheats are just some function run on an actor
I think they can't even be RPCs by default
They kind of can using ClientMessage(ConsoleCommand(FString))
That's what Lyra does
What does client message ultimately run through
Probably the PlayerController or so
Yeah, it's a PC function
Ey my dynamic open world replicated harvestable foliage/ resource sytem is working now! Not possible without this discord, and especially Cedrics Compendium
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?
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
don't worry no multicast on a spawned actor, now I'm like using almost 3 multicast events, because I needed to.
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
👀 Mover 2.0 got committed to the 5.4 branch https://github.com/EpicGames/UnrealEngine/commit/a4b2f5ec21a25f5b2bcf65176d3d48bff9e1e497#diff-970238071cb65248fc78da89d80ec4e6da33745234a4c6ab003b62d1788cbf41
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?
A forum said that i should toggle visibility and disable collision on the client
what are you trying to achieve
you can play cosmetic animations like fortnite does when you send the request
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
if you must you can always spawn the actor locally but unless it's pretty simple you're gonna mispredict most of the time
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
Yeah, there are already blog posts about it being shown off
:O where at?
pretty sure if you google Unreal Engine Mover 2.0
you'll find a blog post by vorixo
sweet, thanks
https://vorixo.github.io/devtricks/mover-show/ Is this the article? Why is it written in past tense?
"Unreal Engine introduced Mover 2.0 in 5.4" 
introduced
Shouldn't it be "is introducing" or is 5.4 out and I missed it?
wait a minute this is a scam, it's a video not an article at all, what a bait
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
🙄
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...

its an overview of a kinematic system, so a writeup wouldnt work as best as a video
Text alone sure, but screenshots would've sufficed for me
but I know that's a lot more work to edit. Thanks for keeping it succinct at least 
I didn't need to see movement 
I just wanted to know what was different. Words was plenty tbh
Screenshots just to show the ui and stuff
well, its a... movement system 😄
Yeah but I can visualize movement 
Like I said, don't mind me. I'm just too hyperactive. 2x speed is never enough for me 
To use a metaphor, when I am shopping for a car I do not need to see video footage of the car driving 😛
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..
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?
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
LoL how ObjectType of an UStatcMeshComponent is not replicated, so annoying to do a multicast
why a multicast
make a new component that derives from UStaticMeshComponent and add a replicated prop
then add OnRep to that
then wake up tomorrow wondering what the hell this extra component class even for
XD
✨ comments ✨
...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.
lol you are right, my multicast fire off earlier than the pointer setup so i actually need OnRep
soon enough my project will be filled with 100 random component XD
(oh i can actually throw it in my actor class) (yay)
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?
This is correct, OnRep only fires when the Client receives a new value from the Server
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
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?
No you are not
D:
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
omg so like when i do replication i dont need to replicate for the host because he is the server
Correct
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
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
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.
@modern heron Is this local multiplayer game? (eg Split Screen)
lan but not split screen
will add dedicated servers later on once more stuff was going but was using lan to test lobby etc
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
LAN = networked
@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
its the only way that would return a value shrug lol But the the turns dont work at all when i launch a standalone launcher
added delays for debugging.
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.
ill try that with game mode
this is done becuase of this So i can set up logic to change the current players turn
isnt that what that is? its in the game mode so should be replicated yes?
How can Pax DEI have 150?
I just test it and we can actually get the controller based on index from server :D. never know that, I thought its only for local multiplayer
Mainly want to do this for optimization.
@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
is unreal Iris using PushModel?
How do i know if Iris is running?
It does not change anything
Hence the "somewhat" :P
PushModel is a per property choice by the developer.
Got nothing to do with Iris.
I'm talking about using RepNotify in a purely single player game, for optimization purposes.
IsGrounded in my case is a custom variable, not part of the movement comp
But that's just an example.
I mean the question is still fair. Maybe Iris exclusively uses it by default, removing the step and choice 😅
I don't see a very good reason for not using PushModel
Sure, it doesn’t though lol
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 🙂
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
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.
Means you are mostly required to code this yourself
ugh :/
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.
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
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
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
another video with the issue visible
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?
that how i made it
you would need to call your code on the server then on the owning client
Is this currently getting called on the client or on the server?
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 😅
xD
I understand what you are saying, and I know that, but my question is entirely different.
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
I added a print, the print appears on both the client and the listen server, as "Client0: Hello"
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
Well not particularly input, my question is if I call a node inside a pawn, without an RPC, does it get called on client or on server.
For example if I add a print string to begin play.
does beginplay run on both client and server?
It does just like any function
Oh sorry we're u asking him?
I'm posing a rhetorical question here
I'm painfully aware of how beginplay works in sometimes more detail than I want lol
the short answer is yes, but it depends on what kind of actor it is
That is very cool, but I can't answer rhetorical questions when I don't understand the basic concepts.
@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
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
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?
Not everything what happend on server happend on client no
Everyone run their own world
U decide what to sync
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
im dying here 
yes you can use root motion in multiplayer... the CMC supports this
i know i can but did you see my setup
I've heard this in 10 different ways, in 10 different videos.
My questions is still unanswered 🙂
something is not working there there is a lag or like some animations are not being played or skipped
I don't really know enough about it to judge the setup, sorry... I think you can see an example of root motion being used for CMC movement in a GAS task... I think
is this about the listen server?
the listen server will not do things twice... in the common case
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?
im not using GAS + im not doing a movement there 😅
it's working both as a client and a server, but it doesn't really need to replicated to itself etc
anyway will keep looking for why is that
anything it is spawned on will call beginplay, whether it is replicated to them is another matter
while a root motion montage is active the CMC has vastly different behaviour
if you are not doing this on the server and client then discrepencies will occur I guess
im doing it on server and client
doesn't change the fact that it could happen at a slightly different time than you intend afaik...
Take a step back from multiplayer mind. Here's what happend. When a pawn begin play called in my machine. My machine will run the begin play code, regardless of client or server
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
my guess is that the release/start is happening out of order, I gotta go though
im not using the Release at the moment just the click or start
If I have to replicate it manually, by calling on both client and server, then what exactly does the CMC replicate Automatically?
yeah... not sure what parts of this are being done on simulated proxies (other players seeing it)
there are conditional things in RPCs that are not being sent as part of that RPC, like that "saved" thing
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
overriding GetMaxSpeed should get pretty far at least
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 😔
here is another video with the full issue very visible at the last 1m
at this moment i see the same thing on both the client and the server so still the issue is when playing the anim montage the character would try to correct its position you can see that at the last part in the video
why leave out if this is a listen server or dedicated?
what do you mean ?
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
its dedicated
yeah you seem to be on a dedicated here
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
I am not extending it, I am setting the built-in variable of MaxWalkSpeed...
Which if it can't handle replication of it's own built in variables, then I don't get the point of it.
Sure but you also have a sprint variable u make and setting it
That's not gonna work
Forget the sprint for now.
I haven't seen your code
that is not a replicated value if that helps
Thanks for trying to help,
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
i saw it already but didn't really help
thanks anyway i will try some stuff and see if it will work or just wont
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```
I want to create more but without a player controller im not sure i follow.. more what?
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
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?
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
OnPostLogin is called by the server not client machine
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
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
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
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
not sure what auth process is
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
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();
You can get the old values
by asking this i also mean i dont know HOW to do that 😛
I know u can 100% but I haven't done it my self :P. Have u tried passing a param?
You create a param in your onrep func and name it the same as the property youre replicating. UE will pass the old value automatically then.
Actually dont think it needs the same name even just same type probly.
Sidenote, fast tarray replication is also an option with some clear drawbacks (ie order of elements may not be synced properly), but it provides callbacks for changed/added/removed array elements. Needs some setup but may be worth looking into later.
i'll have to look this up - is this new functionality?

I'm pretty sure it also existed in UE4
You figured how to pass the old value?
workign on it - having some C++ stuff with making a ToString on a custom struct i made
for debuggin ganyways
pls help, why its stop working i dont understand
my initial guess is this is beign ran on the server... whats your netmode? Are you doing LIstenServer or DedicatedServer?
shit ... i retract that - obviously its being ran on server - BeginPlay runs 2x - AsClient & AsServer
yes its listen server
how to fix it?
@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
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!
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
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
it helped to fix error pop up
but still for some reason my client is refusing to load widget
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
@copper pendant
the only documentation if found is with an hosting player (so you are the server)
strange..
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"?
maybe when i moved files in my project around inluding levels and widgets - somithing broke
could be anything really, I can't tell without having the project at hand
Server Machien have Authority over those actors
Client machine don't have Authority over the actors
The clients shouldn't print authority according to your logic, and the logic that I understand.
@twin juniper I don't really remember Local Role / Remote role. better print it and take it as the truth
Why does it not save the mouse sens variable on restarting the game in the editor?
This is the code within the game instance
@quartz iris #blueprint show me where you call Save Game function
but you never save it?
?
you are only setting the variable in the save game object but you never called Save Game To slot to write the .sav file
well not just that, there is quite a few mistake
you load the save file over and over
You should just load once and refer to the same save game object instead loading a new one all the time
head to #blueprint I will read more there
ok
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)
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
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?
if you use Reliable, then you should delete the WithValidation
It's more like you're not supposed to use WithValidation with anything but Server RPCs
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?
When a player takes or adds an item cant you just multicast the change in state from the bp_chest actor?
i had thought reliable added extra overhead like TCP, and validation checks if the data is sensible
ok lets try that
the widget is not replicated
the player own the widget
the chest don't know about it
Reliable should only be used if the event MUST not fail because it would screw up gameplay too much. Ex: A boss spawning into the match for a PVE mmo should be reliable, but something like casting a spell or opening a door shouldn't be reliable because those can just fail and the player can retry without any issues.
then use playerstate to store the inventory
i understand the use case, i mean at the protocol level they must have coded some sort of transmission control into udp
I think it just auto retries until it gets an ack
the chest..?
Which can be problematic when bound to user input because they can spam the input and overflow the relaible buffer which causes a DC
that's a questionable design
like the player suppose to open the chest, not store it
When the player takes an item it goes into playerstate right?
im not talking about the inventory, im talking about the chest
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);
}
}
}
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
right but if the playerstate changes then the other actors such as bp_chest can read from the player state who interacted with it and broadcast out the change so other players interacting with it can update their widget
but the chest doesn't belong to playerstate, how does the playerstate changes
what are you talking about
where does the item go once they open the chest and take it?
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?
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.
then ill have too many event dispatcher
just need one
i dont use bllueprint, but i guess that's delegate in c++
or two or three i guess for how ever may unique events, move item, take item, add item...etc
How?
i figured it out
problem was i created gamestateBASE
instead of his child
when i switched them widget appeared!
i have many feature that's how
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
You should probably use replicated properties not RPCs
You can set the available buildings on the server and they'll get replicated down to the client
yes you are right that is probably the better way of doing it, i don't know why i am treating spawn points differently
it is no different that character selection
if i iterate and make multiple inserts, that won't cause multiple replication events will it?
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?
Replication is done at the end of the game loop
So dw
i thought as much, i never checked that there wasn't some hook in F or T vars that made them special
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
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
the component isn't spawned, and It's set to replicates, and I'm also using that check which returns true
If it's a default subobject it's already got the correct owner
Where are you trying to call the server RPC
from the begin play of that actor it self
What kind of actor is it
just a blueprint actor, and It's set to replicates
the first one
okay i see where you got confused
you can only call server RPCs on actor and actor components you, the player, owns
print the actor's owner
ok
actor not component
they both client..?
so it should always be owned by the player pawn or controller?
If you wanna be able to call Server RPCs on an actor it needs to be owned by the player controller yes
you should read the ownership document
so on the server when you spawn the actor set the actor's owner to the PC of the player
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
beginplay setowner getplayercontroller 0
iirc it can be the pawn too (since the PC owns that)
what..
what's splitscreen to do with it?
split screen multiplayer game?
that means there is 2 controllers
yeah, and?
an example, and can be yeah
I can't use controller 0
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
what I mean that I want a way without making an onwer for the weapon actor
so that's your owner
what? you need an owner
and I don't know why you'd want to fight that
https://docs.unrealengine.com/5.3/en-US/actors-and-their-owning-connections-in-unreal-engine/
you can read this, it would make things more clear
I have a weapon actor placed in the level which is calling an RPC on it's component, on begin play
that sounds like bizzarre architecture
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
what about the deticated server, can't I make it as the owner of all actors placed in the level?
then I have to call on server always 🤔
I think I have to set owner on begin play for each actor trying to call RPCs of It's components
yeah, the Issue that won't work well on the same PC testing
just make your own aactor class and then make child if that's you want to do
so if the bullet is owned by the weapon which is owned by the player, can the player call an RPC in the bullet
that seems correct
I found also that add component isn't replicated at all
I need to replicate it on multicast
that's bad
why?
make sure the actor is replicated and the component is replicated
yeah they are
show code
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
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?
Suggestion would be to start single player
Multiplayer fps is not simple by any means
Yep
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
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?
On Begin Play of PlayerState, use a Has Authority (Authority) > Call function in Game Mode.
Well the server player is actually not failing, but the client is failing unless I wait a second or two after the server travel I am doing (I am assuming due to internet or some sort of connection delays). So has authority would not work for the client scenario right?
If it's happening on the game mode, then it's not happening on clients.
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
What function are you doing this in
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
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.
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!
Easiest way is to have the clients execute a Server RPC when they've finished loading stuff like their player controller, player state and the game state
And whatever else you need
Okay thank you 🙂
Sorry for not communicating my issue well
Flipbook is not replicating. Any ideas
sorry for not zooming in
I guess it is replicating by making it appear and disappear. just not playing the flipbook
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 🙂
Does the draw debug give any info?
And is anything printing on hit actor
Found the issue, the "Trace Channel" parameter has to be set to "Camera" instead of "Visibility". I'm not sure to understand what this parameter does
That’s the channel you’re tracing on.
What does it mean exactly ?
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
is there any documentation explaining that ?
Explaining what? Am I confusing you? 😀
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
Debugging is often needed, hence why I asked those questions
Then why it didn't work with my pawn set to "Pawn" and I had nothing sets to ignore if I'm not mistaking 🤔
Kinda because I prefer detailed explaination because the fact that it didn't work for me makes me wonder if there's more things to know about that than what you said 😄
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
There prly is. Collision is a tricky bish
What can I show you so you can see whaat was the issue ?
@orchid eagle Multicast and delay?
im still trying to learn about replication 😅
so still dont know what should work and what wont
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
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
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
I nevenr used GAS and dont have any idea how it works
but im trying to play some root motion anim montages for my attack system
they work fine without the motion warping
but still gets some movement correction after playing for a bit
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
does GAS work with blueprints ?
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
my game is a dedicated servers game and not everyone would be on at the same time so will the repNotify work with that ??
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.
#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?
Posses should be called by the server
Character is a child of pawn, you can possess it
okay so no other good ways to achieve that without GAS
if you are the listen server, you are also client. So it will get called on the listen server
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)
even if the server client isn't triggering it? I thought it should only get replicated to the client that triggers it with COND_OwnerOnly?
I would use a well known system that everyone is hype about. Still exploring it
COND_OwnerOnly will only replicate the value to the owner
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
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)
im trying to look at it now
thanks ❤️
No, no. It is connected
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)
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
If I have to guess, it probably exist on the listen server too
hmm
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
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
@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...
When you spawn the actor is probably not replicated to client yet
actually I have no idea
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
@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
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?
No, when im the server and I press V. It gets printed (On Rep called) on Server Machine
Listen server I guess
gotcha
when I am the client and I press V. it only print once too, the server doesn't print
interesting
somethings messed up here
I guess I'll keep poking around, thanks for looking though
Imo since the listen server sets the Weapon for everyone, it should be called on Listen server?
So my guess is if u have 2 players in the world, both owning weapon, server will call twice.
If there are 3 players in the world, all got a new weapon, server will call 3 times
can you try with more players?
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.
@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
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);
}
}
i tried to look at GAS but that's not a easy thing i can deal with also i dont think i can merge it with my current character
also there is not much tutorials on using it with blueprints most of them are just too old
yep i know
but for GAS its just not that easy thing or normal for non programmers
I'm following tutorial for that from udemy
But a lot of programmers think it's not good
yep i saw a lot of people laughing about using GAS with blueprint 🙂
a good player movement using blueprints with multiplayer is literally impossible(really hard + there's pings to keep in mind): https://www.youtube.com/watch?v=YB_ew3j_HFw&ab_channel=Rory
Wishlist our game Spanky! https://store.steampowered.com/app/1732420/Spanky/
GMC: https://www.unrealengine.com/marketplace/en-US/product/general-movement-component?sessionInvalidated=true
Smooth Sync: https://www.unrealengine.com/marketplace/en-US/product/smooth-sync
In this video we address the topic of multiplayer games made with unreal engi...
i already done with the movement and it work so perfect
just doing the attack system and i think the replication works fine i see the animations playing on both the clients fine but the root motion in the anim montage is the issue
my character keeps going forward with the anim then do like a movement correcting and go back to its old location
and keeps flickering
perfect on your device...
i know it wont be that good with blueprints but i still don't know C++ im good with c# but not yet C++
that's already good
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
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
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
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
Ahh yeah that's why I switched to print string so I can check who's calling it
Doing it with debug msg got me fooled
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
yeah now i get it, owning client is someone who owns the object and it can be host or client
thanks
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?
They should be but why are you calling a Server RPC followd by a Client RPC on the same Character?
Your code looks quite strange I gotta say
Yeah kinda forgot the blue print interface function is fired by the server
guys im really stuck here i just want anyone to review my code and see if i did do the replication right or not and what might be the cause of this issue 
yes u do
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).
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?
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
Thanks
there is absolutely no way HasAuthority returns true for (non-listen server) clients in BeginPlay unless the actor is being spawned on the client. also weird this-> usage
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
Hey did anyone already replicated a media sound component ? Seems like the component replication does nothing
why is that something that needs replication
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
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
There is a component replication in the add media sound component
@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.
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
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?
i just quickly checked out the UMediaComponent code. it's just a simple uactorcomponent with a mediaplayer pointer.. doesn't actually do any replication
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?
Okay thanks guys !
UE has the NetworkPredictionPlugin (NPP) since recent, which can be used for a lot of stuff.
how have i never heard of this
does it do client prediction?
Thought the name would be obvious

