#multiplayer
1 messages ยท Page 135 of 1
ye
i mean each client have their own component , if i wanna Reff their Pawn i have to set it and just on their owning client :/?
and the owner will be valid in the client aswell, if this is a component that you added in your blueprint
y
so ye, theres nothing to RPC or set :3
well
ok its not the problem i realize now its setting as it should..
im just debugging this are since i have a target actor bugg
the "target actor"
on the client is null
and im setting the variable replicated on server..
dont get it
where is this target actor set?
I have this code for opening and closing a door with a timeline, but it doesn't replicate for the client, what am I missing?
in which component and where is this component at?
this piece of code is run in the server?
no its run with a owning client event
however the set w/notify use to be a server event
to set the actor
u shouldnt set replicated variables from an owning client
review ur logic and ensure that wherever you set this variable lies in the server
ow, some stuff here
i mean this is how it was before..
not a rep notify tho just a replciated variable*
still dident work
it depends on your logic, but setting the variable on the server is the way to go
yeah but thats what im doing
this cast to unit base... is it being called from the client?
y
ohhh
do the server need to cast ?
but its getting a local reff and sending that reff to a server event
should be fine ?
you shouldnt Server RPC from a non client-owned actor... if the timeline is replicated you dont need to call it from a multicast, ur safe calling it from the server, the update method will trigger aswell in the client, give that a try
is this being called from an input? i assume so, right?
one more, you shouldnt send a client rpc from an input event
its already in the client
so remove that client rpc
owning ?
ohhh maybe that was the issue
not sure if I did what ur talking about but I wiped out the Multicast entirely.
remove also the server rpc, not need it, ur already in the server
also ensure ur actor is replicated
this might be important
on top of that put a has authority to ensyure this logic runs only on the server
no not important, u dont need to replicate movement
u have the replicates set to false lul
switch that on
i have that all the time icarus, dont blame urself xDD its a cheeky boolean
where should i put the has authority
hmm
2 things still, remove the rpc, u changed the rpc type, u gotta change it completely
and the has authority, once u've removed the rpc put it wherever you preffer inside or outside the function
the timeline replication weill handle ur network fluff
works but the door snaps in the client
jumps?
ah thats probably because of the net update frequency
try crank that up
once u do that try again
and we'll do a follow up, on why this is a terrible idea haha
still snapping ;-;
ok i solve lots of things you guys seem know few stuff anyone know how to connect ODBC to have admin rights ?
ow, skill issue on my side then haha, lets go to do the proper solution @twilit spruce
so from authority, call a multicast
and that should be it, turn down the net update frequency
when u got time / vori ๐
thanks for your help ur a legend
so icarus, i totally thought that replicated timelines would give u a smooth update rate, when u told me it snapped i though it was a frequency issue
now calling it from a multicast ur essentially running the replicated timeline in the server, ensuring authority has still control over it
:O
while allowing a smooth animation by calling it in all the clients
through the multicast call
that actually makes sense
thank you for not pasting the Documentation link and ghosting me <3
i just had big skill issue thinking that rep timelines would work differently hahahhaha
hey @queen escarp hellooo
ur having whats called a replication data race buddy
if you set a variable in the server, and then in the same frame u want to use it in the client
it wont have time to replicate
ye as a quick fast fix
u can do this
pass the unit bp to spawn target vfx aswell
that dosent work
why not? :)
?
its one extra pin
one extra parameter
im not suggesting you to connect unit base bp to Target
im suggesting you to add one extra parameter in your spawn target vfx
what? xD
sadd
ahh
cool
ok adding the pin and getting that ref like that worked like a charm!
thats acctually a really knowledge for me
ok i got that part fixed*
gg BloodBanner! :D
can anyone explain why each time i start the game and move up n down its not animating?
once i move any direction then i can up n down and all work..
How do i orient to controller rotation only if player is moving?
for a networked game
this is what i want to do
is there an easy way to package game send my friend the game and use like hmachi to host a server to test my level out?
I have managed to do that lol
could you explain how @sweet sage
FRotator UMmorpgCharacterMovementComponent::ComputeOrientToMovementRotation(const FRotator& CurrentRotation, float DeltaTime, FRotator& DeltaRotation) const
{
if (Velocity.SizeSquared() > UE_KINDA_SMALL_NUMBER)
{
return CharacterOwner->Controller->GetDesiredRotation();
}
// Don't change rotation if there is no acceleration.
return CurrentRotation;
}
like that
it works for me
i`m using "OrientRotationToMovement=true"
my bad i thought your were responding to my message lol
How would I create different game modes like a Search and Destroy mode and Team Deathmatch mode. How can I differentiate
make different GameMode classes
would probably want a GameState class per GameMode as well
or you could just add some enum to your GameMode which says which game type it is, you'd switch on that for all the important stuff like OnPlayerDied etc
On unreal is Aim rotation Yaw not replicated:
?
Is it using somehow the character pawn rotation?
Here i`m looking to the sides but only local player can see it
It looks like it is not replicated somehow
FRotator Delta = UKismetMathLibrary::NormalizedDeltaRotator(Character->GetBaseAimRotation(), Character->GetActorRotation());
Yaw = Delta.Yaw;
Pitch = Delta.Pitch;
this is how i`m calculating it on animator
so, I am new to multiplayer stuff and I am just doing small things to start with ๐
using Oculus Online Subsystem, I get user name/ID in the game instance (as per their example), set variables. Then inside player's character, OnPossession, I get values of the variables from the game instance and set text render above character's head to the name/ID.
After watching youtube video, where they do all this inside player's character (and I am not sure if they were even using any OSS) and use rep notify to make sure player's name gets updated even if players gets disconnected, I am scratching my head.
this is what I do inside game instance ^^
I'm trying to make a sphere that damages the player when there's a collision, the player has a health component and all I'm doing right now is just trying to learn replication with a health variable. When I try running it, the game crashes when I try the overlap for the damage. Can anyone help? Ill provide anything else you need, thank you
Here are the screenshots with the number of lines sorry
@dusty void
You are using a Pointer without checking its validity
Always check your pointers before using them.
if(IsValid(healthComponent))
what's the difference between doing ( IsValid(healthComponent) ) and just putting (healthComponent) ?
IsValid checks to make sure the underlying UObject isn't "pending kill".
Because it maybe still available as a pointer, but is about to be garbage collected
Pointers to non UObject types obviously wouldnt need that
is there anything wrong with this statement? that's where a lot of my problems started after i put the GetLocalRole check
When I didn't have the GetLocalRole check, the game wasn't crashing even without the healthComponent validity check
Yeah after taking away the GetLocalRole() == ROLE_Authority from the DamageSphere::BeginPlay() and the UHealthComponent::SetHealth functions it's not crashing anymore but the OnRep isn't being called
Can I use blueprints to add new actors to the travel list?
Is possible 99% sure of it
thanks, that helped
Hi, I am creating a mechanic in my game where a player can replenish their oxygen by interacting with a device on the wall. I am trying to replicate the Oxygen amount variables on wall-mounted device but I am unsure how to do it. I've tried various combinations of server to multicast custom event setups but haven't gotten anywhere.
Right now the number on the server overwrites the number seen by the client because they are out of sync. I'd like the values to be in sync with all clients when one client uses the device.
Thanks :)
also i not sure exactly what your trying to achieve but sounds like your traveling to another map and actors also , there is a save pack that save all actor even moving maybe if load then you wont need that but just a hint .
while testing in editor does client RPCs gets called in the server instance too? not multicast just client rpc
That's not PIE specific
Client RPCs are called on the owning client of an Actor. If that actor is owned by the server then it's basically seen as a normal event
You want an OnRep Variable for your data. Use the RepNotify to update any visuals from the data.
To update it you need to Server RPC from Client to Server and have it update the variable.
Since the Actor isn't client-owned, you'll need to do that RPC in another actor.
This is pretty typical for an interaction system, so in theory you would want to set this whole thing up with an Interface etc.
Don't think so, unless any of the two functions are exposed?
Oh that makes sense...thanks!
SteamSharedModule.cpp.obj : error LNK2019: unresolved external symbol __imp_SteamAPI_Init referenced in function "public: __cdecl FSteamClientInstanceHandler::FSteamClientInstanceHandler(class FSteamSharedModule *)" (??0FSteamClientInstanceHandler@@QEAA@PEAVFSteamSharedModule@@@Z)
SteamSharedModule.cpp.obj : error LNK2019: unresolved external symbol __imp_SteamInternal_GameServer_Init referenced in function "public: __cdecl FSteamServerInstanceHandler::FSteamServerInstanceHandler(class FSteamSharedModule *)" (??0FSteamServerInstanceHandler@@QEAA@PEAVFSteamSharedModule@@@Z)
E:\UE\MyProject\Binaries\Win64\MyProject.exe : fatal error LNK1120: 2 unresolved externals
[36/36] WriteMetadata MyProject.target cancelled``` anyone got a clue what this error is about? ๐
It was missing indeed however the error persists, which I'm guessing could be from the fact that the SDK downloaded didn't contain the SteamClient64.dll file needed inside 'Binaries/ThirdParty/Steamworks/Steam[Current Version]/Win64'
Hi, for our game we're going to need dedicated servers that host a group of like 20-30 players per server instance. I've been doing some research into services that automatically scale the amount of running servers up and down based on demand, but have only stumbled upon Amazon GameLift, which is meant more for session based dedicated servers. Does anyone have some resources of where I can look to get something like this up and running?
I'm having some issues with replicated root motion, the full details are on the unreal forum if anyone wants to take a stab at it https://forums.unrealengine.com/t/gas-replicated-root-motion-from-montage-struggles-with-latency-and-collisions/1522235 ๐
I'm using GAS but im not sure it is directly related
Hi, when executing my Attack ability, the root motion performs fine when there isnโt an enemy in front of the player. However, when there is an enemy in front of the player the animation begins to stutter and is eventually cancelled on the client after a few swings (the animation continues as expected on the server). This issue does not show on...
Hello Guys.
I would like to test disconnect cases.
as far I did read on the internet it says to use GameMode::Logout to get the callback and use Command " net.DisconnectSimulatedConnections" to disconnect the player, but using this seems to not disconnect the player or trigger the logout.
Can you guys tell me how do you approch this?
I have past experience in Unity with PlayFab and it can scale according to demand only if you deploy your server using docker image
can somebody fact check my own notes write-up on authority vs ownership?
Authority indicates whether or not this machine has created this specific object, it is not the same as ownership, which indicates whether or not this machine can modify/ change a specific object.```
Ownership means nothing in terms of whether or not a machine can modify or change an object - clients can technically change values locally for any actor regardless, but any changes they may make wouldn't be replicated to anyone else as replication is always from server to clients.
In a multiplayer context with a replicated actor, ownership determines who can send server RPCs to the server on the particular actor and who would receive any client RPCs run on that particular actor by the server.
Where is the best place to trigger a save event to save the pawn's world location?
I tried using the gamemode::logout, but the pawn has already been destroyed since then and will crash the server.
You probably need to override PawnLeavingGame() in PlayerController. This function is what destroys the pawn when the Playercontroller is leaving.
This is called in Destroyed() on the playercontroller, which could also be overridden so it doesn't call PawnLeavingGame().
thanks, ill look into playfab then
I'm trying to spawn a system. It works fine on all clients but doesn't spawn on the server. (This is a listen server model)
Hi, does anybody know how to make a communication between the Server and the Client the main idea of it being changing a variable from both ways (like if you want to transfer information from the Client to the Server)?
You use a server RPC to send any data to the server from a client.
Must be called on an actor that is owned by that client.
Can you resource me the some information about RPC (I am very new to multiplayer)
Check the stickies on this channel, second one is a good one.
okay thank you very much!!!
could you define what a client owned actor is? I'm having trouble wrapping my head around that.
can't you do it with has authority note?
Ownership of an actor is set by the server. When you spawn an actor you can feed in the owner.
Clients aren't an object in the game, but their Player Controllers are. So when you're dealing with the PlayerState or the player's possessed Pawn, their owner is set as the PlayerController which is then what allows a client to call RPCs to the server on these actors, and to receive client RPCs from these actors. So long as the assigned owner is a path back to the player controller (eg. If I make an actor have the PlayerState as an owner, then that can still be traced by to a PlayerController) then that client is considered the owner.
So lets say I have an actor BP that changes a text render when a client touches it. Would I put the server RPC in the actor BP or the client?
You wouldn't necessarily need to do it as an RPC at all.
even if i want the text to be replicated to all clients?
this was my original post
Overlap detection can happen on the server. The server can replicate a property on that actor, marked as Rep W/ Notify which can then call an OnRep function on clients, and then clients can do what is needed when that change is received.
btw is there any way to cast to the server character?
Do you know what casting is?
If you wanted a client to interact with it, ie, the client needs to press an input for it to trigger, then you would need to call an RPC. In this particular case, you wouldn't want the client to be an owner of that particular actor, so you'd have to send a server RPC on a client owned actor, like thier player controller, pawn or playerstate. Once running on the server you can then do what you need to do.
Do you mean "Is there any way to send some data or call some function on the server-side version of a player's character"?
i have an interact interface that I'm working with that might be the issue then?
Possibly.
Interfaces don't do any replication for you, and you can't have a client calling an RPC to the server on an actor they do not own.
okay, that might be it then, i'll take a look into that
thank you for the explanation :)
You'd have to structure it so that it'd be something like:
Client Input > Find actor to interact with > Send RPC to server w/ actor to interact with > Server validates target actor is nearby > Server calls interface > Actor does its thing on the server.
In my project I have two players witch control two diffrent characters. One of the characters is playing an action game and the other is playing a strategic game. The idea is that the strategic player controles all the stats like healt, stamina etc. I need a way to make them have the same stats(if the action player gets hurt, the health goes down, if the stategic players heals up, the health goes up). Sorry for the english.
Can somebody help?
You should put that stuff into the GameState then instead
If there is only one health value that both share
I tried it but the game state can't be accsessed by the client
like I can get value from there but not set
@cerulean moss that's expected, you need to RPC in an owned actor first
But that's the same when using any other actor if you want a value to change and replicate that change
so I need to make something like a custom event which have On Server when I chage the variable in the Client and after that I put it in the GameState?
Yeah. E.g. in your Character or PlayerController
Ok I will try it , thanks for you patianse with me
No worries
Trying to make replication and have a problem with client. When my server/host is executing function everything works well and my server is sending information to clients and shooting effects show for them. But when im trying to shoot from client i dont see anything on host or other clients
you're repeating the line trace on client and that is probably not hitting due to multiple possible reasons
but also
you have the FX spawning inside that if
you can put it outside the if
if its just a laser/smoke trail effect
then you only need start vector and end vector
(that is for other clients to see it)
Then i just cant call it localy?
you can linetrace on the client too, but why do you only spawn the laser/trail if there is a hit?
you should always spawn it, no?
Yes ;D
so move it outside that if
also I dont know if your ProjectileSpawnPoint is at the same location in client vs server so that can also be something to look for
I mean its not even it i tried to just spawn actor like simple cube and i didnt see it
to get the end vector you can just do:
FVector End = Hit.bBlockingHit ? Hit.Location : Hit.TraceEnd;
meaning if it hits something then your end location for the trail is where it hit, otherwise, its where the trace ended
You think that the functions are done right ?
its hard to say, because I dont know exactly what you're going for but what I recommend you do when you dont see things visually is using DrawDebugSphere to show a sphere where a certain FVector is in the world
@clear island
So the left side is client and right side is host same ass the spheres Host/server dont see this spheres
I added drawsphere to multi and server
seems like that green line is not matching
it would probably be easier to just use the gun barrel as start vector
and multicast the end vector
then just spawn the trail from those 2 vectors
also make sure to only apply damage on server
But i dont think its the problem of vectors just look i added spawn in every function responsible for the replication
look on the left side i spawned this actors on client but dont see them on server
When host is doing it
everything seems to be right
just use MuzzleLoc as the spawn point for your niagara effect and use TraceEnd as your "LaserEnd" end vector
Nothing Changed
put it outside the if
you're not using MuzzleLoc
you're using Hit.Location
in SpawnSystemAtLocation
use MuzzleLoc
aw wait my bad Im looking at the second one
(on that one you should also check if there a blocking hit though)
for the trail effect I would draw a debug line from MuzzleLoc to TraceEnd
and see if that is where you expect it to
Yeah i know but at least i know its not corrupted project or anything
Ok and another one
This works in my character class
now i need to figure out how to make it work for Weapon Base class
I would start by checking where that TraceEnd Vector actually is
and drawing a line between MuzzleLoc and TraceEnd
I'm convinced the beacon implementation in the engine straight up doesn't work
Like it barely functions but doesn't do any of the the stuff it implies it should be able to do
How do i enable bAllowPhysicsRotationDuringAnimRootMotion only for the first 0,3 seconds of every root motion clips?
with networking and prediction
Anyone knows why all my physical controllers are set to Player 1 for a local multiplayer
hi, i'm using GetSessionInterface()->GetResolvedConnectString("GameSession", ServerURL, NAME_GamePort); but the game port is 0, any ideas how i can get the game port ?
4 players spawn
i only have 2 controllers at hands right now
1 Ps3, 1 Ps4
They both work but controlPlayer1
๐ซ
I'm planning on setting up something similar for dedicated servers soon. I need to determine what i'll use for service discovery since my servers will only be up for the duration of a game (20-40 minutes). Thanks for the write up
Is there a way to use the same NetDriver after changing levels or do you HAVE to destroy and create a new one?
When changing levels it will be automatically recreated for you by unreal
Where is the code for where that happens because that doesn't seem to be happening for me. Once I travel to the actual game level from the main menu, it's gone and cannot be found again.
In the game level are you a standalone world?
No, in a listen server
Yes
Then yes a NetDriver will get created, let me take a quick look
yes a new GameNetDriver will be created
That's not what I'm looking for.
I'm looking for the BeaconNetDriver that existed in the main menu
Well that's something else. You will need to take care of making a new one
Literally like a GameNetDriver was recreated
That's a rule for changing worlds
NetDrivers are associated with UWorlds
Ok so the problem I'm running into is that when I finish traveling and attempt to create a new one, the old hasn't been cleaned up yet so initializing the new one fails
adding more "delays" for lack of better word doesn't seem like a great solution
Before calling DestroyBeacon you might want to call a couple of other methods
Or basically when performing the travel etc.
UnregisterHost followed by PasuseBeaconRequests
Might help, not sure
It doesn't because the socket doesn't get closed until the socket subsystem ticks
Already dealing with delays because as soon as you call ServerTravel, the socket stops broadcasting. So I have to tell all the clients to travel, they start a timer 5 second timer. Host starts a 2 second timer, then sever travels
If the server doesn't set a timer, the client's don't receive the Client RPC
If the clients don't set a timer, the server doesn't exist yet
So you call ServerTravel on clients that are connected to you via beacons?
No
the host calls ServerTravel
to open the listen server and move to the game map
clients call ClientTravel
Right, why do you need delays then
because if you do this:
TellClientsToTravel();
ServerTravel();
the clients never receive the "Time to ClientTravel" message
Well you shouldn't do it like that
You travel to the map with ?listen
You set up a beacon connection with clients there
They travel to you
ok so you have the beacon connections setup in the main menu lobby
Host calls ServerTravel
how do you reconnect the clients?
That's the problem. The way you think about it is totally valid if you probably had a dedicated server. The dedicated server already has the map loaded, and clients just connect to it from their main menu lobby. But no matter how you think about it in a listen server scenario, that's clearly a race. Telling clients to travel to you, while you are going to host another map, that's wrong
The listen server has to sit there listenning for connections before setting up the beacon connection
The beacon connection is setup in the main menu. That's how the lobby is created
The only thing I can hope is that the clients will manage to reconnect once the host re-hosts
Honestly, I would just make players travel to your lobby after the beacon connection is setup, and from there you all travel to the game map
Even dedicated servers games I assume do that
that's awful. why would you want to load a new map just to enter a lobby
that's the whole purpose of beacons
to avoid that
agreed
#multiplayer message
I'm looking for hosting recommendations for dirt cheap that wont have big lag issues. Does that exist?
The only thing I have found in the past that wouldnt cost hundreds of dollars a month was to just do listen servers on steam. But I could not build my game for android if it had any steam stuff in it. Breaks with build errors. And i wanted to make it cross platform and work on everything everywhere with everything else.
Contabo
So i looked into hosting dedicated servers but the affordable options were laggy VMs
Contabo? I have not heard of that one yet. I will check it out. Thanks
I'm still learning about replication and with the same sphere I have that damages the player on overlap, the only issue (or misunderstanding) i have is on my debug logs, everything pops up besides the IsLocallyControlled() check in the OnRep, and here's what I have the owner as, and it is valid from the previous pointer check, any help? ill provide more if needed
They provide virtual machines, cheap VMs
Digital ocean does too but ran too laggy for my game. My game only had maybe 10 characterpawns running around max, and nothing much else going on. No shooting, nothing but occasional RPCs when interacting with various props and some timers.
I hope Contabo VMs will be more performant
Then the optimization is really bad
Maybe your code is slow
Or not multiplayer ready
Have you tried network emulation?
Hello,
Trying to setup a shooting projectile that aims in center of the screen ( Crosshairs ).
I got everything working using Get Player Controller -> Get Camera Manager -> Get Camera Rotation
So ffar this seems to work fine, however in a multiplayer game, the client's rotation will always return 0 as its looking for player of index 0.
So what's the best way of going about this?
I tought I would get my CharacterOwnerRef->GetCamera-> but I dont see any option to get rotation
Trying to do it from CharacterOwner->GetController->Get Control Rotation
Seems to be working getting pitch, Yaw and rotation X but seems to slightly off center,
Would anyone have any tips?
I tried a few of the console commands for that to simulate packet loss and lag before building it for my droplet.
Makes me wonder if I somehow got lag and packet loss simulation turned on for my Linux build but not for my local tests.
Tried another method but not quite centered still
Seems to be aiing towards the hit but I need it to be always centered to the camera viewport
Got more digging to do but feel liek im getting closer
What was your cpu usage and bandwidth?
Is there any method to make a loading screen that persists in between levels while connecting to a dedicated server map? I have searched through all docs but got no answer.
is there a way to make pass thru functions like this work? im getting a null variable on the item object
don't multicast the spawning of something
what is an ItemObject?
i moved onto using a different system so dw
In my dedicated server log, this message keeps spamming after my player logs into the world partition world, is this related to multiplayer or world partition setting problem? [2023.12.14-08.21.27:362][108]LogNet: Warning: Actor WorldPartitionHLOD / WP_HLODLayer_Merged_000000001327f5d3 has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)
[2023.12.14-08.21.27:365][108]LogNet: Warning: Actor WorldPartitionHLOD / WP_HLODLayer_Merged_000000001abd3d2c has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)
[2023.12.14-08.21.27:366][108]LogNet: Warning: Actor WorldPartitionHLOD / WP_HLODLayer_Merged_000000001c4b29bf has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)
[2023.12.14-08.21.27:367][108]LogNet: Warning: Actor WorldPartitionHLOD / WP_HLODLayer_Merged_000000001e3619ce has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)
[2023.12.14-08.21.27:368][108]LogNet: Warning: Actor WorldPartitionHLOD / WP_HLODLayer_Merged_0000000021c3fdb3 has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)
Would anyone know why the .exe for my project crashes whenever I try to open a world? Crashes when i try to create a lobby and if I try to just load a world "offline". CoreTest is the name of the world I tried to open but same thing happens with any other world, including ThirdPersonMap.
Including the log here as my eyes can't see the issue ๐คฆโโ๏ธ
Oh yea, it just crashes withouot any obvious errors. Just closes to the desktop
Those blue wires are references/pointers to memory locations. I dont imagine the same memory location on the other machine is going to contain the same data (maybe no data at all). Maybe you have to pass primitives instead such as integers, floats, Names, or strings.
I wonder if it would work to pass a Class rather than a reference.
Does "seamless travel" do the trick for you?
Seamless Travel can be done in Server Map travel not for Connecting to a Map on Server for the first time
Oh that's true. Does the viewport/HUD/UMG not survive between levels? I thought it would remain since it is not an actor in the world and therefore would not be cleared away unless told to.
I believe so, I am not up to the multiplayer part yet but I manage to keep loading screen widget survive between level
got it to survive by creating the widget as a TSharedPtr, was told that it's a bad idea. No crashes happend soo far but use it with caution if you wanna do the same
I remember starting the server with a different port multiple times on the same droplet until the CPU usage got high enough to be making good use of it but leave some elbow room for when a lot was happening in the game. It was a couple of years ago but I think it was around 60-80%
I dont remember the network bandwidth. Logically the CPU usage should be low enough when the game is not busy that it will not max out when all the servees running on the same VM are busy, so I imagine the resting CPU usage should be the % usage of one server when it is at maximum activity, divided by the total number of servers on the same VM.
For a droplet running 6 servers that would be less than 16% but I tried running just one server below 20% and still getting lag, so I dont think CPU usage was the problem.
That is, if I remember evertything accurately after 2 years.
If the menu is being garbage collected then you could keep a reference to it in the GameInstance since that survives as long as the game is executing at all, even when no levels are loaded.
if I make Event replicable (Run on Server), then server sees client's name tag always facing server's camera (as it should be), but client's sees server's name tag in the wrong orientation and not facing client's camera.
How can I make it so both server and client see name tag face camera?
that piece of code only runs on server
shouldn't use player controller 0 either in mp, try to read the compedium pinned in this channel if you haven;t
Oh yeah I forgot. I have been away from the engine too long
@peak star my latest comment was directed at motorsep
HUD / Widget gets destroyed on level transition unless they are "guarded" I guess
btw you cant keep a reference to it in Game instane
i've tried that
it still get destroyed on level transition
look at the user above me when I mention the Run on server rpc
I remember reading there is a list of actors or objects that gets preserved to the next level which you can add things to, but I dont remember if that works on nonseamless travel or if it works for viewport objects.
That's for server travel
hard travel , widget get destroyed
your option is to use Slate
or TSharedPtr the widget
I feel like I've done this and it worked ๐ค But I'm not so sure if I'm remembering it correctly, as long time has passed
well that was the first thing I do and it didnt. Unless I did something wrong I don;t think it work
That's weird because now I remember I even had problems when player returned to the main menu, due to the previous menu widget wasn't unbinding from events, some things were being duplicated. As we had an unintentional reference in the GameInstance
But that was on 4.21, so it's possible the way widgets are being handled might be changed now
Game instance presist throughout the game but afaik hard references gets detroyed during level change.
I tried caching the widget in game instance in Unreal Engine 5.1, still the same thing
didn;t survive
it's probably intended behaviour ๐คทโโ๏ธ
What I have done now is I first laods an Entry Map that shows player a loading screen that do a seamless travel to Playing Map in this way loading screen remains persists
This Entry Map is empty so it doesnt ccreates much overhead
Hello!! For all the CMC geeks out there, I have a little issue that maybe you guys can help me with.
Basically I have stamina in my project, it goes up and down very nicely using CMC prediction system (referencing here Vaei github post about Stamina, because its similar to his implementation). Every time stamina is consumed I halt stamina regeneration for 2 seconds (timer feature) using the CMC timers (so quite precise, i debugged it).
However I noticed error piles up... and could have different stamina values for the whole duration of the halt -
ie:
Server: 25
Client: 22
So I wanted to check if any of the CMC geeks could help me to force a Stamina value correction in the client during this 2 seconds delay (2 seconds is a lot of time with the stamina value desynced). I tried with a manual RPC and replication, but i feel is unelegant, there should be a way to do this in cmc, right? ๐ค
what is the best way to wait for a spawned actor to load in on the client?
Hello. Im working on portal mechanics like in Portal games but CMC is giving me a hard time with teleportation. Any ideas on how to predict the teleport so its as smooth as possible?
I'm having an issue which seems to be an engine bug:
- I have a replicated array of structs
- Some of the struct's members are marked as
NotReplicated - Serverside, I have one value in the array - replicates to client fine
- I remove the value serverside and add another one at the same time
- Clientside, the rep notify gets called
- The
NotReplicatedmembers of the struct seem to get hit by memory corruption, on the client, as their values on new array item seem to have been overridden by the values of the previous item that was removed.
Anyone else hit by this? I'm on 5.1.1
The serverside values are fine.
Holy shit
share some code or the crash callstack
@thin stratus did you find a solution for #multiplayer message ?
Seems like I have the same issue as you
D:
Can't share code, no crash at all, the properties just get fucked up
But the message I linked is basically the same thing as me and it has code
Hey Erlite, there should be a PR fixing this same issue
take a look in github, i believe erebel pushed a fix for this
@solar stirrup
:3 np
What's it called?
Don't use timers. You have the timestamp of the move for that
Depends on why you are waiting
OnRep of the pointer I guess
yes thats what I said, Im using the timestamp of the move
Ah I read timer
ah because its a feature... so every time I consume stamina i halt the regeneration for 2 seconds or so
Yeah but you do that via timestamps right
yup
Then I don't see why it would desync
and what i noticed is that sometimes... during those whole 2 seconds, the stamina value that got locked by the halt displays a different value in server and client
I manually updated the array
Iirc
Are you maybe using Server vs Client timestamp?
Sounds hacky :c
Yes, the same method employed in UT for CMC cooldowns, essentially
Couldn't find a pr attributed to them for that issue unfortunately
Would need to check
ay
this isnt something thatd id store in each individual character, its a pickup that spawns on the server and then listens for an overlap, then it spawns a new item actor and gives that to the character via a netmulticast function. The problem i have is that on the server, i spawn the item actor, then imedietly give it to the player, which results in a nullptr because the item hasnt yet loaded on the client.
Oh
Well the name didn't help hah
Ah that PR doesn't fix the underlying issue rip
I wouldn't give a character an item via multicast
Use your item actor's BeginPlay() to handle that sort of race condition
And what eXi said, you'd wanna spawn on the server and replicate it to the client
Sounds like the actor itself is replicated
Not sure why the adding of it would be a multicast
Sounds like a faulty setup
Whatever you are adding the item to should be replicated
lol that pr is for gas
I kinda doubt there is a pr to fix that
I generally go with a replicated reference to the actor + the actor's begin play to handle race conditions.
- If during the rep notify of the reference, the actor is null, don't do anything.
- In the actor's begin play, notify whatever is holding the reference that it spawned on the client.
- Tada, no more race condition.
Yeah, I don't even think it's been reported
I mean it's basically memory corruption
You get the data from the previous item that was removed
Wouldn't say so
oooooh
wait no yeah
the client doesn't know about add/remove
only sees an update
fuck
Yeah
fuck fuck fuck
It only serializes the data
(โฏยฐโกยฐ)โฏ๏ธต โปโโป
And skips the parts you marked non replicated
So I doubt they fix something that isn't technically broken
so what i was thinking to fix the issue cmc desync issue caused by the halting was to trigger a stamina-value correction when the halting happens ๐ค Is it possible to do that elegantly?
because RPC/Replication sounds lame
Not sure. I never had to do that
We had stamina based systems with all sorts of cool downs and what not
If you do it right it doesn't desync
maybe try fast array if you need pre remove and post add callbacks
Don't really need the callbacks but it would solve the issue of clobbering
god dammit that's more work
Fast array doesn't solve it iirc
mh... the thing is that when the stamina goes up... and i trigger a consume from a GA... the consume comes at slightly different times in server and client, and the value desyncs even if i flush moves
Not sure anymore
doesn't every item in a fast array hold a unique id
that is uses for delta, so it'd know it's dealing with two diff items?
It doesn't matter iirc. The problem is the serialization iirc
The entries will still be wrong
I can't recall
I def had to manually update the entry
Cause I used this setup for cooldowns in gas
I don't have that code anymore though
Cause that was on a client project
On my example I had a Tag that identified the cooldown, and a Timestamp + Duration for the Cooldown. And a boolean for if the server Ack the Cooldown, but that's irrelevant here.
I'm relatively sure I had to search the array for the Tag and then update it accordingly with the boolean
Cause otherwise if a cooldown ran out, the [0] element got removed and the [1] element went one up and got the Timstamp and Duration which were marked as NonReplicated of Entry [0]
Cause the Client doesn't remove the entry, it just updates the array elements
It can totally be that I used fast array overlal for that
But just using it didn't solve the issue
That's concerning because that's gonna affect some of my other systems with the fast array serializer if that's the case
how did you fix consuming stamina from GAS? cause thats where im getting the incongruences at - tried flushing moves, but... it seems it isnt enough
When using Stamina for Movement, I don't use GAS
Getting GAS to work with the CMC is a shitshow
yeah thats where i am at
my stamina lives in the cmc
but i do have abilities that require consuming stamina
๐ฌ
why do you guys use gas ? is terrible imo
Simple
"imo" it's not
Discussion over
No the answer to that question is simple
ah
Fast array might prevent clobbering
Hm
I'm not seeing bugs in one of my other systems removing elements
If you have to mixmatch GAS and CMC; you have a shitty time atm
The only time we got that working with MovementSpeed was when we basically listened to GE application and removal in the CMC and patched around the problem that GE removal can't be predicted
I coded a fairly advanced climbing system with gas
@pallid mesa Wait for 5.4 or 5.5. with the new CMC xD
with a custom cmc
but its very nasty
I mean it's probably still better to modify the Stamina on the CMC
Via GAs
They might not be 100% synced
But at least you won't get a correction until its empty
0 chance it will be ready for 5.4, most likely 5.6, 5.5 if we lucky
yes im calling a function in the cmc directly right now
which is why i get the desyncs because of ability activation time discrepancies
it works fine to some degree, but error piles up
and if you are a maniac jumping error accumulates
The CMC only ever corrects due to Location mismatch
Not due to any other variable
Stamina would only cause a correction if your movement is different due to it
Idk if you can inject that
You'd need to send the "end stamina" value to teh Server
And then compare that at the end of the move the same way Location is compared
And then trigger a correction
Not sure there are enough overrideable functions for that
my nasty solution atm was to send the server stamina var to the client via a client rpc alongside a timestamp
I wouldn't do that
You can try to cause a correction and then have it run the normal flow
If you send RPCs you will get even more fd up values
i thought that maybe the RPC could work, because at the point i send it the stamina is paused
not moving, so i got a buffer of whole 2 seconds for the client to correct it
Still nasty
ye
Sounds better to just add a layer of correction for now
I'm glad I moved to the GMC heh
Pretty sure I can bind stamina through it and have corrections handle it properly
Haven't done that yet but it's on my todo list for a side project
I very highly doubt the GMC does anything to solve the GAS part
And then compare that at the end of the move the same way Location is compared
And then trigger a correction
Any idea on which functions i should look to do this? or r&d time? XD
Yeah nah that's the downside
That's the same issue Vori already faces
The GMC won't solve that
Only epic can solve that by merging the prediction shit into one system
Misread oops
Uff
I will check a sec
But not long
My wife already looks mad at me for even talking about UE during my vacation.
I want to survive the night
๐ thanks exi
@pallid mesa Info dump
ServerMove_Implementation calls ServerMoveHandleClientError at the end.
That will ultimately call ServerCheckClientError which calls ServerExceedsAllowablePositionError.
If that chain returns true it will cause the Correction by filling in the PendingAdjustment.
Don't know where that exactly is used, but that will then call the whole "FillAdjustment" stuff, where you would (or already are) setting your custom Stamina value for the correction on the Client.
ServerCheckClientError should be virtual, so you could add to it at the end with your Stamina comparison. At least in theory.
Got distracted while typing xD
If you play Standalone, even with Editor (not Packaged), you should be able to see the Overlay
Just not inside the Editor itself.
I guess I would be logging only discrepancies where the error exceeds some units
Yeah, I mean, not much though
Epic's movement error is sqrt(3) or so
MAXPOSITIONERRORSQUARED = 3.0f;
Yop
ye in my case i can do the same ๐คฃ if the stamina differs in 3 i trigger a correction! lets goo :)
thanks exi, now is my turn to do some r&d, appreciate it, will try to give this back to community if it works out!
if (FNetworkPredictionData_Server_Character* ServerData = GetPredictionData_Server_Character())
{
ServerData->bForceClientUpdate = true;
}
Another way to do it
I ended up just making a function to copy over non replicated members from the previous value
Easier than ripping everything out to replace with the fast array serializer when it's not needed
Yeah but that triggers it all the time
Without first having some sort of check against what the Client says the Stamina should be you'd not really benefit from that
does anyone know how to replicate a health bar widget to work on server not just client ive watched every yt possible nothing works
the problem i have is that the client stamina value is never sent to the server for comparison ๐ฌ means i'd have to put it on a custom FNetworkPredictionData_Server_Character
or to extend servermove and send it alongside the other vars in the RPC
so, instead of calling it all the time i set bForceClientUpdate just once when the stamina delay ends, since its when the issues happen
which is only called when the 2 seconds stamina expire
Widgets don't replicate. You replicate the data through a variable and have your widgets read from the variable.
I mean yeah, that was what I suggested
That you send the data via the custom Data
aham, i have the stamina only in the GetPredictionData_Client_Character
so you mention to have it aswell in the GetPredictionData_Server_Character
perfect, first time digging in such area ๐
will do it!
You have the stamina in PredictionData o.o
It should just be a Non Replicated var in the CMC usually
ay no, sorry, its part of the saved move, its not on the prediction data
UCLASS()
class PREDICTEDMOVEMENT_API UStaminaMovement : public UCharacterMovementComponent
{
GENERATED_BODY()
public:
UStaminaMovement(const FObjectInitializer& ObjectInitializer);
protected:
/** THIS SHOULD ONLY BE MODIFIED IN DERIVED CLASSES FROM OnStaminaChanged AND NOWHERE ELSE */
UPROPERTY()
float Stamina;
:P yeah I was just going to say, that can't be true
You'd have it in the SavedMove
yes correct hahahhaa
so you are suggesting now to send it to the server using which mean exactly?
Via the Packed data
Like, the ServerMove sends a uint8 package data pointer that it serializes again on the server
I would just follow what the Location does
location is sent as part of the parameters of the servermove rpc
That's outdated
@d... this is my setup when the server character dies the health bar doesnt reset to full but when i kill client everyhting works i know im missing something just cant figure it out
These are a lot of words being used instead of just ๐ for mover 2.0
So we have a new system to complain about ๐ฅณ
void UCharacterMovementComponent::ServerMove_Implementation(
float TimeStamp,
FVector_NetQuantize10 InAccel,
FVector_NetQuantize100 ClientLoc,
``` 3rd param
That's outdated
wowowewa, im in 5.3 btw
Unless you actively disable it, the CMC uses Packed Data by now
ENGINE_API virtual void CallServerMovePacked(const FSavedMove_Character* NewMove, const FSavedMove_Character* PendingMove, const FSavedMove_Character* OldMove);
void UCharacterMovementComponent::ServerMovePacked_ClientSend(const FCharacterServerMovePackedBits& PackedBits)
{
// Pass through RPC call to character on server, there is less RPC bandwidth overhead when used on an Actor rather than a Component.
CharacterOwner->ServerMovePacked(PackedBits);
}
I also just saw that they have Iris stuff in the CMC by now
#if UE_WITH_IRIS
if (UPackageMap* PackageMap = UE::Private::GetIrisPackageMapToReadReferences(CharacterOwner->GetNetConnection(), &PackedBits.ObjectReferences))
{
ServerMoveBitReader.PackageMap = PackageMap;
}
else
#endif
{
ServerMoveBitReader.PackageMap = PackedBits.GetPackageMap();
}
So much for "just turn it on and it works"
// Deserialize bits to move data struct.
// We had to wait until now and use the temp bit stream because the RPC doesn't know about the virtual overrides on the possibly custom struct that is our data container.
FCharacterNetworkMoveDataContainer& MoveDataContainer = GetNetworkMoveDataContainer();
if (!MoveDataContainer.Serialize(*this, ServerMoveBitReader, ServerMoveBitReader.PackageMap) || ServerMoveBitReader.IsError())
{
devCode(UE_LOG(LogNetPlayerMovement, Error, TEXT("ServerMovePacked_ServerReceive: Failed to serialize movement data!")));
return;
}
ServerMove_HandleMoveData(MoveDataContainer);
This is what the Server does with the packed bits
That Container can be extended
There is also one the other way round
FCharacterNetworkMoveData then holds the actual Location you meant
It's no longer a param on the ServerRPC
void UCharacterMovementComponent::ServerMove_PerformMovement(const FCharacterNetworkMoveData& MoveData)
The current MoveData is also set "globally", so you can get it anywhere
// Final standard move
if (FCharacterNetworkMoveData* NewMove = MoveDataContainer.GetNewMoveData())
{
SetCurrentNetworkMoveData(NewMove);
ServerMove_PerformMovement(*NewMove);
}
That happens for Old Move, Pending Move and New Move
So if you make your own child container
You can add the Stamina to that
And then access it everywhere during the Server call
e.g. in the ServerCheckClientError part
void SetCurrentNetworkMoveData(FCharacterNetworkMoveData* CurrentData) { CurrentNetworkMoveData = CurrentData; }
i was checking ServerMove_Implementation ๐ค
Yeah that's old
// Send move to server if this character is replicating movement
if (bSendServerMove)
{
SCOPE_CYCLE_COUNTER(STAT_CharacterMovementCallServerMove);
if (ShouldUsePackedMovementRPCs())
{
CallServerMovePacked(NewMove, ClientData->PendingMove.Get(), OldMove.Get());
}
else
{
CallServerMove(NewMove, OldMove.Get());
}
}
That's inside UCharacterMovementComponent::ReplicateMoveToServer
// Use newer RPCs and RPC parameter serialization that allow variable length data without changing engine APIs.
static int32 NetUsePackedMovementRPCs = 1;
FAutoConsoleVariableRef CVarNetUsePackedMovementRPCs(
TEXT("p.NetUsePackedMovementRPCs"),
NetUsePackedMovementRPCs,
TEXT("Whether to use newer movement RPC parameter packed serialization. If disabled, old deprecated movement RPCs will be used instead.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_Default);
That's 1/true by default
So I doubt you are using the old way anyway
That's correct and working as expected. If the widget persists through spawning a new character, then that's why it's not updating the UI and why you're getting those errors as you set the reference only on construct of the widget.
yes, i was following ur explanation before and ServerCheckClientError led me to servermove ๐คฃ
You didn't actually ping them. You might want to repost the message. Editing the ping won't actually ping them.
Oh
They replied while I was typing
TADA
It's in both :D
so tldr - extendFCharacterNetworkMoveDataContainer with stamina, and then trigger a correction if a discrepancy is found
Yeah that was my idea
ye but im silly exi, u need to factor that
๐คฃ
u helped me a ton, ima check if i can get this working :)
hehaha yeee lets goo
@sinful tree @thin stratus this is the error and place it says the a issue and could one of you show or tell me how to fix it so i works after repawn
In what class are you actually creating your widget?
@sinful tree im kinda new to unreal do you mean the BP_thirdpersoncharcter class? shwon in picture
Hello,
I will use the game Battleship as an example. In a multiplayer game where the two players have their two grids on the screen, one with their own ships and the other trying to guess the enemy's ship placement. My question is: Can players be in different levels but still share the same session? Or is it mandatory for them to be in the same level?
Yes. That'd be your class. I'm a bit concerned though, as you appear to be creating this widget in a function called "Receiving Damage" which indicates you may be constantly recreating this widget each time this function is called?
@sinful tree bro could join a call cause bro iven been trying figure this for 2 days straight
No, sorry, I don't do voice chat stuff.
They have to be in the same level
unless you implement your own networking code instead using Unreal replication system
At a very basic level, there is no strict requirement of multiplayer games to require users to be connected to an Unreal server or a host which would entail those players being on the same level, but at that point you're no longer using Unreal's native networking system. EG. I can have a small Node.js server that can handle the state of the game. I imagine maybe one could even communicate through beacons.
I'm a bit confused - Perhaps this is an Event Graph you named "Receiving Damage"?
@dark parcel @sinful tree thank you guys ๐
Hello trying to setup a simple shooting projectile,
I was able to get the center of the camera using the get player controller ( Index 0 )->Get Camera Manager->Get rotation->
THis works on a single player game but as soon as I start a multiplayer game the shooting rotation is off as its trying to get the player index 0's camera,
So this will never work on a client player,
So I created a character owner reference->Get compoenent class -> Camera component->
But not seeing any Get camera rotation,
So tried using a foward vector with a line trace,
It becomes more of a target aim, it will always shoot towards the hit point and it does not always shoot at the crosshairs but just slighty off,
Been searchng online and ChatGPT, cant seem to find any solutions for multiplayer.
Would anyone have any ideas?
Show your full logic for the trace, forward vector should be fine
FVector StartLoc = GetCameraLoc();
FVector Dir = GetCameraDir();
FVector EndLoc = StartLoc + (Dir * TraceDistance);
Hi, is it possible to replicate uobjects with beacon connections ?
Ah collapsed graph, gotcha.
So in multplayer, "Begin Play" will fire for both clients and the server. That means for each character that exists in the game, a begin play will be called for them on the server and every client. if both you and I join into a game together, 2 characters would be spawned, and their begin plays fires for both of us, meaning we would both end up creating that healthbar widget twice for a total of 4 widgets existing (2 on my computer, 2 on yours). If there was 3 players in the game, we would each create it 3 times for a total of 9 widgets, 3 on mine, 3 on yours and 3 on the third player's. Begin Play of the character then is not a great place to handle creating this particular widget as it appears to be something that is meant to be seen only by the locally controlled player.
One way to correct this would be to use ReceiveControllerChanged on the character like in the example I provide below. This will make it so the widget is only created if the new controller possessing the character is a player controller, and is locally controlled. Promoting the return value from the widget creation to a variable then also gives us a reference we can use later. Finally, you'd want to implement OnDestroyed like in my example below which will attempt to remove the widget if it is valid. You can use a reference and convert it to validated by right clicking on it.
This way the widget is only created for the player that is controlling the character at the time their controller possesses it, and ensures the widget is destroyed when it is no longer being used.
@wet briar โ๏ธ
Why doesn't discord like me pasting multiple images anymore ._.
@sinful tree Thanks for your time im going to try this out and let you know
@sinful tree okay so i did the logic but its not working after the player dies you see the bar is black not full when respawn then i go into editor shows error message then i click on and directs me to the widget blueprint dont know why its showing that error
Hello, does anyone know how I can stop root motion anim montage? I tried this, but the animation keeps playing on the simulated proxy because GetRootMotionAnimMontageInstance() returns null on the simulated proxy.
`void UMovementPlayerComponent::UpdateCharacterStateAfterMovement(float DeltaSeconds)
{
Super::UpdateCharacterStateAfterMovement(DeltaSeconds);
if (HasAnimRootMotion() && !CheckRootMotionCondition())
{
if (CharacterOwner->HasAuthority())
{
Multicast_StopAnimRootMotion();
}
else if (CharacterOwner->IsLocallyControlled())
{
FMontageBlendSettings BlendSettings;
CharacterOwner->GetRootMotionAnimMontageInstance()->Stop(BlendSettings);
}
}
}
void UMovementPlayerComponent::Multicast_StopAnimRootMotion_Implementation()
{
if (CharacterOwner->GetLocalRole() == ROLE_SimulatedProxy || CharacterOwner->HasAuthority())
{
if (CharacterOwner->GetRootMotionAnimMontageInstance())
{
FMontageBlendSettings BlendSettings;
CharacterOwner->GetRootMotionAnimMontageInstance()->Stop(BlendSettings);
}
}
}
`
Based on this frame, it seems like maybe something else is creating the health bar widget?
The error being received also doesn't make sense if you are following my logic. The widget won't exist before the character exists and is ready, and its character reference should be accessible up until the point that the actor is destroyed at which point you're removing the widget anyway.
If you want, within the widget you could also convert your CharacterRef references to validated ones to ensure you're not trying to read from it if it is not valid.
This won't necessarily correct visual errors you're seeing, but it'd prevent the errors in the log from showing up.
@d...
and after the vid i just sent i did the validate widget ref it fixed the error just not the visual like you mentioned
btw - success!
but... regarding this method i was worried that triggering a full correction would also make my character to correct its position ๐ค
And doing a test on my end, it's working exactly as I would expect.
Widget is created on possession, displays on screen. Destroy the actor on the server, widget is removed. No errors displayed.
could you show in vid yours working @sinful tree
this is video me talking through everything might help understand the situation
@wet briar
What I was getting at with that frame screenshot about is that it appeared odd that the UI was appearing in that particular frame before posession, but it seems like it does that on my end as well.
As evidenced here.
yes this is drving me insane lol @
The UI should not keep existing, and even if it did, it should only last as long as the actor is valid which you had it set to be valid for about 3 seconds after death.
And because it is persisting on your end, the only thing I can think of is that you may be creating that healthbar widget somewhere else as well. If anything a "new" copy of the healthbar should end up being placed on top of the existing one, so when you do spawn a new player, it'd create its value and display overtop of the one that's already on screen.
Is it possible to replicate subobjects with beacon connections ?
It shouldn't though
Like nothing visible at least
If there would be a reason for a location correction, CMC would already done so
ah so triggering a correction doesnt necessarily mean that location will get corrected, gotcha
hey guys!! I have some queries regarding replication...
Actually, what I am trying to do is that when I interact with a flag, I want the flag in the world to set the visibility to false and a new flag actor to spawn as a child to the player... I am using a bool property bVisible that replicates and triggers an OnRep() method when the value changes...
now the flag actor contains 2 methods: Interact and Drop...
and these methods are being called from the player where I am using Server_Interact() method to do all the interaction... so basically its like: Interact() -> ServerInteract() -> Interact() (inside the flag class)
The problem is that the OnRep() method doesn't get triggered although I am changing the value in the server
I have the DOREPLIFETIME() statement in place, and the flag actor bReplicate is set to true
@Datura so the issue is only happening when i respawn the server character everything works when you start but when he dies and respawns the health widget is messed up as we already know and also in video im sending the gun messes fireate breaks after respawning when he dies and respawns and i have to switch gun to fix it so im guessing it has to be something with the respawn logic
@Datura
Does anyone know why when using timelines, the movement of an actor is completely jittery and like half-working? I was trying to use a spline and timeline to move an actor across the spline points, but this just resulted in terrible movement. I tried using a Server RPC for the movement method, tried multiple authority switches, even replicated the timeline itself but to no avail.
Actor is replicated, I've tested with and without Replicate Movement and Net Load on Client and none give me good results. The ending location is correctly replicated but the journey there is absolutely horrible.
This is what it looks like, youll see when I shoot depending on the angles or how close the impact point is, you are never shooting straigh to the crosshairs.
Since my starting location is my gun barrel in a 3rd person shooter,
I dont think the forward vector and linetrace is the way to go.
Im not sure how esle to go about this
So first try shooting from the camera location and it should hit the crosshair, then you can quickly calculate a new dir for shooting from the muzzle
// If the CameraLoc trace hit something, make the direction point from the muzzle to that impact point
if (HitResult.bBlockingHit)
{
StartLoc = GetMuzzleLoc();
Dir = (HitResult.ImpactPoint - StartLoc).GetSafeNormal();
}
This will allow you to shoot from the muzzle but still hit the center of your screen
So it's simply
- Trace from camera loc and camera dir
- Set new dir from impact point to the muzzle loc
- Trace from muzzle loc along that new dir
@sinful tree i got i had to just add a delay to the beginning of your logic so it refreshed on screen after being respawned thanks for the help
Is this what you mean?
Yes that should be it, I'm not sure about the Find Look At Rotation node (I'd just do ImpactLoc - MuzzleLoc and get the safe normal of that, but maybe the find look at rotation node is doing similar)
Does anyone know a good diagram or chart showing where things can be called from correctly in networking within unreal?
visual aid lol
or even a nice document
Exi's compendium
thanks checking that out now , where on the site is the chart?
ahhh actually im finding i think what i need here
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โ.
Ive read things that say a client can call an rpc via an actor if the client owns the actor.
If i use the "set Owner" node and i set the clients player controller to own the actor right before executing the rpc on that actor it should work right?
Im trying that but the rpc is not executing the function on the server
heres a video example of it running in game
Ok finally got something closer to what I needed
But on the client side it seems like its slighty off center
Serverside it seems ok
Umm noticed when going full screen on the client, seems like it improved the aiming.
Maybe the screen was too small? lol
Confused, now wondering if this could be an issue in the long run, example depending on yuor screen size youll get different results
I can confirm that this issue does occur on my end as well with a listen server host and it appears that the problem may arise from using the "Get Player Character" or even "Get Owning Player Pawn" from within the widget as it may not necessarily have the correct value by the time the widget is being constructed. I was able to fix it entirely by making the "CharacterRef" variable set to expose on spawn and then feeding in the reference directly, removing the need to set the value on construct of the widget.
@sinful tree so how did you make the reference in event graph widget without the get player character
Exposing the variable adds the "Pawn" input on the create widget node.
It's a means of allowing you to set the value directly during the creation of the widget.
i understand that but im bit confused did you not make ref node from the construct node in graph @sinful tree
@sinful tree this what i mean how did make the Ref
Then you're not understanding. I don't need to set the ref within the widget. I'm setting the reference during the creation of the widget. This here is setting the "PawnRef" to "Self" which in this case is there reference to the character this Create Widget node is placed in.
i see now how do you make the ref variable my details panel is blank? @sinful tree
lol i meaning i dont have no info in my details pannel to even add variable?
@sinful tree
dont mind me i feel so slow the widows where closed thatsh why lol smg
the only issue is when you need to add something from character like health you cant because your ref is the widget not the character blueprint @sinful tree
the actual health variable should live in PlayerState/Character/Controller, somewhere that make sense but deffinitly not in widget
widget just Read, period
Since the pawn is fed to the widget, widget can just read the pawn health component, etc
if i run UnrealEditor.exe MyProject -server -log on launcher binaries, what do i get? it cant be a dedicated server so is it just a headless client?
I have a character class that is Replicates=true and ReplicatedMovement=true with a simple:
UFUNCTION(Server,Reliable)
SetLocation(FVector Loc);
SetLocation_Implementation(FVector Loc)
{
SetActorLocation(Loc);
}
My expecation is that whenever SetLocation() is called, the character will be moved on the server and all clients, but for some reason, it's only on the server. Does SetActorLocation not work with ReplicatedMovement?
I am trying to do a quick playtest via the PIE with a friend who is connecting via parsec with a controller.
His controller is picked up in windows (tested in gamepad settings) and in Unreal it does come up as 'input device 1' (mine is input 0). But it won't let him actually control any of the active players (even if I increase from 2 to 3 or 4, tested that in case it was assigning that controller to a higher player number).
If I disconnect my controller and restart, so his controller via parsec gets assigned as 'input 0' then it works as player 1, but my controller (as input 1) won't control player 2....
So there's something in Unreal gating the controllers, and I can't find any kind of 'device manager' options or setups page in unreal... any advice?
I'm trying to get a reference to a playerstate from the thirdperson character that is interacting via an Interface but it keeps saying accessed none. Any ideas?
@twilit spruce Get player controller a different way and see if it works. If you're in the character blue print, you can get the controller of that character. Look for the "Get Controller"node
Get player controller() doesn't work in multoplayer
i'm in another blueprint that the player is interacting with
i've tried defining the value in the thirdperson bp before passing it into the interact function but its not working, whether its a player controller, player state, third person bp ref, etc.
that says "target is character" and target is set to self
you can get the player state from the character blueprint
wiuthout the controller
This is from my character blueprint
just pass that directly into interact
@twilit spruce
lemme check
plug that print out to cast failed
yea
if so then youe just have to set the default player state in the game mode
there isnt a cast anywhere else really
that get player state isn't reliant on another cast
its just there
accessed none
yea
no worries! Null means theres nothing there
okay
take a screen shot zoomed out of this part that you are setting oxygen amount so i can see what happens befopre this
yea you set the player state on teh server but not on the clients
๐คฆโโ๏ธ
the multicast is the only way i'm getting my text render to replicate tho ;-;
so whats the goal here this all feels too janky
just describe this blueprint to me what is it
I have an object on the wall called OxygenStation. When interacted with by the player, it should remove 25 from its own "OxygenRemaining" variable and add 25 to the "OxygenAmount" variable in the player state. and then update the text render that displays the "OxygenRemaining" variable
the replication of the value on the text render and actually setting a value for the specific user of the oxygen station has been a huge challenge
ah i see okay
at first i was using variables stored in the third person bp but then I was informed that player states would be better, and i've been in limbo since then
yea this shouldnt be a big issue just move your code where you modify the the player state to the server part, and leave the text render in the multicast parat
so the multicast doesn't use the player state at all
You don't need to multicast the change. You have a variable that is set with notify. That means there's an OnRep function that gets called on every client when the new value is received on the client. That function can then call what you have the multicast doing.
the repnotify exists in the player state though. isnt it weird to handle this object's logic in the player state?
like setting a text render for this object in the player state seems weird
what no that absolutely would be weird no
You're updating the "Oxygen Value" on the playerstate, so then that playerstate's value changing should change whatever needs to change when that value is changed.
no no
i've started a war
he has a separate actor that also has its own oxygen value
The "Oxygen Remaining" value then should have its own onrep for this actor.
okay
And that onrep can update what it needs to.
sorry i guess this looks kinda confusing given that both the player state and the object have oxygen values
okay
so i can have a non replicated custom event, and then just use rep notify?
and fire them both on the interact event
Input from client > Run On Server > Interact interface > set values on server
Onrep > Update UI
okay i'll give that a go
thank you for your expertise
@frank pecan @sinful tree you folks just solved a 3 day issue <3
thank you kindly
**Can anyone recommend a deployment mechanism that's free, simple and appropriate for early play testing?? **
Some context: I'm cross-compiling successfully (Linux package compiled on Windows), and have deployed and connected to my dedicated server (running Ubuntu 23.10 x64). However to get the executable onto the server, I pushed the Linux package to a remote Git repo to then clone it on the server.
Unfortunately after doing this, Git damn near crashes my shell whenever I'm inside a repo directory... I had to delete/rename the .git folder in order to restore shell performance. This is obviously not tenable, as every time I need to update the Linux package, I'm going to have to restore .git and reintroduce this awkward performance issue (that presumably will only worsen as the repository grows in size).
im using playfab
look up betide studios tuts on you tube he shows how to set it up
Deployment for Server or the Client?
Client you'd probably use Steam or EGS I guess. The 100$ fee shouldn't really be a problem or?
Server is more tricky. Especially asking for free and simple. PlayFab has some free tier but ultimately wants your money and I can't remember it being simple.
Not sure why you use a GitRepo for this though. Can't you just use an FTP Client?
Yeah server deployments. I'll look into PlayFab.
Using Git has been helpful in the past, but perhaps I wasn't working with such a large project. It was simpler to setup the SSH key than deal with opening ports and what not for FTPโฆ but maybe the middle ground is secure copy.
Thanks for sharing your perspective y'all!
PlayFab looks pretty sweet 
Until you have to pay yeah
Or generally notice the garbage that third party deployment services are. But I'll leave that experience to you
Is it logical to use a streaming level and make character replicate to owner only when the player enters that level so that I can provide a singleplayer puzzle area for each player without duplicating the area for the number of the players?
If the area contains no replicated actors, and all the gameplay is client side, then potentially.
How to duplicate an actor with PhysicsConstraint
I didn't write any code
replicate movement doesn't work
Hi, does anyone know how I can stop root motion anim montage? I tried this, but the animation keeps playing on the simulated proxy because GetRootMotionAnimMontageInstance() returns null on the simulated proxy.
`void UMovementPlayerComponent::UpdateCharacterStateAfterMovement(float DeltaSeconds)
{
Super::UpdateCharacterStateAfterMovement(DeltaSeconds);
if (HasAnimRootMotion() && !CheckRootMotionCondition())
{
if (CharacterOwner->HasAuthority())
{
Multicast_StopAnimRootMotion();
}
else if (CharacterOwner->IsLocallyControlled())
{
FMontageBlendSettings BlendSettings;
CharacterOwner->GetRootMotionAnimMontageInstance()->Stop(BlendSettings);
}
}
}
void UMovementPlayerComponent::Multicast_StopAnimRootMotion_Implementation()
{
if (CharacterOwner->GetLocalRole() == ROLE_SimulatedProxy || CharacterOwner->HasAuthority())
{
if (CharacterOwner->GetRootMotionAnimMontageInstance())
{
FMontageBlendSettings BlendSettings;
CharacterOwner->GetRootMotionAnimMontageInstance()->Stop(BlendSettings);
}
}
}
`
help
Hi,
I'm working on a multiplayer game and I have trouble to connect to my dedicated server when I build in Production mode.
Everything is fine with builds in Development mode .
I pass the address and port of the server via the command line.
It seams to me that the prod build didn't use the address from command line but use all the other parameters.
Do you have an idea what could be wrong?
That is a nice gem... never knew there a node ReceiveControllerChanged. Tried IsLocalController node or something, but it is buggy.. tq
Fwiw, you would need to enable logs and also show client logs
Fwiw I would probably stick to dev builds for dedi servers
Hi
I'm creating a chat system where players can chat inside their guild or in a global chat
I send RPC to the server, which in turn sends RPC to certain players with FText end EnumChannel parameters, should I think about serialization before sending, if we say there are about 100 players and messages are sent approximately every 4 seconds
@thin stratus I have enabled log on server but not on client in production build
I already though about using the dev builds in prod
You should def get a hand on logs
By prod build you mean shipping build there is a bUseLoggingInShipping bool that you can enable on source builds to allow for client logs
As far as I understand in shipping mode, the server address can't come from the command line, so I pass it via enviromnent variable and try to ClientTravel to it
What are some reasons why setting my characters location via SetActorLocation() on Server RPC wouldnt work on clients? Since the character movement component handles replication to all clients I assumed that would work fine, no?
hey... is it true that the OnRep() method needs to be explicitly called from the server after changing the replicated property
If you want the onrep function to fire on the server.
so if I am changing the value on the server and dont call the OnRep() will it only replicate to the clients and exclude the server
If you change the value on the server, it will set the value on the server which will replicate to clients. When clients receive the changed value, they would execute the OnRep(). The server would not.
aaah I see!!! Thanks for the clarification
Im using the advanced steam sessions plugin and managed to get multiplayer working in terms of connecting to eachother but whenever my character plays an animation all other people start playing it as well (at least thats what happens client side for everyone) and im not entirely sure why
I havent worked with multiplayer much so if the answer is obvious then thats why
It probably has to do with me not replicating properly but I did it as best as I know how to
I havent worked with multiplayer much so if the answer is obvious then thats why
That's why.
If you're connecting and you're seeing clients reacting, then it's more to do with how you are getting the animation to play. If everyone is doing it, it sounds like you may be doing a multicast and using a "get player character 0" node to define who is supposed to do it, or something along those lines.
I can confirm that Im probably doing that cause I didnt change anything in regards to that, I dont remember how. The tutorial I used was taken down i believe, Ill start looking around
I'm trying to do a ClientTravel in PostLogin of the GameModeBase but after the travel, my character is in spectator mode
am I wrong to try to Travel in PostLogin?
My bad, it was because I didn't connect to a server with the same code...
is it possible to create / spawn a clientside only sublevel? im basically wanting to create a similar feature to Baldur's gate 3 in coop and possibly dedicated where a player can interact with a mirror or similar object and then get taken back to character creation screen which would house unique lighting settings and a copy of the player pawn to edit. or is there a better way to handle a feature like this?
There is a multi world plugin in the market place. Cost hundreds of bucks tho
I think I will just spawn my character preview area at the bottom of a level
oh gee well ill look into it and put it in my favs until... stuff ๐
Could anyone help me in regards to how to properly replicate actor movement?
https://forums.unrealengine.com/t/replicating-actor-movement-with-a-timeline/1527240
This is my post on the forums, its better if I just link it as sending multiple pictures in a row here would clutter everything ๐
Hello everyone, wanted to ask here about my issue as I am not really sure what is going on. So basically I have a replicated actor that upon spawning, uses a timeline that sets its location along a spline. Here is the code that does that: The event which this is in is a Server RPC, called on Begin Play with an authority check like so: The...
oh i figured. i suppose i can just spawn actors in the level on just the client? like managing lights and the pawn etc.
so two people can be looking at the same level and seeing different actors and variables
nah, if its like a character editor id just throw the player chosen variables that define morphs / hair mesh or whatever over onto the server once they click some sort of a confirm button otherwise no reason why the server should know what the players doing with the sliders and all that, i think
When I call
UFUNCTION(Client, Reliable)
void MyPawn::BeginTurn()
From my GameMode class, nothing happens. Is that because the game mode is server only and cannot access the client pawns for some reason? What's the common practice for calling CLient code on the game mode? I basically have pawn controls that are locked until the game mode does stuff.
So BeginTurn is in your gamemode class?
nmo its in my pawn
And you are trying to call that from client or from server?
from the game mode so server only
How are you calling it from gamemode?
I Get the game state from the game mode, and loop through the player state array that the game state has. I use playerState->GetPawn() and save that to a TArray<AMyPawn> PlayerArr
Then later after the game mode sets up the map, I get one of the pawns from PlayerArr and call BeginTurn(). Nothing happens
but if i run this in standalone, works great
Can you show me how are you looping through player state array?
Players.Empty();
for(TObjectPtr<APlayerState> Player : GameState->PlayerArray)
{
if(auto PS = Cast<ATGPlayerState>(Player))
{
Players.Add(PS);
}
}
So basically this array is in gamemode, then from gamemode you are trying to call beginturn on each player?
yessir
Can you show me BeginTurn code?
UFUNCTION(Client) will execute the code on client side only
yea that's what i need
So if you have something related to character component for example changing any values
server will revert them to default values
void ATGGamePlayerPawn::BeginTurn()
{
// if(HasAuthority())
// {
// if(!IsLocallyControlled())
// Client_BeginTurn();
// }
LastRestedLocation = BallMesh->GetComponentLocation();
CameraBoom->CameraLagSpeed = 1;
MyTurn = true;
FRotator LookAtRot = UKismetMathLibrary::FindLookAtRotation(BallMesh->GetComponentLocation(), BallMesh->GetComponentLocation() + AimingVector * 10);
FRotator Rot = AimingSpline->GetComponentRotation();
Rot.Yaw = LookAtRot.Yaw;
AimingSpline->SetWorldRotation(Rot);
AimingSpline->SetWorldLocation(BallMesh->GetComponentLocation());
OnTurnStarted();
}
Because only server has the ability to change thse values
no just the MyTurn = true is just a private bool that enables Input
show me header and cpp file
where you declare void MyPawn::BeginTurn()
because your class name is ATGGamePlayerPawn and you are declaring MyPawn::BeginTurn()
no i know that was just to simplify
wanted to show that BeginTurn was inside my pawn class and not my game mode class
Do you have any other RPC that is working fine?
or this is the first RPC you are implementing?
Do someone know how to replicate render targets/paintings? Like so
Hey everyone, how does text replication work? If one of the clients picked a different language, what happens?
Edit: nevermind, found the answer. Texts are corrected on client side.
Is there any way how I can turn player into ragdoll (set simulate physics) after the player dies so that it works on both server and client?
tear off and call on both server and client
what do you mean by tear off?
Assuming you don't want to do any more with the client character after ragdoll, calling the tear off function makes it no longer recieve net updates
So you can then call whatever on everyone's local machine like ragdoll without any potential server replication corrections
there is a way, but it can stress the server if too many players paint too much and players joins later
so it depends how the code is structured
Okay so I tried it, but when server dies and goes ragdoll, client still sees it standing like nothing happened, but when client goes ragdoll, server sees client go ragdoll. Any suggestions?
I would just do an OnRep bool variable that gets set to true when dead, the function that gets called when this variable changes should be called on server and client (automatically if you are using blueprint)
In that function, do your ragdoll and it should be working as intended on all machines
It'd be a lot easier to replicate what did the painting.
Oh yeah that works. Thanks for the help
if i have a level actor that isn't set to replicate, but that was already spawned both on the client and server (because its a level actor) - can I at some later point during the game set it to replicate, consequence-free?
Hi people. I have "replicate movement" and "replicates" in the character. I have enabled "allow clientside navigation" and I have the following blueprint, but the character doesn't move in the server (it does locally but then it gets back to the original position).
Dropping the client side "move to location" (the one on the top) makes the character move weird without any local prediction.
Edit, it actually moves but extremelly slow. The same code in standalone doesn't have any issue.
Can property replication notification callback have parameters and return non-void?
i am not sure if that is the case but i assume that u have this code inside of ur unit, if that is the case then i can see that u are asking the server to move his own unit instead of the unit that the player is controlling, i think u should be sending the self reference as a parameter to the function instead of getting it directly there
It looks like the Simple move to location just doesn't work. I had to implement my own
were u using nav mesh ?
yeah, I had to replace it with this if anyone is interested
and then on every tick
That reminds me of the Primer timeline
i think this makes things a bit complicated and i am not sure how it affects the performance as u r doing it on tick
You'll make much more readable code by arranging things so each executable node is kinda standalone and you dont' gotta follow pins all over the place
Hi guys, according to this https://vorixo.github.io/devtricks/atomicity/ Unreal defaults to delta replication for USTRUCTS but does not guarantee that the struct will "eventually be replicated" as how I understand "Replicated" UPROPERTY is supposed to do. Does this means by default USTRUCT replication is not trustworthy unless similar implementation is done to guarantee full replication?
hey could someone explain why my camera for player 2 (client) might be behaving like this?
Using default third_person_character and default camera , my player 2 spawns but has the camera orientated in a different way than player 1. Im not sure why the camera is different ?
If I delete the built in camera and just use a static top down camera , the 2nd player will move right instead of up, UNLIKE player 1 when moving forward
Its seems like player 2's forward is behaving differantly than player 1 ??
are they both coming from the same BP or u r using 2 different BPs for each character ?
same BP
how do u spawn them ? BP or u put them inside the level ?
Spawned via BP
can u show me the spawn logic ? cause as far as i can see this is more of rotation issue and it's not about replication
what happens if u spawn 3 characters ? or go with 2 clients ?
If i spawn 2 players both as clients , they both behave incorrectly . Like player 2 is currently behaving
if i spawn 3 players , only the server behaves correctly (at least how i think it should behave)
then in this video the server is not behaving correctly right ? only the client does ?
sorry i didn't see the mouse correctly xD
only the server is behaving correctly , the blue player is the server
who makes the spawn call ?
player controller tells the game mode to spawn player
and then the game mode is the BP actually spawning the character
how exactly are you controlling the character with mouse or keyboard ?
so basically when u press W on client u get D action