#multiplayer
1 messages · Page 8 of 1
yes I got also confused for a second hahaha
its a fine icon
are they placed in the level?
question is relevant
if that's the case then I recommend you using a proxy replication actor that can run at a higher net updates
with a fast array serializer
@errant vapor
so comfortably turn off replication on these fellas
and let this always relevant big bro handle data replication 😄
ive included analytical data comparing the method against competitive methods ie: push based replication
thus the question of whether theyre placed in level or dynamic, since in the latter case they wouldnt be name stable
correct
😄
you can make proc gen actors name stable by using deterministic name generation
but that's not covered in the article
thanks, ill have a read through of this
i was considering maybe trying to modify the replication graph to keep a high frequency update rate until such a time as the client has acked the latest packet
but it would probably require extensive changes
👍 pass me feedback if you find typos or something not clear!
oh yeah, this is much much simpler
im with you
hi
well that'd be effectively a local predicted remote activation
but in these cases server initiated is okay
you can jump first in the server and later start jumping in the client producing a semi jittery result
for a smooth experience you can do what you suggested
but its a flow of rpcs just to achieve smooth butter results for your local client
2 rpcs right?
from server to client and from client to server
its a local predicted action with remote activation
lol...
although
im not sure if there are server only events that can produce smooth results in your client by just interpolating the result
because i dont like the fact that you have to do a couple of rpcs just to achieve a smooth launch character that should be triggered from the server...
mh
maybe someone knows?
rn I cannot check engine code
yez
no but i doo
i want you to learn the proper way
because maybe im missing something
and there is indeed a way i dont remember rn
to get smooth results in your client
when executing directly from the server
;/
ofc implying lag
so... not prediction
Well, hold on because i added some animations and they messed up the character real good.
and i cannot test...
So that don't work at all
is this component replicated and owned by a pawn?
where are you calling the local launch character?
can you remove the set actor location local?
also i see you are selecting self and something else as the target
Yeah, i want the launch to happen to both characters
oh okay, give me a sec attending something else rn
No worries
okay remove that node to get rid of plausible source of errors and hang on a sec
the set actor location local
okay im back
well that should work
because from server side you have access to both players
and you are invoking a client rpc on them
which are client owned components
@fallow shadow
Well, i can tell you that it's causing jittering
Need screenshots?
Let me check
try setting a launch of 0,0,200 rather than your calculus there
and see if jitter still happens
It's only happening to the client that's attacking(meaning the damage causer) But if i plug the calculus in it happens on both
okay there are several questions that i have before we move on but i have to pickup some friends
so it'd have to wait
basically there is this server only take damage event that is not related to your anim notify
that I have yet to comprehend how these interact
to see the big picture
May i text you in dms?
feel free, sure although not sure how available ill be
today ill have a social day
XD
That's fine. I will just try to explain the entire flow of the code
👍
as long as you learn why stuff is going wrong so you can think of solutions yourself its all right 😄
That's one of the reasons i wanna type it out lol. Thats how i usually really understand something
How do i set net update rate in component?
There is no NetUpdateFrequency in component
I might be mistaken but I think components use their parent actor's net frequency, please someone correct me if I'm wrong
Is that possible to use beacons in pie ?
Beacons is a topic I'm researching now I haven't touched before
but maybe I'm able to give you an answer later this week
you tried to setup online beacons in pie and got no success?
i imagine with ossnull
i was able to use beacons in standalone with steam running in the background
so that's all I can tell you... if that works for you
so you can test them in the editor, yes
just not sure if PIE would work
Question, did anyone managed to setup EOS plugin + advanced sessions for UE 5.0.3 using epic account (no steam)? I have very weird problems with it (can create session and host joins correctly as far I can tell, but others can't join that session properly). Yes, I use two separate computers with different epic accounts.
when the HOST player left the game, all players will be kicked from the server after the host player, how I can avoid this? in games like call of duty black ops zombie mode ,after host left the game , another person will become the Host by server automatically and the game continue , how can do that?
This was talked about 3 days ago. Read till it's not related anymore: #multiplayer message
Have pawn must be possessed in order to client -> server RPCs work? If my pawn just owned, isn't it enough?
It's enough to be client owned afaik, and invoked by owning client. Otherwise, it's dropped
doesnt work
{
const FString FullPath = "Blueprint'/Game/Units/" + UnitName + "." + UnitName + "_C'";
const TSubclassOf<AActor> SpawnActor = Cast<UClass>(StaticLoadObject(UObject::StaticClass(), NULL, TCHAR_TO_WCHAR(*FullPath), NULL, ELoadFlags::LOAD_Verify, NULL, true));
FVector Position = Vector;
ProjectAndAdjustLocation(SpawnActor, World, Position);
const FTransform SpawnPos(FRotator::ZeroRotator, Position);
ARODPlayerController* const Controller = Cast<ARODPlayerController>(NetOwner);
ABaseEntity* Actor = World->SpawnActorDeferred<ABaseEntity>(SpawnActor, SpawnPos, NetOwner, NULL, ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
Actor->SetTeam(static_cast<int32>(Team));
Actor->SetOwner(NetOwner);
if (Controller)
Actor->SetPlayerOwner(Controller);
Actor->FinishSpawning(SpawnPos);
Actor->FindClearSpace(Vector);
Actor->RegisterComponents();
if (Controller)
{
Actor->SetPlayerOwner(Controller);
Actor->SetOwner(Controller);
}
Actor->SpawnDefaultController();
OnUnitSpawned.Broadcast(Actor, Controller, UnitName);
return Actor;
}
``` This does not make Pawn owned by PC
for some reason
how can i print ownership?
to be sure
Yep, i think it requires many code change checking if you are in editor mode, was trying to avoid that but not sure it's possible.
Atm i'm trying to persist a connexion over map changes but i think we need to respawn the beacon and reconnect, or maybe use the game server connection instead i don't know what's the best design
I'm not sure what's the thing you trying to persist, but fwiw you got GetSeamlessTravelActorList
The online beacon, you mean i can persist it without having to reconnect ?
If it's a seamless travel then there is hope
There are two versions
One for server, one for client
AGameModeBase, APlayerController
Will try that then, thanks !
Mhh i'm not sure to understand, seamless travel can work if clients are not connected to the game server ?
No. They have to be connected to a server
First time you connect to a server is a hard travel
Hey guys quick question, how are you handling loading the selected character/equipment on a server travel? (e.g I select archer with the magic bow and enter a match)
I can only think of three solutions:
1.- Using the game instance so that the player saves the configuration when traveling, having an RPC on load and loading that character
2.- On travel, use level settings (open 127.0.0.1?Character=Archer?Weapon1=MagicBow) so the server reads them and loads the character based on that
3.- Send the current configuration on an API when the person selects a configuration and have the server run all the logic (e.g. myAPI.com/LoadCharacterConfig&Id=12345)
The first 2 I have the problem that it becomes client authoritative and in the future someone might abuse that, the third option might be too much overkill?
yeah you are right lol
but sometimes unreal has some arcane thing ive never heard before that handles this kinds of things
1- Works. Not my type.
2- Works, though error prone and again not my type.
3- What the heck is this?
Here's my suggestions though
1- Use APlayerState::CopyProperties as it's really the best method to persist stuff that involve the player, i.e. PlayerState/Pawn
2- Wait for my blog post to get a more thorough answer
Though the TLDR is going to be 1
see? arcane things ive never heard b4
Note though that it works only when seamless traveling
ah, so when the player state persists
Correct
If you want something to work for non seamless then you have GameInstance or Subsystems
damn since i come from the main menu that'd probably won't work for me
Subsystems are better imo in that regard
let me check the subsystems cuz ive always done it via gameinstance
Yeah that will probably be a hard travel
So it will not work then
Well there are other methods ^
But in that case you copy the data and reapply it on respawn
You can spawn actors in the world and save them in the game instance ?
Nope
Well you have to reconnect then
References don't persist, and the actor won't anyways
Yes though you respawn with the copied data
Well saving data is ok, the reconnection is annoying :p
Hard traveling is effing annoying
Hey guys.
Do you know how to make „Widget Component“ visible only to the person whose collider Sphere overlaps with it? (C++)
I'm executing some code after my session is created:
GetWorld()->ServerTravel(ServerLevelAddress);
and it's causing my session to not be findable by my client yet EOS dev portal shows that there's matchmaking sessions.
My client prints out that 0 sessions are found.
Do the overlap begin / end checks only on the client side.
so I am back with continuing my attempt at solving this. As I currently have it set up, clients can see themselves "lean" and see other clients "lean". but now the server host wont "lean" at all. it can however see the clients "lean" and I dont know why it is being exclusive. If I switch the authority node, then the clients cant lean but can see the server host now leaning.
im sure there is some simple mistake I have made, but I just cannot seem to find it
Well on authority call LeanLocal
You'd have to remove your Has Authority check and change it to "Is Locally Controlled" and if true, call the event.
thank you so much
you helped yesterday too, thanks for all the help!
I am currently getting a warning LogOnlineSession: Warning: OSS: No game present to join for session (GameSession), does this mean that the session cannot be joined by a client?
no, that log can be almost entirely ignored
thank you
I found the problem with my game, it turns out that the slider I had set with a minimum value of "2" was sending the default value of "0" for the amount of maximum players in the game session
how do i do multi user editing
What this has to do with this channel?
Either #ue5-general or #ue4-general is the channel for it
Hey, never made a multiplayer game before but I am trying to learn. Watching a tutorial from ue4 but I am using 5.0.3 which may have something to do with my issue. So I have used print string to give myself an idea of what's working and what's not and I can create a session, find a session, and join a session but it won't actually join. Is there something else I need to do after? It will print string for "Joined session" which comes after success of joining session but I don't actually load into the same session I just stay on the main menu level
[QUESTION]
Hey, i have quick Q.
I have UPROPERTY with RepNotify. When i trigger the Uproperty from server, only Clients received. On_Rep function doesn't work on the server. Only clients. Is this normal? 
In CPP, yes
Then i will call it manually on server. Thank you for your answer 👌
so first i developed a steam dedicated server game, but then i decided it's too expensive for one person to maintain, and did a steam listen server game
question is
what would be the drawbacks of using a listen server game hosted on some cloud and make it appear as a dedicated server?
I have a UI which I want to ultimately use to save data on a (dedicated) server. None of my rpc 'run on servers' are running, i imagine because of one of these rules...
I attempted to wire in to game state/player state to make the call, but no luck. What am i missing
you didn't show any code
you have to give better information than this for the highest chance of receiving help
even that's not enough, where are you calling save character event?
inside of the UI?
here is my ugly web of trying to find somewhere that can legally broadcast
i can see it fire in standalone, but when i switch to dedicated server/live testing, the call is getting dropped
even that's not enough, where are you calling save character event?
inside of the UI?
yeah. in an onClicked of a button
but, im fairly certain that's not a legal place to rpc, so i started trying to find legal places to broadcast from
So youre accessing the playerstate from the UI?
i tried game mode, game state, player state, and a pawn. no luck
If I want to set the 'velocity' parameter in my CMC, do I need to multicast this? I am running it on server but not seeing it on any client
I thought I was circumventing that by having the owned/replicating actor make a call, which would be allowed right?
That's never worked for me, only when I do it as the server
Try to add a second event that isn't replicated
On the character
And then have that event call the replicated event
sure, tryin
Cmc?
character movement component
I'm pretty sure you have to multicast movement related changes
I dont believe that's something ue does automatically
no luck. any chance 'save game to slot' functions differently on a dedicated server?
It doesn't, can you connect breakpoints
and see if the events are being hit
and then make sure the objects are correctly being passed
Can i debug the dedicated server like that?
I thought only my client was in the PIE
when i run in standalone, the breakpoint is hit and stops
clients shouldn't be giving server any information on saving by the way. The client should say (hey can you save?) and the server just saves
nothing should be passed to the server o.O
and yes you can run breakpoints on server
you are passing the slot name, and the save game object to the server as client
that shouldn't be a thing
that was just for simplicity in testing the rpc
youre saying it might be an actual issue though, and i should just move it now
?
yes
Ok so my issue is, I am trying to adjust character movement component vertical velocity value
The problem is, my actor is a child actor of another actor which is anchored on the xy plane. I attached the actor via the AttachActorToActor node and the attachment works fine
If I want to open map after creating session with LAN true, options should be like that, correct? listen?bIsLanMatch=true
UMG are not actors and they aren't replicable, so it's 1 and 2
SaveGameObjects are not replicable, so they are local. That's why you can't send them via RPCs
Yes
thanks
I turned on network emulation in the editor to get a more realistic multiplayer test of a project I'm working on and noticed that the core movement seemed to have issues.
As a test, I created a new third person project, set the emulation profile to average, and ran the game in multiplayer and noticed occasional pops/rubber banding on my local client. They are small, but still noticeable/jarring.
I'm just a bit surprised - the stock character movement controller has a lot of code for handling prediction and synchronizing the client/server movement. I guess I just expected the default behavior here to be better, so I'm assuming I must be missing something.
You probably have PackageLoss in those Average Settings
PackageLoss is just the worst :P
You can also tweak the rubber banding in the Character movement component settings
Under the client correction stuff
Packet loss tho does no one favors
Ah, I see, it's at 1 percent in this profile yeah.
I do see in UCharacterMovementComponent::ReplicateMoveToServer() that it appears to aggregate "moves" all the way back to the last acknowledged one which should help with lost packets.
I was just about to ask if that misprediction interpolation was tuneable, awesome.
Verified that 0 packet loss removes the issue. I turned it back to 1 percent and tried playing with what appear to be client correction knobs but it doesn't feel like it's affecting the visual pops like I'd expect. Went all the way to one second for interpolation time but they still feel like very quick/aggressive corrections, so maybe I have the wrong ones?
Will keep digging though, thanks both for the assistance ❤️
The red circled values control the time for a server corrected simulated proxy to reach its destination. So you need to be testing with two clients running or sever and client and move one while watching it move on the other window with simulated lag.
Ahh, I think I see, I misread the tooltip. I was looking for how the local client handles correcting mispredictions (e.g. autonomous_proxy rather than simulated_proxy)
Packet loss results in the sever correcting (teleporting) the player to where they’re supposed to be. I don’t think there’s a way to smooth that out because cheaters. You can adjust how much tolerance of deviation is allowed but that could just result in a complete and total desync.
You can interpolate the movement of simulated proxies so that other lagging players kinda look like they’re teleporting less but you as a player will have a jerky not so responsive feeling whenever there’s packet loss. Some AAA games come up with their own solutions to mitigate this as much as possible. There are some GDC talks floating around here and on YouTube for this subject and other similar ones for games like Overwatch and Valorant.
Gotcha yeah, happy to add something if needed. Just seems like if you can work within how unreal expects you to solve these things you tend to have a better time, so was hoping to understand what was there out of the box. I'll probably debug through the source a bit and get a better feel for how that correction is happening now.
I find testing with packetloss can help out with finding bugs or game exploits that might give an unfair advantage due to lag spikes.
I added text renderer component on player character (you know, for nickname above head) and marked that component for replication, but it does not update - player sees their own nick, but not others.
If I had to venture a guess, I am supposed to have separate replicated text variable and if it changes, update text renderer accordingly. Is that correct?
Correct, you don't replicate that component. Also replicating FText isn't a good idea afaik. You already have a name property in PlayerState which is replicated. When the OnRep it's tied to fires you set the text on the component.
Right, I forgot about PlayerState. Will check it.
Need a refresher --> Have an RTS Camera Pawn
How do I cause my multiplayer location to follow the client side pawn? As I roam the map, replicated actors are not popping into view. I thought it was this setting on the CameraManager but it seems to do nothing.
replicating FTexts, especially through RPCs can be appropriate. with how it's serialised over the network, the player will actually see it in their local language
Thanks for the clarification!
For his case, I can still grab the name property from the PlayerState which is an FString and somehow set it into the FText property the UTextRendererComponent has right? I would still have the localization working to my favor?
well yeah thee player name there already exists, but you convert the FString to invariant text in the widget itself
Gotcha, thanks!
plus localisation isn't really applicable to user-entered text anyway
Ah it has to be set beforehand?
I was pretty surprised when I found FText replication "just works" though
Oh wow, that's new to me. I'm not that familiar with how it works all together, but good to know. Notes written down
it replicates a FTextHistory or something similarly named to that, which unless the text is invariant, it'll retain information like string table entries and text formatting over the network
though of course if you do ToString on the server then that's destructive
I see you, so you can't simply convert it like that. I guess I will have to dig into that FTextHistory thingy then.
I've seen the "you can't replicate FTexts" myth here a few times
Literally. I've seen it mentioned quite a few times by big names, that's why I keep being worried about it xD
Though the RPC part you mentioned makes more sense to me now. I've seen an example somewhere of someone RPCing chat messages as FText
Hi, I am using flying mode and want to have server authoratative gravity. Suppose I add movement input in the -Z direction from the client to act as gravity, then if the player net got off, he would be stuck in mid air. Isn't there a way i could have server authoratative gravity?
Need a refresher --> Have an RTS Camera Pawn
How do I cause my multiplayer location to follow the client side pawn? As I roam the map, replicated actors are not popping into view. I thought it was this setting on the CameraManager but it seems to do nothing.
Yeah but there are 20 other things you would need to account for when teh player logged off anyway
I am taking care of that
Quick question: I'm trying to replicate locally simulated weapon bullet spread by FRandomStream and its seeded by 42 -- but players joining late to the match wont be synced with others
whats the best way to overcome this?
Randomly generate a seed for each player on the server and replicate it, updating it after each shot. All players can then simulate the spread locally whenever a new shot is fired.
Each player would see a different spread though?
Actually seeding again after each shot might overcome this, as you said
Shouldn't. Server generates the seed after each shot for each player. When player A shoots, their seed is set to 3583. When player A shoots again, player A and player B will see the seed is 3583 for that player, thus they can simulate it exactly the same.
Gotcha, thanks
Another quick question: how ownership works on replicated UObjects?
Is it equal to replicating actor's owner?
😄 i am sure a lot of you know clash of clans for example.
Is there a way i can do the same, like every client has their own level but they are still connected to the server?
It's the outer actor. You need it to route RPCs for example as you get the NetDriver from there
Jambax's article covers that part iirc
I'm pretty sure a server can have only one map loaded at a time. Unless you have sublevels, I'm not sure how you can go around this
gotcha, thanks
can anyone tell me why all of this is replicated except for the server host? the boost multicast is seen by the owning client and every other client including the host. but when the server host does it, only the server host sees it themselves.
also I am not super educated on multiplayer systems, so I apologize if I have made obvious mistakes.
In case of a listen server, you don't need to RPC but anyways it will fire as normal function on server.
Is the multicast firing when you fire that input on host?
i.e. have you tried debugging it?
Hi folks! I am using "smoothsync" plugin to try and replicate multiplayer movement in my WIP star wars fangame but...
stuff like this keep happening, and no matter what I try i can't seem to get rid of it fully
Any ideas?
The spaceships always seem to be a little bit behind in the other clients
it's even worse because i'm just testing in the editor, which SHOULD be a virtually ping-free enviroment afaik? so it's probably much worse in actual gameplay
hello i am attempting to replicate this trackerball actor's selfdestruct and bool for selfdestruction, I would appreciate some help. It feels like a very small thing I need to add, but I jsut cant seem to put the right stuff in the right spot.
what would be the best way to debug for that? the input does fire on the host client but it is not replicated to the other clients. Which doesnt make sense to me as the clients can see it as long as the host isnt the one doing it
its as if the multicast is not multicasting for the server host only
That's a guess not a fact
Welcome to debugging
tl;dr you press on the node you want to set a breakpoint for and you hit f9
In your case the multicast
Then you can step through your code and see what's being executed and what's not
This has no problem. Should be executing fine in any case. Your problem lies in something you didn't show, most probably to what you do in the multicast
But anyways learn to debug
will do, thanks for pointing me in a direction
what would be the smoothest way to MoveActorToLocation over a small amount of time in multiplayer. I'm guessing some kind of lerping using a timeline? But i don't quite have my head around lerping things yet, so I was hoping I could get some help. Whatever the solution is, would hopefully have as little server correction as possible. This would be a fairly fast movement. Thanks for any help you can provide.
I solved it, I had a pitch modifier node that was messing everything up. thank you again!
What anyone here would do is literally try to read your code and guess why it's not working. The better is option is if you see the debugger, he would tell you 100% why it's not working
^ Last guy did debug his issue was solved
Smooth sync probably does some interpolation, which means you always must have some lag.
I'm executing some code after my session is created:
GetWorld()->ServerTravel(ServerLevelAddress);
and it's causing my session to not be findable by my client yet EOS dev portal shows that there's matchmaking sessions.
My client prints out that 0 sessions are found.
Is there a way to turn it off?
Is there a way to turn on replication for a static mesh actor? Not a BP derived one, but like when you pull a static mesh into the world by hand. I can't find the setting.
I don't see they have any, probably bNetLoadonClient is what you're looking for
There is a setting "Static Mesh Replicate Movement"
I don't think you can do much else with the base Static Mesh Actor class
Yeah that I noticed too.
This is on by default though
Yeah I saw that. Was curious if there was anything else.
I am facing a small issue with replication.
I have a turret above a vehicle which is a actor that contains static mesh of turret.
It's controlled with camera movement. The problem I am facing is, that in multiplayer, the movement of turret isn't replication, can anyone please help me on what I might be missing?
Well it might be this: #multiplayer message ^^
i have a hopefully quick MP question. In my MP game, each player spawns a ghost of their best run on a level, but when the host spawns theirs, everyone else can see it also. How do i prevent this from happening? ❤️ ty
i had the event set to owning client but that didnt solve the issue
Clearly you spawn it client side
Depending from where you call it, it can get executed on server
it is on the player controller
In that case it should be running on the owning client
im nt sure i follow
i have it set to owning client
but it still spawns for all players when the host does it
And I say that's not logical. At this point you have to decide if you want to share code or not
you mean i shud send pics?
Yes
Who calls that event
and they arent set to client only
could this be the issue?
ok i tried making those client and it didnt fix it
so that is called from this
also on the PC
and that is called after the server spawns a pawn for the player that joined
If you are already on client, why do you keep calling client RPCs
You are already on client, call a normal event
It will execute on client
No. It will execute on client, but that's some bad habit
Also here the event after possess is a server RPC. You are calling it inside a server RPC. Same reasoning
Should be a normal event
ah ok
so if im on a server event, if other events i call need to be on the saerver also i dont need to mark them to do it
since its already there
Correct
Same goes for client
The event is self also should probably be a normal event (Request Player..)
That's 100% called from server.
Yes. You already call it from somewhere where it's server
Where do you call it from?
I meant from server or client
client i believe
RequestBeginPlay doesn't tell me much
That's custom
I'm looking for the engine function
it calls the client though right in that function?
and this is the one that calls request gameplay
thats everything from the engine event
No worries, it's for me too 💤
How do you handle replication in level instance? it seems like it doesn't update clients.
You mean in the level blueprint?
yeah, the level instance you add to existing map (not level streaming)
the blueprints that i have in it, when it call multicast; it doesn't send to clients
This is without level instance, it send both to Client and Server
this is in level instance, only appear on server
It seems like the level instance are not aware of clients? do you need to load them or something?
Net Load on Client is checked.
You need to understand enough about your setup to determine what your problem is. Are you doing client side movement prediction?
I ended up testing it in an actual game after packaging and it was much, much better, barely at all noticeable
i guess it was just the editor being janky af
Is there a reason ClientTravel() would only be working when ran from inside the editor and timing out when ran from outside the editor?
I'm struggling a ton with a replicated struct. On a server RPC, i load save game slot in the controller and store the loaded data in a local struct (which replicates)
It works in standalone, but on a dedicated server, the client never gets the loaded data, it just has a default values struct
probs need to paste some code
so here's the server rpc that loads a save, pulls struct data out, and sets the local version
First problem is your replicated struct appears to be stored on the game instance, which does not replicate
And infact cannot replicate
maybe ive combined 2 problems
I was trying to put it somewhere that would persist between levels
i landed on gameinstance last, i tried a bunch of others first. pawn/controller/etc
GameInstance survives level transitions but only actors have replication support
Maybe you can help me take a step back and think about the right way to do what im doing
My first question really is why load a save game on a Server, that makes very little sense to me without any background
The plan was to save characters on the server, which is dedicated persistant world
Saving on the client would mean security/data loss issues?
Well, the issue is when you join another server, that save data doesn't exist there
So everytime you join a new server, your save data is gone
At the moment, i have my servers runnin in the same folder
So, it has access to the same saved games folder
Or, you mean, on a level open, i lose everything anyway?
No but in the real world you wouldn't have servers running on the same machine, let alone the same folder
Definitely. This is just getting some foundation setup
So if the data existed in an sql db, i still have a similar issue right?
Server is going to fetch data from somewhere then need to replicate it
It depends, you don't necessarily have to replicate it. It also depends what it is.
If this is player-specific data, then the only logical place to store it really is the Player State or player controller
Even if the game instance method did work, you would be setting that on everybodies game instance
player data but not player specific. Things other clients would need to know about entities it encounters, like their names/levels
that would be replicated right?
Oh. because i would be referencing it by obj, and all clients dont need all the data all the time
Data about entities belongs on the entity itself
Hey there! I'm doing some Procedural meshes on client side and I get this weird error from LogNetPackageMap
Warning LogNetPackageMap FNetGUIDCache::SupportsObject: ProceduralMeshComponent /Game/FirstPersonCPP/Maps/UEDPIE_0_FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.BlockWorld1.Chunk 51 NOT Supported.
Warning LogNetPlayerMovement ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction! Client currently at world location X=331.468 Y=255.332 Z=148.155 on base StaticMeshComponent0
I would expect mesh generation to be fully unrelated to networking, I don't want to replicate anything with that, how is that error even possible?
i guess i assumed that needed to be replicated to be available to other clients
Each of which is presumably an actor, and replication already has concepts to deal with relevency etc.
Set CanBeCharacterBase to "No" in your procedural mesh
The object the character is walking on has to be network addressable to use based movement
Ah, that's a pain. But it makes complete sense.
Would it work if I set CanBeCharacterBase to "No" only if I'm not the Authority?
Basically I want the server to have the meshes of all players, for movement, but clients only need the mesh of what is around their own player.
No that won't work
The server and clients all need to agree on the movement base
For all players for all clients?
Just the controlling client and player
The Server can have all meshes, that's fine, and clients can only have certain meshes relevant to them, but the point is that all the mesh components need to e individually addressable, which means all names and ID's have to match for all clients
Alright, so as long as names & IDs match I can generate things separately. Cool. Thanks.
But the long and short of it is they have to be network addressable, that's really all there is to it
Which either means their object names have to be completely stable (aka in the level or deterministically generated), or they are spawned at runtime and replicated by the Server.
I'm still doing something fundamentally wrong it seems. I cannot get the saved game data my server loads back to the client
I'm presenting the user with a list of save files, that contain basically just a character name for now
The user selects one, and is sent to another server, where the first thing it does is attempt to get the data from the save slot
The server is successfully loading, reading, printing the characters name, but the client never sees anything but default values in the data
Is there any chance it's because i'm using 'set ...' to set the struct as a whole? Do I have to do something else, like set members of?
Setting it in one go is fine
I mean you are getting PlayerState from player "0" there though, which is always going to be the first player in the server, or the server itself
yeah i swapped that to the proper multiplayer version
That means it's complex to do component pooling, no? The result of "picking from the pool" must be the same on client and server, otherwise names won't match.
If the components are not replicated, you have to spawn them with deterministic names on all connections, and yes you have to choose the right ones. You will also have to subclass the component to ensure the network functionality regarding stable names is overruled.
is (and if so how much) replicating properties more performant than reliable multicast RPCs? I want to trigger some event on simulated proxies but I don't mind little delay in it, so initially I used replicated gameplay tag for it. But occasionally the engine doesn't replicate the same property value multiple times even if I use push based model so I've come up with an idea to wrap the tag into a struct and add a new nonce property (uint8) that is different on every update on server so that I can trick the engine. Does such hack worth the benefit of avoiding using reliable multicast RPCs? I don't mind the 1 byte overhead (if I wasn't that lazy I'd even implement custom NetSerialize to leave only 3 bits of the nonce)
The usage is different, so it's not really a question of performance.
State = Property, always
Hey Jambax - do you plan on digging into Iris?
Probably eventually
I wouldn't mind replicating the procedural mesh component, picking the pool from the server and just sending the comp reference in an RPC call.
Then ID would be identical for sure. Although I hope that replicating a PMC does not actually send mesh data over network, it's much easier to generate on both sides from a small input that is sent over network.
I doubt it does tbh
I've noticed that you do not have network data straight away and need to wait few ticks after new player joins before you can safely access stuff like network id or name. Is that normal?
from the client? absolutely normal
what to do in this case, just loop over ticks until IsValidUniqueNetID returns true?
No. That property is replicated
Inside PlayerState
You have OnRep_UniqueId
Wait for it to be called
ok, thanks
I don't see it in list of overridables on blueprint derived from PlayerState, is there way to do it? I would like to avoid doing it in C++ if possible.
That's because it's not exposed to BP and I don't know of any workaround but to use cpp
You're going to have a hard time if you keep using BP for MP
You're going to end up using C++ in networking. Or you could try and find plugins that handle what you're trying to do.
bleh. Ok, thanks
For reference: #multiplayer message
LNK2001: unresolved external symbol "public: virtual void __cdecl IPlayMontage::PlayComboMontage(enum AttackTypes)" (?PlayComboMontage@IPlayMontage@@UEAAXW4AttackTypes@@@Z) any ideas ?
You haven't included the correct module in your build.cs
(or the function isn't exported)
void AActionTCharacter::AttackLight()
{
PlayComboMontage(Light);
}
void AActionTCharacter::PlayComboMontage(AttackTypes AttackTypes)
{
UAnimInstance* AnimInstanceRef = GetMesh()->GetAnimInstance();
if (AnimInstanceRef)
{
PlayComboMontage(Light);
}
}
Wrong class
?
oh
If it's not there, the compiler might expect one and throw errors, like that, where it thinks there should be one.
so I should always do that?
For interfaces, absolutely.
virtual void PlayComboMontage(AttackTypes AttackTypes) = 0;
Also in the input could I add it to the input or I need to create an addtional function then put the interface in it?
You can't override functions and change signatures like that
Well, you can, but yeah. You probably shouldn't.
oh so need to go into a functions then called on the input
I'm using OnRep_PlayerName(), but GetPawn() (returns pawn controlled by this player state) returns nullptr... I intended to cast it to player character and call function that sets name over character's head. Any idea what could be done?
Create a second function (change the name or add using YourFunctionName; to your class to import the base class function instead of overwriting it) and do whatever you need to do in there.
A different function name would make your code a lot clearer.
Hi, I seem to have a problem with properly timing events when trying to refresh player UI in a network game. I need to present some initial data on the UI, which is a widget component in my pawn. This implies I need to set it after BeginPlay has been called, otherwise the widget does not exist yet. The data is owned by PlayerState. On the serve...
so I should use OnRep_PlayerState()?
From pawn class yes
oh, I think I get it. thanks
virtual void OnRep_PlayerState() override; on my character (class AMultiplayerTestCharacter : public ACharacter) seems to not be called at all. checked with debugger, there is also logging
I do not know what I am doing wrong.
No idea really. For sanity I tested it and it's called fine
I also think it should work, after all OnRep_PlayerName() in PlayerState-derived class worked, even if value of GetPawn() did not exist yet...
What's the default NetUpdateFrequency?
Just create an actor and look?
Ew I have to open a blueprint, fine whatever.
Could also just look at the property in the AActor class itself.
It says it's 100, that feels like a lot
Actors will observe a maximum update frequency set in their NetUpdateFrequency variable. By reducing this variable on less-important or less-frequently-changing Actors, network updates can be made more efficient, potentially leading to smoother play experiences in limited-bandwidth scenarios. Common update frequency values are 10 (updating every 0.1 seconds) for important, unpredictable Actors like player-controlled characters in a shooter, 5 (updating every 0.2 seconds) for slower-moving characters like AI-controlled monsters in cooperative games, or 2 (updating every 0.5 seconds) for background Actors that are not very important to gameplay, but are still synced over the network and/or are controlled by server-side logic and thus need replication.
They say 10 is for important actors
I guess the minfrequency plays a role, that is 2.0 by default
Also, if I have a simulated physics skeletal mesh that I am replicating, is it important to setsimulatephysics to false on the client to prevent it from getting out of sync?
I feel like it is but it's hard to tell the difference, having tried it with and without
i still can change the value in cheat engine. what i did wrong?
Client is passing the value directly. Then the server is just adding 1 to it.
Server already has the amount of gold someone has. No need to have the client pass that value.
Client can intercept and say "I have 10 gold, not 1", then the server just takes that and increments it by 1.
thank you i get it but how to solve it
Don't pass the value from the client to the server.
In fact, you shouldn't even let your client call any function that augments their gold value. The server should be able to do that logic itself.
is it ok to do this logic in player bp? or i need to change it to player state or controller?
It's not ok to do this logic anywhere at the moment. There really should be no reason you have the client tell the server to add 1 gold to themselves as this can be exploitable.
If the idea is to have some kind of "coin" being picked up, then that logic can be handled within the actor where the pickup happens.
For example, if you had a "coin" actor that you place in the world, on its OnOverlapBegin event:
OnOverlapBegin > HasAuthority (True) > Cast the "Other Actor" from OnOverlapBegin to your character class > Add 1 gold to the gold value of that character > Destroy Actor (Self)
The HasAuthority makes sure the code is only running on the server as that's where you want the coin value to be set.
thank you i'll keep that in mind and try it
Hello, I'm trying to create a skeletal mesh at runtime, but the SetSkeletalMesh node only set the mesh on the server (only server sees the SKM appearance), any idea why?
Edit: I tried to add the Skeletal mesh directly in the Components panel, under CapsuleComponent, then :
- Checked Character has bReplicates=true
- Set CapsuleComponent, SkeletalMesh to ComponentReplicates=true
- SetSkeletalMesh on server
Still doesn't work...
Edit2: Ok so it seems that skeletal meshes don't replicate their mesh, not like static meshes, I will use a repnotify on a SkeletalMesh variable
you use has auth i think this is why
Yes but the SKM component is replicated, it should replicate to client, right?
If I don't replicate I will need a RepNotify to update the SKMComp mesh
Hi guys, I am trying to replicate a webbrowser for multiplayer. So that a player can change the address of the browser and it will replicate for multiplayer to see the same website
Has anyone done this?
Anyone have any cool multiplayer tips-n-tricks for handling predicted grabbing of (mostly) server authoritative physics objects? 😄
I don't know how to display a webbrowser, but to share the web link you can :
GameState:
- Create a RepNotify string variable called "WebLink".
- OnRep_WebLink : Display the webpage
PlayerCharacter: - Create a server event "ChangeAddress" with a string input, that will set WebLink
Now just call "ChangeAddress" to change the website
Yes you can have a web browser widget after enabling the web browser plugin and restarting UE. You can also add the web browser widget component into a regular actor with a static mesh (computer monitor) and then adjust the size and location.
the widget webbrowser will replicate for multiplayer?
Solved it, OnRep_PlayerName() works only on client, on server you need to call use PossessedBy()
Is checking for Authority/Not authority a different paradigm than checking if Server/Client, or are these supposed to go hand in hand?
I don't see how writing flow based on role works well with RPCs which target Server or Clients.
Generally speaking having authority is an indication that you're running on the server, however, if you have actors that are spawned locally on clients, then the client can have authority over those actors rather than the server.
If the intention is to make sure whoever should have authority is doing the thing, then has authority should suffice. Generally speaking, you shouldn't need to ever use a server->client or client->server RPC then use a HasAuthority node as you know you are running on the server or a client, but that distinction is lost if using multicasts or other non-replicated events, like OnOverlaps/Hits etc. in which case you may only want to run logic if you know it's the server or a client.
You will also run into troubles using HasAuthority if you're dealing with listen servers & dedicated servers and you're trying to use the "Remote" path for only running something on a player's end or not as one of the players can also be acting as the server, and so, they would normally have authority. In this case you'd need to do a check like:
HasAuthority (Remote) > Run stuff for client. (Any clients would run this)
HasAuthority (Authority) > IsDedicatedServer() (False) > Run Stuff for client (the host would run this)
Is the server RPC's Function_Validate function ran on the client?
Well no. All the OnReps are called on client. If you want it to get called on server you need to that manually
Also you don't call PossessedBy manually
It gets called when you possess a pawn on server
Automatically
I said wrongly, I meant "you need to put code in PossessedBy()"
Oh then that's something else :D
How do you guys handle when the game is started when a friend invited you to play a game via steam?
Thanks for the answer.
I am a bit confused. Let's say I do the collision query in the Character.cpp tick function. And make Interface->ShowInteractionWidget()
of the closest actor with an "INTERFACE-class" and disable rest with Interface->HideInteractionWidget();
How do I make this all show only locally, so that each client is autonomous and maybe if I have listen server enabled also the server has only its own widget state.
In this case, because it's a character/pawn, you can do a IsLocallyControlled() check, if true, do your traces and then display the widget.
99.9% sure it's only on the server.
I believe the concept behind it is to kick anyone who may be sending invalid values to the server.
Yep, I was looking through it more and thought the same.
Thank you very much.
So is the use case for _Validate to do something like check if the player is within distance, object not null, variables set, etc to prevent cheats?
It's to validate whatever you wish to validate when the RPC is received, but returning false from it will cause the engine to kick the player.
So like, if you know the player has only a choice of 0, 1 or 2, but someone somehow sends a 5, you know it's an invalid call so you'd return false.
Kick the player?
Kick the player.
It's meant to be like your first line of defense against a bad RPC. You check whatever input values are what you are expecting or if you were even expecting the RPC itself, and if not, you know the person is manipulating their client or sending their own malformed RPCs manually.
Talking about cheating, does a player can read in the memory and from reading a pointer, deduce what object it is and read its variables?
technically yes
is GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_Flying); supposed to be automatically replicated?
Ok thanks so I should replace some replicated variables with rpc i think
@fresh chasm I wouldn't
No. Replicated variables won't get changed on the server. Doesn't really matter if clients change whatever on their end.
Even if it gives a big advantage to people that does this?
I'm not afraid of people changing variables, but reading them
^ Wouldn't alter what happens on the server
Well with enough knowledge you can also hook function calls, so that would not make a difference
Like on a survival game, if a player knows what is in a player base, it will give him a big advantage
You won't be able to avoid that.
You should focus on relevancy then
Mostly.
avoid the server sending info if the player is not concerned, there is not much you can do
^
Using rpcs or ? Currently I have chests that replicates their content
Don't replicate their content to everyone all the time.
Wait I can choose to which people the content replicates?
you don't really need to replicate their content at all, it can stay on the server
and do the spawning of the loot server side
Not sure, haven’t tried but would assume you can share the URL between clients.
And then how do you send the content to client when he opens it?
Request the information through RPC. That's the typical way to make chests and inventories
I'd be careful with relevancy. It can get quite complicated
Send an RPC when the client touches the chest, and checks on the server that the client is indeed close enough to the chest to open it
It's often not even worth it to go the extra mile just to avoid cheating.
And yes no need for relevancy here, you should avoid relying on relevancy whenever you can
Making everything server sided is an easy way to a complicated game that some clients will experience lots of bugs on
Some things need to be client sided for best user experience
By revelancy you mean Reliable / Unreliable?
No
You can choose to make things relevant or not relevant for certain clients
They won't recieve network information on it
and they will receive network information again when they become relevant again
Oh ok I get it
I would highly recommend to not worry about making your game hack proof for evey little thing. It could be a lot of unnecessary effort. Program your game first and make sure that it actually works :p
Then when hacks are found and exploited you can patch those
True, I will do that thanks for the advice
I'm struggling to unposses/detach an ai controller from a dead enemy. I think its a multiplayer issue. I'm calling from a server RPC on the pawn itself when it dies
So I'm looking to develop matchmaking for my game. Currently we just join servers by searching for sessions and joining. My thinking is to make a matchmaking app using the EOS/Steam SDK and then have that manage the incoming players and forwarding them to the server that gets created for their game session as it comes online. Is this a standard approach?
You mean you want to stop ai logic?
Why are you worried about your AI Controllers from dead enemies?
I have a health = 0 trigger, and i want it to stop running around and fall over
but... i cant make the behavior tree stop and it keeps runnin
from hours of googling it seems like i should be able to just call unpossess or detach pending
If you're calling a server RPC from a pawn for an AI, you're definitely encountering something multiplayer issue related.
As you shouldn't be doing that anyway....
you don't need RPCs, I don't nkow what you're doing
the AIs are on the server. the server can just unpossess it or do whatever you want
Just in case if I switch to rpc method later, if a client spam click on the chest, it will send content over and over again, is there some sort of network usage limitation in unreal?
prevent them from spam clicking the chest?
You can restrict that yourself by limiting the response from the server.
neither is workin
Oh yeah that's the way to go, thanks
You can't stop players from sending packets but you can control what you do in response
What is calling "Die"?
What is calling "Receive Damage"?
yeah, we don't need to know what's calling it
to help here lol
there should be a brain component on your AI if I remember correctly
We do if they're calling "Receive Damage" on the client.
No. Damage calculations should be done on the server, and you can't call an RPC on an unowned actor.
AI should be handled on the server entirely
say an ai char walks into a trap and takes damage. cant the pawn say 'hey, im dead' and deactivate its own controller?
you just code it to run and let everything happen server side
Flow would be something like:
Player Presses "Attack" Button > RPC To server they want to attack > Server plays attack sequence, spawns any damage dealing projectiles or does traces > Server Finds Hit Enemy > Server Applies Damage to Enemy > If Enemy is dead on server, then it can depossess.
For a trap, so long as the trap is spawned on the server >
OnOverlapBegin > Has Authority > Server Applies Damage to Target hit by Trap > If Enemy is dead on server, then it can deposses.
@datura boo server traces
if i had a dollar for everytime I got hit markers and didn't actually do any damage
Simplification... I know line traces you'd probably do on client and send over the result...
How would you trust the client result ?
you'd have to validate it
Do some sanity checks on the server.
make sure it's something reasonable
The client could get the target location and do a trace from his camera to the target loc right?
with a modified client
are you talking about preventing cheating?
yes I don't get it how you can prevent it
depends on the game but you'll just have to check that what was done is reasonable. So for example, you'd want to use relevancy to keep information from clients that they shouldn't know
For example in our melee slasher game .I'm. Client does the trace -> sends results to server -> server checks if the client is in an acceptable distance to land the hit, and checks to make sure the actor they are hitting was rendered on the client, and checks that they weren't flinched between a certain time frame (an estimated time that the client swung) and some other small stuff
You can usually deduce what's cheating and what isn't
then on top of that, you could do something like, was the player at some point where this shot makes sense at N (ping) moments ago
Oh ok I get it
The check might be bigger than the actual swing lol
I can't wait to start these anti cheat things, I like it 🙂
You'd be surprised how big our melee system is
We couldn't afford to put that on the server even if we wanted to
Because it's doing multiple trace from the start of the blade to the end?
I have a combat system that does that, I was about to move this logic on server, but it's not a good idea apparently lol
Arm tracers, leg tracers, weapon tracers, weapon sway at the time of swinging, determining the type of attack, resetting everything when faints are called, morph detection, parry cancels, detecting world hits
There's so much being checked consistently when a player attacks
Because theirs so many different possible outcomes
That it's just too much for the server to do on a game with 50+ players fighting
Yeah don't, let clients generate the results, and let the server verify them
Oh I see, looks like mordhau combat system
I would love to test your game when it comes out :p
It's been in alpha for a while now, we are going to closed beta soon
A starting player? AGameModeBase::HandleStartingNewPlayer
Not sure what's going wring with my client RPC... I'm calling it from within this if statement
{
GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Orange,
FString::Printf(L"spawn/equip called from netrole %d", GetLocalRole()));
SpawnWeapon(WeaponClass, SLOT_Primary);
EquipWeapon(SLOT_Primary);
}```
Within my EquipWeapon_Implementation, I have:
```if(weapon->FPAnimInstance != nullptr)
{
FPMesh->SetAnimInstanceClass(weapon->FPAnimInstance);
GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Orange,
FString::Printf(L"AnimInstance set for netrole %d", GetLocalRole()));
}```
But in the debug message, it always says netrole is 3 (authority). Shouldn't it be 2, since it should be executed on the owning client?
The RPC's are defined as follows:
```UFUNCTION(Client, Reliable)
virtual void EquipWeapon(EWeaponSlot slot);
UFUNCTION(Server, Reliable)
virtual void SpawnWeapon(TSubclassOf<AWeaponBase> wep, EWeaponSlot slot);```
not on a listen server where a player is also the host
I was running as client
also as a listen server w/ a connected client (it should be 2 for that client anyway, no?)
no
the listen server will always be authority
and running a single client in PIE without telling the editor to launch a separate dedicated server means you're running a listen server.
I had this option selected. Does what you just said still apply?
When I said this I meant I tested both options, listen server and play as client
play as client runs a separate server, yes
which debug message is saying what though
All of them are saying 3 for the net role
And what is this actor? Who owns it?
Is this the default pawn spawned by the gamemode or are you possessing it after the fact? Trying to understand if ownership is actually set correctly.
Then it seems like it's being executed before the pawn is actually possessed
So it's running on server
For sanity check what the net mode there is
for some added context, the first if statement is within the actor's BeginPlay
that's where the "spawn/equip called from netrole %d" debug message is
Ok then that's most prolly the issue
BeginPlay is called before Possessed is called
so is there a "OnPossessed" event I can use then?
Yes
I take it this is what I want?
https://docs.unrealengine.com/5.0/en-US/API/Runtime/Engine/GameFramework/APawn/ReceivePossessed
That's in BP
I can't recall what is it called in cpp, but should be something like this
APawn::PossessedBy
Override it and call Super
Then do your thing
👌 tyvm
in my 4 years messing with UE, online is by far the worst thing i have ever done lmao. Literally nothing ever works how i think/hope its going too xD
Welcome to #multiplayer 🥳
It helps if you come from a background in asynchronous programming.
Doing Web tech is very much like mp in that respect.
Or at least some experience in that sort of thing.
Hi - So I read that AI can only be done if you set up a server, which should have explained why my Get AIController call returned None even though the actor in question has a default AIController. But, when I set up a local server and connect a local client to it, it still returns None in my debug messages. Anyone have any idea what I could be doing wrong?
I set up a server using a windows batch file shown in this video. It worked just fine as a test server/client but the AI still didn't seem to function. https://www.youtube.com/watch?v=TNu8TBDuBjM
this is my BP. My AIController is running the appropriate BehaviorTree which is connected to the appropriate Blackboard. The controlled actor is fine and in the debugger shows that its AIController class is appropriate.
I was also using this tutorial where the presenter has no problem using the AI without a server. This was about a year ago though, so maybe things have changes since then. I'd appreciate any explanation. I'm fairly new to Unreal. https://www.youtube.com/watch?v=5glARrtPS9U
In this episode we continue to delve deeper into AI and take a look at AI behavior trees and how it can communicate with blackboards and perception in Unreal engine 4 and Unreal engine 5.
Support me on Patreon here: https://www.patreon.com/LeafBranchGames
Join the Discord server here: https://discord.gg/zBeebU7uv3
What's the difference between ROLE == Authority and HasAuthority() in C++?
FORCEINLINE_DEBUGGABLE bool AActor::HasAuthority() const
{
return (GetLocalRole() == ROLE_Authority);
}
nevermind, I figured out that I had to use Spawn AI From Class instead of Spawn Actor From Class
Hey all,
How can I make the ui input navigation player specific in a local multiplayer? just like in gears 5? player 1 controls its own ui and cannot control player’s 2 ui and vice versa. i have been struggling with this for the past 2 months and reached a dead end.
Any help would be deeply appreciated
Quick question, it is not guaranteed that replicated properties reach the same frame that they were changed. But can I guarantee it if I bind them in a single replicated struct? The struct will replicate as a whole and hence the replicated properties will reach together. Is this what will happen or still the individual struct properties might differ in frames they reach?
So how does RepNotify work in regards to something like playing a sound? Will it play the sound once it becomes relevant? So multicast would be better or does it save the time of the RPC?
That a player can be acting as the server sounds like such an insane idea. Why on Earth not keeping them distinct and run the server in "parallel"?
Multicast would be better for playing a sound as it's more of a fire and forget kind of thing.
It then allows players to easily host their own games and not take up additional resources to effectively do the same thing twice on one machine.
Not sure I follow the question.
Multicast is used if you have something fire and forget. If players aren't relevant to the actor, the multicast wouldn't be received. If you do a repnotify, relevancy still applies, except the players who are not relevant when it fires can have it fire when they are relevant, so it wouldn't be synchronized anyway.
If you have a sound that you absolutely want shared and synchronized, then use an actor that is always relevant, like GameState and do a multicast that plays the sound. It should then be mostly synchronized.
If it needs to be attached to an actor too, then that can still be done locally on the multicast.
using either a timestamp with synced network clock, or a small hack with RepInitialOnly would work there
if your clients are aware of the delta between their and server world times, then they can translate the server timestamp into their own world time
and play your 30 second sound from 17 seconds in, for example
other hacky way is to have SoundRemainingTime ticked down by the server, and have it Replicated with Initial only
in that case you get only one OnRep as the Actor becomes relevant, but you can't use it to start a sound on relevant clients, and would have to rely on a multicast for that
special obfuscated rules, less work but its ugly
Anyone?
don't actors and objects save their fields after seamless travel?
Question: How can we create a grabbing feature for a multiplayer ?
we want to create a feature, where only one player can Grab an Actor in the world. If an actor is grabbed by someone then other players wont be able to grab it.
In order to do this, when a user wants to grab i make user grab the Object locally, then send an RPC to server which sets the data on server using a repNotified Parameter and that parameter makes the grab for server and simulated proxy.
if i dont do it immediately for user who was wants to grab, then you can see a little delay because we are waiting for server to replicate the data to the same user also.
this approach has a flaw at this moment, because the currentGrabingPawn parameter is on the Actor to which we want to grab, and that parameter only gets set on server (who is current grabbing pawn).
doint it on client does not make sense.
This approach will work most of the time, unless 2 client does Grab on the same actor exactly at the same time.
because user grabbing happens first on Client, although they are checking if currentGrabbingPawn is valid, but it is being set on server only, so they might both be valid to do grab.
so they both grab on client, but only one happens on server and simulated Proxy.
so my question, how should i create a mecahnism where client can see grabbing quickly as possible but also does not allow two users to grab at the same time.
You'll need to reconcile. The server will do the final decision on this and then clients need to adjust on this. So if two players grabbed it locally, the client, where the server decides didn't grab it, will lose the control.
so the client who failed on server should, release it ? right ?
yep. It's the same with quick response to shooting. Locally it looked like you killed someone, but the server decided different and the client needs to reconcile^^
right, thanks, make sense.
This might be a really simple question to some, but im just starting out - How do game developers make the first person playable character seemingly invisible to himself, except the arms? This is seen in almost every fps game, to others you look like a regular character, but you dont see your legs or body, but the model and character shadow is there.
you literally use a second mesh but with arms only
I hate it
That doesnt explain everything
How can everyone else see my character but not floating arms then?
when you click on the mesh component there's a variable called "only owner see" and "owner no see"
you set the character mesh to owner no see
and you set the arms mesh to only owner see
Hm, alrighty
I want to change actor variables from player pawn
but actor cant replicate variable changes to server
In the details you have to set the variables "replicates" to true
and then click on the variable, and set it to replicates in the details panel
you must be setting the variable on the server
you can not update it on clients
that's exactly i cant do r.n
how to do that
what's calling the event
i want to spawn item on client only..but its spawning on server
use "has authority" macro
from server. event works perfect
no I'm saying if you want it to spawn on clients
I think, client actor can't access to server actor
but pawn can
i tried that it always goes to authority
which is right server is cslling interact
for pawn i ask server to interact
if you run the function on server then yeah it'll only go through authority
you need to use run on owning client
from server to owning client right
crate an event and set the replicated property to run on owning client
then spawn the actor
//A ServerRPC on my PlayerController, requesting possession of a Pawn
this->Possess(RequestedPawn);
RequestedPawn->MulticastFunction(SomeData);
MulticastFunction_Implementation(SomeData) will be run on all clients' instance of this pawn. I need some slightly different/additional code to run if I am the client that requested the possession. Due to the nature of the order of events, I'd like for this to just be a simple if-check in the middle of the same function that everyone else executes. Am I guaranteed that the possession is completed on client-side before the multicast-function fires for the client, so that I can just check if GetFirstPlayerController()->GetPawn() == this inside the multicast, or should I pass the PlayerController in the multicast (RequestedPawn->MulticastFunction(SomeData, this)) so that everyone receives the data AND the requesting PlayerController and can check if RequestingPlayerController == GetFirstPlayerController()?
Or are there other approaches I should consider?
what's calling interact?
How do you hook up the "Join Game" option in steam friends list to actually do something? I'm working on a multiplayer coop game and finding/join sessions all works great - I just cannot find any documentation on this button and wtf you're suppose to do to hook it up. Anyone here have it working or some documentation on it?
player e->
I've managed to make my 'dead' AI enemies stop AIing, but its a monstrosity. Can someone help me clean this up?
i have a hunch these are showing up because of a multicast
When an owned actor attacks an AI, it calls on server a function on the AI entity, which then multicasts the detaching
The stops/detaching are successful, but I still get the errors, so I think even with the switch, the multicast is causing someone 'extra' to try and detach?
Generally speaking, you shouldn't need to do a multicast for damage application. The health stat should be replicated. You do all damage handling logic on the server and client just gets the new value.
Hi,
I have a problem where a multicast runs twice on the server, but is only called once.
It runs through the function the first time and then the next frame it gets called through an ActorChannel on the server again?
Listenserver?
Yes
on the same instance? (object has the same memory address)?
Yes sir
That's how I first saw it because a integer got ++ twice and I was like huh
I can show the callstack
how do i receive notifications of changes to items as a listen server when using a FastArraySerializer?
PreReplicatedRemove()
PostReplicatedAdd()
PostReplicatedChange()
only called for the clients
you implement it your self^^
If they change in the same frame then yes they will arrive in the same update
CopyProperties
Almost all of them don't. The few that has to the ability to do so, must be done manually. See APlayerState::CopyProperties for reference
Good morning everyone.... I'm still haven't an issue replicating a Webbrowser for multiplayer.
Does anyone know how we can replicate a webbrowser for multi-player?
I found a work around... which is to setup a virtual camera and it can record the webbrowser and then that video feed would be shown on the multiplayer screens
By the time you travel both are valid. And anyways I would have the inventory on PS
You null out the inventory on PS then
That's when the pawn spawns
But when he is killed it's still valid
So is there any fix for clients jittering visibly from the point of view of the listen server in 4.27 or is it one of those things that Epic never got around to?
I believe the issue is that listen servers only tick client movement / animation when receiving network updates rather than every frame as they should (and as clients do with each other)
Calling GetMesh()->bOnlyAllowAutonomousTickPose = false; in PossessedBy() doesn't seem to change much as suggested in one of the reddit posts about this issue
It possibly does make animations smoother but the actual movement tick rate is still very low, resulting in very choppy movement
You have refresh bones checked right?
Mkay
Is this still necessary for android lan beacon? https://blog.squareys.de/ue4-android-windows-lan-multiplayer/
You also have to disable the TickPose in the MoveAutonomous or whatever that was in the CMC
This does overall improve things, but yeah, they never fixed it :D
Thanks! Ah it's a shame that it wasn't fixed but I'll take this improvement for sure
One other thing, do you know if it's safe to do this as I know some of the original posts around it said that they didn't know if it interfered with anim notifies and such?
I'm not sure if this should go here or in #gameplay-ai.
Do BBTasks work online? Because, except the movement, all actions in behaviour trees, aren't played in client.
Well AI is a Authorative Concept
It should only run on the Server. Clients are mainly simulating.
Good evening everyone, does anyone know if there is a way to protect ue 4.26 against ddos login floods? specifically for Mordhau servers
Good morning/afternoon/evening everyone!
Does anyone know if the seamless travel method that is in Player Controller "APlayerController::PostSeamlessTravel" is supposed to execute server-side only?
It's. Reason is, it's called from a GameMode function which is server only (and the function called on PC is not an RPC)
Thanks !
Things like cloudflare provide good protection against ddos but there is no actual algorithm that can really protect against ddos. Having lots of bandwidth is the way to go
(edit: nevermind.. they moved Saved/Windows to Saved/WindowsEditor .. wasted hour)
What's the method of disabling steam in UE5? In UE4 I made a copy of Saved/Windows folder with:
Engine.ini
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="DemoNetDriver",DriverClassName="/Script/Engine.DemoNetDriver",DriverClassNameFallback="/Script/Engine.DemoNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Null
[OnlineSubsystemSteam]
-bEnabled=true
bEnabled=false
[PacketHandlerComponents]
!Components=ClearArray
But in UE5 when I try and connect to a listen server with that I can see it checking and failing steam auth
The PacketHandlerComponents ClearArray I think is what I had to turn off steam auth
I also just tried adding:
[GameNetDriver PacketHandlerProfileConfig]
!Components=ClearArray
[PendingNetDriver PacketHandlerProfileConfig]
!Components=ClearArray```
and it still failed
Does packethandler not handle ini overrides?
Core/Private/Misc/ConfigCacheIni.cpp
2929:bool FConfigCacheIni::GetPerObjectConfigSections( const FString& Filename, const FString& SearchClass, TArray<FString>& out_SectionNames, int32 MaxResults )
Core/Public/Misc/ConfigCacheIni.h
847: bool GetPerObjectConfigSections( const FString& Filename, const FString& SearchClass, TArray<FString>& out_SectionNames, int32 MaxResults=1024 );
PacketHandlers/PacketHandler/Private/PacketHandler.cpp
1058: if (GConfig->GetPerObjectConfigSections(GEngineIni, TEXT("PacketHandlerProfileConfig"), ProfileSectionNames))```
Seems to be the only caller of "GetPerObjectConfigSections"
xpost from bp channel:
If I want to change UI when a particular pawn is possessed, how should I handle the client/server?
I can add a ui element on possession but i cant seem to remove it on unpossession
This is the current setup for possession and unpossession
Once your pawn is no longer possessed, the owner is removed, so you can't RPC to the owning client to change the UI.
A better way to handle it would probably be to use the controller's On Possess and On UnPossess functions, seeing as you seem to want to do things in the controller anyway.
Good thought. Ill check it out. Thanks, @sinful tree
when I'm traveling to the main game map from the lobby map, my playerstate seems to be destroyed and made new or something. I have been trying to figure out why some variables on the PlayerState aren't staying valid past the lobby and when I log the PS name in the lobby, it's _0 and after the lobby it's _1 (both logs coming from the server)
and the variable is no longer set
Am I missing something?
You're missing this: #multiplayer message
Override that function and save the properties you want them to persist
Thank you! The description of CopyProperties implies that it's for inactive players returning. I didn't know it needed to be run after travel as well. Thanks!
Is the PlayerState passed into that the new one?
I guess I can figure that out myself if I just look at it haha
Yes the passed is the new one
That's because it's used also for disconnects
thanks
That's perfect
how long does the server hang onto an old playerstate? and what does it use to verify it's the same player?
The NetId is the one used to find the disconnected player. There has to be an OSS implemented for it to be valid
Otherwise it works by saved IP address
Which is not accurate
See AGameMode::FindInactivePlayer() for reference
gotcha, thank you
I kinda figured that seemed like teh only valid way, but I wasn't sure
thanks
Also note that CopyProperties can be used to keep some of the data but not all of it. You have to use OnDeactivated instead. That's a pitfall @winged badger told me about and I'm begging him to explain it to me more 😄
Like how the heck I can pull pawn data there if PawnLeavingGame has already been called (which destroys the pawn)
Is there any way to open an actor channel for specific connections?
Override PawnLeavingGame() in a custom playercontroller C++ class to prevent the pawn from destroying itself, thus preserving the pawn so you can read data off of it, then destroy it when needed.
I know that's the reasonable thing to go for to solve this, though Zlo said that he exclusively populates his FDisconnctedHeroData from OnDeactivated. That's what bugged me out
Even CopyProperties is called after the pawn has been destroyed. So PawnLeavingGame has to enter to scene in the sense of pulling pawn related data
He probably still overrides PawnLeavingGame(), and on his Playerstate's OnDeactivated() he reads the pawn data and destroys the pawn when done.
When he said exclusively, I think he just means that everything that he was trying to save is getting handled within OnDeactivated(), not that everything required to save it was done within OnDeactivated().
Oh yeah that makes more sense than to read data from both places, i.e. from PawnLeavingGame and OnDeactivated. Making the pawn stick to that point even solves the issue he referred to then which was saving the pawn location at the time of disconnection. Then he said that reading the data from CopyProperties won't yield a correct result as the data isn't there yet. So you have to pull that data from a later point in time which is OnDeactivated
Yeah exactly. He told me last week that there might be some detail he forgot to mention and that I remind him this week but seems like he's still busy 😄
Thanks Datura, you was the secret weapon I was looking for
anyone have an idea as to why PlayerState's CopyProperties would NOT be getting called during seamless server travel? i'm in the process of rapidly testing match connection. i'd say about 80% of the time it does get called, but 20% it does not. i'm currently digging thru the source but i'm assuming there must be some race condition i'm not aware of or something
I haven't faced the 20% just yet, but seems like something is failing to spawn or some pointer there is null.
I would definitely debug and figure out what the issue is
oh yeah, just scrolled up and see you've got some similar issues. it's definitely debuggable bc it never used to happen. we've done a million playtests without issue. so something must have changed
It's not really a similar issue 😄
Though this one is from the type of bugs which unless you debug you never know what the issue is
I'm a traveling geek, so if you come to find out that it's some special pitfall, make sure you tell me xD
yeah i always try to post solutions for posterity
Hi! i heard multiple times that replicating a static mesh is a bad idea, instead replicate a variable OnRep and adjust the mesh with that variable on clients.
Why exactly is this? If you replicate a static mesh you send to the net the whole mesh?
If you're talking about the difference between RPC and OnRep:
OnRep - for state changes.
RPC - for one off stuff mostly.
If someone is outside the relevancy of an actor and you do an RPC to change the mesh, they won't see the change. If you do it via OnRep, they will.
why not just set the mesh to replicated?
My understanding is that ideally you want to send only the data you need to over the network. So instead of an entire mesh if all you need is a boolean then just send the boolean and use an onRep to make the changes to the mesh.
Exactly the less the data the better. Also sometimes you can't replicate the thing you're referring to. For example someone might want to change the skeletal mesh. Some think that replicating the skeletal mesh component would make the process of setting a skeletal mesh replicate to clients which in fact is wrong. The skeletal mesh itself is an object which doesn't replicate and has to be set on client explicitly for it to render there correctly.
That's why you use an OnRep for example
But for static mesh actors, if you have properties there that need to be synced over the network then yes replicate the actor
Hi, why a beacon connection is slow to connect ?
got further with this but still not fully solved yet.
the actual bug was that the match was starting before everyone was finished server traveling. this was the result of a very simple mistake. one of my game mode's match start conditions is a check that all players are connected. i was doing this using GameMode's GetNumPlayers() method. but this method returns all the connected AND traveling players. of course i want only the connected ones; the traveling ones are giving me a false positive
however, what happens now is that server travel simply never finishes. so NumPlayers and NumTravellingPlayers return the correct numbers, but the latter never goes down.
edit: this seems to only happen in standalone mode from the editor. at least in some preliminary packaged builds it's fine...i feel like this just raises further questions lol
Need a help with replicating Character rotation. I have a scenario where Character is rotated using Input using SetActorRotation. Since Input is only on client, rotation is not synching properly. How do I replicate it properly ?
It is better to replicate an FRotator variable or a Server RPC ?
Since its happening on Input event, how do we make sure that no buffer overflow occurs on RPC calls ?
You need to apply your rotation by overriding PhysicsRotation() in a custom character movement component if you want it to work properly in multiplayer
is there a way to delay a pawn spawn when a client joins a server? I need to retrieve spawn data from my backend and that's latent so I cannot do it in UGameModeBase::ChoosePlayerStart
Just need to prevent RestartPlayer() from being called, or spawning the player at least
thanks
Sorry for the ping but do you know if this messes with anim notifies or if anim stuff will continue to work as expected? It does indeed seem to noticeably improve smoothness
If it's a safe workaround then it's definitely way better than how it behaves by default!
I do not know
Hey, I've been working on dedicated server, but I got this error: UnrealBuildTool : error : Server targets are not currently supported from this engine distribution. when building the project as Development Server solution configuration. Does anyone know how to solve this, please?
I've been following this tutorial: https://www.youtube.com/watch?v=PIg2q0wEPJc&t=0s
I use:
Visual Studio 2022
Unreal Engine 5
GameLift-3.4.0
My target file:
using UnrealBuildTool;
using System.Collections.Generic;
[SupportedPlatforms(UnrealPlatformClass.Server)]
public class devBR1ServerTarget : TargetRules
{
public devBR1ServerTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "devBR1" } );
}
}```
The only thing I didn't do is building unreal from source, but downloading it from epic games launcher - is that the issue?
Oh okay, thanks
By the way, should I have UE installed from the launcher, or will it be useless?
If I build it from source
If you build from source that becomes your engine version for the project, so you shouldn't need the launcher one as well.
However, it can be useful to have a launcher version installed anyway tbh.
Why tho?
compare and contrast. or track something design/art team have a problem with that you can't reproduce
as you don't want them running source engines, usually, custom binary is fine though
Also at least in my experience it's nice when working on .cpp stuff as you can't accidentally recompile the entire engine with a change
i did that twice in 5 years
I'm not sure why but it seems to like building a lot for me 😄
work the Ctrl+Z into your muscle memory
I never touch engine source files but I think it may be changing .cs files or something similar?
Anyway have been happily working on the binary version now for a year or two with the source build on another PC used when packaging
most of my unintended engine alteration are in scenario
running with a debugger, holding W and a breakpoint in an engine file breaks
Ctrl+Z to the rescue there
never delete, delete is changing the file
I sanity ctrl + Z all the time
Honestly it's a bad habit for me 😄
But yeah it's the worst when you go back a bunch with Ctrl + Z then make a blunder with your fingers and you lose all that you did!
Thanks!
also by custom binary do you mean an installed build made from your source version with edits?
Lmao
yes
Nice, I'm using one of those for fast packaging across all platforms
No reason to sit through the engine recompiling every time
throwing hardware at it also helps Building 337 actions with 64 processes...
So if I build the engine from source, can I change "baked" variables like seed to randomly generate when the game starts?
why would you need a source build for that?
we only modify the engine to fix engine bugs that are too annoying to work around
I don't know, some guy told be that I should use some sort of library to generate landscapes at runtime, because I can't change the brush seed in the editor blueprint / cpp
and ofc, to be able to debug engine code in a packaged game
I see
I have 128 processes and it still takes a long time 😄 There would be no reason to use a non installed build if you aren't making frequent source changes and need to package for multiple platforms frequently though right?
As it rebuilds the engine from scratch for each individual package
this is ofc not the same machine you're working from?
No but still
Package time is like 5-8 mins on installed build
Like 30-45 mins per platform on source build
No real reason to waste the time / energy constantly rebuilding the engine is there? Unless I'm missing something

