#multiplayer
1 messages · Page 226 of 1
I'd like to get some insights on replicating a train movement. I've made a prototype but it has some defects.
Right now, train itself is a replicated actor with InterpToMovementComponent to follow a spline (railway).
For the rotation along the spline, rotating the actor itself somehow break the movement (maybe the interptomovement gets affected by the actor forward? didn't debug it to see what was the reason). So I instead added a replicated scene component to rotate it along the spline.
Finally, I've also set wagon meshes to replicate to give them a relative rotation according to their offset to the actor's center. So it also looks like a snake rather than a stick.
Visually everything is okay so far. But having players stand on it seems to have it's own challenges. Listen server is fine on the train. But clients are rather fragile. Server can push them while they're grounded. Also they sometimes teleport to some other place on proxies when they jump and come back when landed. They're vulnerable to falling off the train even though they should be held inside by the train's collisions.
I guess the real issue to solve here is replicated player movement on another replicated moving platform. I'd love to hear recommendations, pitfalls, other approaches on this
Is there a function that allows you to get the local player state to each machine? Or should you get the controller from the player state and test if locally controlled?
You can get your local player controller from GameInstance (UGameInstance::GetFirstLocalPlayerController) to then get your player state
Thanks, in this case I have a playerstate to begin (as an owner of something in the world) with an need to test if it's local so I think the correct flow is a function on the player state like this
APC* OwningPC = Cast<APC>(GetOwner());
if (OwningPC && OwningPC->IsLocalController())
{
return true;
}
return false;
in this case?
Well if you're already on PlayerState you can just call HasLocalNetOwner() to see if it's locally owned
Which basically does what you do there
Ah even easier thank you!
Be aware that if you have AI and if they have PlayerStates, then this will return true on the server for them as well
If you want to only get player owned player states you also need to add IsABot() to the equation
I don't in this case thankfully! good to konw though
Though my func above would filter this out by using the player controller
I'll have a look to see what is inside HasLocalNetOwner and may just keep the original snippet if it's similar
If APC is inheriting from something below APlayerController then yes it would sort that issue as well
HasLocalNetOwner tries to reach top of the ownership chain to see whether it's a locally controlled pawn or controller
It's coming from AActor so it's a bit of a more generic implementation
Can anyone confirm that Network Profiler doesn't work when using the Iris Replication System? I'm switching back and forth between traditional and Iris in Lyra and not capturing any data when using Iris. Just want to make sure I'm not missing anything.
Thanks for the confirmation! 🙂
hi there what would be a good exercise to start learning multiplayer ? i wanna create a simple game for me and my friends
This page is generally considered the "bible" of multiplayer in Unreal: https://cedric-neukirchen.net/docs/multiplayer-compendium/introduction. Fair warning: multiplayer is a complex topic with a steep learning curve. Even if you just want to make a small, simple game, you'll have to spend a lot of time learning and understanding the intricacies of networking. Fortunately, Unreal does a good job making it easier and more accessible than other engines with a lot of built-in networking features and things like blueprints.
amazing thank u so much!
how do I launch a dedicated server in the editor? instead of listen server
Just select play as client
Can a client call a RPC on there gamestate to the server?
Lets say you want to set a variable on the game state from client
No
Client doesn't own the gamestate, server does
You'd have to do the server rpc from like, the player controller or something that the client has network ownership of.
what's the drawback of using UEFN for multiplayer game creation ? thanks and soryr if this isn't the right place to ask
No clue. Being tied to Fortnite would be the no.1 drawback for me.
Not being able to use the Engine properly and having to touch Verse would be another one.
That is the main drawback right now
yeah that's what holding me back as well ! Just read the beginning of your compendium thanks a lot it makes everything more clear
UEFN is pretty limiting compared to UE proper.
So you have to do things within the confines of what Epic allows you to do
It's a preference I guess but I will never tie myself to Fortnite and the Metaverse crap
Not everything is exposed in UEFN either. So some games simply aren't possible.
oh yeah no i'm so glad the metaverse catchphrase is gone
yeah if you're in that space and you're not roblox glhf
and yeah in UEFN, devices written in Verse are your only scripting entrypoint
and they run serverside only
Sounds horrible
Lmao, it hasn’t even begun.
nah all the metaverse grifters moved to web3, and now onto AI
I wonder why they didn't stick with BP for UEFN, adding another language into the mix in UE6 is going to be a bit strange
BP being quite intuitive for visual learners etc.
Though if it means better perf than BP with no rebooting the editor after each change and it's text based then maybe it makes sense as a C++ alternative for gameplay scripting
They could have done that without needing to implement their own language though
C# would have been entirely fine
Anyone know what the right way to lerp movement on the server and replicate down to the client is? I'm trying to have an item on the floor get magnetically pulled to player's position when they are overlapping with a magnetic sphere. I use lerp and a timeline to adjust the item's location in the world. This item actor's movement then gets replicated down to the client. With this solution the client has a really laggy/choppy movement shown.
Looks like I should instead be notifying clients that movement from point a to point b should begin and then let the clients trigger the movement locally on their end.
Running it locally will be far easier to make look smooth
You could do the exact moment they gain the item separately too if need be
Thanks again Megafunk. So IIUC the server should check collision with player, then multicast the event down to players, which then run it locally to smoothly move the item. Since movement is replicated, will this cause issues, if some clients don't have the same item position as the server? Will the server's corrections cause jitter as well?
It could be an onrep on the item for who they are moving towards instead of a multicast
You can disable movement replication temporarily or override it to consider not applying during the magnetism
Although the latter will be easier in cpp
Thanks this is super helpful. So a variable called "SelectedActor" that is replicated to clients. Then in the on rep the client checks if its set to a valid actor, and if so trigger movement on client and disable movement replication, until the item has reach the target location.
Cool, I'll try it in cpp then.
The simple thing here is to follow what the onrep for reptransform does
And figure out how you want to make it either get ignored or skipped, replaced etc
Replication between two properties is not atomic so you could learn about the fact it's being sucked in a bit after you get a transform
Basically expect onreps to occur basically at random and account for ones showing up at bad times vs the other
The other option is to merge both into one property which works double duty to get both states in one packet every time
But you may not need that for this
Ahh, this is really insightful and I wouldn't have thought of it. Thanks again, going to give it a shot.
And fwiw a bit of jitter isn't the end of the world if it makes mistakes 1% of the time
Can't win em all
It’s all apart of the same inevitable future. Web 3 just means players owning their assets; I’m in favor of this. And AI is so broad its like saying computerized
there shouldn't be assets like that to own in the first place 🙃
the net is a place for all to be free and equal. chaining everyone to some coin to track arbitrary ownership of arbitrary licenses ain't it
but it already exists in a WORSE form ? what would you rather do, buy a skin, not actually own it, and not be able to trade it ? or buy a skin, actually own it, and be able to trade it freely ? i see it only as a positive for the gamer that grinds or pays for what they want in games they spend HOURS in.
the value stems from the player's themselves; not the person that made it own-able in the first place. and this then leaves the brunt of the guilt (if there really is any) to the market (aka the actual players of whatever game)
I would prefer not to buy skins at all, but still be able to use whatever I wanted as a skin.
yea completely remove the word buy and replace it with earn, i love that too
Who said anything about earning?
lol well how else would you aquire the skin in the game ? maybe im missing what your point is
Biggest joy on the Internet is watching NFT Bros losing their shit about others copy pasting their profile pictures.
Also that whole concept won't ever work for assets in games anyway.
not a single person who actually understands what an NFT is would ever care about this for the record
Even then. The whole setup makes no sense for game assets
Buy something in Game A and try to use it in Game B. Or try using it once Game A shuts down.
You are still f'd, even with the ownership
i agree that , the reality of true interoperability is much further away than some may claim, but it's not impossible nor is it not something i can see working
I think it's pretty much impossible unless you live in an ecosystem like Fortnite with your games
And then you don't need the NFT stuff anyway
again, the ownership at least you have some sort of relic to hold on to as a gamer. it's like a pokemon card that isn't used in tornaments anymore or something. just a relic to hold onto. doesn't need to be some overvalued nonesense
well... that's kinda the point
When the game shuts down you have nothing
fortnite, ironically, is in the best position to make something like that actually happne and work
but they probably would not be willing to give that liquidity to the players
they would pretty much lose money
Comparing it to a Pokemon card, it's like keeping the receipt that you bought it but the card is gone
you have a non-working asset in that game, sure, but another dev could easily say, ok that asset is now going to be used in my game
no, it's not
you would still have the asset. it just wouldnt be usable in that game
Man you are deep in that shit. I'm not gonna waste time on it.
It goes kinda with what pliny was saying... There shouldn't be assets to own in the first place. Creation and ownership of digital assets are in a strange place in my mind - once you create the thing, you can effectively infinitely duplicate it and it costs effectively nothing to do so. Why does there need to be any ownership at all if technically everyone could have it when it costs you nothing to make more of it? Of course the answer right now is because you want to make money off of your creation, and that's fair because that's the kind of society we live in right now.
I play a game where you make your character look how you want from the beginning and your gear doesn't change what you look like. It's not about earning the outfits at all in the game like most other similar style games, but they do tie some of their systems to both monetization and to events to "earn" those outfits, but really, the game, the actual playing part suffers because the company focused too hard on the monetization and how to earn costumes, but never really fully built out their game, the fun part of playing.
yes. i am very deep in it. been involved for many years and trust me most people dont have a clue.
Yap. Of course.
There are a lot of games that do it right and the gameplay doesn't really suffer. But there are infinitely more where it was too much of a focus, yeah
It also started to be a requirement of sorts if one wanted to compete with other similar games. If you need players and you are unknown, you gotta make the game free, and add stuff they can buy.
Which didn't help
Saw a lot of games come and go with the f2p+customization stuff
People willing to fork over $20/month for a ton of different movies a month, but good luck getting them to part with $10/month for a single game.
Then they'll dump $500/month if they can buy loot boxes for some reason if it's f2p.
I often find myself buying random shit I don't need to buy over spending it on a game or two that I want. And I can afford both easily but well. I don't invest into cosmetics though
you answered the question in your reply, the digital world is a business. let's not debate the state of our current society, i think we'd all agree it's not near utopia.
and yes, i agree it's such a new concpet relative to most mediums that it will take time before the balance of games having a true economy really works and doesn't impact the game for the worse. but i don't think any of this is a reason to disregard the idea or think it's wrong by default because of some bad actors / devs taking advantage of an opportunity
if that game had a massive economy, i think it could work. but yea it doesn't seem realistic right now
but nothing seems realistic until it happens
Hello. Question. Am I understanding this correctly. A level instance needs to be added / loaded and turned visible on both server and clients, right? I always thought it was just the server, but from the testing I've been doing this morning, it seems that both server AND clients need to add / load and set them visible?
Can't say I am an expert on level instances but that's how also I use them. Doesn't seem like ALevelActor has any property/function replication to force clients to load/unload levels
Did any hero from the community create any kind of docs for Iris yet? Would love to use it but the codebase seems a bit daunting.
Your best bet is to check out engine implementations of custom serializers
but for the most part beyond custom serializers and filtering it's a drop-in replacement
besides some missing features like certain net conditions
Thanks. I have used replication graph quite a lot and would like to redo some of the logic in Iris, like the spatial filtering, team-based filtering for a specific game modes. Do you know by any chance where is the correct place to hook the filters up for a given game mode in Iris?
And one more question if I may, does the replication itself run on separate thread now? When I last checked it was still on the game thread.
some filtering can be threaded afaik but it's still on the main thread
it's just... much faster
I have never had to set up filters so I can't say... it's driven through ini configs for many things fwiw
there should be some default ones in the engine
I am more familiar with the internals of reading than writing
hey guys, i have a game which has vehicles in the syncronisation works fine in the editor and standalone game when connecting with another person who has the editor on a different network via steam. however. when packaging the game and trying the packaged version the desync happens
i am using local physics and using a line of code to send positions to the other clients
{
vehicle->SetActorLocationAndRotation(position, rotator, false, 0, ETeleportType::ResetPhysics);
Multi_UpdatePosition(vehicle, position, rotator);
}
void AVehicleBase::Multi_UpdatePosition_Implementation(AVehicleBase* vehicle, FVector position, FRotator rotator)
{
if(vehicle != this)
{
vehicle->SetActorLocationAndRotation(position, rotator, false, 0, ETeleportType::ResetPhysics);
}
}```
have you tested with net emulation in editor?
i have not with net emulation. but we have two devs via source control and we were able to play with not sync issues
Are you directly possessing the vehicle or do you "stand" on it with your pawn?
this only happens in build versions of the game
directly possessed
Okay, sorry I have no idea for your issue then. I'm just interested with replicated moving platform kind of a thing recently and thought you might be having a similar problem I had
you should try using the physics prediction option and letting UE handle replication.. i dont think just sending RPC's of vehicle transform will be enough
i tried the work in progress physics prediction they stoped clients being able to move and had less syncronisation then normal physics modes
the RPCs are the closest ive got to it being fully synced position wise
for the game were making i would rather most of the vehicle be client side for physics to look smooth and just have the position replicated and the replication normally is very jittery with chaos physics
I don't know why people ask stuff like this without sharing ping stats...
if the ping and framerate was identical with similar sendrate for the object then it is weird, but you have provided 0 context beyond "worked on my machine here" sorry
you might find that it's sending less if the server is running slower, or that there are more things contending for space in packets in some cases
also... is this a multicast to set the position? Why do that and not just replicate it?
does it need to store a buffer of each move update?
But me and same person have tested on the editor version standalone the replication works fine. When packaged the replication stops and become out of sync.
I am going to ask that you read what I wrote again
you are saying two things are the same that could be different given DIRECT ACTUAL NUMBERS
From my testing frame rates stay the same for both people on the packaged and standalone game
The multicast was because the original replication was jittery
The vehicle come out of sync after collisions
But again this multicast fixed this in the standalone game
And only having physics on each client
And sharing the position
the build version is an actual setting where lag exist, why don't you test with net emulation in editor?
Testing multiplayer with 0 ms, is fake test
also yeah I would say at least try the built in vehicle replication stuff... it might be overcomplicated but I doubt it will be worse than raw rpcing the positions with no smoothing
you could probably just go prev-->next lerp and get okay-ish looking results
yea if you really want to RPC positions for the movement, i would disable physics on the clients not driving the car and purely lerp the transform
sending transform updates at a specific rate so you dont overflow the RPC's
But lag still exists when testing over steam in the standalone game window. Over the internet and it works in there just not the packaged build.
I will look into the inbuilt replication more. I stopped using it due to it bwing very jittery and was unpleasant to look at for more than 5 seconds especially in first person
I have a question about session games where you can close the game and rejoin, with matchmaking etc. Do i need to provide server side security to insure who players are? As i understand any player can join the session technically, and i need to have some sort of auth token to validate the player and set ID to him, that it is the player from matchmaking system and set his ID in game to his player controller or something like that, is that correct logic?
If you're on Steam, you can use thier SteamID which can't be spoofed. So I can't see a reason for the extra security when the game already knows exactly which player is allowed to rejoin
I'm sure Epic and other platforms also use a similar Account ID
I have my own web server with authentication/authorization already, and i will sync it with stream later i guess, but it can be played without steam as well. So basically it's the same anyway, i need to use some Account ID. But i'm thinking about using auth token specifically, isn't just passing Account ID is vulnerable, how is SteamID secure, what stops me from using someone else ID, or its some sort of token/guid as well?
Because Steam handles all the security and you can't spoof someone else's SteamID.
Hello,
does FFastArraySerializer guarentee order integrity?
I want to replicate an array of structs, I can do it with regular replication as it'll only ever have like 50 elements max, but the functions of FastArray look quite nice
but I need order integrity
Steam uses session tickets. Your clients can pass their ticket ID, and you'd end up calling up a Steam API to then see what their Steam ID is along with some other data, and you can then compare their Steam ID in the session ticket with the one they connected to the game with, and if they match, then you know it's the right person. No password is shared at all in this and that session ticket is only valid for a short duration. You also don't need to worry about transmitting and storing any passwords yourself.
You can't really spoof a ticket ID, as it's just a long series of numbers and letters, and there's no way to guess exactly what one would be valid at any point in time, nor for that ticket ID to actually be linked to any single Steam account.
That makes sense
can you just null your values instead of removing them?
I believe FAS swaps positions to avoid mutating the array, which would mess with your order
since mutating the array would have to sync all elements down the line, which is a big no no
Actually, what am I saying
I'm porting this from Blueprints and I don't remove elements I just null them already
but does the initial initialization of the array (let's say 20 slots) keep the order when that gets replicated?
does the order issue only happen when syncing the arrays after removal?
what are some good starting resources to learn persistent account progression in online video games? does EOS/steamworks facilitate this? or would I need to spin up my own infrastructure?
Yes
Steamworks allows account vars, so it can all be done through steam im pretty sure.
You can also use this plugin to save lots of headaches.
https://www.fab.com/listings/0d3b4a43-d7cf-4412-b24d-e3f844277f9c
the creator is pretty amazing and will provide all the help you need
The most ultimate Steam Integration plugin with complete support of Blueprints!📺Getting Started Video📖Documentation💬Discord Community🖥️Example Project🚨Lyra Integration✨ChangelogFeatures:One Click Steam SetupConfigure Steam from SettingsComplete SteamWorks SDK ExposureComplete Steam Web API accessLatest Steam SDK Support ( Version 1.6 with Timeli...
I guess if I made a steam plugin, I'd have to call it the "super ultimate steam plugin". That way people know it is the better version.
Then there's the "Ultra Super Ultimate Steam Plugin (MEGA Edition)".
Dang. Already outclassed and I'm only in the concepting phase.
order isnt the same between server and clients
for various reasosns
if you need a fixed order, you would need to store the index inside the array entry (thats what i did for my inventory system)
@sinful treehey do you mind clarifying or explaining how you would set up a simple turn based system 🙂 ?
If you're talking strictly about player turns, have the gamestate keep track of who's turn it is in an Array of PlayerStates. Add all players to the array whenever you want to start.
Array Index 0 = The playerstate who's turn it is now.
An "End Turn" function can be used to:
Store the current playerstate at index 0 of your array in a local variable called "Previous Turn Player"
Remove Index 0 from the array.
Add "Previous Turn Player" to the array. (Adds them to the end).
Whenever you have some kind of action that requires it to be a player's turn to do it, you check if the playerstate of the player trying to take that action is currently in index 0 of your array in the GameState. If not, it's not their turn.
Using AIs would mean you'd use something else other than playerstates, like the possessed pawns/characters.
thanks ill try to workout a easy system based on that
hi i don't understand why one player sees the block up in the air and the other sees it down
here is my setup
here is my setup
Looks like I'm in the same boat here. Did you happen to make any progress on this?
Looks like I'm having the exact same issue. Did you happen to make any headway on this?
At a high level, what techniques should I research for reducing the load on the server and clients from having hundreds of actors in the game all replicating their position?
- relevancy
- despawn the actors if they're nowhere near the players and can be safely nuked
Anything else that's very obvious?
Hi guys! Im having trouble wrapping my head around proper networked speed switch implementation. I am setting my character max walk speed and then resetting it super fast to simulate recoil. However, since its such a fast switch, I think the server correction latency is slower than my reset, so it looks very jiterry on clients as seen in the video. (Blue is server, and red is client). Im trying to set movement speed on every instance of the character, so in theory it should set on both client and server. Am going in the right direction?
I have tried doing this as a server RPC too and it also jitters.
This effect is basically the opposite of a a Sprint, just triggered by Weapon Firing.
You need to integrate it with the CMC directly in order for it to be properly predicted and not cause corrections.
There are a few Pins in this channel which might assist you in doing this.
Find one that specifically helps you implement Sprint to the CMC
The process for adding the effect you want would be identical
You would just change the trigger (Weapon firing, instead of Sprint input)
You have the added benefit of adding Sprint along the way lol
Keep in mind ,they would be 2 separate additions to the CMC
true!
gotcha
thanks so much again!
Yes no doubt it uses CMC
Interesting. Wonder if they’ll ever share what’s going on in there’s
Their’s**
I doubt it.
Any generalized adjustments would already be in the Engine.
Meaning they aren’t necessarily changing the CMC but more so the engine itself ?
They would have subclassed it to implement all the specific features they need in Fortnite.
I think I understand the context of what you mean by subclassed but essentially they are extending the CMC like anyone else could in theory
?**
Yes
Nice
is there an event that triggers in clients for jump, like the "landed" event? im just trying to avoid sending an rpc for a replicated jump sound
Why is jumping sound replicated at all?
its not, i want it to be
im just wondering if theres a better way than sending an RPC
Only way for client to communicate to server is with server rpc. Nothing else
Honestly though for what ever you are trying to do there , it doesn't seems like you need any networking at all.
A character jumps then just play the jump sound locally on each machine when the character jump.
What is the case where do you actually need rpc?
I may be totally wrong, but at the moment it seems like the Accelleration vector sent up as part of a character move gets its signs completely flipped when I step on certain static meshes in my game. I have logs spitting out values pre-client send and post-server recieve and the values almost directly flip on XY when I step up on a thing
Also ACharacter has a LandedDelegate, you can try that, I suspect its called for Proxy clients as well as Local auths
well how would i play the jump sound locally on each machine? i mean i could do it with a notify on the animation or something like that i guess but then i would have to override the notify class thing just for a jump sound
Anim notify play sound
There is already anim notify to play sound
do you have a bit of code i can look at?
Just go to your anim asset. Right click on the timeline
. Select add notify, play sound
oh ok so i dont need code at all, i didnt know that
thats very nice to know
And even if you want to implement your own, think about it generically.
Make anim notify that play a sound
Instead thingking oh I need anim notify that play jump sound. Then I need anim notify to play explosion sound.
do you happen to know if those sounds play even if the mesh is hidden?
cause i might run into the issue of having the sound play twice
I'm not sure, you probably have to play around with the settings.
Maybe set the abp to always tick
this might be what i am looking for, its an option in the skeletal mesh
gonna mess around with it tomorrow see if it works
thanks for the help
Has anyone encountered client crashes in PIE when connecting to a dedicated server with World Partitioning? Built clients connect fine.
The server log shows:
LogPlayerController: Warning: ServerUpdateLevelVisibility() ignored non-existent package. PackageName='/Memory/4ANQIJOX24KSFW4LRPJNRLCMD', FileName='/Memory/UEDPIE_0_4ANQIJOX24KSFW4LRPJNRLCMD'
It seems related to how PIE handles streaming. The /Memory/ prefix used in PIE doesn’t match the prefix on the server build, leading to rejection. I've tried modifying parts of the UE source to allow this, but it only introduces more issues, and it's not a rabbit hole I want to dig deeper into.
Any ideas or solutions?
Hey I am having a replication issue due to late joining that has had me stumped for a couple days now . I have an array of all the player pawns in the session stored in gamestate, this is replicated.
I have a player join on the server and it gets added to the array. Now when the client joins, the first player that had joined is not replicated, and the length of the player array on the clients version of gamestate is 0.
mygamestate.h
UPROPERTY(BlueprintReadWrite, Replicated)
TArray<APlayerCharacter*> ActivePlayers;
mygamestate.cpp
void AATGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AATGameState, ActivePlayers);
}
int AATGameState::RegisterPlayerWithGameState(APlayerCharacter* JoinedPlayer)
{
int Index = ActivePlayers.Add(JoinedPlayer);
JoinedPlayer->PlayerIndex = Index;
JoinedPlayer->OnPlayerRegistered();
return Index;
}
In the picture I am printing out the length of the array on tick and can see that to the client, the array has no players, but to the server it has one.
Let me know if I can provide any more info, Any help would be much appreciated, pretty stuck!
Quick question, why are you reinventing the wheel here? There already is a player array of playerstates, and I'm pretty sure you can get to their pawn from there.
Do you know where this is stored / how i could access?
It's a property of GameState
Ah okay thanks. Either way I think i still need to do custom because the game I am doing has local + multiplayer, and we have had issues with unreal creating a ghost input device, so you need to be added to the array and have the pawn spawned in when you press A. I’d also like to solve this problem just to understand replication better.
For performance if I need pawns often i think it also makes sense to store pawns in an array rather than getting them through player state every time
The performance gains would be negligable.
oh interesting! Even if it’s on tick?
Even on Tick.
Access speed of already existing, already cached pointers to Actors is not a large overhead.
Early optimization is an anti pattern
Optimize that sort of stuff when you already have a product thats selling and you are trying to get every little bit of performance you can
doing stuff like caching pointers is a bit beside the point when it's already in a pointer... the fact it's randomly stored is why it's slow more so than the fact you are saving one pointer deref out of 100s
What do you mean randomly stored?
I guess the point is you are already bouncing around in the cache as is
I see
The only thing I am worried about is I need to check the type of pawn the playercontroller has which requires casting. and doing that on tick in multiple places makes me think performance would take a hit but Ill try ti first and see per Matt's suggestion of pre-optimization
you will get a lot further by just not spamming overlaps and avoiding bp ticks when reasonable... Profile and find out
measuring the effectiveness of things like this is in the order of 10 calls a frame is tough to reason about... stuff like this is more evident in the order of thousands
Is there a best practice around modulating the player's velocity in a way keeps the server and client seeing the same thing and makes the experience minimally jittery for the client?
I'm specifically thinking of cases like the client player character opening a parachute while falling and slowly decelerating until a terminal velocity.
Should I directly modify the velocity? Apply an impulse? Do that on both client and server? Only on the server and let the replication notify the client?
I suspect that y'all have this well figured out.
I would suggest trying linear vs exponential interpolation to see the difference if this is a cmc
replicating the fact the parachute is open should ideally be inside the same property as the speed (easier said than done) so they show up in the same packet
Casting on tick isn't as bad for performance as you think
Thank you
Out of curiosity, do you happen to know if an approach of bumping a player's velocity vertically up on every tick to simulate a parachute-style deceleration is rife with problems when it comes to replication, and if perhaps people end up picking another approach entirely in practice, like temporarily changing gravity, or maybe there's a terminal velocity parameter of sorts on the CMC?
you need to do movement inside of an actual extension of the cmc and not just on tick
could do custom movement modes or just getmaxmovement speed/falling speed changes etc
the cmc ticks but it does not move from just from ticking... it moves from performing movement
the more you follow the cmc's actual idea of how to send moves from client/server the more you will reproduce similar results on both sides
Roger. Sounds like I should look into potentially adding a new custom movement mode like "Gliding" and that might give me the rails I'm looking for?
that might work but I think you could get away with just changing falling speed etc. If it's just basically reducing the falling speed I don't think it needs to be a whole new movement mode
Ah, perfect, I will investigate 🙏
I don't specifically remember what was the problem but I don't have the issue now. Would you like to share how you create the sesssion (options) and how you get the URL/connection string parts?
What is the best way to profile how much info is being sent over the network / speed? Game is pretty laggy client side so trying to figure out how to tackle that
Unreal Insights
Is source control on a multiplayer project different than a solo project ?
Is it possible to set password for sessions, without requiring the client to connect to server (or at least to travel/change the world) and not exposing the password on the session settings?
I tried giving the password to travel string to compare the input with server's expectation on AGameMode::PreLogin. Although the logic works, client tries to travel, which probably triggers the PreLogin. So on a mismatch and returning error, client experiences the level change from menu to game level and back to menu again since it's travel error. I'm curious if this can be done before level change is even intended without a third party solution
No Shouldn't be?
cool thanks!
no sure but multi is so weird i was just wondering
Beacons can allow you to connect and communicate with a server before having the game travel to the server.
Oh that sounds fun. I'll take a look into it, thanks
Any idea why i get this 1gb file in my build ? it has the same name as the project It's the first it happened to me
which part is 1GB
sorry the "SteamINT55"
that's a folder
1GB in context of UE development is nothing 
true 🙂 but it's the first time i'm getting this with a packaged build
anyway every technology should have some documentation, which may (or may not) explain it's "project/directory structure" as well as what files it provides/generates. So I guess you need to check what steam docs says about it
true thanks i'll check that 🙂
i mean i named the project this way
but yeah it's weird
btw steam is just a name of your project or it really has steam stuff?
both ahha
i followed a tutorial to add steam integration
and unreal packages all content by default unless you configure it
ah maybe that's why
that's literally your project files
but it'll be extremely difficult to maintain a package size below 1GB once you add stuff
sure taht's ok but now the proj is practic empty
yes but there's plugin and engine content
and having plugins enabled does increase the executable size
ah yeah maybe that"s why
true it's just i need to use source control
I generally wouldn't put a platform name in a project name, just as a general observation
true 🙂 it was just a test because i was testing with so many projects
yeah consider NotSteamINT55 
I'm using Advanced Sessions to get the data for JoinSession. I've used Advanced Sessions in the past and I haven't had any issues with it before trying to use it in UE5.5. I don't believe my issue is with the connection string (though I guess it could be, I don't really know at the end of the day), but rather the built in JoinSession function.
As far as I can tell, the URL looks accurate, and even gets a pass from JoinSession. That's where the problem starts, though. After the JoinSession kicks off, the client eventually times out and returns to the main menu. Form the logs I can tell that the map travel started, but then it starts timing out for some unexplained reason.
[2024.12.03-22.58.58:281][299]LogNetVersion: Project 1.0.0.0, NetCL: 37670630, EngineNetworkVersion: 36, GameNetworkVersion: 0 (Checksum: 1211119396)
[2024.12.03-22.59.08:280][227]LogNet: Initial Connect Diagnostics: Sent '10' packets in last '10.000923' seconds, no packets received yet.
[2024.12.03-22.59.58:286][731]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 60.01, Real: 60.00, Good: 60.00, DriverTime: 60.01, Threshold: 60.00, [UNetConnection] RemoteAddr: xxxxxxxxxxxxxxxxx:7777, Name: SteamNetConnection_0, Driver: Name:PendingNetDriver Def:GameNetDriver SteamNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[2024.12.03-22.59.58:286][731]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection..
I replaced the connection string incase it carries some id information I'm not aware of.
So far I've tried:
- Opening ports on the server and client machines and routers(7777, 17777, 27015-27050, etc)
- I am using two different steam accounts
- I am using my own steam app ID
- It also fails with the default 480 ID
- I have used the default driver configuration from Epic in my DefaultEngine.ini, as well as a bunch of optional settings I've found through various posts online
- Ensured the client and server on using the same version
- Have the proper plugins enabled as far as I can tell
- Added the plugins to my build.cs file (I've tried it with and without, does not seem to matter)
- The map exists in a custom plugin, I made sure that that plugin also has the modules listed as public dependencies
- Ensured the OpenLevel (reference) function adds the listen option
- Tested it as LAN-only, where everything seems to work fine
- Turned off Firewall on both Client and Server
- Ensured that CreateSession, FindSession, and JoinSession all succeed
I'm at the point where I need more log data to figure out what on earth is actually happening, and I don't know how to get that data. I'm pretty much down to some man-in-the-middle issue or an engine bug? I'm currently installing 5.4.4 on both machines to see if it works on another version of Unreal.
@sinful tree hi man, i did a system as u suggested real simple but im having a brainfart or something cus i cant end the turns on client side https://blueprintue.com/blueprint/8548_bg1/
They are endind the turn via a widget that uses a function from the owners player controller > calls event from playeer gamestate > gamestate
have you enabled EOS logs? i.e. verbosity. Are there smth suspicious?
Does default open ip:port works for LAN client/server? (without EOS)
Maybe you need setup port forwarding on router
Create an array of PlayerStates on the GameState. Who's turn it is, is the playerstate at index 0. You do not need to keep track of who's turn it is on the playerstate itself.
Only the server should be manipulating that array. You can replicate it out to the clients if you want them to know who's turn it is or the order of turns.
yeah all that is working
its just when a client tries to end turn it dosent work, only for the server
or oh
the Turn system should not be run on server ?
You can only call Run On Server events from clients if they own the actor. Clients would not own the gamestate.
ahh
thats why
but then how do i make a client end turn' since the end turn event is inside the game state ?
Ports to the server are open on the machine and the router. I've confirmed with 3rd party tools externally that the host machine has an open port, but I did not do the same for the Client.
I am unfamiliar with EOS logs, how do I enable them with verbose settings in Unreal? I can give that a go and see what the output is
Depending on the type of game, you'd probably have the server determine that the player's turn is over after they executed what it is they wanted.... But if you want a client to be able to tell the server it's turn is over, then you have to RPC on a client owned actor first.
That also means you'd probably want to make sure it's that player's turn before actually attempting to end the turn.
to enable logs use .ini config or console commands (google it)
exactly
ok so i need to rpc then
and you have to find corresponding log categories used in specific system (EOS), IDE search tools can help with that
hello
I'm encountering an issue with my multiplayer game setup in Unreal Engine. Specifically, I'm having trouble using GetPlayerController(1) to access the second player controller. The function GetPlayerController(0) works perfectly for the first player, but when I try to use GetPlayerController(1), it returns None, causing a runtime error.
Error Message:
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerController_ReturnValue_1". Node: Set View Target with Blend Graph: EventGraph Function: Execute Ubergraph BP Third Person Game Mode Blueprint: BP_ThirdPersonGameMode
Steps Taken:
- Used
Create Local Playernode to add a second player. - Attempted to use
GetPlayerController(1)to access the second player controller. - Tried using C++ for the game mode, but the same issue persists.
- Ran the game as a listen server, but player 2 is still missing.
Despite these steps, the second player controller is not being recognized. This issue is affecting my entire multiplayer code, as many functions rely on accessing the second player controller.
Any insights or solutions to resolve this issue would be greatly appreciated!
@sinful tree ok but
this is how you mean i would check if its the currents players turn ?
Something like this, yes, but you probably want this to be a bit more reusable by making it a pure function call in the GameState that can take a PlayerState as input and return the comparison of Index 0 to the fed in PlayerState.
i can just make it to a function really but yeah thats fine but im still not sure how i can make the clients end the turn
this is whats in game state now
RPC on some Player owned actor.
That RPC then calls the end turn function on the GameState.
There's no point in having Run On Server events on GameState.
The GameState is always owned by the server, so only the server could ever call to them.
Why are you Multicasting?
u said i need to RPC :/ ?
oh right sry im dumb
i know that im just slow today
but then nothings happening on the client side
Okay perfect I can comb through and give these a shot. Right now I'm trying to downgrade to 5.4.4 just to test but it turns out downgrading breaks a whole host of things. I just upgraded to 5.5 three days ago and it looks like you can't just go backwards
You now have a means of tracking who's turn it is..... What you want to happen when the turn changes is up to you.... Like... You could make that array an OnRep and have it signal an event dispatcher to do things, or whatever you like.
yeah thats fine but it still not working for clients
What is not working for clients?
im getting cast fail on playerState for clients
the object is wrong i assume :/ ?
I'm not sure why that cast has anything to do with this.
thats the reff im using when im ending the turn
Why do you have to cast it?
Except if you're doing that on say.... Begin Play of a character, the playerstate may not be valid at that time.
Actually you can call ps from pawn. Every pawn has ps
If this is in the Character... The "Get Player State" you're doing is fine.
Same with the controller.
The problem is when
And you don't need to set a ref on begin play.
aye well the delay fixed it
That's not a "fix".
so it dident have a valid re
It's a misunderstanding of what you're doing.
yeah i get what your saying but i just like haveing it as a ref
Isn't there some type of async load on game start?
but this was the problem all along so 🙂 thanks anyway
It's going to break...
wdym ? why
Because you're calling this on Begin Play.
Begin play fires on the server and all clients.
Get Player State 0 == gets the first available PlayerState, not the one belonging to this Character. Therefore, it'll end up being a different ref on all computers.
even if i do "player state" obj reff ?
Hey @queen escarp you can know more on networking in UE here https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
yeah thanks ive acctualy read those some time ago i just struggle with parts of mp
That's fine, but still not great.
I'd recommend either:
A: Override the OnRep of the PlayerState in the PlayerController to know when your PlayerState is valid (requires some C++ work)
or
B: Create your own pure getter function for the PlayerState in your PlayerController that casts it to your custom class.
There is no need to store it as a separate ref and could actually cause problems down the line if you do as it's now another variable you need to maintain yourself.
If you always use the PlayerState ref the controller has and get it and cast when necessary, then you shouldn't run into problems unless you have the wrong playerstate selected in your world settings.
What on earth... So with your help I was able to verbose the LogOnline log and it looks like my server is listening on random ports in the 53000-55000 range???
These are from three different attempts:
LogOnline: Verbose: STEAM: -- IPAddress: 192.168.1.110:53883
LogOnline: Verbose: STEAM: -- IPAddress: 192.168.1.110:54456
LogOnline: Verbose: STEAM: -- IPAddress: 192.168.1.110:53927
I have no idea where this port range is coming from, I've never seen this range mentioned
have no experience in steam EOS to help here 
I believe it's configurable for steam to use certain range
Either way, thank you for showing me how to get this data, at least I have something tangible now. I can at least do something with this info lol
this might be a dumb question but how do I get the Networking insights tab open in unreal insights? I follow the documentation and used the console command etc, i jsut dont see the tabs it is talking about.
I guess you have to setup networking stuff to be captured
and then it auto opens? I ran this console command before and during trace -trace=net -NetTrace=<VERBOSITY> [-tracehost=localhost]
Thank you!!
for some reason I enabled the channel but still cant open the window
its grayed out
try launch insights browser manually
thats what I did..
Am I able to do this for a build/packaged development game?
or is this only something unreal insights does with the editor
Is networking insights a seperate plugin from unreal insights?
Hm, might be a different module, but it's part of Unreal Insights
Do what? You can use Unreal Insights on pcakaged builds. Maybe not Shipping.
Its very strange to me that it is greyed out. I should be able to just paste
-trace=net -NetTrace=<VERBOSITY> [-tracehost=localhost] ```
this in the console no?
maybe it wants these flags from the very start (launch args)
This is incorrect... You are supposed to replace verbosity with a number
Try 3

Hello, is there any fast way to make a player be irrelevant for some actor?
I have a CCTV camera in my game players can predictively rotate. To replicate its rotation, I send an unreliable server RPC with the new yaw, and set it server-side. Then, it's replicated to everyone else because my static mesh that I'm rotating is replicated. However, due to that, the SM rotation overrides whatever I have locally on the cameraman. The camera knows the cameraman, and I use that in the IsNetRelevantFor, however, it's taking effect only after 1-4 seconds after I set it. I knew that the net relevancy is checked every .5 seconds or so, but I'm getting a very different number
1-4 seconds could be though. .5 is just the randomized varity .
What's the best way to see a client's network stats (latency to server, packet loss etc) in a UE multiplayer session, assuming you've packaged the game using the Development configuration? Is there a console command that will give me exactly what I'm looking for?
Is there a listen-server version of this that might tell me what the connection to all of the clients is looking like?
I googled a little bit and couldn't find anything obvious.
Hello, how could I ignore pawn movement corrections to spread to attached physics constraint? Corrections are causing jitters to constrained components
fwiw this won't show packet compression from oodle etc
so you might find real life results are better if using those
I believe
Issue with GetPlayerController(1) in Multiplayer Setup
Description:
I'm encountering an issue with my multiplayer game setup in Unreal Engine. Specifically, I'm having trouble using GetPlayerController(1) to access the second player controller. The function GetPlayerController(0) works perfectly for the first player, but when I try to use GetPlayerController(1), it returns None, causing a runtime error.
Error Message:
PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerController_ReturnValue_1". Node: Set View Target with Blend Graph: EventGraph Function: Execute Ubergraph BP Third Person Game Mode Blueprint: BP_ThirdPersonGameMode
Steps Taken:
Used Create Local Player node to add a second player.
Attempted to use GetPlayerController(1) to access the second player controller.
Tried using C++ for the game mode, but the same issue persists.
Ran the game as a listen server, but player 2 is still missing.
Despite these steps, the second player controller is not being recognized. This issue is affecting my entire multiplayer code, as many functions rely on accessing the second player controller.
Any insights or solutions to resolve this issue would be greatly appreciated!
Is this a local couch coop game? You state you used CreateLocalPlayer but also ListenServer. Not sure what your setup is.
Keep in mind that clients only gave access to their own PlayerController.
The error seems to be from the GameMode, which should have access to all PlayerControllers, but you also gotta make sure you wait for everyone to connect. If you do this on BeginPlay then the Client probably just hasn't connected yet.
SetViewTarget is also a local thing iirc. Not sure this even replicates. Your best bet is to move this code somewhere else.
Its not a local coop game
I only tried using create local user if it will work
Its a multiplayer turn base game but I found out that the index1 player is never spawn or called that's why I want to use a simple camera to get it to work before I start adding the logic
Should I increase the delay at begin play to like 10 seconds ?
Hmmm
So were will I move the code to
And again the camera don't have to be replicated since players only need to see their camera
No, BeginPlay of the GameMode calls when the Server starts their game.
No delay will ever be correct. The other player can connect at any time.
Point is that you calling SetViewTarget on the Server won't change the ViewTarget for the Client
You can move the code to a custom function that you call when all players connected
E.g. if you always expect 2 players you can use PostLogin in the GameMode to count them and add them to an Array
PostLogin calls for every connecting player
Logout can be used to handle the opposite case
If you want to affect the local client's ViewTarget you might have to call a ClientRPC on the PlayerController and in there call SetViewTarget
okay since its a turn base game i bother not to create a characterBP
THE GAME PURPOSE)
each player will only interact with the holes
6 holes per character (and i have a tag in the instance of the holes to identify them on my level ) and when a player touches their hole the logic will handle their rest then the next player turns starts)
this is what am building but without getting both player i had to start with a simple camera
So, I can't really help much without spending a good chunk of time on this that I don't have right now (work and a release slotted for next week).
The main thing you need to learn at the moment is how to structure your multiplayer code for this. It's really really important that you get a firm grasp on when what functions call and when what actor is valid.
I know that's easier said than done, but it might help making a small test scene or project in which you just toy around a bit. Especially if you have access to c++, you should explore all the different GameMode events.
It's usually very helpful to utilize the existing functions UE allows you to override (for multiplayer a lot is hidden in C++) as that ensures you stay within the "flow" that UE expects and things will be valid.
An example of that being using PostLogin to react to a player connecting instead of BeginPlay.
For you specific issue I would look into using PostLogin, or even Login in C++ ( for an earlier point in the chain ) to clearly identify the player as player 1, 2, 3 etc. instead of using the GetPlayerController node.
In (Post)Login, which is in GameMode, so on the Server, you can easily react to a new player joining and start initializing them. Keep track of how many player are there. If you expect multiple players you can use a fixed sized array and insert them into the first empty spot. When they leave in Logout you can remove them from the array without resizing the array (in BPs you could find the index the PlayerController occupies in the array and simply call SetArrayElement on the array to set it to null). You can additionally create a replicated array of PlayerStates in the GameState (which is available to everyone unlike the GameMode) and also manage that array the same way so everyone sees the same player order. PlayerStates instead of PlayerControllers for that second array so everyone can see the values as PlayerStates replicate.
Note: There is already a PlayerArray on the GameState containing PlayerStates, but that is filled by everyone locally and while that looks like it is replicated it is only passively kept in sync with the order not being guaranteed to be the same across players. So a custom second array for that is fine and logical for your game.
If you sort them properly into your array you can use the index of that array everywhere to identify the player. I wouldn't put the index itself on the PlayerState or PlayerController as it can be found by asking the array (which is cheap enough with just a handful of entries anyway).
You can then add some helper functions to your GameMode and GameState to get a player by index from the array as well as get the index based on a passed in PlayerController or PlayerState. PlayerController creates the PlayerState iirc so they should be valid at the same time on the Server. At least in most cases.
You can use different methods to then set the ViewTarget correctly. I would keep the ViewTarget on something that resembles a Pawn or Character tbh, even if that's invisible in your current iteration. If you want players to look through different cameras it's probably easier to use the PlayerCameraManager which you can create a child of and assign in the defaults of your PlayerController. There you can override the function the determines where the player view is located. If you keep the ViewTarget on the Pawn or Controller, you can easily cast the ViewTarget in that function, grab the PlayerState and ask the GameState for the index of the player via previously mentioned utility functions.
Then you can grab the camera that matches.
Here you can also manage the case where the player doesn't know yet what number he has due to replication and maybe let them use a default camera that shows an overview.
The more you use UEs existing systems and get used to what is there, the easier your life will be.
Sorry to butt in, do you predict your hit react montages? Especially if they have root motion.
All good, I'm done writing my book.
Just wondering if I'm gonna expect a lot of de sync or a lot of snappy effect
Also I kinda play my hit react as a gas ability but it's done by the server since the code lives in post damage calculate. Meaning no prediction, but I guess everyone predict their hit react? So maybe I should look to implement this else where?
I don't know how others do that, but I once worked on a MOBA where we wanted a given RootMotion to feel smooth. The problem is that one of the two players has to suffer here.
If you execute the RootMotion on the Server, it will be a bit smoother for the player who applied the hit but it will cause a correction on the player that receives the hit.
If you execute the RootMotion on the Client that receives the hit, it will be a lot smoother for that player, but the player that applied the hit will have a larger delay.
Given that the information about the hit will arrive at the player who received the hit at roughly the same time as the call to execute the RootMotion, it does line up quite well.
The problem with multiplayer movement is that the client that predicts movement almost always also wants to continue doing so and any interruption to that feels shit.
A lot of game devs seem to not care and simply apply the RootMotion on the Server, causing a correction on the Client and just living with it, because good bandwidth and ping conditions, together with the correction usually being smoothed if not too big, handle this.
We went the other way and accepted the larger delay for the applying player. With GAS this was relatively simple. If you set the GameplayAbility to be locally predicted and the Server activates it, it will automatically tell the Client to activate it first and the Client will then naturally tell the Server to activate it, so somewhat of a fake prediction.
The delay is usually:
Scenario where it's not predicted
- Client 1 attacks Client 2
- Action is send to the Server ->
Client1(RTT) / 2- Server attacks Client 2 and applies RootMotion
- RootMotion replicates tp Client 2 ->
Client2(RTT) / 2->Correction->Total for Client2: Client1(RTT) + Client2(RTT), but Client2 already only sees the information of the hit with that delay. - RootMotion replicates to Client 1 ->
Client1(RTT) / 2->Total for Client1: Full Client1(RTT)
- RootMotion replicates tp Client 2 ->
- Server attacks Client 2 and applies RootMotion
- Action is send to the Server ->
Scenario where it's predicted
- Client 1 attacks Client 2
- Action is send to the Server ->
Client1(RTT) / 2
- Action is send to the Server ->
- Server attacks Client 2
- Server tells Client 2 to activate the RootMotion GA ->
Client2(RTT) / 2 - GA activates on Client 2 predictively ->
No Correction due to prediction->Total for Client2: Client1(RTT) + Client2(RTT), again- Client 2 tells Server to activate GA ->
Client2(RTT) / 2 - Server activates RootMotion GA
- RootMotion replicates to Client 1 ->
Client1(RTT) / 2->Total for Client1: Full Client1(RTT) + Full Client2(RTT)
- RootMotion replicates to Client 1 ->
- Client 2 tells Server to activate GA ->
- Server tells Client 2 to activate the RootMotion GA ->
That should show that you basically trade the correction on Client 2 with an additional Full RTT for Client 2, in terms of time, for Client 1.
@dark parcel ^
Omg, thank you for the comprehensive answer. I will be sure to read it dozens of times.
There is a world for a Scenario where the Client 1, the player that applied the hit, also predicts the RootMotion, but I don't think that's a thing with the CMC, cause a SimulatedProxy can't do anything on the CMC despite look at it moving via replicated and smoothed data.
And that could of course be a false-positive. Games like Dead by Daylight do this for hits and other interactions, and it often leads to nasty corrections.
E.g. if a player jumps through a window to escape from the chasing killer, the killer of course sees a ghost and old transform from milliseconds ago.
If they attack the player they can do 3 things: 1. Miss the hit 2. hit them 3. Pull them out of the window directly on their shoulder.
You'll often encounter scenarios where the killer will see 2., but nothing about the health of the player changes, because the prediction was wrong.
Or they start the "pull/grab" animation but instantly get corrected out of it again because the Server said that the player was too far through the window.
It's your task to decide who should see the least amount of "wrong" prediction and how to hide all of this if possible.
It's the nasty side of multiplayer game dev that a lot of beginners aren't even aware of. The whole replication and session stuff is really the shittiest and simplest part of all of this.
It's gonna take a while to process the wisdom shared but I get the big picture.
We once had an ability where one player could grab another, and we ultimately dropped it cause it was way too much work to get that to feel really responsive on both sides without causing desyncs and softlocks.
For context, I am just doing PVE, gonna see what's my best option based on what you said when it comes to who should suffer
Yeah the MOBA being competitive PvP is of course the master class.
Aww that's what my fear is. I originally wanted a hook ability where a player can hook a.i to their position
That's fine, that's just a RootMotionSource in theory.
The grabbing one was actually grabbing and keeping them attached and walking around to then throw them
Well said I have to go back to the drawing board
Thanks a lot
Hey all. Having a weird issue. I have my netmode set to listen server with 2 players and New Editor Window (PIE) but the client and server are in their own instances, not connected to the same map when I play. I've been using these settings consistentely during the project and haven't changed them but it's suddenly behaving this way. Any ideas?
did you change netdriver? like enabling steam sockets or something? that will make it not work in PIE
I haven't made any net related changes either in engine or in the .ini file since I set it all up initially. I've just been working on game mechanics
[Core.Log]
LogOnline=verbose
LogOnlineGame=verbose
LogNet=verbose```
throw that in your DefaultEngine.ini and see what kind of messages you get
youll probably have to restart editor tho
Will do. I'm not at home but I'll give this a shot when I am.
when i call SetMontageTypeToPlay why is montage only plays on server?
UFUNCTION(Server, Reliable) void ServerSetMontageTypeToPlay(EMontageType MontageType);
void ServerSetMontageTypeToPlay_Implementation(EMontageType MontageType);
UPROPERTY(BlueprintReadOnly, Replicated) EMontageType MontageTypeToPlay;
UPROPERTY(ReplicatedUsing = OnRep_bWantToPlayMontage) bool bWantToPlayMontage = 0;
UFUNCTION() void OnRep_bWantToPlayMontage();
void UUseableItem::Use(AMyCharacter* Character){
if(!Character) return;
Character->SetMontageTypeToPlay(EMontageType::E_Eat);
}
DOREPLIFETIME_CONDITION_NOTIFY(AMyCharacter, bWantToPlayMontage, COND_None, REPNOTIFY_Always);
DOREPLIFETIME(AMyCharacter, MontageTypeToPlay);
void AMyCharacter::SetMontageTypeToPlay(EMontageType MontageType){
if (HasAuthority()){
MontageTypeToPlay = MontageType;
bWantToPlayMontage = !bWantToPlayMontage;
OnRep_bWantToPlayMontage();
}
else{
ServerSetMontageTypeToPlay(MontageType);
}
}
void AMyCharacter::SetMontageTypeToPlay(EMontageType MontageType){
SetMontageTypeToPlay(MontageType);
}
void AMyCharacter::OnRep_bWantToPlayMontage()
{
switch(MontageTypeToPlay){
case E_Eat:{
PlayAnimMontage(EatMontage);
}
}
}
i call SetMontageTypeToPlay from a widget blueprint by double clicking on the item and giving it the character casted from getcharacter(0)
Probably cause you can't guarantee that both values replicate in order?
I would wrap that into a Struct.
will try it now thanks so much for the perfect idea
hey, I'm trying to solve a weird issue caused by a custom replication graph. In client POV, host's player character is rubberbanding like crazy when they move around. We use client-authoritative movement, with both bIgnoreClientMovementErrorChecksAndCorrection and bServerAcceptClientAuthoritativePosition set to true.
Player Characters are always relevant (legacy architecture constraints).
Any idea what might be causing replicated movement to become rubber bandy in client POV?
Host character is also invisible to client until host moves a lot
{
if (!HasAuthority())
{
Server_SpawnModules();
return;
}
for (UBuildingDataAsset* Building : General->AvailableBuildings)
{
BuildingModules.AddUnique(Building);
{
UBuildingsModuleComponent* BuildingComp = NewObject<UBuildingsModuleComponent>(this, *Building->BuildingName.ToString());
if (BuildingComp)
{
BuildingComp->SetIsReplicated(true);
BuildingComp->SetupAttachment(Modules);
BuildingComp->BuildingDataAsset = Building;
BuildingComp->RegisterComponent();
UStaticMeshComponent* ModuleMesh = NewObject<UStaticMeshComponent>(this, *Building->SM_Building->GetName());
if (ModuleMesh)
{
ModuleMesh->SetIsReplicated(true);
ModuleMesh->SetupAttachment(BuildingComp);
ModuleMesh->SetStaticMesh(Building->SM_Building);
ModuleMesh->SetMaterial(0, General->PlayerDefaultColor);
BuildingComp->ModuleMeshInstance = ModuleMesh;
ModuleMesh->RegisterComponent();
}
ReplicatedBuildingComponents.AddUnique(BuildingComp);
BuildingComponentsMap.Add(Building->BuildingName, BuildingComp);
}
}
}
}
void AMilitaryBase::Server_SpawnModules_Implementation()
{
SpawnModules();
} ```
Hello everyone! Can someone help me to understand this issue? I'm trying to dynamically create UScenecomponents and attach to UStaticMesh components based on DataAsset. When I test this in Standalone it works. Names of NewObjects are right, attachment is right, Material is Right. Module MeshInstance* is filled. But in Multiplayer none of this works. Why?
So I'm not seeing anything out of the ordinary. It works as intended if I switch the play mode to standalone instead of PIE
Is there benefir of using ReplicateUsing instead of Replicated for UPROPERTY ?
i know that, then I gues i have to read what that GAS macro does for replication
/**
* This is a helper macro that can be used in RepNotify functions to handle attributes that will be predictively modified by clients.
*
* void UMyHealthSet::OnRep_Health(const FGameplayAttributeData& OldValue)
* {
* GAMEPLAYATTRIBUTE_REPNOTIFY(UMyHealthSet, Health, OldValue);
* }
*/
#define GAMEPLAYATTRIBUTE_REPNOTIFY(ClassName, PropertyName, OldValue) \
{ \
static FProperty* ThisProperty = FindFieldChecked<FProperty>(ClassName::StaticClass(), GET_MEMBER_NAME_CHECKED(ClassName, PropertyName)); \
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(FGameplayAttribute(ThisProperty), PropertyName, OldValue); \
}
does not explain too much
not a whole lot to look at
Just because you mark a component as replicated doesn't mean all of its properties automatically replicate out.
A mesh component for example... It won't automatically replicate what mesh its supposed to have or any material changes.
and you can likely just see what SetBaseAttributeValueFromReplication does
Hello,
Is there something special to setup for arrays of structs to replicate? I can't use FastArray because I need order integrity
I am currently editing struct values inside of the array (int value for ex) and it doesn't seem to trigger the Onrep
It only does it once
Actually, my bad, I'm on the server and in c++ On rep functions don't get called automatically?
if for example I have a function that loops over the array modifying a few values inside, do I just call the Onrep at the end of the function?
OnRep functions do not get automatically called from the server, no
In this example, let's say I modified 3 values in the loop, does the Client receive 3 Onreps? or is it based on the replication intervals and settings?
Clients would normally only receive a single OnRep as the loop would finish within the same frame before the server would then consider the property for replication.
i just remembered something, can you tell UE to not try to rep yet edited properties without a runtime condition ?
imagine if you want to edit stuff on server on multiple frames and only make it consider clients at the end ?
Hey my dudes. So I'm working on my security camera terminal which just has some simple functionality. It has a plane static mesh for the "screen" which has a material that uses a Texture Render Target. The material is using the render target which the cameras are using in their Scen Capture Components. I want to allow the player to switch between views in the level. I'm doing this by getting all the camera actors in the world and storing it to an array, then when the player presses a button in their camera terminal widget, it changes an integer which has an OnRepNotify. That's where I set the visibility of the SceneCaptureComponents for the available cameras. It works fine for the server player but not for clients. I'm wondering if I have to route the functions through the player character.
Terminal Construction Script:
Cycle Camera Forward Function:
Current Camera Index OnRepNotify Function:
Screen Material:
Widgets don't replicate. You also can't set replicated variables on clients and expect it to replicate to everyone else - you need to have the server set replicated variables in a replicated actor in order for that property to then replicate to others.
This also means that you do need to route an RPC through a player owned actor in order for a client to tell the server that they're requesting a change to the camera being viewed.
Ok cool. That's what I meant by wondering if I had to route this through the PlayerCharacter. Now, follow-on question: can I set ownership of this terminal to my player when they interact with it and then set replicated variables/server RPCs from that actor?
You can set the ownership but I wouldn't recommend it, and that would allow you to send RPCs directly on that actor. If you want a property to replicate out to client, then it must be set on the server to do so.
Interactions are usually something that needs to be generic, because you may want to interact with not only this screen, but also other objects in your game world, like light switches, or drawers, or elevator buttons, and how are you going to have the server set the ownership of these actor first before you communicate to the server that you want to interact with them? That means you will likely want a means of RPCing on the character or controller and pass along a reference to the actor you want to interact with, and then have the server complete whatever is required by that interaction instead of setting the owner. You can use either:
- An interface that you'd then need to implement in every actor that you want to respond to such interaction events and you can call this interface with reference to that actor when running on the server.
- A component that you attach to the actor which you can then retrieve from any actor reference and then implement some kind of dispatcher in your actor that you call when the player interacts with it - again, easily makes a retrievable reference to the component so you can call such a function on it.
- Class hierarchy (I wouldn't recommend this) so that you can then cast your actor reference and then call whatever function you want on that actor.
I currently have an "Interaction Dispatcher" interface that lives on the player character so that I can call events there so I'll just utilize that. I wasn't sure if I would need it for this use case or not
And I'll work on routing the button input from the widgets through the character as well
So, if the "screen" mesh has the material with the render target in it, shouldn't the screen look the same to all players before the terminal is interacted with?
Cause this is what is currently going on:
Anyone here able to help with this replication graph issue?
How much of Project Titans movement stuff would be applicable to a multiplayer game? Given them using Mover I’m pretty interested in it. Cool stuff going on but yea not sure if it would help w my movement related desires. I’ve heard mixed thoughts on mover thus far so maybe this project has something in it that could push mover to a more comfortable position to be used
push model property replication might be what you're looking for
basically manually tell engine when to replicate a property
unsure if it's possible to use push model along with normal replication or if everything has to be one or the other
not entirely sure why you would want to defer replication, though
seems like a premature optimization
just wondered
This is mind boggling lol. I don't understand why this actor has a broken material on my clients than on my server player.
RenderTarget and Materials aren't replicated. So long as you're sure you're using the correct scene capture component on both ends, and it's writing to the local render target, and the screen mesh has the material with that render target, then it should look the same.
Well, I don't see why it wouldn't be using the correct scene capture component. It's not dynamically assigning anything. The capture component belongs to cameras in the scene and the terminal actor has its screen material hard-set. That's why its confusing.
I'd probably replicate a reference to the camera that you want to be used rather than replicating the index of the array. There's no guarantee what order the cameras would be entered into the array so that could be part of the discrepancy. The other trouble I see is that you're just hiding the scene capture components, but you probably want to deactivate/activate the components.
Ok. Thanks. I'll give this a whirl
fixed!
I feel its good to break ties with bad practices... I've seen flushing, marking dirty, and force net update being used before and after updating properties (even from Epic's side). And i think for the general case its not an issue until it is... so fixing this bit of info is really importat, even if the article is only about Dorm_Initial
A little side note -- StaticMeshComponent will replicate the mesh, but not the SkeletalMeshComponent
Any help would be appreciated: #ue5-general message
You are supposed to extend the Character Movement Component for this.
Coding the replication into the character like you did will cause corrections
What was the var I could add to watch to tell if it's server or client when debugging in vs?
{,,UnrealEditor-Engine.dll}GPlayInEditorContextString
Does anyone have any resources for multiplayer testing in editor and otherwise? I launch standalone with a separate server process, as I understand they still both use the editor build (I use from source 5.4.4). I am getting very inconsistent results vs. running in editor.
Due to my terminal ballistics server only setup I need separate processes but I feel like I can't get the setup working optimally to actually test more predictably
Hello I want to ask for something, I'm working in a an spectator camera in a first person multiplayer game. I'm using the Set Target With Blend method to get the camera view of the other player. When I simulate in a listen server, this works properly. But when I simulate in a dedicated server, only the location of the player being viewed is correct. The camera rotation doesn't move nor the first person mesh. Then after searching, I could fix the camera rotation overriding the CalcCamera method in the player character. But the 1P mesh stays static.
Has someone know why this happens? or a way to fix it?
Just to let you know -- there's APlayerController::ViewAPlayer() that does what you want out of the box
but isn't that function the same? I mean that and ViewTargetWithBlend, both call the SetViewTarget method inside of them. So I think the result would be same no?
True, but it should be reading the target location and rotation. If it's not changing the rotation, are you sure that the actor that you're trying to spectate is changing the rotation client-side?
after debuging, I saw that the capsule component of the actor is rotating properly. And the third person mesh that we use for the character (his shadow), replicates properly too. It's only the first person mesh that doesn't move at all. As we are using the same view as the player, we can see it, but it doesn't move. I'm trying to make it rotate forcibly but I don't think that's a correct aproach
What is the FP mesh attached to?
it's attached to a spring arm, which is attached to the capsule component, and checking those values in the viewing client, the rotation is correct
Why is that? Why don't you attach the FP mesh directly to the capsule?
that is indeed a very good question. Unfortunately I wasn't in charge of setting that up, But it could be a good experiment to see what will happen if I do that 🤔. Also, even tho the world rotation of that spring arm is replicated properly, the Target Rotation remains at zero
and following this setting in the spring arm, Probably that's the reason it remains static
im a bit stuck for hours now
one client is replicatingfine, the other client isnt
for now i just got them to change color when an event is called
i was told to do it this way where GameMode >> Player State >> Player Character
you are still using multicast 😔
yes? to update visuals for every client and server
you don't use it on stateful behavior
thought the purpose is to update the server and client
how do i call this onrep? when i do it sometimes gives me an error
do i call the variable directly and set it?
Multicast is NOT the way to do this. It's not guaranteed to be called, it will be dropped on actors outside relevancy, and it will not run on players that have yet to join the world.
Only server should change role
ohh right
Unreal uses server to client model. Server hold the true value, client can listen for changes.
the thing im confused by most is how to relay this information
so server (the host) set the role, the value will be replicated to clients
client can then execute codes based on the incoming value
i am setting stuff in gamemode cuz its server relevent then sending the info to a player state, through rep notif and then casting tot he player?
OnRep is called when the value of a variable is updated
even when the client calls it without a replicated event?
you can create a delegate inside OnRep, and any objects that need to listen to the change can subscribe to the delegate.
call what?
It will just fire the function whenever the variable is updated. In C++ it will fire on client only in blueprint, OnRep will fire on both server and client.
but the point here is
Server Set the variable, it will then try to replicate the data to the client
client will receive and change the variable eventually (when a client receive it, OnRep will fire)
correct?
that's better
it really depend on the context though. Server RPC basically the only way for client to tell server to do something.
You probably don't want to give that much autonomy to the client, they can just cheat and say, Hey I am this Role
making a role system, murder sheriff and innocent, just setting peoples role from there, thats why im storing it in player state
but validating probably not something you should worry about for now
The better way here is probably to request server to change role
then server validate on it's end, if the client are permitted to change to the role he asked for
No worries but be aware of multicast X_X
i was told multicast is stuff like gun sounds, muzzle flash, particle etc etc
a lot of people fell into despair and cling into multicast again which is never a solution
yeah anything that is fire and forget
something that can be forgiven if dropped
But if you want something stateful (e.g. the color has to sync with everyone) then multicast is not the tool to use
Playing a particle effect? Sure multicast away
Not even multicast reliable?
who cares if somehow, I don't see the muzzle flash for once, that's okay
context needed, for changing material that needs to be in sync ofc it's not okay
Multicast just mean, Fire this function on every relevant players on their computer.
So some player havent even join the game yet, and the server fire multicast
The late joiners will see the material as default and unchanged
Yeah, makes sense for the obvious cases, onrep if a door is open or not, multicast for fx. But there are some cases where I think multicast, but when you don't know how the engine decides relevancy that is maybe not good for a shooter either.
tldr I think the rule is simple
if it's something stateful, don't use multicast
for fire and forget? if there's no other mean, then maybe multicast is the answer.
this probably going a bit too extreme, but I found this info from a video of a guy that explain unreal multiplayer and how he doesn't have a single multicast on his shipped game.
I think it's a complicated subject though. For multiplayer games there's a lot of talk of server tick etc. but it's pretty clear even for big games that added features make the servers worse. If you are doing everything "right" you will face limits. But what you say does make sense.
I still think nothing competes with Infinity Ward's network/animation code for WZ1 and 2. Silky smooth games with over 100+ ping and decent hitreg. Even a LAN setup in Unreal I struggle to get it smooth 😄 (but that's on me mostly)
yeah, too many info for my brain
I always feel like a newbie, no matter how long I work on something
okay, I managed to fix it. I tried I didn't attach it to the capsule component. But after debuging the flow a little bit. I found out that the spring arm component view target rotation was always zero. And that rotation for simulated proxies was defined by a variable in the local controller that wasn't being replicated properly. So I override the GetViewRotation method in the player character class and make sure that for simulated proxies it uses the controller rotation. And this fix it properly. Thanks for helping out 😄
Is there a way to prevent a actor from being replicated to a certain client i already have a way to figure out what client not to replicate to i could on begin play do those checks and if they fail destroy the actor but isnt there a more efficient place to do this (am spawning on server with bReplicates = true;) btw
override IsNetRelevantFor maybe?
going with this for now on begin play
if (bNoSpawnOnOwningClient && GetInstigator() && GetInstigator()->IsLocallyControlled())
{
Destroy();
}```
If in actor is spawned on runtime, it will be destroyed when it's irrelevant
Likewise, it'll be created when it becomes relevant
i know that my thing its i do not want this actor to be spawned on a certain client regardless of relevancy
Why don't you make it irrelevant when you don't want to spawn it...?
If it's irrelevant to a player before the actor is even spawned client-side, it won't spawn until it becomes relevant
Hello, I'd love assistance to find the solution of how to make the Beacons persist and not disconnect from the server on Seamless Travel
Beacons (actors) are destroyed upon any travelling. When you do seamless travel, it makes copies actors you marked as seamless travel actors, and copies data you want. There should be no way to do that
replicated Line trace issue :
basically , when i trigger line trace from server everything works fine , but when i try on client , it is accurate , but it is off direction from server side , which means i need to look even lower to hopefully hit a button , as you can see in the image the line traces from client as seen from server side its slightly raised
why don't you just do the trace locally
instead of "Hey server, do a trace for me"
send
"Hey server, I want to interact with this thing"
well , this set up is used to interact with an elevator , when buttons are being interacted with by players , they can all see whats happening , not just locally
thats fine
you tell the server that you just clicked a button and the server can multicast an OnInteract to make it push in and make the sound
Instead of:
Input -> RPC -> Trace -> do button stuff
you want it to be
Input -> Trace -> RPC -> do button stuff
later you can add validation so someone can't click a button from a mile away but start there
negative
tried several implementations and it didnt work
could be a misimplementation from my end , but thank you !
show what you got
one sec
potential bug after initial test , because it didnt show any result , but i tried again and it worked , god bless you mate < 3
hi, i need some help with a role generation, this is replicating correct but the way its sent out i think is causing issue. I think (??) its resolved to the way I send the roles out to the clients with player controllers, is this the correct way to do it
(its meant to be 1 sheriff 1 murder' and rest to be "innocents")
Why do you use a client RPC to tell what role the client is? Use OnRep variables to keep the state and notify about the changes.
Also doing that on PostLogin is not the best option considering that you might want to restart the game. It's better to give out all the roles once you know that you actually want to start the game. In GameMode you can override ReadyToStartMatch so that it returns false while you're waiting for people to become ready or simply join. After that you'll get OnSetMatchState with NewState equal to InProgress, which is a good point to assign roles to all non-spectator players
no
In plain English, how do the roles work?
Assuming there's 1 sheriff, 1 killer, and the rest innocent, then just assign it at match start
GameMode can support the concept of match state, there's an OnMatchStart in it, override that
shuffle a copy of the Player array (it's full of PlayerStates), choose the first to be Sheriff, 2nd to be killer, rest default to innocent. Put the role in the PlayerController if you want it to be private between the server and client and not sent to other clients, which I assume is the case
prob cuz im a noob
but i havent setup a proper lobby system, just making sure all the client connect and then start the game
It seems that I have been able to re-establish the connection by resetting the NetDriver 😀
Is it worth it to dive in the network prediction plugin?
Im working on a heavily predicted weapon plugin, and it is starting to feel like the best way to deal with that is to make my system tick with the cmc, which does not sound like a good idea tbh
Not like this 😭
Mind sharing your solution?
im trying to find the best way to do a replicated jumping sound, i have a walking and a jumping animation that loops, if i use a notify and the player falls from a high place then the jumping sound will loop, i could rpc the sound but that sounds like killing an ant with a shotgun, is there a better way?~~
Why do you need to replicate jumping sound?
its not that i dont, i just not grasping a better way
because my jumping animation loops
you don't normally want to replicate sound like that
well that's got nothing to do with networking or RPC
just think of a way to not loop the sound
where do you play the sound and in what asset? you are playing the sound in your falling animation?
i was
if you only want to play sound when the character first jump and when it landed, then play the anim notify in jump start anim and landed anim.
Replicating sound would be the worse way to go
the timing that it will come to other players will not be reliable
you should just play the sound when it should play
ye i know its not a good way thats why i am trying to figure out a better one lol
E.g when the feet land on a floor
maybe i could do it with a montage where i loop just the end of the animation and have the start be a one off thing
Why overcomplicate simple issue which has straight forward solution?
just play the sound when it's appropriate. E.g when you first jump, or when the feet land
its not straight forward, if it was straight forward i would have done it already
if i play when i first jump and i play it in the notify than its gonna loop
because i dont have multiple animations
it would be a simple solution to have another animation IF i had an animator or money to hire one lol
then i could make the anim BP have another step and have that sound play there
so is there a jumpin event in the cmc?
there should be, I know there is OnLanded event
well yes and im using the landed one
i just dont know of any jump one
and google didnt tell me anything
there is a jump but it is triggered from input so im not exactly sure if it will trigger on proxies
is your skeletal UE skeletal compatible?
i ahve some that are and some that arent
you can look for a free jump anim in mixamo
your game looks awesome by the way, did you do the art?
@limber gyro actually default tps already have jump animation
and jump loop
that's what Im using too
ye i know, i will check if the jump event is called on remote machines and if it isnt im gonna mess around with animations
nono, dont look for any jump event
why not? i already have it overriden
just use Unreal jump animation assets?
well how you gonna play the falling anim?
yes, but you will need the falling animation assets
i do have one yes
Well, how are they even gonna jump
they will try to go up on falling? that do be akward
project is opening, but i think i dont have a falling
its just jumping
and the animation works for both
o ye, this is my glorious setup
I dunnoe then, last ditch effort that I can sketch from my head is probably to just make your own Anim Notify that play sounds once which can get resetted when the character lands.
ye probably not the most elegant solution, im gonna check if the jump event triggers on other machines and if not i will come up with something
how do i increase bandwidth allocated to each client? the default is capping at 0.1mb/s and i'd like to be able to use 10-20x that
this is on a local server btw
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000
MaxInternetClientRate=1000000000
[/Script/Engine.GameNetworkManager]
TotalNetBandwidth=5000000000
MaxDynamicBandwidth=1000000000
MinDynamicBandwidth=500000000
i've increased the values in DefaultEngine.ini but it changed nothing
anyone have any workarounds or tricks on how to handle syncing movement and shooting in multiplayer?
this may help
https://vorixo.github.io/devtricks/simple-rewinding/
Hey, when i package the server in shipping mode i get the error 'Warning: Steam Dedicated Server API failed to initialize.' However it works without any issues when I package it in development mode. I've already tried the full rebuild option. What could be the problem?
Yes, it seems this is the key part, to reattach the net driver:
// If we still have a NetDriver and a BeaconConnection
if (NetDriver && BeaconConnection)
{
// Reattach NetDriver and Notify
NetDriver->SetWorld(GetWorld());
NetDriver->Notify = this;
// Set state back to Open or whatever it was before, NOT Pending
SetConnectionState(EBeaconConnectionState::Open);
UE_LOG(LogBeacon, Verbose, TEXT("RestoreConnectionAfterSeamlessTravel: Connection re-established without handshake."));
return true;
}```
so I tried it, when I seamless travel, although the client's beacon stays, it doesn't keep sending the packets to the server's beacon
after seamless traveling and calling a function with this, I've managed to get back the pinging to the server and not have it timeout me
i mean that set up worked xd
ok I have some weirdo shit happening in my movement code, I am still learning so pls do not attack me and explain me what could be wrong. I did the ladder climbing movement, it's packed into FMoveData, SavedMove etc. so I think it's networked properly - because when playing on client in high latency it's smooth. Now I want to make jumping off ladder - simple Launch or setting velocity to the player in the opposite direction of ladder normal. I can't do that in DoJump function because server is not executing the code. I checked why and my variable in condition check bIsLadderClimbing is ... false on the server? Don't get it why because when I check what's happening in for example TickComponent with GetNetRole() == NM_DedicatedServer it shows that variable is changing on the server without any problem, (on client-side too) but in DoJump function is false (on client side works). What could be wrong?
void UDXMovementComponent::SetLadder(UBoxComponent* NewLadder, FVector Normal)
{
if(NewLadder) // FIXME: We should not switch the movement mode here
{
LadderNormal = Normal;
CurrentLadder = NewLadder;
bIsLadderClimbing = true;
//SetMovementMode(MOVE_Custom);
//ChangeDXMovementMode(EDXMovementMode::DXMOVE_LADDER);
if (GetNetMode() == NM_DedicatedServer)
UE_LOG(LogTemp, Log, TEXT("SetLadder"));
}
else
{
CurrentLadder = nullptr;
LadderNormal = FVector::ZeroVector;
bIsLadderClimbing = false;
//SetMovementMode(MOVE_Falling);
//ChangeDXMovementMode(EDXMovementMode::DXMOVE_NONE);
}
}``` my variable is set via this function which is called from Character class OnBegin/EndOverlap. Checked and it is executing on the server-side too
variable is marked as replicated
well suggestions are welcome , and basically since it worked i didnt want to spam the channel and let space for someone else to ask for help , but yeah , if theres a better implementation then i wouldnt say no
my tip would be to avoid multicast for anything stateful
you should let server handle the interaction, clients just request for the interaction
If the server gives a green light, server will move the elevator, which have it's transform replicated to clients
your lift will cease to move on client with only that change
most likely
You will need to replicate the lift movement
i replicate the elevator movement in the elevator it self
and everything still works perfectly
i removed the multicast like u said
Ok I fixed this, I was sending unecessary data in SavedMove which was state if player is on ladder. If someone want to learn about custom movement networking: https://docs.google.com/document/d/1UO6Ww6Lfpti3YElVdo9uioTUtQJQ9CoSLvd9kF8hvJo/edit?tab=t.0 this is what dazzled me
Custom CMC Network Data Discord Permalink This document will cover how to use and send custom network data between the server and client through the Character Movement Component, beyond just custom flags. This could include sending additional compressed flags, additional input vectors, etc. No...
I use lots of GPU animations even for movement of units. Essentially im faking the movement of units sometimes to save performance.
Im half way through my game and though im not thinking about doing it multiplayer at the moment...i wonder how can this be compatible with multiplayer.
Because when you move a unit in the GPU, the unit is not really in the new location. The unit is in the old location still, but looks like its in the new location. You then update the unit location less, but the moving animation runs smoothly.
Can this work in multiplayer?
So if you were to move a cube forward in the GPU only... And then update its true location every 2 seconds.
Would this totally fail in multiplayer?
The more delay you introduce (eg 2 seconds) it will increase the lag for the other participants. Tho you are moving objects on the gpu but you can probably still replicate the actual intention of this movement at the very beginning, like for instance a direction vector or the pawn interactions itself, which can immediately notify the other participants (and perhaps the server) about the movement at the very moment it begins, therefore no extra lag will be introduced that way.
This obviously require that all other participants can replay this movement on their own (dedicated servers has no gpu access, so it must have a separate logic for emulating this movement behavior on its own)
🫡
thanks
i think i will leave the multiplayer for a 2nd title inspired on this one
Hello, hope all is well. I have a really noob question and hope this is the right place.
I’m a filmmaker looking to host a single level online for people to be able to access and explore as a proof-of-concept for the location of a indie film as a fundraising asset. Doesnt exactly have to be multiplayer for a couple people to access it at the same time or does it?
Can anyone share their thoughts on accessible possibilities for people who aren’t gamers to access that and the costs associated with hosting? I’ve already went down a google rabbit hole that is over my head. lol.
Feel free to DM me. Thanks!
I'm having trouble replicating a DataAsset variable in Unreal Engine. I have a UObject that's created in Blueprint and stored in the player's Player State. This UObject has a variable that holds a DataAsset.
On the server, I set the DataAsset variable immediately after creating the UObject. However, the client never seems to receive the updated value, even though the variable is marked as Replicated.
Here's the relevant code for my UObject:
UCLASS(Blueprintable)
class UObjectBeingCreated: public UObject
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, Replicated)
UInventoryItemDefinition* ItemDef;
};
Attached below is the Blueprint where I create the UObject and set the DataAsset.
I've tried marking the DataAsset variable itself as Replicated, but that didn't work. I suspect it might have something to do with DataAssets not being directly replicable, but I'm not sure how to work around that.
Any ideas on how to get this DataAsset replicated to the client? Should I instead be replicating the DataAssetPath and have the client load the DataAsset from the path with an ON_REP?
I have a custom event that is called from OnRep. It plays a replicated timeline that updates an actor location and it's dynamic material for opacity and emissive. The moving part of the actor words for the client, but they don't see the change in the dynamic material.
Are you sure that dynamic material instance exists on client?
Check your blueprint log when running the game
Make breakpoints
Check if it executes
in begin play of the actor, I create and set the dynamic material. That has always worked for me
Did you set up your UObject to be replicatable? They don't support replication on their own.
Duh... I forgot to add DOREPLIFETIME(ThisClass, ItemDef);. Thank you!
Here is a better screen shot of everything. I'm not sure why the client can't see the change in the dynamic material. I have a RepNotify that calls the event to Spawn an actor. In begin play of the acter I create and set the dynamic material. After the actor is spawned, I do a replicated timeline to set the world location and set the dynamic material parameters. For some reason, the client can't see the changes to the dynamic material.
74
The client can see the spawned actor. I'm calling the event from OnRep, so I figured that was all good. I suppose I'll try to spawn the actor inside the OnRep
Just tried it. No change. The client can still see the actor move around from the timeline, but can't see the change to the dynamic material
So no lininging up anything between server and clients at all? OnRep will fire on all clients, they each spawn the Spirit Orb actor, then have it move randomly on each client since they each call the random nodes seperately. I'm not sure how good it is to have a replicated timeline that is also called on each client separately. Then your delay is called individually as well.
Is there any logic inside the actor for setting the dynamic material?
Only on begin play, create material instance dynamic and set it to variable
So how would you recommend me to set it up? Should I not do it on repNotify?
I think it depends on what you're trying to do with your spirit orbs.... I made something similar using a niagara particle that uses a seed for its movement so it's all synchronized.
I'm just trying to get an orb to fade in and out as it moves from one point to another. Also it is only visible on scene capture
It also spawns within a box collision I place in each room
Something like this? This is a component I put on a "ghost" actor using a component. The top portion of that final image has some unnecessary code in the top sequence but eventually calls whether the niagara component is visible only to scene capture only. The niagara component itself just needs to have determinism set up then you can have whatever randomness done within the niagara component and it should be the same on all clients.
Interesting. I'm not too familiar with niagara. I'll have to look into it. So basically, you have a random integer for repnotify and then you spawn the particle. Seems easy enough. is it simple to contain the particle to a room so it doesn't randomly float out?
You can definitely constrain it within an area, so if you wanted to feed the particle in some bounds, if you set it up correctly it would stay within those bounds.
alright. thank you. I'll have to look up some tutorials for niagara and I'll give your method a shot
So I was testing it out and set it up somewhat similar to you, but the client doesn't see the particle. I set a single particle that doesn't move (for testing), and OnRep I spawn the particle. The host can see it but not the client
You sure whatever is handling this replication is set up to correctly replicate? (Actor & Component for example)
Has anyone here tried to implement input delay? Or I want to know how does CMC handle input delay. So you send the inputs to the server first and then play it locally, so you can reduce jittering to some extent?
CMC stores multiple frames of state (including inputs) and replays them as new information arrives from client or server. Responsive to client but might get a correction if server disagrees with something after the fact.
yeah but how would it work for input based delay?
I mean if the inputs are sent to the server before and then there is delay visually or sending inputs to the server is delayed?
the client processes input locally and hopes it ends up at the same spot as the server does when it processes the input. if it doesn't then the client corrects its position.. no input delay
no, with my question I mean - when input delay is given then I think it means the inputs are sent to the server before applying it locally so when there's a correction, there will be less discrepancy between the server and the client. I am not sure if CMC even has this kind of a thing ?
or is there another way to do it?
that would feel terrible in a non turn based game
giving 3-4 frames delay is legit i guess. If something goes above 10 then it would seem bad but 3-4 frames delay is given by a lot of games
all rollback based fighting games do it. Even tho it's peer to peer but I think server based netcode games like brawlhalla do it too
I have a video camera that players can pick up and it assigns a specific render target depending on if another player already has a camera in use with a render target. Having multiple render targets drops FPS. I tried to make so the scene capture component only visible to the locally controlled player, but during play, the host and client can still see each others displays working on the cameras. Is this a wrong way of doing it and there is a better way?
I ended up setting it like this, but the FPS still seems to drop a lot when I test play this with 2 players in the editor. Goes from around 55-60 fps / 16-18ms to around 40 fps / 25ms. Not sure if it's because I'm playing in editor with 2 players
Hi, In cpp how to identify which player controller is calling the rpc on server side ?
I have a component that is created when it collides with an object in the actor it collides with
how can I make the widget that is created in the component only be available to the component owner?
the server creates 1 widget
and the client has 2
Depends on the association that the actor or actor component has to the player controller.
Eg. Owner of PlayerState == PlayerController. Controller of Pawn == PlayerController. "Self" if the RPC is in the PlayerController itself.
Hey, Thank you
so if we just get the player controller in rpc context it will return the invoker of rpc ?
No.
Calling an RPC dictates nothing about the PlayerController that may be calling it. The actor that it is being called on would have to have some reference path to the PlayerController, whether it's the owner of the actor, or the owner is one of the other actors owned by the Player Controller (like their controlled pawn or playerstate) or a component of these object in which case you'd need to get their owner and then from there figure out how it is associated to the PlayerController.
If there is no PlayerController owner down the line at some point, then the client would not be able to invoke the server RPC.
Alright i see now, let's update my question a little bit
How to identify whom is invoke the server rpc in AActor object ?
How to know which player controller is knowing the owner path.
Which can differ based on how the ownership of the actor is set.
Lemme give you some examples..
Let's say I have a Character that I am possessing. Within the server RPC I can check for the owner of that character and I can cast it to PlayerController.... I now have a reference to the PlayerController that made the RPC call as a possessed Pawn's owner is usually the PlayerController.
Let's say I requested the Character to spawn a replicated projectile in that server RPC. I set the owner of that projectile to the Character.
For some reason, i want to allow a client to call an RPC to the server in that projectile and i wanted to know who the PlayerController is that instigated that server RPC, well, I know that the owner of the projectile is my Character.... So I could actually get the owner of the Projectile (the character) and then get the owner of that which would be the PlayerController, again I'd need to cast to change the AActor Reference provided from GetOwner() to then have an APlayerController reference.
Finally... If I had a component on that projectile and I was calling the RPC to the server in it.....
I'd have to get its owning Actor (The Projectile) and get that's owner (The Character) and then get that's owner (The Player Controller), cast the reference to APlayerController and then I should have the reference to the PlayerController making that RPC call.
Thank you for the explination, I think i misunderstand about GetOwner work
void ATestActor::ServerReportEquipped_Implementation()
{
// i want something that i could use to identify whom is calling current rpc
// GetOwner() <<< this will return the association with current rpc call ?
}
GetOwner() will return whatever actor object is assigned as the owner of the object that the RPC is running on.
No owner == There wouldn't be a server RPC initiated by a client.
Ahhhh I think i get it now
Thank you so much!
Owner == someone else's player controller, you wouldn't be able to call a server RPC on that actor as you do not own it.
Now that make sense
And sorry for confusion i try to apply my knowledge from the other network framework infrastructure and just try to understand it.
S'all good 🙂
is there a problem if you try to call a run on owning client from a run on server? I am change the visibility of an actor that players can see.
when the player picks up an item and they press an input, it runs on server an interface event that goes to the item BP. From there, I'm trying to set that the player that used the item can view a certain actor
This only works for the host
Owning client. If the actor isn't owned by a client, then it won't execute on any clients.
As this appears to be something stateful, you probably shouldn't be using an RPC. Mark the variable as Rep w/ Notify and then use the generated OnRep function to then trigger the desired logic.
this is inside the item blueprint and the owner is whoever picked it up, including the client. Does the actor that I'm trying to make visible to the player using the item also have to be owned by that player?
If I change the visibility of the actor inside a Rep w/ Notify, won't it just change the visibility for all players?
Yea If I try to put the logic in OnRep, it messes with the visibility of the other players
This object has to be owned by the client if you want that particular client to receive this client RPC.
Yes, the client is the owner
on pickup, they spawn the item and are set as the owner
This means you need some additional logic or checks to ensure that it only applies to those you want to see it. As an example, the boolean can have a replication condition of "Owner_Only" which means only the owner of the object would receive updates to the variable.
Just noticed this too... If this is triggering on the server, then it won't always work as not all viewing characters would be locally controlled.
When you say "They" spawn the item do you mean the client is spawning a local copy of the object?
This is from the player BP that calls the interface event for the item
This is where I set the owner of the item picked up
I believe its set up correctly to set the owner of the item for who picks it up
Probably shouldn't be passing "self" references through that RPC. The RPC is received on the same actor and the server can just use the self on its end. Prevents players from being able to tell the server that another player picked up the item.
That aside... Yes, ownership should end up being set correctly to a client when the object is spawned.
So the Item Primary Use interface is being invoked on the server, but then you're checking if it's locally controlled, which would be false for clients, so the run on owning client event would never trigger except for the host. You technically wouldn't need that locally controlled check at all as the Run On Owning client RPC would only ever trigger on the owning client, not on other clients.
Again though, this is something stateful. It seems like you want this thing to happen only for the owner and when that "Night Vision On" variable changes, whether on or off. That's a good candidate for Owner_Only replication condition of the boolean.
I tried Owner_Only Rep Notify when you mentioned it earlier and it still changes the visibility for other players
Then you're doing something wrong with it.
Owner_Only = that variable will only replicate to the owner. It'll remain its default value for all others.
The bool is owner only, but when the host uses the camera, it also changes for the client
So much redundancy here...
Device has an "ON" variable, you have "Night Vision ON" as a variable, then you have "Spirit Orb Visible" being turned on and off with them...
Is the "ON" variable an OnRep?
The On is from the parent Item blueprint so I can see if any child item is on. It is not OnRep
Ok.. That should probably be an OnRep with no condition.... This can then be overridden in child classes to perform functionality as you need when the power is turned off an on.
"Night Vision On" can make sense as you can have a separate normal view and Night Vision view.
That should also be an OnRep, no condition.
The spirit orbs visible.... Let's get rid of it... We'll just use the NightVision ON OnRep instead, don't worry that it's no longer using the owner condition.
ok
WIthin the NightVision OnRep, you'd need to get the owner (which as I understand is your character), cast it to Pawn, and check if it is locally controlled. If it is, proceed with your logic based on whether the NightVision ON variable is true/false. If it is not, do nothing.
The host changes the visibility for the client
yes it's a static mesh
a plain sphere
When you say the host changes the visibility for the client, do you mean in terms of these?
wait... I think it works
wait no there is still a problem
Here is a short video of the problem
seems like the host can change the visibility of the orb for the client when they use their own camera
even when the client's camera is still with night vision ON
Is the mesh replicated or something? I can't duplicate this on my end.
Yes, it's replicated. The end goal is for the orb to move around change material parameters. If it's not replicated, won't it be different for clients and host
You can't replicate the mesh and modify its visibility.
And expect it to happen locally only.
The actor can be replicated and you can move its position
The mesh visibility can be local only if its not replicated.
And replicate any properties about the mesh through the actor.
@sinful tree thank you very much. I was able to get it to work how I wanted to. Something so simple was driving me crazy since yesterday.
Isn't there replication condition that we can use?
What does the skip owner do
The problem is the visibility is managed with the replication of the component itself, you wouldn't be able to modify it on the server without the change replicating to everyone else
Skip owner does the opposite of OwnerOnly - replicates to everyone but the owner.
Setup:
- Actor is set to replicate with frequency set to 0. Actor is a simple cube (though it shouldn't matter).
- Server calculates new location on tick and stores in local array. Every 100 ms (timer) it clears the replicated property and moves over all locations from local store to it, then it calls ForceNetUpdate.
- Client side here prints a message on RepNotify of that replicated property.
- Testing simply with 2 instances on single machine, one being auto listen server, but manual session creation and join on standalone instances ends up the same.
- I have locked framerate to 30 fps. Both instances run at that fps.
It works fine (second screenshot) when there is only one actor. But the issues starts to show up once there is more. In the first screenshot I am testing on the level with ~250 of them. Debug shows messages for only one actor. For some reason, during this particular run, 5 updates are lost and only 6th gets delivered.
Size of update every 100 ms (assuming all timers fire at the same time) would roughly be:
250 (actors) * 3 (vectors) * 24 (size of vector) = 18000 bytes = 17.58 kB
So nothing crazy. And setting TotalNetBandwidth, MinDynamicBandwidth and MaxDynamicBandwidth to higher values doesn't help.
The question is:
Why the updates get lost? Is there some additional network limiter at play here?
At this point it doesn't matter what I am trying to achieve - it just feels wrong that this setup isn't reliable. Is there some magic checkbox I have to tick?
You should really be using the Networking Insights tooling instead of doing print strings and assuming the size of the data you are sending is all that is being sent.
Profile your setup again, but use the Network Insights tool instead.
You might be surprised with the results
not assuming it's the only data. but 18 kB of user data shouldn't be a problem
going to check the insights in a moment
Does anyone know any reasons why this multicast called from my server character isn't also firing on the character on the client side?
the size doesn't look bad at all. even given the fact that I forgot that I am sending long and bool along with the vector
what seems to be a potential problem is that it is sending them in groups of 6, 7 or 8. and claiming that all of them are delivered. both outgoing from server (left) and incoming on client (right)
if Engine Frame Number = tick
then it is one such packet of 6/7/8 actors per tick
Character isn't replicated. (Typically not a problem)
Character is outside of relevancy on the client. (Wouldn't be a problem if you can see the character on the client)
Reliable buffer overflow. (Can happen if you're using too many reliable RPCs too quickly)
Wow thank you.. adding a brief delay made it work properly, seems like it was reliable buffer overflow
That's pretty annoying, I don't even think there's that much going on at that moment, but maybe I need to audit that. Is that something infamous with UE multiplayer? I've never heard of it until now but it seems like it's relatively easy to run into
Reliable Multicasts are usually notorious for it and most people try to avoid them. You really should only reliable anything if it's mandatory for the logic of your game to work. VFX and SFX are usually considered things that don't need to be reliable.
A delay isn't really the fix for the problem either, that just offsets the issue and may cause problems down the line. You' need to profile to see what's going on and see if there's something calling a lot of RPCs.
Yeah makes sense, I just wanted to confirm that was the issue and it proved that it was the overflow that was going on, not intending to keep a delay in the code
I didn't originally have it reliable, but I made it reliable just in case it was getting ignored (which I guess it was), I'm fine with it being unreliable I just didn't think my two-player test would be enough to cause the server to ignore some RPC calls
I'll see if there's anything I can do to lower the amount of RPCs on that tick
Hello, I'm trying to call a server RPC from a replicated controller component, but I'm failing with this error https://pastebin.com/LgzRHRym.
From what I understand it means that server doesn't know anything about the component, but the thing is that I'm creating it server-side, and it is replicated. There is no other piece of code that would create the component, so it's not created client-side elsewhere. The crash only happens in packaged game. Running standalone game from the editor doesn't give any warning/error when I try to do the same thing.
After testing a little bit, I found out that the issue stems from the fact that I'm calling that from BeginPlay (I do that when it's locally controlled only). With a delay of 5 seconds it doesn't crash, and works as supposed to. I want to try to have way lower delay, but I'm worried that it might cause crashes in case of higher ping or packet loss.
Does anyone know anything about it?
Maybe client should only do something to the component when the component has been initialized
It seems to work with a delay of one frame as well, but I'm testing that in local environment (same network, different computers), so I get around 10 ping
BeginPlay seems to be a good point. It's 100% initialized server-side since you get it replicated client-side, and it's already executed basic initialization it should have before BeginPlay. If it will never crash for that reason if I use a one frame delay, I'd be okay with that, but I'm still wondering why it would happen in the first place
Hello Guys,
I have a query regarding In-game Marketplace asset. I was wondering how they work.
Well As per my knowledge, Server and all client should hold (Locally) for them to render.
But let say, then a new skin or new prop is added to market place, Do they have to get the updated build (download new asset in update) or do they handle it differently.
Do let me if I was elaborate enough
@fickle seal maybe you want to look at chunkdownloader video by epic.
@dark parcel Hello, Thanks for the letting me know, I will have a look at that.
Imo the easiest way is to just ship the game with the skin
So sure, people that can hack can render the skin in their computer locally but at least that save you the headache from trying to bring every computer to the same state.
but as for the name suggest, chunkdownloader, it might download a file from online database, but like game with 15 client, then all them have to download player respective asset ?
Ship or update the game that contain the skin.
Access the user steam data or w.e platform you will use.
Check if they own the skin, if they do, then they can equip it.
Yes any client wanting to render the skin will need the file.
I would say just ship the game with the asset.
yeah, that the way,
have all asset in the shipped build,
but let assume Fortnite - every time they offer new skin or new accessories, but while increase the size of the build as new asset comes in.
they have to give update
@fickle seal whenever you have a skin you want to add to the game, I say just push a new build to your platform
Like steam, you just push a new build with the skin.
Then everyone that want to play the game have to update to latest version
Everyone will have the skin file in their computer. You can then make the host check if the player own the skin when they want to equip it
@dark parcel Thanks, it was good to have quick chat with you.
Having asset in build is not brainer
I don't know how others do it, I am just a hoobyist
but I will look and let know if I found anything else than this
regarding reliable multi casts, I have a replicated terminal where players can type commands, each command executes some logic locally(displays text on the terminal's screen), does it make sense to make the multi casts reliable?
since it's not really a vfx thing, I wanna make sure everyone sees the same output, but what if I keep spamming random stuff into the terminal? could that lead to reliable buffer overflow?
I'm replicating the command line this way too, that's every single character typed being reliably multicasted 🙃
Keep in mind that if you leave replication range and return, or somebody joins the game after that started, that won't replicate to those clients.
Multicasts should be used for transient, missable events. Use property replication for anything permanent.
yeah I'm aware, that should be easy to solve, store the current state of the terminal screen and use repnotify so clients coming into relevancy can update their screens
yup, and with that you won't need any reliable multicasts
Can probably count on one hand the number of times I've use reliable multi in 10 odd years
well, I'll look into getting rid of multicasts, I had a suspicion I'm not doing it right 😅
Hi there, I'm working on a listen server multiplayer game. Say I have a wallet actor component attached to each of the character, but now I need to make it as a 'shared wallet'. How can I 'redirect' clients' wallet actor component to use host's wallet actor component instead? Thanks in advance!
just run method that changes screen text value on server(it's usual server rpc), change property with onrep_notify on server and it will be replicated to other clients. no need to do multicasts
after a seamless travel (with a client) i get a crash, i cant properly debug it since its crashing in engine tick
// few logs before crash
[2024.12.09-15.55.38:367][741]LogGameMode: << GameMode::HandleSeamlessTravelPlayer: PCBP_InGame_C_0
[2024.12.09-15.55.38:379][741]LogGameMode: Display: Match State Changed from EnteringMap to WaitingToStart
[2024.12.09-15.55.38:381][741]LogGameState: Match State Changed from EnteringMap to WaitingToStart
[2024.12.09-15.55.38:383][741]LogGameMode: Display: Match State Changed from WaitingToStart to InProgress
[2024.12.09-15.55.38:620][741]LogGameState: Match State Changed from WaitingToStart to InProgress
[2024.12.09-15.55.38:629][741]LogGameMode: >> GameMode::HandleSeamlessTravelPlayer: PCBP_Lobby_C_1
[2024.12.09-15.55.38:637][741]LogGameMode: << GameMode::HandleSeamlessTravelPlayer: PCBP_InGame_C_1
[2024.12.09-15.55.38:647][741]LogNet: Warning: Actor None_1065353215 was found in the NetworkObjectList, but is PendingKillPending
Could put the shared wallet in the gamestate and have the host update that one. One could make an argument to put it in the playerstate, but that can get dicey imo due to ownership and all that. But either of those two would be fine imo. Just whichever way you want to go.
id personally avoid having special behavior for the host and probably put a shared wallet in a subsystem or game state
there's already quite a handful replicating components in my gamestate currently. so perhaps I'd go with the player state one. to clarify, do you mean I can get to use the existing component or should I make a new one to handle the sharing?
kindly correct me if i'm wrong, but subsystem doesn't meant to be replicated, no?
Who cares if there are already some replicating components
Putting a replicating component on the gamestate or playerstate doesn't matter. Both are going to be replicated components
correct
hey there, is there really no native way to tell on client's actor begin play whether or not the actor begun play "for the first time" or "came back from being net culled"?
Technically - it is always "the first time"
ik, but i was hoping there would be some flag or something hehe
The actor is destroyed and created - no flag to be made
Depending on what you're doing, you could check the UWorld's begin play status
That gets flipped after the initial begin play on all placed actors
So not reliable at all
But could work in certain scenarios
the use case is rather trivial.. playing a little poof effect on clients when an actor is spawned. but i didnt want to introduce additional replication for it
Have the spawner play that and not the actor
yea doing that now, it's just "not as nice" in the specific setup hehe. thanks
how do you guys test multiplayer in editor with a listen server and clients when using the EOS net driver ?
i rarely need EOS to test some MP stuff, but when i try to start a PIE session with one PIE instance as a listen i get the following error:
LogSocketSubsystemEOS: Error: No local user to send p2p packets with
[2024.12.09-17.29.30:848][ 0]LogTemp: Warning: Could not bind local address
[2024.12.09-17.29.30:848][ 0]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = NetDriverListenFailure, ErrorString = Could not bind local address, Driver = Name:GameNetDriver Def:GameNetDriver NetDriverEOSBase_0
[2024.12.09-17.29.30:849][ 0]LogNet: Warning: Network Failure: GameNetDriver[NetDriverListenFailure]: Could not bind local address
[2024.12.09-17.29.30:849][ 0]LogNet: NetworkFailure: NetDriverListenFailure, Error: 'Could not bind local address'
[2024.12.09-17.29.30:849][ 0]LogWorld: Failed to listen: Could not bind local address
[2024.12.09-17.29.30:850][ 0]LogNet: DestroyNamedNetDriver NetDriverEOSBase_0 [GameNetDriver]
[2024.12.09-17.29.30:850][ 0]LogTemp: Verbose: Shutting down NetDriver
[2024.12.09-17.29.30:851][ 0]LogNet: Error: LoadMap: failed to Listen(/Game/ToothForCash/Levels/Core/L_Game?Name=Player?Listen)
do i have to switch netdriver class when testing with/without EOS ?
You can have a replicated bool that is set to InitialOnly replication condition. The default value can be set false and after some slight delay after begin play set true on the server.
When the actor Begin Play fires, you can check if the bool is false, and if so, play the animation locally.
If a player is within range of the actor spawning, they should receive the default false value and play the animation.
If a player is outside of the range of the actor spawning and move into its range and the delay has elapsed, then no animation should play as they would receive the replicated "true" value.
could be an okay solution in this case. thanks
Guys, I have a Character, which is replicated. Character has equipped items. Some of them can be invisible and can only be seen when detect invisible Tag is present. In general items should be seen only if character is able to see.
I would like not to replicate items if a player cannot see them. I wonder how can I approach this problem.
So basically I want some kind of custom replication for array I guess. So it can take in consideration weather client should be able to see it's items or not
Been working on a project mostly with AI. I have steam Multiplayer built in and Really need to test it. Anyone help me out?
I think you can override AActor::IsNetRelevantFor and add custom logic to decide if an actor is relevant to a certain player.
You can override IsNetRelevantFor and check if the character has the tag.
actor yes, but it's array of structs
I basically want different clients to have different array depending on their vision
but maybe you're right, maybe it can be done that way
I can't think of any easy way to have a single replicated array that only replicates certain items to certain players.
Yea, it's some lower level networking coding I guess
Have to mess with chanels for sure
And we're here to make games 🙂
FFastArraySerializer has certain control that might be able to do what you want, but it would be a lot easier to spawn an actor per item instead
ah, actually I have no idea how will I implement in this wearable stuff. I was thinking about just replicating the array of items character wears and then just mess on a client with it
since I don't need those actors on server at all
For something like that I'd probably have a replicated array of asset references, or indices into a datatable etc, on the character itself. Use OnRep to make sure the correct meshes are loaded and attached.
I guess, it's not really the unreal way. I think I should go with your suggested way of using actors
and relevancy should work really good here
with replicating an array you will probably not get around the other client at least knowing that there is an entry they don't see
