#multiplayer
1 messages ยท Page 142 of 1
Yeah this can be super low
Well it cant
Even very brief desync wouldn't be a problem I Just don't want items permanently diverging
I get you if it's too low it never fires
I just meant, as low as it can go
You can use things like the significance manager to handle adjusting the update frequency for further away ones
You might want ones really close to the player to have a very high rate so they appear smoother
And ones far away can be a lower rate because you are less likely to notice the hitching
Slapping this in broke it now the items are just stuck in the original spawn position on client
Is that the wrong way to disable phys?
It's fine, but probably better to keep it disabled by default and activate it if authority instead of vice-versa
is it disabled by default on the mesh?
I have it set enabled on the mesh, I can try inverting it, you think that'll fix? 
Enable on auth
Yes
Because before it wasn't being turned off on clients
You were activating the physics on the server on a mesh that has physics already enabled by default. And not turning it off on clients either
What? No look at this again
On false, no authority, it sets it false
Or am I misreading
I was refeering to this
Assuming you did it
Starting True and Setting False on No Authority seems to me like it should do the same as Starting False and SEtting True on Authority, but it does not 
Perhaps just to do with the timing of beginplay I guess
Probably if I did it in constructor then it'd be the same
I totally missed the message, just saw the screenshot and the question about if it's correct my bad
Thought it worked
All good
appreciate the help
I did some testing
And simply doing this works, with Actor and Movement replication enabled
Yes
I said it works that way I was just curious why it doesn't work the other way around. I.e. on by default and disable when remote. But I'd bet it's just the timing of begin play
Oh then it's fine, it's definitely about the timing
makes sense
That timing issue probably won't happen inside the construction script, might want to use that instead.
No need. Makes more sense this way anyways. enable once for auth instead of disable multiple times on remotes
I feel like this is a MP question, since it's a MP reason why I want to do it 
Is there a way to crank graphics waaaaaay down for Play in Editor mode, for testing purposes? with 4 players on one PC it gets a little slow 
I'm made to understand that Run Under One Process is much faster but when I do that, my shit breaks, and the tooltip suggests it is bug-prone 
https://github.com/dyanikoglu/ALS-Community/issues/41
I`m having this same issue but if i disable root motion on proxies the animation quality of motion is way lower. What is the best way to fix? is it even fixable?
Do anyone have something like this?
When playing root motion montages and colliding against moving objects, they are on different positions for each machine and replicated proxies sometimes don`t collide, etc
anyone here familiar with playfab?
I used it once
were having a problem with the server allowing connections... its probably something stupid
like i get the servers up and running and it gives the clients the ip/port to connect to...but its just not listening on those ports so the clients time out
Without playfab does the server work correctly?
yes
Are you using the container mode?
yeah
I didn't use the container mode but I think it requires some verification of some sorts if I'm remembering correctly.
Disable the container mode and try that way and see it it works
ok stdby
yeah...here is the issue...i could never get the process mode to work, servers kept failing to deploy...also with process mode we can only run 1 server per VM which is not ideal...i can try again as a test but we really want containers for scalability.
https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab#verifying-containerization
Take a look at this
It's the containerazation thingy, I don't know how it works but it's probably relevant
I'm having an issue with properly connecting a client to a server since I added seamless travel over Steam.
In the OnlineSubsytem the listen server player starts a session upon the complete delegate firing it calls
GetWorld()->ServerTravel("/Game/Maps/Home?Listen", true, false);
The client opens up their online menu and sees a broadcast of the server game and can hit join.
Upon the join delegate firing it calls TryTravelToCurrentSession()
PlayerController->ClientTravel(ConnectString, TRAVEL_Absolute);
Here's the weirdness:
- The client goes nowhere. They just sit in their own level and don't travel to the host map
- If the host changes level (via a trigger) which uses the Blueprint
OpenLevelfunction with the map name?Listenin the options. The client gets pulled into the new level. - If the client leaves the server and reconnects it all works fine and they automatically travel to the server map
- If the host ends the server and starts a new one the problem begins all over again
The usual stuff for seamless travel is there. The bool is enabled in the GameMode and the transition map is set. Which I guess is a given because once it works it works. It's just that initial map load that's causing the problems.
When you start the server use open level instead of server travel
I did wonder if that might be the way to go. I'll give it a shot.
As far as I know Server Travel is to carry players that are already existing in the scene to the target level.
If they never really joined then there's no one to pull, open level ensures clients will be pulled to the server scene as soon as they join.
Well dang, that seems to have done the trick!
Thanks for that. Saved me spending the rest of the night prodding at random settings and packaging builds over and over.
Does multicast only go to relevant actors in replication range, or all connected clients? How careful do I need to be with my multicasts?
If the event is ticked reliable then relevancy is is irrelevant, if unreliable it will check for relevancy and decide to update or not.
That's... wrong. RPCs can't be executed on actors that literally do not exist on a client.
If an actor isn't relevant to a client and the client does not know anything about it, any RPC on that actor sent to that client is going to be dropped.
Apparently the engine is/was dumb about this.
And immediately opens a new actor channel for actors that aren't replicating
jfc
Yeah relevancy doesn't mean the actor doesn't exist
It does for dynamically spawned actors
(assuming the client is up to date)
but at least in some situations the engine will apparently replicate the actor anyway. And then immediately remove it from relevancy again.
just one more reason reliable multicasts should be avoided in almost all situations
ah, turns out this behavior is actually controlled by a (default-on) cvar and it requires that there already be an actor channel. Still something to be avoided, but not quite as ridiculous behavior as I assumed.
When you make the build and upload, did you configure the right port number for the first Entry?
how unreliable is it when you put "unreliable"? it's like, if the bandwidth is saturated then it won't execute the rpc?
and won't be resent if it fails to arrive
What does normal video games use? Local Predicted or Server Initiated?
Like Fortnite or sth.
Depends
Also if I didn't know that was a very specific setting in an ability, I'd have no idea what you were asking there
How does Iris even work? Do I just enable it and call it a day? lol I'm reading the docs right now on it and that's how it sounds in a nutshell to me?
Iris is very experimental
Most stuff should work either minimal ini file setup
But not recommended atm
Unless you have a reason for iris, I would ignore it
much like udp and tcp?
cool, ty ๐
Since it seems like subsystems in unreal cannot do server rpcs, how would you typically elevate a subsystem request to the server? It's awkward to create a subsystem and then a client object who's only job is to listen to the SS and simply RPC for it
yeah so the process has to be Initiator->Subsystem->Client Object RPC'
I cannot do better than three steps of indirection to just send a single rpc?
Good to hear!
Hey, a few questions about shooter + multiplayer in a scenario I don't care about cheaters (its coop), am using GAS and it's a third person shooter where the position of the character doesn't necessarily reflect where they're aiming.
- How would you deal with shooting? Client sends to server an RPC informing it has hit X, Y and Z characters? Or you go full predicted by the server and only informs character X is shooting and each instance simulates it?
- AI life - do you replicate it to everybody? I believe, in general, it's not a good practice but would like to hear your experiences.
- When hitting walls, for example, I want to spawn a particle. How to go about it? Client -> Server RPC -> Multicast? (in our context, hitting walls don't break them etc, it does nothing, its pure aesthetics)
Well it can't be a Client RPC anyway, unless you're spawning multiple actors (one owned by every player)
Only Actors can send RPCs, so it has to go to an actor eventually
Shoot, send the aim direction + origin to Server. Server checks and shoots too, or rejects. Replicate some minimal information about the shot to all clients so they can simulate it locally too. Really depends on the type of game, the weapon, the projectile etc.
There's no catch-all solution
The "modern" way to notify other users is probably via a Gameplay Cue, but I prefer a simple counter. https://jambax.co.uk/better-burst-counters/
Shoot, send the aim direction + origin to Server. Server checks and shoots too, or rejects. Replicate some minimal information about the shot to all clients so they can simulate it locally too. Really depends on the type of game, the weapon, the projectile etc.
That's good insight. No projectile - raycast only. Weapon: automatic.
Hits are similar. Client tells the Server they hit something, server either agrees or disagrees. Or you do full Server-side hit detection.
ShooterGame is old but has a reasonable implementation
Projectiles are SSHD, Raycasts are CSHD
SSHD and CSHD ๐ค
Server-SIde Hit Detection vs Client SIde Hit Detection
Or you do full Server-side hit detection.
This is probably... the smoothest, network-wise? ๐ค
SSHD means you tell the server you shot, and it does everything else. Players have to account for latency
CSHD means players generally don't have to account for latency but is far more complex to implement
Since ofc, the Server needs to validate everything the client sends, and you're dealing with different frames of reference when validating the shots
Is this kosher? I'm setting a struct of resources for teams on my gamestate but when I'm retrieving the values I don't use an RPC since the gamestate is automatically replicated. Should I be sending requests to the server to retrieve the values from the server gamestate?
Edit:After reading this.. the server should be the source of truth lol
I do wonder if it'd be sane for shots to start off as raycasts, and if they don't hit anything, they get turned into projectiles by the server for them to travel
IIRC insurgency does that, raycasts for the first 50M or so then projectiles to make it more 'responsive'
Seem to remember hearing something
Are there any events for when dormant actor wakes up and sleep?
by projectiles you literally mean an AActor?
or particles, etc?
bc I mean, probably it invovles a sh-t ton of techniques to make it performant - I bet it wouldn't be a mere SpawnActorOfClass AProjectile and les go baby
Pooling and all
like a pawn?
Yes
OnPossesed?
aa
still
it works for controllers
but i probably dont know what you're talking about
so i wont comment further
Has anyone ever experienced crashes with GetPlayerControllerFromNetId ? For some reason my UniqueNetIds are CRASHING when checking the .IsValid().
Itโs a little surprising to me UE doesnโt have a in house solution for projectile prediction like they have with character movement. I guess thatโs a lot harder to make it flexible enough to work with everything
they do have the projectile movement and the other projectile interpolation feature for fake projectiles
FUniqueNetIdWrapper::IsValid() Line 592 C++
So I did the whole checking the pawn, but I had the same issue - the pawns get validated very quickly, while the Client viewpoint is still in the middle of the world, until it starts using the proper camera. Do you have one camera and how do you assign it to players?
And this is my questions to others I guess as well, if you have 1 camera in the scene that you want all players to use on joining the game, how do you do that? I currently have one camera in the level and in the gamemode I use GetAllActorsOf and set it to a var that later on I use NewPlayer->SetViewTarget(SharedCameraActor); in HandleStartingNewPlayer_Implementation but that is quite slow apparently. And I have no idea how to make a callback so that I get a notification when the Client has started using the one camera in the level so I can start the game.
Hey,
Im running into an issue with vehicles and desync. I can attach my player to the vehicle and drive around with no problems. But as soon as a detatch the player from the car and take ofer the character models control again, it's no longer synced and I'm warping and teleporting around. any ideas why?
Do you get any warnings in the log?
Most likely CMC is telling you something
HandleStartingNewPlayer_Implementationbut that is quite slow apparently.
What do you mean by that?
did thest it with a dev build so far
Super::HandleStartingNewPlayer_Implementation(NewPlayer);
PlayersInGame.Add(NewPlayer);
if (SharedCameraActor)
{
NewPlayer->SetViewTarget(SharedCameraActor);
}```
this is what I do to set a new player to the camera I have in the level. And I mean that the process of the player joining and starting to use that camera is quite slow. It's not like the player joins and they immediately start using that camera (which is static by the way)
You can wrap your code using doing it like that instead
```cpp
my awesome code
```
It'll format it in a fancy way
thanks!
Do you mean that you have to wait some time before it happens regardless? After a player joins, how long do you need to wait before it calls the HandleStartingNewPlayer() and before they actually start using the camera?
...and? Does the log contain any warning about character movement component?
My assumption is that the calling happens immediately, cause I have some other code afterwards that fires. But the Client looking for that camera and starting to use it takes time
And if you ask how much time....idk, I have to time it, but I wouldn't know if it's always the same. If it is, then it would be a simple timer to do, but I can't rely on such an arbitrary method
If it calls the HandleStartingNewPlayer() immediately, does it mean that it processes the NewPlayer->SetViewTarget(SharedCameraActor); for long time? You don't have to measure it precisely. Is it 5, 10, 15 seconds? I'm asking just to get an idea
And for these 5 seconds, what does the new player see?
Once I build a new version and tested it I can say more. The issue dies not appear while playing in editor all as clients
they are just in the origin. I can see on the Server that the player has been spawned
Can you try to step through the APlayerCameraManager::SetViewTarget()? It looks like that they set some timers internally for blending purposes. It might be something to do with that
step through with debugger upon new player login*

thanks
Insurgency's guns do feel pretty damn good
what am I looking for exactly?
You're looking for the reason it delays the function. As I said, it looks like it's setting some timers inside. Take a look at the timers duration it sets, and compare it to the 5 seconds delay you're getting.
is that it's going to say somewhere in the debugger here that value?
Step into the function, and get to the PlayerCameraManager.cpp line 156, and see whether the delay is anything like 5
adding a breakpoint on line 156 doesn't make it stop so I can see whether it's giving any value
Can you try to put a breakpoint in void APlayerController::ClientSetViewTarget_Implementation( AActor* A, FViewTargetTransitionParams TransitionParams ) to see whether it's called immediately after the HandleStartingNewPlayer(), or perhaps it's called after 5~ seconds after that was the case?
seems to be immediately
I wasn't using that function honestly until now
just added it for testing
You don't have to use it manually, it's called in the SetViewTarget() at some point
Either way, does the ClientSetViewTarget_Implementation() call the inner SetViewTarget()?
seems like it
Does it get a valid NewTarget (the first argument)?
What does it do inside the SetViewTarget() when it's client-side?
Also, a quick tip. In order to know whether you're client-side or server-side you can use the {,,UnrealEditor-Engine.dll}::GPlayInEditorContextString in your debugger. Adding it to watch will tell you that interesting information anytime you open up the debugger
you mean like this?
Yeah, like this. It should've worked ๐ค
btw, do you have the debug symbols downloaded? Their absence might be the reason it doesn't find anything
maybe not, I will need to have a look
If you're unsure, you most likely don't. That's fine, but it's heavily encouraged to download them if you're going to work a lot with C++ in UE, as it gives a lot of extra debug information. The only issue is that they are 50GB or something
okay, I will get them
but I am not sure how to check this
maybe I need those symbols you mentioned, I am not sure what do be looking for
I apologize, I am still fairly new to programming, so I have not learnt these ways for pinpointing exact issues
That's fine. To see whether the NewTarget is valid simply look at its value in this tab. When it has a name and properties in 99% of cases it's going to be valid.
To check what it does inside SetViewTarget() you have to step into the function using F11 (or the button above the properties in the aforementioned tab), but I'm unsure whether you need the debug symbols. You actually might need them since that's kind of the point of downloading them. Since I haven't worked without them in a while I cannot be 100% sure about it.
I guess download them, and in mean while perhaps look at how other people switch the camera, if you haven't already. I personally haven't worked with cameras really, so I only have ideas on how things should work. ๐
Not neccesarily actor based, just an projectile of some kind. Most large scale games are gonna be using some ECS approach or something similar
there's very little info on it, I tried googling it
And I can see there's a FViewTargetTransitionParams that has a BlendTime that is used for the Timer, but I think that one is set to 0 by default
And even then just doing a TransitionParams.Blendtime = 0.f doesn't really change anything
I see. I guess we can go the other way around: instead of getting to the problem from its origin, we can try to get to it from the very end -- from the function that actually makes the player see using the camera you're setting. The only question is what this function is. After that it's just the matter of going down the call chain, and see what delays a certain function in all that chain. With that knowledge most likely we can find either a workaround or a fix for that.
{
K2_OnBecomeViewTarget(PC);
}```
this is the end one and I cannot go anywhere else.
I am not sure exactly what's going on, I do not see any real timers, and if the timer is for the blend, I tried setting it to 0 but nothing happened
I mean, worst case scenario, if it's always 5 seconds, which I cannot really pinpoint until I test a bit more with others, I could put a timer to start the game after those 5 seconds and just have a loading screen in place...not a great solution, but I don't mind ultimately if it really is concise
Once you download the debug symbols you can try to go down the call chain in the stack call, and see what's the very first function that's called with some delay. After you find it, you'll know what function makes the delay -- the one that is just before the one that is called after some delay.
Practically you need to put a breakpoint in the BecomeViewTarget(), and look at the bottom left angle, there you'll have all the functions that took place before calling this one. Look for those that are relevant to the camera, and see whether anything is called by a timer manager, i.e. something has asked to delay that function
Thanks Tony, I will have a look later, I downloaded the symbols, but need some break, cause my mind is tired by this point ๐
I will message later with the results
Sure, take a break. Debugging such issues is always a pain as you have to understand a lot of someone else's code ๐
how do you pause a multiplayer game in listen server? I want to pause a game and show a popup with some data from the server. But when the game is pause the multicast that tells the clients to open the popup is never triggered because the game is paused :D. So how do you pause the game but still allow clients to receive data and do ui stuff?
pausing the game shouldn't stop network traffic. It just stops level ticking essentially
oh I see, it needs to replicate with Reliable checkbox on
Sounds like you're multicasting state to me.
What are you actually trying to do?
I stumbled upon another issue, the player state does not replicate properties while game is paused?
Basically what I want to do is to pause the game and show same menu to players where they can choose a random ability from a list (like a vampire survivals but multiplayer) . So I'm generating the abilities on the server for all the players and save it in player state (each player can choose from their own ability list and can see what other players are choosing). This works fine for the server but the clients will not update the list while the game is paused :/
add item to player inventory should ever be called by client?
Probably not
so in this situation can we call server event from UI?
lets take a look at an Accessory item attach to AK47 and i drag it and drop it in my inventory from UI and the UI is not available on server!
I have a component on the player controller that holds the RPCs for inventory actions in my case
You'll need something similar
Ok thanks
silly question but, how can I check if my footsteps on multiplayer are working? When I focus on another client the previous one is muted
Yeah i'm doing the same. UI is calling something like "Move Item" (Server Reliable) on the player controller, server is executing MoveItem_Implementation and then calling a MoveItemExecuted (Client) on the player controller which will then update the UI.
If it needs to be fast you can already update the UI clientside and then just correct if the server response is received (or don't send a response at all if everything is ok)
for editor
thx
dosent work
need this thing in editor
as a quick hack maybe just add a +1 velocity in the move function so the char is always walking?
Or a more simple question is: How do i check in code if the current blueprint in which the code is running is the real player (the player that is controlling the machine) or not?
Maybe, if there is something like get current player's index? Because i know the real player index is always 0 so can check with that?
is locally controlled
Thanks. Very helpful.
would anyone be interested in discussing a latency-tolerant hitstop with me? I have some ideas for it but they all have major pros/cons. i'm hoping we can all learn something from the discussion
my defininition of hitstop is just setting montage play rate to X for Y seconds
triggering it would be server-authoritative, but i want all clients (including autonomous proxy) to keep in sync with the server as much as possible
i need help understanding how to use gamemode and gamestate
do you put the variables in gamemode or gamestate
it seems like everywhere i look has a different answer
gamemode is server only and gamestate is replicated and all clients has it
i know that much
but should the gamemode have the variables and the gamestate takes from that or the other way around
Game mode holds rules, game state holds state. To get a better idea always open them and see what properties and functions they already entail, then u know more or less where yours should be placed
Oof. Making a game with basic floating movement but I want the player to be able to attach pieces onto their character (spaceship). Looks like networked character movement only uses the capsule, going to just resize the capsule to contain anything as I attached pieces I guess >_>
is it floating pawn movement or character movement component?
What is actually doing the moving?
If it's a spaceship I'd probably use physics myself but that's up to you
Why do you need prediction for a spaceship? There's nothing more smoothly accelerating and slower responding than a spaceship
For physics collisions was my impression
But yes you'd think it's simple
As far as movement goes at least
It is that simple, just play with the physics replication settings
If I were doing a spaceship game that's exactly how I'd do it, but it depends on how physics driven you want it to be
I'll try it out thanks
Created a blank project -> added some spawns -> packaged -> clients connected to me have ~60 ping with only cmc replicating
ideas?
Where are the Clients located?
That seems like a normal ping (if it's not a LAN ๐ )
Only the Server can replicate changes of variables.
The Server will always be Authority over all Actors
Therefore an Autonomous Proxy cannot change a variable on its own and have that affect other Clients value of that variable.
Thats not how it works.
The architecture of how the networking layer is setup REQUIRES it to be Server Authoritative
There is just no way around it
Unless you want to do massive changes to the engine
Stop trying to take shortcuts
Work how Unreal wants you to work.
Its like that for a reason
the value is set but the server never receives it
clients cannot tell the server to set any variables except through an RPC
there is no Client -> Server replication, period
clients can only set variables for themselves
The only mechanism for Clients to affect change on the Server or other Clients is by routing it through an RPC
There is no difference, other than Autonomous means it is locally controlled by a Player.
Pretty much across the street? No hyperbole, exaggeration or joke.
And it's a listen server; am hosting here, at home.
What happens if I create an actor component during runtime only on the server, and set it to replicate, is the construction of that component replicated?
If not, then if the client also locally creates the component at runtime (say via a replicated event), are those 2 components then kept in sync via replication? how does unreal maintain the association between the server and client copy of the runtime spawned actor component?
My clients seem to get the wrong location of their gun component. This location is used to spawn in the gun's projectile. Using the actor's location everything works correctly. Using standalone or listening the locations are set correctly. The picture shows one debug sphere going to 2 locations. I'm really not sure why this is. Any ideas?
- I create a session (listen server; Steam; UE 5.3.0; windows 11 etc)
- Friend who literally lives across the street connects to my session
- Each one of us are possessing our own Pawns, who have no components but a SkeletalMesh; NetUpdateFrequency of 25 and no variables replicating whatsoever but the actor itself
- Map we are connected to has nothing but some static meshes to be the ground
- 60 ping
I wondered, why?
Then we tried a few things:
- I asked him to host a session so I could join, same ~60 ping,
- I asked another friend to join my session, same ~60 ping,
- Disabling Steam Sockets, same ~60 ping,
- Tried a different NetDriver (SteamCorePro), same ~60 ping,
- Tweaked each and every TickRate config on
DefaultEngine.inirelated toNetDriver(andIpNetDriver), same ~60 ping, - Build, re-build, clean build, relaunched Steam, relaunched Editor, and all the standard procedures one might blindly try, same ~60 ping,
- We launched another co-op, listen server, Steam game we released back in 2020 (UE 4.26) and there we got around 12-17ms regardless of who hosted it
- Launched another listen server co-op Steam game, same thing; 12-17ms regardless of the host
All the above said as we are running out of ideas... does anybody have any idea of what we could be missing?
(Below I leave a stat net picture of the client; not sure how much it may tell you but perhaps it could lead to something?)
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_GS_WeatherReport_C_0. Function UpdateTeamResources will not be processed.
I'm getting this when I call an RPC to to update values on my gamestate from my character. Shouldn't I just be able to set it from my player char BP? I thought my client owns this actor?
Nvm figured it out. Gamestate is owned by the server so if I call an RPC on it it wont work.
is OnRep Called in case of FFastArraySerializer ?
Generally speaking you wouldnt use an OnRep with a FastArray. That almost defeats most of the point of using one.
As a FastArray exposes functions that express when elements have changed via replication.
/**
* Called before removing elements and after the elements themselves are notified. The indices are valid for this function call only!
*
* NOTE: intentionally not virtual; invoked via templated code, @see FExampleItemEntry
*/
FORCEINLINE void PreReplicatedRemove(const TArrayView<int32>& RemovedIndices, int32 FinalSize) { }
/**
* Called after adding all new elements and after the elements themselves are notified. The indices are valid for this function call only!
*
* NOTE: intentionally not virtual; invoked via templated code, @see FExampleItemEntry
*/
FORCEINLINE void PostReplicatedAdd(const TArrayView<int32>& AddedIndices, int32 FinalSize) { }
/**
* Called after updating all existing elements with new data and after the elements themselves are notified. The indices are valid for this function call only!
*
* NOTE: intentionally not virtual; invoked via templated code, @see FExampleItemEntry
*/
FORCEINLINE void PostReplicatedChange(const TArrayView<int32>& ChangedIndices, int32 FinalSize) { }
It is, but you don't get a 'previous value' pass in. That's not supported
I have this AIs running on my dedicated server. What is the best way to disable the AI for a optimized server when no player can see it?
Think tarisland, where i can have more than 5000 mobs over the open world map. Running all them when players can`t see more than 100 is not worth it
I`m using void AMmorpgCharacter::OnSerializeNewActor(class FOutBunch& OutBunch) to awake AIs but how to detect when it is ready to sleep?
I have a gameplay ability that should spawn particle effects and sound effects at a location. What would be a proper way to have them replicate to other clients?
I also need to update variables on the particle effects at certain points in the ability
Do it runs only 100? do bots count as CMC?
CMC is the CharacterMovementComponent. In theory yes
Anybody using World Partition in MP currently?
Seeing an issue where the persistent level is being GC'd and the engine is trying to stream it out, curious to know if anybody else has run into this.
I don't want to replicate the particle system directly because apparently that will be too network intensive, and I don't want to use RPCs
My current idea is to use UAbilityTask_SpawnActor, or maybe even create my own UAbilityTask_SpawnParticleSystem
Then have the ability update those as it goes. But I'm still unsure how to let the owning client do it's own thing based on the locally predicted ability, and have other clients respond to the actual ability run on the server
I'm wondering. In a competitive game, where there are teams (let's say 2), if a character could turn invisible to those not in the same area (e.g. a high grass field or brush), what's the sanest way of handling that?
Simple state replication and handling the visuals on each client allows for cheating.
IsNetRelevantFor would be better, but I read that the delay on this actually taking effect is pretty high.
Let alone the fact that I don't know if the project I might use it on is properly perpared and doesn't break on itself if NetRelevancy stops replicating the whole character -.-
I did something like this for a "drawing" ability on a MOBA. At least I think it sounds somewhat similar.
I basically spawned the Actor twice, once replicated and once locally.
And made sure the additional actor that would come in from replication is hidden.
One can also probably fiddle around with NetRelevancy for that.
The Ability would modify the individual instance, with the Server one being used to replicate the changes to the SimProxies.
Is dormancy bad?
You can hide client side and stop sending updates
But don`t destroy
It will use the last known position, not that bad
Dormancy doesn't kill the actor, but also resends everything when the channel reopens so isn't ideal here I don't think
Also Dormancy is not per player or?
Dormancy itself like relevancy takes a while to kick in too, to avoid channel spamming
Ah yeah that too dormancy is global, not sure they ever did get per-connection dormancy working
So it would also break it for teammates and the local player
How did the server replicate the changes? Using replicated variables or?
This is more meant to hide from the other team unless they are in the same area
I suppose you could do a mix of both, send properties and use relevancy, so you get the 'immediatte' effect from properties until relevancy actually kills it off
So the NetRelevancy condition is something like if (IsOnSameTeam() || IsInSameArea()) return true;
The only issue would be if relevancy stops the properties being sent, so you might actually have a case for a reliable netmulticast ๐
Right, but I'm more worried about the other way round
If an enemy walks into the area, they need to see the previously not-relevant Character again
Preferably as quick as possible
And NetRelevancy has this strange delay
What is the problem with NetRelevancy? popping?
yeah, well I guess it has to reopen the channel and that could take a while to spawn the actor etc.
Given a freshly spawned actor spawns quicker
I don't think that's all
I feel like it's more a "Let's ensure the Actor is not relevant for at least x seconds before we really kill it off"
Yeah and that's the thing I need to have instant
I wonder if that's a cvar
Well "instant" you know
It might be yeah. IIRC it's to avoid spamming close/open channels when you're sort of hovering on the relevancy distance
Otherwise you could get a huge spike of packets due to imprecision or micro movements etc.
Do NetUpdateFrequency help?
Nah this is a lower-level thing
Isn't there something like "Net Cull Distance" or "Network culling" ?? And you can set it per object bases.. Not 100% how to code it or the 100% fundamentals of it.. But, I think it doesn't replicate or run on server unless you're within that region or distance
Net culling already works, I`m using replication graph but i want to reduce CPU usage and stop behaviour trees
@thin stratus
RelevantTimeout=5.0```
Laughable that this exists
Somewhat happy though if that solves stuff
But worried there isa good reason not to put that to 0.0 or close to it
Yeah there is, it's to stop spam when hovering on the cull distance
We have no cull distance in this game
Ah well, you're fine then ๐
It's a MOBA with a somewhat small map
The idea is to hide peeps that walk into the brushes
Typical MOBA stuff
But I'm not so insane to just OnRep that and wait for cheaters xD
...did they do it?
You wouldn't know. You aren't a dirty cheater.
You are the one that rages at why that <insert champ name I forgot> knew you were trying to gank the lane while sitting in that brush for 2 minutes.
I know that, but that's sadly not applying here
Valorant is FirstPerson, and the problems they faced are entirely different ones
Still a good read
It's a good solution but also one that only works when you can dedicate a very knowledgeable person to one very specific task, and have a highly controlled game environment
Gotta love the comments on that article though "lel this is old tech what"
Idiots everywhere
Game sense!
Do the invisibility has a timer?
Or is it like lol bush
/** Gives the actor a chance to pause replication to a player represented by the passed in actor - only called on server */
UE_DEPRECATED(5.3, "Replication pausing is deprecated.")
ENGINE_API virtual bool IsReplicationPausedForConnection(const FNetViewer& ConnectionOwnerNetViewer);
I have found that but is deprecated
LoL brush
Have u seen that?
bool AShooterCharacter::IsReplicationPausedForConnection(const FNetViewer& ConnectionOwnerNetViewer)
{
Don't think the project is on 5.3 yet, but using something deprecated isn't gonna be it
It is here
I`m using 5.3.2
I`m not sure why it is deprecated. Looks useful
void UVisibilityBasedReplicationNode::GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params)
{
Super::GatherActorListsForConnection(Params);
// Get the current connection
UNetConnection* Connection = GetConnectionManager().GetActiveConnection();
// Iterate through actors in the PotentialActors list
for (AActor* Actor : PotentialActors)
{
ACharacter* Character = Cast<ACharacter>(Actor);
if (Character && !Character->IsVisible())
{
// Exclude invisible characters from replication
ExcludedActors.Add(Actor);
}
else
{
// Include visible characters for replication
ReplicationActorLists[Connection].Add(Actor);
}
}
}
If you use replication graph you can create a custom replication graph node and override GatherActorListsForConnection.
But you need to trigger it on visibility change
I will certainly not use replication graph haha
tbh there's little point now anyway, iris is gonna replace it
In an RTS game, where should i be spawning stuff server side, like where to put the events
Why is iris experimental if fortnite is using it?
Is fortnite not production?
Fortnite is the test bed
Once Epic is happy with how it works in Fortnite it'll be moved out of experimental, of that I have no doubt
I see
I will replace now replication graph with iris then
Lost time with replication graph
Iris isn't really 'ready' in 5.3 tbh, still some issues
But the filters stuff is basically rep graph IIRC. Doing a deep dive on it soon
Am i doing something wrong here? Client spawns a "building" client side so they can see placement, then when they click it calls place building, then im trying to make it spawn server side and destroy the client side visual one
You can't run ServerRPCs in non-Client owned Actors
The client spawns the actor originally though, does that not count as client owned?
Ownership is a network thing
The Actor isn't even replicated
tbh, the Building shouldn't really do anything unless for whatever reason that's how it works for you
You should ahve some Building Manager that does all of that
Yeah it wont really do anything
How much in meters is NCD?
square root it, divide by 100
(sqr(10000000000.0NCD)/100) = 1000 meters so if I want one kilometer distance to my open world game I should set NCD to 10000000000.0
Ty!
Wait... so reliable multicasts don't care for relevancy?
They do but I'm pretty sure any pending reliables have to be acked before the channel is closed
Ah, so in a situation where it was relevant and becomes unrelevant before it had a chance to repliacte... i see ๐
So that doesn't apply to replicated properties you say... mhm
yeah, properties are unreliable so probably no garauntee you get them before channel closes
That's what I'd expect anyway
can server edit a blackboard value?
i have a few npcs that i can select and move, theres 1 thats in my level and i can move that one fine. But when i get the server to spawn in a new unit and i select it, i cant move it for some reason
"accessed none trying to read property CallFunc_GetBlackboard_ReturnValue_1"
Playerstate updates less frequently, I've never used wait for attribute change before so can't help much there, but maybe use repnotify attributes and respond to that instead of working the other direction?
guyz how can i send RPC with widget
i know widget's are not replicated
but how can i solve this problem
what is the best approach
Send it with the playercontroller? ๐
thanks for reply bro
yea i am able to send with player controller
but problem is
i have to write all neccesary functions in player controller
SOLID principles are dead in multiplayer ?
i wan to know this
So i mean for exaple there is door and door have widget
i wan to call open door function
do i have write opendoor rpc in character
and trigger with the widget
i can able to with Interact interface
this works and flex
but interact interface only one have code block i cant every control with the interface funciton
Logically is the door asking to open itself?
The player is using the button though so I don't think it's unreasonable to involve the PC in the logic/interface
But ultimately it's the way the engine is written and it's easiest to work the way it's intended
So, is it possible if I send an rpc via Pawn and the player obtains this pawn control?
thank for your effort Kelso you are good man
The actor needs to be owned by the client. I believe possessing a pawn does make you the owner but ๐คทโโ๏ธ https://cedric-neukirchen.net/docs/multiplayer-compendium/remote-procedure-calls
Other ways for Replication are so-called โRPCโs. Short form for โRemote Procedure Callโ.
So, we are continuing our quest from yesterday, but today with a new approach:
- Created two blank projects in both UE 5.3.0 and 5.3.2
- The two with same code, pawn and a mesh and nothing else
- We two join each other and still get ~60 ping (the top-left big white text is the result of
GetPingInMilliseconds) - Both with 200+ FPS
Even more clueless now. Ideas on what we could be debugging on?
I know this may not be of help at all but since youre stuck I might as well, these are my in my DefaultEngine.ini and I've never had this ping issue
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxNetTickRate=60
NetServerMaxTickRate=60
LanServerMaxTickRate=60
NetClientTicksPerSecond=60
MaxClientRate=120000
MaxInternetClientRate=120000```
sorry for the borderline pseudohelp, I don't have any other leads other than vague engine config settings
I'm trying to do "As Client" (i.e. 1 player on a dedicated server) and getting a crash that leads to this:
OnViewportResized(GEngine->GameViewport->Viewport, 0);
I'm guessing tha'ts because there's no viewport on the dedicated. Duh. So the correct function to wrap this in is
IsRunningDedicatedServer()
Correct? 
Well that worked anyways 
You sure GetPingInMilliseconds is returning good data?
Test the round trip time with rpcs
So PIE with listen server + 1 client (separate instance) is very laggy, even though CPU is not going above 35% and GPU 40% and it's literally same computer so why is there so much lag? 
This is a barebones project with absolutely nothing going on yet
But like just a sphere with replicates movement is jittery as hell
I think it's throttling the other when either is in focus
This is off
But FPS still goes way down as soon as window loses focus
And client lags when server is out of focus
Engine is optimizing for in/out of focus I think. I bet there's a console command or something...
Okay, yeah, confirmed.
When I put both in standalone it's much more obvious
Focus-based throttling is my number one most hated thing in computers man
I hate when software tries to be "smart" in a way I didn't ask for
Why don't you let me worry about what is in focus
Might be Windows changing its priority
Since this is off, if it's really doing what it says then what else there is
Or the engine is lying in some way lol
Well
This is standalone now
Editor prefs aren't relevant, right?
There must be a console command or some ini setting
Oh that's not in the project settings, right
For the engine itself ?
Also
When one is on focus
CPU is only 60% and GPU is 10% (tiny windows)
So it's not like we're pushing resources
It's just throttling itself when out of focus
I don't see how windows oculd be responsible for that 
I guess this isn't really about multiplayer anymore though so I'll look for a more appropriate channel
Hello
My character is a mesh that only the player sees and has another mesh that only the rest of the players can see (the typical Owner not see), I would like that when an item attached to the character spawns, the rest of the characters only see the item that is attached to the mesh they see, and not the item that is attached to the mesh the player sees
It's quite difficult to explain hahaha
Reading this:
Client-side prediction with server authority is considered the gold standard, however it comes with downsides; it is vastly more complex to develop, takes considerably more time to develop, and has high processing costs so for larger games such as battle royales or high player-count shooters it can become incredibly prohibitive for a server to process the prediction of so many players.
My game is coop only, so there is no point in any attempts to mitigate cheating. Is it possible to just... not use server authority for movement? Since there would be no benefit for me 
The CMC has a setting that allows you to disable authoritative updates, disable it and see how you go.
Though, if your game has low player count (which most Coops do) you probably wont benefit as much from the decrease in overhead as other types of games might
I'm not concerned with the overhead as much as the extra dev time
If you are using the CMC, then it costs you nothing in dev time, as its already supported.
By default.
"Prediction" isnt a singular system you just enable or disable for your game.
Hmm yeah now that I think about it the stuff I would need to not be server-auth is the stuff GAS is doing 
It is a concious choice by a programmer to introduce to a particular feature.
GAS is what's setting the movement speed conditionally
Some features, like the CMC, already come with it developed.
There still would be a benefit, what happens when 2 clients say they're in the same place?
They're both authoritative, they're both right, so who's actually standing in the spot?
Why would two people being in the same spot be a problem? 
I mean maybe it is, maybe it's not, IDK if you have collision between players. But there's all sorts of problems you can encounter similar to that. 2 people having different ideas on the game state.
Sure. In my game there's collision between players but they nudge each other, so they'd just shove each other mutually until colliders depenetrated 
I get what you mean though
THe thing I'm having trouble understanding is how I execute a prediction
how do I run code on the client that it normally isn't allowed to run because lack of authority
I'm reading a lot of stuff and just seeing people talk about performing predictions but not how
The CMC handles a lot of that for you, do you have any weird movement modes or just the basic walkin and jumpin?
I have sprinting implemented via GAS movespeed attribute and an ability that applies a modifier to increase it. Also stamina consumption and so on
So prediction needed around when stamina depletes and so on
But I'm stuck on Square 1 because I can't even figure out how to "edit the client-side stamina value"
I just keep reading more and more posts and guides and not a single one has illustrated what it actually looks like to predict something
They just say when/why you want to do it 
I'm like a PHD on the theory at this point
A prediction is simply executing an action immediately that you are assuming is going to be accepted by the Server as correct. The Server will execute the same action and send down a result, if the result differed the Client will correct itself to what the Server decided was correct (thus meaning the prediction failed).
If there was no difference then the Client carries on and does no corrective action.
If done correctly you should just be able to read the stamina and call it a day
that's what GAS gives you
So how do I execute an action immediately that I assume will be accepted by the server
Run it on the Client
execute ability?
Depends on what it is
So for example Stamina drain or recharge
GAS only replicates the final value of stamina when it replicates
So it goes up jittery/unsmooth
That doesn't sound right
It is. It doesn't replicate periodic effects, just the outcomes (via replicating the actual attribute)
So when the attribute is updating say 10 times per second on the server
It's not gonna replicate 10 times per second on the client
So it's unsmooth
So I'd like to "simulate" it on the client
Predict it
But I cannot seem to find any way to modify the client's perceived value while waiting for the next replication
just interpolate in the widget or wherever
itnerpolate / extrapolate
Oh the widget could lie... and OnRep_Stamina can just force the widget to the correct position every time Server updates Stamina... 
Wait but

Then widget shows 50 stamina, but you cannot use 50-stamina-cost-ability
Surely there is some way to force the client's stamina value to what I predict
Then client predicts it has 50 stamina, allows activation of ability, by time ability activation reaches server client does have 50 stamina so it works
If the widget is faking that won't work
prediction is hard as fuck
I'd just interpolate towards realvalue at somespeed
it's conservative, it'll never lie to you really
yo i need to connect to this game with a friend and i'm not sure what im supposed to fill in as a host/join because I have weak understanding of ip and ports can someone help me
does anyone have any idea
if i need to write in my public or private ip address, and how i setup my port forwarding rules? i opened a port but im not sure if i got the info right
The issue is not what to set the value to! It's HOW to set the value at all! 
Changing the widget doesn't allow me to fire an ability with gas that requires the correct amount of mana or stamina
@hasty yoke Are you using Sessions? You should probably do some research on how connecting to other matches is usually managed in Unreal.
The stamina regen is per second, so knowing what to set it to is trivial, it's just math. The question is How to actually set it via the client's prediction logic
It predicts a value that the server is probably at--good! Now how do I set that value
no im not ๐ฆ its ggpo but i cant seem to find a channel about general networking questions
@lucid badger Clients can still set a local value of a replicated variable.
When the Server sends a new value down, it will override the Clients
I can't directly set the value via GAS, you ahve to use instant effects but those seem to be server-authoritative
This isnt a general networking quesiton, it is highly dependant on how you are deciding to architect your game.
I don't seem to have "client side prediction-only effects"
Read through this if you are using GAS
Yep I'm all over that
It's guilty of the same thing with regards to Prediction. All when/why but zero "how"
Is that the correct way to spawn an actor? This is inside my building component on the player controller
kaos is helping me in the #gas channel now, apparently you have to use Wait Net Sync but I don't yet grasp why it worked 
It works fine in stand alone, but not in client. Do i need to replicate the "Building To Place" variable?
pretty much at the moment, the client spawns a building locally just to see it and position, then when they place im calling those server functions to spawn the building server side and destroy the local actor
That wont work.
You are passing through an Object (The locally spawned building) to the Server.
You admitted its local only.,
So how would the Server know what that object is
In order to use it to get the class to spawn etc
You would need to pass through the static information you need to the Server instead.
ah right, so would i have to tell the server what the object is the same time i spawn it locally, in a replicated variable, then use that to spawn on server side?
There is no need for a replicated variable
You just need to change the Params on your RPCs
so just pass the class instead of the object
And the Transform
yep
Since the class is an abstract, it has no idea what a Transform is
So you need to pass the Transform as well to be able to place it correctly on the Server
also one other thing, i have a springarm for a topdown camera on my players that they can adjust the length of with scrolling to zoom in and out, yet if i got client i get this error
"Blueprint Runtime Error: "Accessed None". Node: Set TargetArmLength Graph: EventGraph Function: Execute Ubergraph RTS Controller Blueprint: RTS_Controller"
Do i really need that to be replicated to work if its only ment to affect the local client?
Unless you have Server code that relies on the length of the SpringArm (which is doubtful) then no, you dont need the Server to know about it.
Thats all i have and it is only for the client so not sure why i get the error and springarm doesnt work at all
nothing else references to the springarm
Got the building spawning properly now though, thanks for that
Well is your BP player property set at this stage? Probably not hence the error
Probably not, i thought being client side it should be fine
You can always just get controlled pawn
Yep that worked, thankyou
Thatll help me fix a heap of other widget visibility stuff too i imagine xD
If you ask your game to read a property you should think about how that property gets set
ahhh just that one thing fixed soooo much stuff xD
Thanks for the help guys
down to 0 errors now. Time to make some more spaghet to get them numbers back up ๐
launch from the debugger in the first place
-WaitForAttach on the command line
-server YourMap
-WaitForDebugger does the same, if it's easier to remember
it doesn't do the same
oh, as waitforattach
you'd need both
IDE or with -WaitForAttach from the command line. Or neither if you're running single-process PIE
if you're not running a separate process for the server it's entirely unnecessary to do any of this
...no? it changes nothing about how you build
Is there any way to benchmark multiplayer games ? (dedicated server)
Can i start a lightweight client
Is it impossible to send UObjects created on client side with server RPCs? I wanted to do a data payload kind of a UObject but even if I make the UObject replicated, server won't get the object that I'm sending, since it doesn't exist on server, right? Only solution comes to my mind is creating a struct and sending that. But that requires to put every parameter in that single struct and I would be happier to be able to create custom classes to separate and group related variables together and create object according to my need
Nope
You'll want it to be a struct
However, you might want to take a look at FInstancedStruct
sounds like it might interest you
It's a wrapper for "any" USTRUCT
So you could make a struct that has your UObject class as a field and then an FInstancedStruct for "any" data that specific UObject needs
Oh that sounds like it could be fitting to my needs. I'll check that, thanks
Is it possible to make: me (client 0) see something different from the rest of the clients?
How different?
Yes, because I have a first person project, and being firstperson, the character is 2 meshes, one is the arms that the player sees and the rest is the complete mesh that the rest of the players see
But, by equipping a flashlight in both hands (the one with only the arms and the one seen by the rest of the players) I want only the correct one to be seen for each client
"only owner see" or just completely having it only exist for the local player I guess
Thanks
What ini was that in again?
DefaultEngine?
I want to spawn damage number actor only on my client
UFUNCTION(Client, Reliable)
void SpawnDamageNumbers(float InDamage, bool IsCrit, FVector EnemyLocation);
void SpawnDamageNumbers_Implementation(float InDamage, bool IsCrit, FVector EnemyLocation);
void ASentinelCharacter::SpawnDamageNumbers_Implementation(float InDamage, bool IsCrit, FVector EnemyLocation)
{
AFloatingDamageActor* DmgActorReference = GetWorld()->SpawnActor<AFloatingDamageActor>(FloatingDamageActorClass, EnemyLocation, FRotator(0, 0, 0));
DmgActorReference->InitializeTimeline();
DmgActorReference->CalculateDamage(InDamage, IsCrit);
}
Where im calling this is in GameplayEffectCalculation
void UDamageGameplayEffectCalc::Execute_Implementation(const FGameplayEffectCustomExecutionParameters& ExecutionParams, FGameplayEffectCustomExecutionOutput& OutExecutionOutput) const
{
...
ASentinelCharacter* Sentinel = Cast<ASentinelCharacter>(SourceASC->GetAvatarActor());
AEnemyBaseClass* TargetEnemy = Cast<AEnemyBaseClass>(TargetASC->GetAvatarActor());
if (DamageMulti > 0.0f)
{
InDamage *= DamageMulti;
}
if (CritMulti > 0.0f)
{
UE_LOG(LogTemp, Log, TEXT("Crit Calculation"));
UE_LOG(LogTemp, Log, TEXT("Random Range %f"), FMath::RandRange(0.01f, 1.0f));
UE_LOG(LogTemp, Log, TEXT("CritChance Range %f"), CritChance);
bool IsCrit = FMath::RandRange(0.01f, 1.0f) <= CritChance;
if (IsCrit)
{
InDamage *= CritMulti;
UE_LOG(LogTemp, Log, TEXT("Crit evaluated"), InDamage);
}
Sentinel->SpawnDamageNumbers(InDamage, true, TargetActor->GetActorLocation());
}
OutExecutionOutput.AddOutputModifier(FGameplayModifierEvaluatedData(DamageStatistics().InDamageProperty, EGameplayModOp::Additive, InDamage));
UE_LOG(LogTemp, Log, TEXT("Damage - %f"), InDamage);
}
the problem i have is this actor still spawns on server and not on client
Is ASentinelCharacter Client Owned?
Yes
The only reason this would happen is if it was in fact not
That's an actually possessed Character?
On another note, you might want to do this in your AttributeSet Post GE bla.
Sometimes Damage is still changed by the Attribute before actually applying
E.g. by a Shield
Problem is
i can of course
but i need to make something that will tell me that is a Critical hit
Hm I think there was something you can do via Tags for that reason
Might be worth asking in #gameplay-ability-system
Kaos might have an idea
But either way, the RPC would be the same
Not entirely sure why it's spawning on the Server atm
My theory is Execute_Implementation is server only
and that is causing this
but still
function is called on server
Well yeah that is indeed only server side
and executed on client
But you need the Server to call the RPC anyway
Putting that to 0.0 seems to cause problems :D mรคh
I can't access the only owner see from the spawn actor
Then access it after spawning?
OwnerOnlySee is a Component Variable
You need to get the Component that you want to make only owner see
It is not a component, it is an actor
The idea I had was to access the spawned static mesh and mark that boolean as true, but I can't access the static mesh
Actors that are visible do so with component primitives
Or just set the value in the asset I guess
The problem is that the same flashlight that I spawn for my character, I also have to do it for the rest, I don't know if I'm explaining myself correctly
The static mesh is possible to retrieve at runtime by finding the component?
Or exposing a function that does this in the flashlight, or setting things in the flashlight based on local net role etc
Is locally controlled etc
๐
That worked, just that node I needed
thank you so much
Keep in mind that you might have to change what this means later
If people want to move the flashlight between players etc
I don't know any other way to change it, because I can't expose a variable from the actor because I'm spawning the actor through a variable of type actor class reference that I get when I pick the item
I realized that, with the character that I control, for some reason I also see the flashlight in the mesh that shouldn't be there
That mesh can be hidden for the local client
Multiplayer code is just a lot of "actually, the client does this"
Or sim proxy (other clients on a client) etc
I understand, thank you
Any idea how to send data to a gamestate from a client?
through the player state
Anyone Ever seen this? I'm using the EOS subsystem on UE5.0.3 and trying to get the player names. It only returns some 3 digit numbers (e.g 325 and the next player name is 326)
Sounds like the PlayerId which is a UE thing
I tried it with the straight set player array, not the replicated one
Whatever I tried it doesnt return anything else than the numbers
Yeah then the Subsystem seems to apply the name strangely
Might want to ask in #epic-online-services
Have u ever seen this tho?
or any idea on how I could force to get the name? Possibly with custom c++ even?
I don't use EOS
The ID itself sounds very much like the PlayerId
That youcan get from the PlayerState
yea, thanks anyways! Why not replicate the array btw?
It's for a replicated player list
Because the PlayerController doesn't exist on anyone but the local Client and the Server
A client doesn't have access to other player's playercontrollers
That's why the PlayerArray is having PlayerSTATES
The script is run by the gamestate*
Which are replicated to everyone
Doesn't matter
PlayerControllers don't exist anywhere but owning Client and Server
Okay interesting, appreciate it!
Is there another way besides that?
Now btw. If I wasnt using EOS, it should atleast display like "WIn..." or "Pc..." something right?
With NULL, yeah
yep, so its less of an eos problem I would assume
Every Subsystem can provide a name for the PlayerName stuff
yea so its more of a problem of the get player name node isnt it?
Yes and no
The name it returns is provided by the Subsystem
E.g. Steam would set it to the Steam Name
idk why you get a number for EOS
Is there anywhere where I could see whats going on?
Access the get player name node somehow?
In C++ you could follow back on the name
FString APlayerState::GetPlayerName() const
{
return bUseCustomPlayerNames ? GetPlayerNameCustom() : PlayerNamePrivate;
}
bUseCustomPlayerNames is probably false, at least I assume so
alright, how would I access the C++?
On some nodes I can double click the output and it opens visual studio
Doesnt happen here
Just navigate to it via Visual Studio
PlayerState.h and search for it
Opening which file would I open? ๐ Havent worked much in c++ with the engine yet sry
nvm. I found it
I got an answer for you though, at least partially
// Init player's name
FString InName = UGameplayStatics::ParseOption(Options, TEXT("Name")).Left(20);
if (InName.IsEmpty())
{
InName = FString::Printf(TEXT("%s%i"), *DefaultPlayerName.ToString(), NewPlayerController->PlayerState->GetPlayerId());
}
ChangeName(NewPlayerController, InName, false);
is that the fix, or what I'm lookin for?
wait lol
thats it
it has no return function in it
should I just add: {
return bUseCustomPlayerNames ? GetPlayerNameCustom() : PlayerNamePrivate;
} to the end?
fair enough lol
what was this referring to btw?
What I posted is what UE does:
FString AGameModeBase::InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId, const FString& Options, const FString& Portal)
{
and there's no name in there right
It seems like if no Name is passed by the connection spring
Then it will take the DefualtPlayerName of the GameMode
And add the PlayerId
The PlayerId is what I meant looks familiar to this
ahhh thats why
So I assume your DefaultPlayerName is for one empty
And there is no ?Name being passedb y the connection string
Why there is none passed, that's a different story
so the problem lies in the game state array of the player states?
No
The Problem is the connecting player not passing over a name I would think
When joining, a player does this:
// Send the player nickname at login
FString PlayerName = GetNickname();
if (PlayerName.Len() > 0)
{
URL.AddOption(*FString::Printf(TEXT("Name=%s"), *PlayerName));
}
With GetNickName being
FString ULocalPlayer::GetNickname() const
{
UWorld* World = GetWorld();
if (World != NULL)
{
// Try to get platform identity first
FString PlatformNickname;
if (UOnlineEngineInterface::Get()->GetPlayerPlatformNickname(World, PlatformUserId, PlatformNickname))
{
return PlatformNickname;
}
FUniqueNetIdRepl UniqueId = GetPreferredUniqueNetId();
if (UniqueId.IsValid())
{
return UOnlineEngineInterface::Get()->GetPlayerNickname(World, UniqueId);
}
}
return TEXT("");
}
okay maybe that part of my engine is screwed
imma check
There you can see the Online stuff coming into play
yep
World is probably valid
Bit strange that both functions would fail
Maybe your EOS setup isn't correct
but that would cause it to send an empty name
You can see that in the Logs too
There should be a BROWSE entry in the logs
with some ID and also the ?name stuff
lemme check
hey, so I made a custom ASpectatorPawn class and set it to my default spectator pawn, and that ASpectatorPawn class has a CameraComponent as a root component. When the servers makes a player go into spectator mode with ClientGotoState(NAME_Spectating), it doesn't seem to use the camera component.. it seems to be some generic camera.. and this ONLY happens in dedicated servers.. in a listen server it isn't an issue.. which doesn't make a whole lotta sense cause spectators are purely client side arent they?
Hi! Can someone explain to me UObject replication logic(especially in TArray)? I read different documentation about replication, but something I didn't get. Do I need to create instances for server AND client, so they replicate with each other, or just on server only?
Because I already have replicated TArray of UObjects, but it's created in BeginPlay, so they called both on server and client, and they works perfectly. But when I try to create new object realtime on server - client OnRep get information about TArray changes, but all new elements are nullpointers
There is actually no BROWSE entry in the logs
I searched everything and I can't find anything that ever calls for the players name
yep
PIE: Server logged in
PIE: Play in editor total start time 0,168 seconds.
LogViewport: Scene viewport resized to 1550x861, mode Windowed.
LogEOSSDK: LogEOS: Updating Platform SDK Config, Time: 0.057717
LogPlayerController: Error: InputMode:UIOnly - Attempting to focus Non-Focusable widget SObjectWidget [Widget.cpp(802)]!
LogViewport: Display: Viewport MouseLockMode Changed, LockOnCapture -> DoNotLock
LogViewport: Display: Viewport MouseCaptureMode Changed, CapturePermanently_IncludingInitialMouseDown -> NoCapture
LogBlueprintUserMessages: [BP_GameState_C_0] 346
LogBlueprintUserMessages: [GM_Lobby_C_0] Player Connected
--> the last 2 lines are called by my string trying to read the players name
earlier there is this note: Start Session (User: ...)
Does this sound dumb?
I have a game with multiple clients. 2 clients are on the same team. They have a building that npcs bring resources to which both clients share.
If client ones npc delivers to the building first then I would ignore client 2โs npc contribution? Does that seem like a reliable way to sync things across the network? Fastest client would keep everyone in sync in this case. No one is clicking these npcs. Just assign them a job and they do it
Well, the clients should't probably be the ones running that logic, you'd rather have that happen in the server and replicate the resources to the clients.
The second part of the issue is the order in which the resources are collected - I don't see many issues there - you can implement a queue so that there is some kind of order and timing on delivering the resources (for example, vespene gas mining in starcraft), or you can just let them deliver the resources instantly, there is no problem at all with that.
i guess on that part Im confused. How would I have the delivery event be client agnostic* Right now I have my teams and their values on the gamestate (which I know is on the server and repped to clients). Ive done a bit of reading but I feel like Im missing something
Have you read the network compendium?
It's the first pinned message on this channel
yes I use it often
Well, actors are replicated - basically the server will be running their logic by default (specially for characters etc). Your server usually is the system running the most logic and replicating values to clients, that's the default setup for Unreal (and many games/engines)
You can check for authority/net mode to conditionally execute logic
ahhh right so I check if the npc has authority then that means its running on the server.. trigger delivery event boom
i got you. I think I was just thinking myself into a hole lol
Yes, exactly
one server to rule them allโฆ ๐
How would I go about making a similar system to Galactic Conquest in the original Battlefront 2?
https://www.youtube.com/watch?v=txCE7kIGQK0
Where you can select your fleet/character and move to the nearest planet
#starwars #battlefront2 #elitedifficulty
- This game is quite difficult on Elite difficulty. I've been playing this game for 17 years and I even struggle sometimes so I wanted to make a series detailing how to beat each mission on the hardest difficulty in the game!
- If you like this style of videos, make sure to...
- LIKE - COMMENT - SUBSCRIBE...
Simple idea - That is a map in of itself. Each point has a reference to the map it will go to. Then to move the ship (IE - the player), you just do something like AStar for simplicity.
How can I limit where the player will be able to go to?
Could probably even cut out the AStar part and have an even more simple approach in that things are referenced to each other and then you just do a simple move to the points
With AStar? That'd be just cutting the node out of access really.
I've not heard of AStar
I'd definitely recommend studying up on it. Pretty foundational algorithm for pathing. Even if you don't end up going with it here.
It's used quite heavily in many areas
I just need a basic system where you can only travel 1 location ahead and not just go anywhere on the map
Then do the 2nd one I mentioned. Where you hand set things up.
I gave you the simple high level ideas. Now you need to break them down and implement them the way you'd like.
I'm not sure how to make the movement system though
Like how to limit the locations you can jump to
Hi! I have a question about debugging multiplayer. There seems to be a bug in Niagara, in which running more than one game under the same process will cause some exceptions. Running server and client(s) under different processes fixes the issues. However, this also makes debugging less straightforward, since the client is launched in it's separate process, detached from IDE debugger. I assume I should be attaching the debugger manually to the client and debug in that way, right?
If I change bAlwaysRelevant for an actor on the server at runtime (on an actor that spawns as only relevant to owner) is that possible and/or do I need to make an additional step to replicate the actor onto the other clients? I've tested setting it on the server and the value changes but the actor doesn't show on the other client/s
I probably just need to have the client-only actors stay that way and use an RPC to spawn new relevant actors and delete the client-side actors, it's not an event that will happen frequently so not a big deal
I'm trying to spawn a projectile at a components location. it works on the listening server \ client and standalone... but not when I do play as clients. I tried messing with replication and making sure the components replicate but nothing seems to change. The projectile spawns somewhere below the ground. How can I get this projectile to spawn on the component and not someplace else? Debug sphere show the component location in both the wrong spot and the correct spot.
How are you spawning the projectile?
@dire cradle UFUNCTION(Server, Reliable)
void HandleFire();
void ABaseCharacter::HandleFire_Implementation()
{
if (GetCharacterMovement()->IsFalling()) return;
FActorSpawnParameters spawnParameters;
spawnParameters.Instigator = GetInstigator();
spawnParameters.Owner = this;
UObject* GunBarrelTipObject = EquippedWeapon->GetDefaultSubobjectByName(TEXT("Gun Barrel Tip"));
USceneComponent* GunBarrelTip = Cast<USceneComponent>(GunBarrelTipObject);
GunBarrelTip->GetComponentLocation();
UWorld* World = GetWorld();
if (World && ProjectileBlueprint)
{
World->SpawnActor<AEnergyRifleProjectile>(ProjectileBlueprint, GunBarrelTip->GetComponentLocation(), GetActorRotation(), spawnParameters);
}
}
I have tried a lot of things but I tried this. The component replication is set manually in the blueprint.
@dire cradle hey this is related to the stuff u helped me with yesterday any ideas ๐ ?
For multiplayer the widget needs to be created client side
oh right
It's a bit hard to explain the solution through text
I'll provide an example
Can i ClientTravel without a loading screen?
nice ty
^ Game Mode
v Player Controller
It's probably a good idea to return the controller itself in addition to the character with the delegate as well, didn't do that here
So handling multiple clients at the same time wouldn't be an issue
Do ClientTravel maintain state? how?
@dire cradle ion the player controller the last node "event dispatchers" it need logic inside it also ?
No, just the commented section
@dire cradle oh okey,
im unable to find the bind event :/
Have you created the delegate?
This
yeah in player controller
compiled?
Guys how do i ClientTravel to another ip/port but don`t show a loading screen / use same world position?
@dire cradleok yeah that worked so it creates the widget but dosent asign the widget afterwards
hm
Assign the widget? Do you mean it doesn't add to viewport?
nah the choose widget spawns correctly for all palyers when i select unit it spawns but the "player hud ui" dont sapawn
Have you called the "Start" event you created yesterday in the character?
From the GameMode after you spawned the player
or in controller i dont remember
@dire cradlehttps://blueprintue.com/blueprint/qrk9ieni/
Looks like it's fine
Do pass the controller in the onSelectedCharacter event though like I mentioned
it will be less error prone
No idea why the hud doesnt spawn, it might get fixed if you do this though ^
here
just add a player controller reference
and pass "self" when calling it
Then use that in the gamemode instead of pulling from the handle new player starting event
dont forget to compile
done
testing
oh the UI dident even spawn on standalone,
yeah the client gets the UI created and created the character but unable to move & UI so maybe the controller gets assigned wrong ?
@dire cradle
so if i change this to player character 0 it worked for the standalone (locally)
so the problem must lie here
dont use that index in the Get Player Controller
yeah i know, it was just test where the issue were
I have an issue where my game isn't properly replicating the location of my "muzzle" on my weapon actor.
Standalone: the muzzle is properly located and its direction is properly drawn (blue sphere, purple line)
Client: the muzzle is not properly located.
This is frustrating because the muzzle is clearly properly attached to my scene root and moves/rotates with the character.. However there is a vertical offset where the muzzle is just sitting below the barrel. I'm not sure why it does this.
Beyond this issue, when I have a subsequent "look at" command exectue in the animation blueprint, the client+server visually properly update the static mesh and point the gun itself at my crosshair... but the muzzle itself and the debug drawers do not follow
does it work now? @queen escarp
the start was an "object" i tried passing the player controller so i changed to that
Revert the stuff you did in the character and make the "Start" event Run On Owning Client, reliable
@neat prism Can't have an idea without knowing how the muzzle is attached / spawned / its location drawn etc
As seen here, the weapon mesh, muzzle, and debug drawings properly "Look At" the target in standalone, but when running as a client/server setup, only the mesh properly "looks at" the crosshair while the muzzle+debugs do not
kk will get my stuff
wdym revert the stuff i did in the character :/?
The cast
it will always fail
You plugged a player controller reference to a character class cast
ah aye
Muzzle component (USceneComponent) added manually to Gun Blueprint (which derives from C++ Actor class). I do not spawn/instantiate the muzzle component in the constructor of the C++ class. It is created in the blueprint.
Muzzle component itself derive from its own c++ class (perhaps unnecessarily?)
@dire cradle ok if iwanna make it reliabe it hjas to be run on server /owning ?
oh owning ofc
reliable basically means it wont be ignored, skipped if the server is under heavy load
yeah i know that*
ok so now it worked for listen/locall
but client still unable to cotnroll/ui
Should have also said: the muzzle compnent is attached to a socket that exists on the selected skeletal mesh
can you send the gamemode and the character again?
so it is strange that the static mesh visually replicates to all players and the server but the muzzle itself isn't properly following
is the start event run on owning client now?
Then the drawing of the muzzle location is simply in the character blueprint behind an IsServer HasAuthority check
@dire cradlehm no
do it
the start evene itself is runn on owning client
but its being called in the bind event
how do i change that on those events ?
you cant, i guess you have to do a workaround
it's ugly, but usually it solves the problem
Did anythinig I provided help give any ideas about what I should check to fix my issue?
Honestly I have no idea, looks like it should work
try putting a static mesh instead of the muzzle and check if it's position reads correctly
ok so now its running opn owning it spawns and possessess, but still cant move / ui
if it does, it's a problem with the muzzle component's C++ side
on client standalone works*
the hud doesnt spawn?
well i changed the "start event" to also run on owning then it spawned but still cant move
I see, I'll create fresh assets and disable smoothsync to see if that fixes it
This event is in the game mode, so this wouldn't happen on the client that owns the player controller, which is where you need it to happen
@sinful tree yeah nmoticed that also
Can't move yes, but does the player hud spawn? @queen escarp
it will tell us if the start event is even running correctly
do you mean by "move / ui" just can't move? Or does the ui also doesn't spawn?
i did and the input works*
@dire cradlehttps://gyazo.com/00375de776985e6908dd09225a034aa0
this is standalone
this is client
The errors tell you where to look at
why do you need a reference to the parent class of the character?
all 4 different player unit chooices derives from the parent class
Still doesn't require a reference?
The child classes already have access to any variable or event in the parent class
hm
well the player hud is a child of "parent widget class" wich is this one
it basicly just hold referenses
but those fail on client side
i see
since widgets are always locall not created on server using the "get player character 0" would work right ?
yeah it should
If the player doesn't have the character to begin with, then the cast would fail, which means none of the other variables would be getting set either.
the widget gets created in the character itself
after possession
wait, not necessarily
nope yeah it shouldnt be a problem
since the parent wb is created before i select characrt
maybe thats why
maybe i should create the "parent widget" after i create character
isn't it created in the "Start" event?
im confused
are the widgets being created before the character gets spawned and possessed?
I thought you were creating them in the start event, which is done after the possession
oh right yeah im creating the player hud widget in the start event
and when the player hud is created then the parent one is also created right ?
ok so this is where im creating the "player_Hud" wb
and the player_hud widget is a child of "Parent_Wb"
this shouldn't be causing a problem
yeah right
since its creating in owning player player the owner should be fine right
yeah it's local
There must be something else in there you're referencing that's causing a problem
well in my "player_Hud"
check if the casts are failing in the widget
im referencing stuff from the "parent_Widget" inside the "player_Hud"
those are the stuff im getting errors from
this is the parent Wb
check if those casts fail
in the beginning of the start event, could you put a short delay like 0.2 seconds?
and see if that changes anything at all
hm yeah
then the game mode failed
but game mode cant be accessd from clients should be "authority only right ?"
game mode only exists on the server so that's normal
you cant cast to it in the client
it's a timing issue, in the widget do this, hold on
This will make sure to wait until the controller finishes possessing the character
remove the game mode cast, and it will work
yes, if you need that reference for the server do that
hm yeah so did "if server" removed the game mode fail ofc
use has authority switch
and tried tdelay on character but its still giving error
there is no node liek that in a widget right
that means you're trying to access the variable before it could be set
validate them before using them
you should neve ruse Get Player Character or Get Player Controller by index in multiplayer games
never use*
that did fix it