#multiplayer
1 messages · Page 214 of 1
Note: they may have been replicated but
If i had a UObject replicated through replicated sub objects list, and it was to be garbage collected on server, would it be destroyed on client too, or would the client just keep its copy of the object till it gets garbage collected on client too?
It will be destroyed from replication
It's marked as garbage when the client receives the notification that the subobject was destroyed on the server
Ok thanks
Is there some delegate that gets broadcast before the destruction?
No, but there's an interface you can implement in your subobject
IInterface_ActorSubobject
Gives you two functions:
class IInterface_ActorSubobject
{
GENERATED_IINTERFACE_BODY()
virtual void OnCreatedFromReplication() {}
virtual void OnDestroyedFromReplication() {}
};
o7
What happens on the client if i remove the object from the replicated sub objects?
Nothing much
You're meant to keep the replicated subobject list in sync on the client for replay purposes mostly
If you don't use the replay net driver, you're probably fine
What do you mean by keeping the list in sync?
Am i supposed to call RemoveReplicatedSubObject on client too?
does anyone happen to know how to add a custom header to a packet? I would like to add the global variable which every replicated actor shares to reduce the packet size
While the server will certainly need to maintain these lists, actors/components on clients should also maintain their subobject list locally, particularly for any actors with local authority. This is especially important if a project is recording replays on clients, as actors on a client will temporarily be swapped to a local authority role when recording the actor into a replay. Because of this, any replay recorded actors should maintain their subobject list on the client, regardless of their local NetRole.
Okay so you should just do it outright
You can use the interface to maintain it (AddReplicatedSubObject in OnCreatedFromReplication(), Remove in OnDestroyedFromReplication())
Make it easy
Nice, apparently when i read that documentation i stopped right above that point lol
Just wanted to say thanks - I believe that fixed it (was tired last night too so had an errant duplicate connection).
Fair to say that controller assignment and de-assignment to pawns (for the sake of possession) is always controlled on the server, this isn't something a client can initiate and manage on their own without the server's authority?
Yes
What's the scenario you're thinking about
Hey 
Has anyone found a solution for moving platform in multiplayer the other players slide problem ( smooth sync) or without smooth sync it is too jittery, so I use client side control ( for better feeling locally) ?
I have tried enable/disable UE replicate movement, but it does not work properly.
( Smooth Sync used becasue if ther is any lag the animations in host side jittering.
Hey, does anyone know why when i connect to a server, i don't load not the server map but the main menu map. like when i create a server, the map is loaded but connecting to the server doesn't work. it connects to the server but doesn't load the map
Have you tried attaching them to the platform on all clients?
Like using a repvar?
Hello guys!
So I face this issue when I attach my Button to my Terminal (as an actor component) and then run it the button turns twice for the local viewing client. It does work perfect though when I do not attach it and leave it as its own object.
void ATerminalButton::OnInteract(UPrimitiveComponent* HitComponent, APlayerController* PlayerController)
{
if(HasAuthority())
{
bIsRotated = !bIsRotated;
MARK_PROPERTY_DIRTY_FROM_NAME(ThisClass, bIsRotated, this);
StartRot();
//Send Data to Terminal
ATerminal* Terminal = Cast<ATerminal>(GetOwner());
if(Terminal)
{
if(bIsRotated)
{
Terminal->OnButtonTurnOn(bIsCorrect);
}
else
{
Terminal->OnButtonTurnOff(bIsCorrect);
}
}
}
else
{
bIsRotated = !bIsRotated;
StartRot();
}
}```
the interface gets called twice once by the local viewing player and once by the server for network prediction
When I delete the "StartRot();" function after the check on authority it works but will not turn for the server.
bIsRotated is replicated like this
```c
FDoRepLifetimeParams RepParams;
RepParams.bIsPushBased = true;
RepParams.RepNotifyCondition = REPNOTIFY_OnChanged;
RepParams.Condition = COND_SimulatedOnly;
DOREPLIFETIME_WITH_PARAMS_FAST(ThisClass, bIsRotated, RepParams);
thanks for any help!
I havent tried attaching yet. It is a good idea actually, If players can keep the free moving on platform. Maybe with a trigger zone could work, only if jump out of trigger deattach, right?
(although currently the platforms working locally ( only set first frame) and player snyced maybe the attach cant help hmm)
The way i normally do things (never tried in multiplayer) is to literally attach the player to any movable actor it lands on, and detatch when they jump. So it automatically works on any moving platforms
And so if you jump the platform keeps moving under you
Since you are detatched
There is no need to attach Characters to movable bases.
CharacterMovementComponent already handles standing on something that moves.
The more important thing is to ensure the thing that moves is mostly in sync between players.
Yes, I have noticed that it worked perfectly when I used replicate movement, BUT if there is any latency, host sees laggy the animations ( not only in Editor network emulation, but in build as well) that's why I started use smooth sync plugin.
And moving platform logic runs locally on each client ( At begins replicate only)
can anyone send me DefaultEngine.ini file with steam subsystem pls?
Listen server seeing laggy animations is an engine problem
Cause it ticks the pose via the rpcs and not let frame
In a inventory, would you set up client prediction for picking up, dropping, moving items or would you just send RPCs and make the moves based on the RPC?
Hey, all! I'm excited to report that I've solved a connection problem (LAN mode Listen Server) that I asked about here, over a week ago. I wanted to share the answer because this is, AFAICT, not documented anywhere, and I've never seen it in a tutorial. This is in Blueprint prototyping, but I think it would happen in C++ as well.
Symptom: CreateSession() with bUseLan=true works fine. FindSessions() with bUseLan=true locates the test session after a couple seconds of beacon scanning. JoinSession() also works at first, and the log has all the setup and performance metric counter initialization messages. Within a second, however, the session is disconnected with Error Code 5, SE_EINVAL.
Solution: My application doesn't have a "lobby level"; the network session control is done within the single level that exists (this an XR engineering app rather than a game). After the session create, the server didn't call LoadLevelByName() or equivalent because [I thought] I didnt' need it. WRONG! The "listen" option is essential and is not implied by the fact that you're in the level that started the Listen Server. Loading the same level I'm already in causes the server to become active, and the client connects.
Follow up: See my next post. The connection happens, but then there is another problem.
Now I've got another warning, which might as well be an error because it's stopping the app from working. Log extract (with private info and IP addresses replaced with fakes):
`/[2024.09.28-15.10.26:464][ 62]LogWorld: Bringing World /Game/MyUnrealProject/Levels/UEDPIE_1_L_NetworkSessionTest_X.L_NetworkSessionTest_X up for play (max tick rate 0) at 2024.09.28-11.10.26
[2024.09.28-15.10.26:464][ 62]LogWorld: Bringing up level for play took: 0.001907
[2024.09.28-15.10.26:464][ 62]LogLoad: Took 0.029761 seconds to LoadMap(/Game/MyUnrealProject/Levels/L_NetworkSessionTest_X)
[2024.09.28-15.10.26:464][ 62]LogGlobalStatus: LoadMap Load map complete /Game/MyUnrealProject/Levels/L_NetworkSessionTest_X
[2024.09.28-15.10.26:464][ 62]LogGlobalStatus: TravelCompleted Pending net game travel completed
[2024.09.28-15.10.26:490][ 63]LogNet: Client netspeed is 100000
[2024.09.28-15.10.26:490][ 63]LogNet: Join request: /Game/MyUnrealProject/Levels/L_NetworkSessionTest_X?Name=mycomputer.example.com-18A4EED10BC348D292AB29FBABBC1D1D?SplitscreenCount=1
/// Snipped some irrelevant UI widget messages from my code
[2024.09.28-15.10.26:496][ 63]LogNet: Join succeeded: mycomputer.example.com-18A4E
[2024.09.28-15.10.26:498][ 63]LogNet: Warning: Incoming ip address doesn't match expected server address: Actual: 10.100.200.30:17653 Expected: 10.100.200.30:7777
[2024.09.28-15.10.26:498][ 63]LogNet: NotifyAcceptingConnection: Client refused
[2024.09.28-15.10.26:517][ 64]LogNet: Warning: Incoming ip address doesn't match expected server address: Actual: 10.100.200.30:17653 Expected: 10.100.200.30:7777
[2024.09.28-15.10.26:517][ 64]LogNet: NotifyAcceptingConnection: Client refused`
The last message pair repeats infinitely until I stop PIE. I'm just starting to investigate, but suggestions welcome if you've seen this one before.
Is there any wayaround? I would think it woould work if it wouldnt set the pose only set pose from replicated values ( so interpoaltion could smooth )
I'm just thinking...
I was curious if there's ever a scenario where a client gets to possess something that's only local to them and the server doesn't need to approve it. Sounds like that's never the case? My impression is that controller + pawn pairing is always verified by the server?
Spectator Pawns could be a local only thing fwiw
Gotcha, so a client could possess them without having to check with the server, and the server would only need to come into the picture when it's time for the controller to possess a player pawn after spectating is over?
Yeah if it's only for flying around and no one would see or notice you
Roger. Do you happen to know if these "rules" of who can possess what and when are explicitly documented anywhere, or is this one of those things you figure out by looking at what APIs the engine gives you?
Unreal is generally Authority based
This just goes hand in hand with how UE works in terms of replication
Nothing is allowed to get to other players from a Client.
Everything goes over the Server
Relatedly, if I can possess spectator pawns client-side only without the server being involved, why is the Unpossessed event server-only? I'm assuming things will still run by the server one way or another even if the rest of the clients don't need to know anything about your spectating activities?
ASpectatorPawn* APlayerController::SpawnSpectatorPawn()
{
ASpectatorPawn* SpawnedSpectator = nullptr;
// Only spawned for the local player
if ((GetSpectatorPawn() == nullptr) && IsLocalController())
{
As a matter of fact, that's how Spectators are alreayd handled in UE
Ah I think you answered my question there.
GameMode tells GameState the SpectatorPawn Class.
GameState replicates it and calls SpectatorClassReceived in the OnRep of the variable.
That then tells the PlayerController to start Spectating (if the state is right).
And that does the above.
Don't mix up Server-Only and Authority.
Server != Authority
If you use HasAuthority in an Actor, then that can return true if the Actor got spawned locally.
It's not the same as IsServer
It's just that the server has authority over Replicated Actors
So most people never get into the situation where HasAuthority would not mean Server.
/// <summary>
/// Function will only run if the object has network authority
/// </summary>
BlueprintAuthorityOnly = 0x00000004,
The comment on the ReceiveUnpossessed function is wrong
imo
/** Event called when the Pawn is no longer possessed by a Controller. Only called on the server (or in standalone) */
UFUNCTION(BlueprintImplementableEvent, BlueprintAuthorityOnly, meta=(DisplayName= "Unpossessed"))
ENGINE_API void ReceiveUnpossessed(AController* OldController);
AController::Possess has no check against Server, only against Authority.
Same with AController::UnPossess, which doesn't even have the BlueprintAuthorityOnly specifier.
UnPossess does not even check against Authority fwiw
Thanks for explaining that! Let me double-check why I was convinced of this previously, one sec.
In a inventory, would you set up client prediction for picking up, dropping, moving items or would you just send RPCs and make the moves based on the RPC?
@thin stratus ok here's the bit that threw me off, the node says both "Server Only" and "Authority Only" here
While Prediction can be nice, it can also be a pitfall.
You'll notice that your prediction of picking up might need to affect other systems.
E.g. maybe your Items have Weight and you walk Slower.
And that becomes a huge rabbit hole of stuff to predict.
Maybe you gun aims differently if you have more weight on it or so and now the shot is different so you gotta predict the shot, and then you gotta predict the damage and then you gotta predict the death
And what if you mispredict any of that?
So tl;dr, what I want to say with that:
Try to only predict the absolute minimum to make the gameplay feel smooth.
Yeah I didn't think of all of that. I was thinking about like moving items around or dropping.
Yeah I know, it's a more generic answer
Yeah I would say that's wrong
Looking at the corresponding code
It#s probably one of those "Blueprint users are too stupid to understand what Authority means." things.
Where Epic just slaps the next best thing on there
Yeah but by definition, Authority is not the Server in all cases
The locally spawned Spectator Pawn has the Client that spawned it as Authority
This is the correct thing to state regarding Authority.
FORCEINLINE_DEBUGGABLE bool AActor::HasAuthority() const
{
return (GetLocalRole() == ROLE_Authority);
}```
Ok understood now, basically in UFUNCTION the Server specifier is the actual server-only directive, while BlueprintAuthorityOnly does not imply server, just authority, which often overlaps with server.
/** The network role of an actor on a local/remote network context */
UENUM()
enum ENetRole : int
{
/** No role at all. */
ROLE_None,
/** Locally simulated proxy of this actor. */
ROLE_SimulatedProxy,
/** Locally autonomous proxy of this actor. */
ROLE_AutonomousProxy,
/** Authoritative control over the actor. */
ROLE_Authority,
ROLE_MAX,
};
/** Authoritative control over the actor. */
Nothing here says Server
I also don't think a locally spawned and possessed pawn will change to AutoProxy role. Not sure.
Referring to these two:
No, Server in a UFUNCTION turns it into a ServerRPC
That doesn't limit it to Server. That has nothing to do with that.
I have a weird question. Lets say someone built a FPS similar to like Counter Strike. Lets say 5 v 5. If someone followed (mostly) youtube videos on creating the game, would it end up being poorly optimized? Like is a 5v5 FPS with no "best methods" implemented end up playing terribly?
Wait, isn't that just semantics? By forcing it to always be a server RPC, it effectively makes it a server-only function? What am I missing? Are you saying "watch out, this is a network call, not just a gate that prevents you from running this on clients"?
Let's say the chances are A LOT higher for it to be poorly optimized.
In fact, a lot of games done by experienced developers are unoptimized for the majority of the development time.
Yes
If you call that on a Client Owner Actor it would move to the Server.
This is a not a Gate.
Is it better to develop first then come back to optimize?
If you want a Gate, check IsServer
A healthy mixture fwiw
One learns a lot of things to prevent bad performance. But there is always a time during which one needs to squeeze some more ms out of the CPU or GPU.
You shouldn't code literal poop, but also don't need to over optimize everything from the start.
What if it is part of the framework. Wouldn't you want to start on a solid foundation?
I don't think it changes anything
We are talking about optimization, where the changes to optimize are usually not that big.
The majority of the foundation would stay as is, unless you coded said poop.
Ok thanks for your help
And if you follow tons of YouTube tutorials and mixtures of them, then you have a higher chance to code badly
Mainly due to those tutorials:
- Not being curated.
- Sharing things they learned thinking it's good, but it's actually bad.
- Having tons of different coding styles and standards.
Ha I was using YT as an example. I don't watch them and follow them. I do watch Stephen U. videos though.
Yeah all good, but if you bring it up as an example then I gotta be able to comment on it :D
Sure sure
Ok, understood, thanks for the solid tips, super helpful.
although, it is hard to know what is a good method versus a bad method when you don't know how to do what you are trying to do.
Yeah that's the toughest thing. The YouTube tutors also mostly don't know.
I def also have some stuff I think is good and how you do it and it's possbly shite.
Takes time and iteration to learn this all.
Yeah. I can tell
This is how I feel.
"Oh, sweet. This is some big brain stuff right here. Dang, maybe I do know what I'm doing!"
James: "We tried that - it sucked in the end. Do this instead."
😒
Jambax James?
Yeah
For some reason - I use his name and online handle interchangeably. I don't know why.
No worries. His company only calls him Jambax, even during meetings.
Just ask him about some NPP Prediction stuff when you write with him next time. He loves talking about that.
I'm doing a little of that in my non-game app dev. Engineers in a shared simulation telepresence aren't going to be trying to cheat on how fast their pawns can move, etc. (FWIW, my Pawns actually are server-authoritative in the traditional way -- that was just an example.) Mostly the client-authoritative stuff is cosmetic, like an object briefly bouncing to indicate a simulation event.
Even engineers in a shared simulation at work will still have the TTP, though.
This is so true! I was squirming in my seat recently when I viewed a tutorial on UE networking and the instructor -- who may or may not know what they're doing within gamedev specifically -- tried to define some network terms and got it completely wrong. I'm new to UE multiplayer but have 30+ years experience in network design, so the misuse of the terms stood out. (BTW, reading the official docs on the same topic backs up my use of the terms.)
YT or written tutorials are like AI coding assistance: Useful tool to see ways of doing things, get an overview of how a thing can be done -- but don't check your brain at the door.
I think it's the lack of those tutorials being checked against errors and mistakes. Especially videos are probably very often not redone
A text can be commented on and quickly fixed at least
- who knows if the comment on the video is the wrong information
If one wants to create a good resource then it's probably best to have lots of eyes on it and being open for changes to it
Which reminds me that I still need to put my compendium up for PRs
Maybe they can make actual income from tutorials. But personally my time is spent working, or actually making stuff. So I contribute in the form of public repo. No time to make tutorials - they're very time consuming. I also didn't learn from them at all myself. It makes me wonder why they have time to make tutorials because most professionals don't. But if I genuinely wanted to I'd find the time I guess so it's not impossible that good devs exist on YouTube
I'm not sure if it's true that professionals have no time. There are a lot of peeps that have lots of time after they end their 8h shift. They can write tutorials, create free plugins, etc. just fine.
What's an 8h shift? 😄
I would love to know.
I agree with Cedric here - they (most likely) have time. They just most likely don't really want to.
I was using Google's NotebookLM to aggregate resources on UE's networking and it generated this podcast style conversation for me which I think y'all would find at the very least entertaining. I piped Cedric's site into it and Alex Forsythe's videos, so it's funny they're both mentioned in there.
Even if it is at an irregular schedule. The time is there.
That's what I meant when I said
if I genuinely wanted to I'd find the time I guess
Because after 8 hrs, if that's really all you're working in game dev, most people still have tons of stuff to do outside of work, it would be hard to prioritize creating YT tutorials
I guess it comes down to the individual and how they structure and prioritize their life
Yeah. So creating YT tutorials would have to be pretty important to you
You can duplicate a person and give one of them a dog and they already have a lot less time.
We have three. 🙂
I do wonder if 1 more makes it easier, so they can entertain each other
Well I won't get into that here lol
Don't even think about it.
Let me have done that mistake for you.
or become sworn enemies
In theory that will still keep them entertained
Just out of curiosity, when looking at Voxel Plugin documentation there is a phrase talking about TCP sockets: "Requires the server ports to be open, so won't work on Steam.", what exactly that mean? steam only allow certain ports to be open? or it just mean it will not work with the Steam Online Subsystem?
Sorry for replying to my own post, but in case someone encounters it later from a search: SOLVED!
The problem was that seamless travel was disabled in PIE mode. I issued this console command:
> net.AllowPIESeamlessTravel true
After that change, it Just Worked. I had suspected seamless travel was somehow involved, because the error was being issues after the server reloaded the map. I'd been all through the project settings and editor preferences, but I didn't realize there was this CVar as well.
is anyone familiar with steam sessions? sometimes when testing my build i see random servers, is it like other ppl with the app ID 480?
Yes
App ID 480 is for testing purposes and leaves a lot to be desired
It's also region locked keep that in mind
Does anyone know, Is there any reason why when a server changes a replicated variable (UDataAsset pointer), that it wouldn't replicate, and its ReplicatedUsing function not get called?
quick question
For the Netdriver. Is this a single object instance that is used across all actors and is part of the WorldContext. I see UNetConnection hold a pointer to it so I suspect in general there is one net driver ?
from looking at the code It smells like the main pipe that all a connections (Actors/Players) subscribe to.
when destroying objects using chaos in multiplayer, im not sure what the best way to replicate this would be... i've considered spawning a destruction force via the field system by repnotifying a impact point location, so everytime a new location hits it will spawn this force that will destroy the building, but im not sure if this is a solid approach.
the destroyed buildings do destroy themselves once destroyed tho, so maybe not as bad, but yea not sure if there's a better appraoch for replicating the destruction of buildings
The Server, and all Clients have one instance of their own UNetDriver, so yes there is only one. UNetDriver establishes a UNetConnection once a connection has been made. The server has a UNetConnection for each client, while clients only have one UNetConnection for the server.
can someone help with this
I'm spawning an actor on server, but it only show for other clients when I spawn on multicast which shouldn't happen at all
the actor is set to replicates and replicate movement already
an already have an owner as the actor trying to spawn it, which is player controller
to call server RPCs from client, the client needs to own a connection
in c++, can i use the Netdriver or the NetConnection (or something else ?) of my character to send a RPC ?
my goal i to call server RPCs from client side of an actor that is not owned by the player, to avoid to add to much external code in the player because of redirection
That's a ton of effort to avoid just making a generic interaction system.
its not related to a interaction system
Why would a player need to RPC through an unowned actor though?
because im in a widget representing the state of the actor
Hello everyone,
How would you approach this situation?
I have a skylight and interiors in my multiplayer game. When traveling to an interior, I use a teleport actor and hide the skylight, relying only on the lighting baked for the interior level. This works for clients, but when the listen server uses that function, it disables the skylight for all clients, even when they are outside.
Skylight is replicated
And the player looking at this widget needs to affect this actor on the server that they don't own because?
because some stuff of the state cazn be modified by the interface
see it like a inventory
Don't replicated the skylight. You can put the skylight on an actor that is replicated and make everyone affect it locally based on the replicated state in that actor though.
is it that complicated to use the connection of anything to call an RPC ?
if yes i can just put my specific RPC on the controller and call it a day
I'm still not understanding why you need to RPC through the unowned actor though. You say inventory. My player owns an inventory, that inventory has the ability to try to affect other inventories and is player owned on their Pawn or PlayerState.
i said "see it like" because its not a inventory
It's more about systems design. You don't want random people calling RPCs on things that you haven't told them they can own.
i see, but i am still curious on how i can call a RPC through the UNetConnection
or if a blog post talks abotu the steps of a RPC
Hi everyone! 👋
I’m currently working on a custom multiplayer session management plugin in Unreal Engine and would love some help with a few specific functions I’ve implemented. Here are the details:
Functions I’m Working On:
CreateSession
UFUNCTION(BlueprintCallable, Category = "Multiplayer|Sessions")
void CreateSession(int32 NumPublicConnections, int32 NumPrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, FString MatchType, FString ServerName);
Parameters:
NumPublicConnections: Number of public connections allowed.
NumPrivateConnections: Number of private connections allowed.
bUseLAN: Boolean to specify if the session is LAN-based.
bAllowInvites: Boolean for allowing invites.
bIsDedicatedServer: Boolean to specify if it's a dedicated server.
MatchType: String for the type of match.
ServerName: String for the name of the server.
FindSessions
UFUNCTION(BlueprintCallable, Category = "Multiplayer|Sessions")
void FindSessions(int32 MaxResults, bool bUseLAN, FString ServerTypeToSearch, bool bSearchEmptyOnly, bool bSearchNonEmptyOnly, bool bSearchSecure, TArray<FString>& OutServerNames);
Parameters:
MaxResults: Maximum number of sessions to find.
bUseLAN: Boolean to specify if the search is for LAN sessions.
ServerTypeToSearch: String to indicate the type of server to search for.
bSearchEmptyOnly: Boolean to search for empty servers only.
bSearchNonEmptyOnly: Boolean to search for non-empty servers only.
bSearchSecure: Boolean to specify if secure servers should be searched.
OutServerNames: Output parameter that will hold the names of the found servers.
JoinSession
UFUNCTION(BlueprintCallable, Category = "Multiplayer|Sessions")
void JoinSession(const FOnlineSessionSearchResult& SessionResult);
Parameter:
SessionResult: The result of the session to join.
issues when trying to find and join sessions can't find the sessions, and I’m not sure where to look for potential problems.
When spawning a SpawnSystemAtLocation on the server, does it replicate or would I need to Multicast to all clients?
it isn't replicated afaik
multicast it
hey when im loading all clients into the game map from ther lobby map i create the loadingscreen in the player controller upon entering but there is a short 1-2 sec where the camera spawns in the ground then loadingscreen pops up
is there anywhereelse where i sohuld put the loadingscreen that loads faster or advice ?
You should check out CommonLoadingScreen. It'll make your loading screen life a little easier.
hmm yeah but everything works atm, i might do that on the next project prolly since im gussing id have to remake awhole lot ?
Not really. Just take out whatever calls you have to your current loading screen. Place your current loading screen in a project setting, and yawn.
Using CommonLoadingScreen is as hard as adding the plugin and specifying this.
aye but if im gonna try that i would like to have it fresh tbh easier to learn that way, now everything works
oh
but will that solve my current issue ?
CommonLoadingScreen puts a widget up when you travel maps. So it's up before you start loading your other map. And it's not taken down until your new world has begun play. But at beginplay if you need a longer loading screen for whatever reason you can register a reason and then simply remove it when done with it.
Since you have no loading screen before bginplay, I assume it'll solve your issue. Why you need one after beginplay I'm unsure.
But if you need one post beginplay. You could simply put up a task around the reason.
ok i will look into it
also side note / im using the add controller yaw/PITCH node for the replication part, but not im gonna test to set the actor rotation towards mouse location
is there any prebuilt for that i dont really wanna Rpc set actor location :/?
What is this for?
actor rotation
i want him to rotate towards mouse location at all time (also using gamepad so rotating towards stick input=
)
You're not using the controller rotation stuff? Like the pawn should usually be using UseControllerRotationYaw or whatever it is true. The rest is like animgraph faking with the replicated pitch via GetBaseAimRotation
Then your client can just set their controller rotation to whatever they want to follow their mouse. Everyone else gets updated from it.
yeah im using the controllerrotation yaw but im moving with w,a,s,d and rotating with the mouse is the idea
common top down
That's fine. But I'm not sure what WASD has to do with it? EG The pawn should check if it's locally controlled, get it's controller, set it's control rotation to point to the mouse target.
hmm yeah but m testing to turn stuff on/off nothings changin now im just rotating left or right using the mouse
its not setting the rotation towards
maybe i deleted something default ?
Are you using IAs for the mouse movement?
yeah
aye thats what i thought
hmm imma test that one
the thing is that the cursor is hidden also... hmm
well it works but its chasing an invisible mouse cursor... hmmm that will be messy
and how would i get this tho work with a gamepad stick also :/
instead of casting like this, do a branch for "is locally controlled" and then get player controller with the existing pure function
are you trying to do mouse cursoe or center of screen?
Cause if its mouse but mouse its hidden, then it makes sense you show your mouse first
yeah but the mouse will be hidden when playing so idnno how to make that proper if u cant se it
so what do you want to achieve? Cause it doesnt make sense to want to look at the mouse if the mouse is invisible
hmm yeah true, hmm well the mouse is never used except for Ui stuff... hm could change the cursor style tho while visible thats an idea
What is it you are trying to achieve?
just easier movement, now u rotate the character by moving mouse left and right with the mouse, but overall movement will be easier if u look at the cursor instead
same with gamepad look at where stick is pointing
is this topdown?
y
that wont work, you can ideally get the input 2d valuae (mouse or gamepad), and as long as its more than a vector length of 0, convert it into a rotator and apply it to your character
using a mouse for this would not work for gamepad and its also wrong, since technically the mouse would have to move over the player to really look into another direction
What does this error actually means?
LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: ObjectName: Bullet_1, ObjOuter: /.../.../...:PersistentLevel
Hello guys .
If my game have like 500 EOS Sessions is it possible to get the whole count of connected players inside these sessions ?
IIRC sessions have a count of current players connected? If so you could just do a normal session search and iterate them to += some integer.
are you testing on a packaged build?
Make sure your server and client are updated. If it's in editor, make sure the machine trying to access Bullet actually has that actor spawned
Hi. Just want to know does mover have client-side prediction architecture? Does it have multiple compressedflags unlike in cmc?
it works entirely differently look through the Network Prediction plugin
Alright
Oh i will check it ..
Also i got another idea is it possible to add maybe to the party or session a variable track if the player pressed matchmake or trying to join a server .
Because i dont use dedicated as a lobby to gather the needed player count
Before deploying new server
If you want decent relatively realtime updates, you'll probably want to rely on Beacons. Session data is notoriously fucky and slow. Specially with Steam.
Im using Redpoint EOS btw..
Is there any software can handle this?
i always thinking to use my own backend to track these things but i keep worry about the downtimes xD
Hi all,
I have the issue that my coins are not displayed the same. Only text is not matching but in the left top corner the rigth value is added. Any suggestions?
remove that has authority node
@kindred widget Mate I've made a few research about the Beacons but my question is Can I make a server just for Queue players can join it and this server can only route players to the servers ?
I mean when the players count reach 40 the server can open a matchmake ticket for them ?
Ah, I thought this was to gather a count of everyone currently playing. If you're doing a queue, I don't think you need beacons or a server, but I could be mistaken. I'm not as familiar with EOS, but I know Steam has some matchmaking code that you can just queue to which I believe eventually leads into you joining the session. I'm not familiar with how it works though.
Yeah usually another service is handling this cause you could Que, you might also want to just spin up another server
I've already made a plugin for matchmake using Edgegap backend and its also deploying the server.
My Idea is since I want to reduce the server time I've removed the In server Queue ( Waiting the other players to start ).
I thought I can get the players who pressed Start and put them in queue every 40 players can matchmake and join one time not one by one
If it possible to launch just Beacon Server without any maps just Queue tracking could be a good idea
I’m not as familiar with beacons so unfortunately I can’t answer that
Me too xP @worthy oak
Beacons are kind of just like a secondary session. They allow the use of RPCs to and from another machine, but not replication, and connecting to said session also does not cause a travel.
Its a good thing but is it possible to deploy just server from same project but without any maps to make it light weight ? and keep it running all the time or it will be different version from the client ? xD
and Also thanks for the good information as always
I'd assume so. I mean you'd still need at least a blank map. But on a dedicated server it wouldn't cost anything really.
Cool i will try and see what my Brain do @kindred widget xD
any good ways to close a dedicated server so that endplay is called? I want it to unregister itself from my lobby when it closes instead of just killing the process directly. Any console command ways of doing this?
Heya, so what's the best way to deal with items and lag?
Ex: laggy client tries to cook a fish on the campfire -- it takes 1 second to actually appear (auth with server), and then when they take it off, it takes 1 second to be removed
But during the lag, they can try to keep adding fishes to the fire. Or when they remove it, they can tryto keep removing the fish multiple times while waiting for the server and getting infinite fish
All I can think of is some kind of server confimation, but wouldn't that take even longer, under the laggy conditions?
tldr: How do I deal with taking and placing items when players are laggy? To avoid situations where both players take the same or multiple of the same item before it's removed
Hi I have a newby question,
I wanted to create a custom game state on my template third person shooter but when i change the gamestate it doesn’t work as the template one.
Do i need to do something on my gamestate to make it the same as the default one?
Can you be more specific when you say it “doesn’t work the same as the template”?
If you’re saying it doesn’t work at all, make sure you inherit from the correct gamestate. I never use the templates so I’m not sure what gamemode they use as default, but if you inherit from GameModeBase, you need to use GameStateBase, same with the non-base version
Thanks i’ll try rn
This solved my problem, many thanks
np ❤️
Love
can i call a RPC from a unowed client actor if i get the owning connection of the player controller ?
Huh
No
The way I handle it, if a client wants to dmg a server-sided enemy:
The Client RPCs the server, telling it which enemy it wants to dmg. The server then dmges the enemy
The server can call an rpc anywhere and everywhere it wants owner or not. There's no exceptions for clients, either you own it and you can call RPCs or you don't own it and so you cannot call RPCs
The client can't make the enemy dmg itself or call server rpcs directly
i would like to call a Server rpc thats inside a actor placed in level, so by default it cannot call server RPCs from client side because its not owned by a owning conenction
You gotta call the server RPC on yourself and pass in the actor you want to make the action on
you can pass AActors through rpcs
yeah thats what i call redirection, ideally i would to avoid that
That's the only way, I have an entire class dedicated to redirected rpcs
I wish they would make it so you have multiple "owners" of an actor so things like this would be easier but it is what it is
Actually I wonder if that's a simple actor function you can override to allow RPCs to go through regardless of ownership
It's gotta be overrideable somewhere 🤔 gonna add that to my list of things to check
AActor::CallRemoteFunction and UNetDriver::ProcessRemoteFunction
I don't know if you can do that with multiple owners. But those functions are your RPC calls.
But yeah I'm a little stuck on how to deal with triggers during lag.
Ex: 2 players wanting to activate a switch. Player 1 activates it, but player 2 is lagging and does not receive the rpc, thus is also able to activate it (or aquire an item, etc)
Any good tutorials on this type of thing?
Ah! Figured it'd be some additional check in the UNetDriver :p
Make the RPC reliable
Nono, the problem is the delay
if a player is lagging by a second, they will be able to pick up an item that has already been picked up, for example
because they have not yet received the change on their end
They should be asking the server if they can pick it up, and the server picks it up for them.
Yup
Sort of
There's no getting around that unless you let the player predict that they've picked up the item, and then the item just disappears once the client finally receives the update that it'd had already been picked up
There's only so much you can do for lagging players
So for placing a fish on a fire for example,
I place the fish, my game then disabled the fire as i wait for server confirmation (so i can't keep placing it)
Then I get the confirmation that someone else placed a meat instead
and so nothing happens for me
OR i get confirmation it was placed and my fish vanishes
BUT
What if then I place the fish, and throw it on the ground while waiting for the server to confirm
or do I need to like, lock the inventory and the fire so nothing will change while waiting for the server
man 😐
just hope that your player will not lag this much
Literally that ^
I just tried with my artist from brazil, and i did lag that much haha
was able to break all kinds of stuff Canada->Brazil
Even just a split second delay from the server is enough to break stuff
The best experience is just wait for the server to confirm things otherwise you'll have to take the prediction route which means things that you thought you picked up will potentially disappear if you really couldnt
In any game like this, server literally does everything, clients just ask it to do it
Yeah, will def have to rethink things a bit to get it all solid
Server updates inventory, and state of the game
oh, even dropping stuff on the ground?
like for minecraft
i doubt server would manage player inventories, just manage what is on the floor
but yeah ill have to think about it
Also very odd interaction: Player movement is very quick, while reliable RPCS/Repvars are slow as hell
Even dropping stuff on the floor. And yes it does also manage inventories. For example when you move something in Minecraft from one spot to another
So a player can run over, attack an enemy, then run back
You asked the server to move it to that slot, and the server did.
well, you are searching it lol
most people are on the same continent
And then you received the location of the latest update
server will see the player run back and fourth, then do the attack somewhere else, and enemy dies lol
Atleast I'm pretty sure Minecraft works that way I haven't played it in years. But any inventory where you can see real-time changes from other players. It's all happening on the server
IMO, you should make server 100% authority for most things. Client telling the server what they hit is fine. Server can authenticate it, but they still have to tell the server.
^
Yeah I just mean player personal inventories. I doubt server keeps track of everyones personal inventory 😮
It should
But anyway thanks for the info guys, def got some stuff to think about 🙂
Otherwise duplication is possible
Our game sure does
Nothing happens without the servers say so
Player inventory or not
My inventory is all server auth. They're just components on everything that has an inventory. The player uses their own inventory to try to interact with other inventories. Everything a client sees is replicated back to them.
We also make use of prediction though, clients need to predict something is actually possible before they can even bother asking the server to do it
Yup, exactly like this
Hmm, and if they make an impossible action their item will reappear or whatever
safest way is the UI/input actions of the client calls server RPCs, the sever edit what needs to be done, the client see the changes when replicated back
Yeah makes sense, considering that'll only happen in laggy situations
so how do you handle something like weapons overlaps then? like I only have the collider bound on the server but the issue is it frequently doesn't register where as on the client it's reliable.
Alright sounds good, thanks for the info guys! I'll def start considering more server auth inventories
I'm testing in the editor
I think most games allow clients to say they've hit something. Within reason. Server can roughly authenticate it. EG. Make sure you don't stab someone 50ft away with a 2ft attack. Beyond rough auths major games rely on client side anti cheat.
hmm interesting. I notice this can be a problem when both doing overlaps and line tracing on the server (like for checking for hit while ADS) what would this look like in practice? Do the attack on the client then validate distances with some measure of tolerance on the server?
You should try to catch someone like Jambax when they're around. He's done this in real practice. But as far as I understand it they save timed moves or something. And when client says they hit something, server virtually rewinds the objects to their timeframes to validate it. So that client can't just shoot through walls and whatnot. I'm not sure how that works with actual projectiles like a rocket. I think most of that was done with virtualized bullets which just trace over multiple frames to simulate movement and drop.
dang ok, the rabbit hole gets deeper
You can calculate when the projectile was fired in that case, but the server would have absolute authority for those kind of projectiles
For hitscan the client tells the server when it hit and the server would rewind like you said
If you're in a scenario where rewinding isn't feasible for your game (tons of players perhaps, or other cases where it's not possible) then yeah you can go with simplified checks
That's what games like Squad do afaik
@rustic sable ^ for the later part of the message
Yeah, I don't know specifics, but I know he's talked about it a couple of times on here. Never had to solve the projectile problem myself. 😄 Been working on UI or RTS games
Really depends how tight you need it
CS/Valorant/R6 Siege can get away with that since it's low player counts and high tickrates, they have the budget
50v50 games or more really can't, the server performance would take a massive hit recording and rewinding player moves (depends on how much data you save and rewind. A simple bound check might be good enough and not too costly)
He was working on Hell Let Loose at the time I remember him talking about it. So a bit more higher player counts.
ah so HLL does rewinds? Interesting.
Worked on Post Scriptum/Squad 44 and we didn't hah. Guess that's another thing that separates us, that's cool
Maybe. 😄 Vague memory here.
@chrome bay I'm intrigued if that's something you can comment on
CMC was hammering us on Squad 44 at the time so if HLL does do rewinds, how?
Don't use CMC?
HLL didn't use the CMC?
It was a question. 🙂
Ah, fair
as far as my project it's fairly casual so letting the client say hey we overlapped (melee) or have a successful lintrace (ads) then having the server validate somehow should be enough. This even happens when running and connecting to the server locally, but not when playing in pie, so will have to do some further debug, mulitcast out what the server things mob positions are etc. Really didn't think this would be an issue till we started playtesting 😅
You said what you have is enough. I just wanted to confirm that the most fair way is the rollback method, where the client sends a timestamp and the actor they claimed they hit, the server then roll backs the actor who was hit and checks their location at at that time to see if it would have actually hit
You do this by constantly saving the location of every player for the last x amount of seconds
i have player icons on minimap in my multiplayer game. how can i only show the icons for the right team?
interesting, thanks for clarifying how to go about this, I was wondering where to start. I still think I need to further debug why this is happening because like I mentioned it even happens when I connect to a server launched locally where there should be close to no latency and the mobs are standing in place. The overlaps on the server often miss where as if I play the game in pie the problem goes away. Same with the line trace where the mob is just standing there. Sometimes I get misses on the server where there doesn't seem to be a reason for it. I'll put in more debug code this week to track down whats happening.
Ghost ping?
Am I mistake or are InstancedStructs not replicatable by Iris? If that's true, is there an alternative?
They can be replicated by the regular net driver so Iris should be able to. If not, it's probably just missing a serializer?
depends on how your minimap system is set, but ideally you can compare the user's local team with each characters team, if it matches you assign on icon, otherwise another icon
Some screenshots would help to see how your map system works like
Oh, If you're having this problem with projectiles rather then line traces, it's likely due to the fact that your bullets are traveling too fast
does your minimap show other players right now?
on every team it shows all player icons.
I do see in the logs that Iris is generating a descriptor for it: LogIris: Warning: Generating descriptor for struct InstancedStruct that has custom serialization.
However, my attempts at replicating fairly simple instanced structs have failed. Just to make sure, I am referring to FInstancedStruct
where are you setting up your teams? Game State has access to all the pawns so might be a good place to set up team arrays then just display those to everyone on the team?
the projectile movement in unreal engine will literally teleport if the framerate can not keep up with the distance traveled based on speed
I've seen multiple cases of people making their projectile so fast that it quite literally teleports each frame potentially "going through" the target
yes but I'm not even launching projectiles yet, this is a line trace to before hand, and these are pretty slow anyways
line traces are instant, but if you are using a line trace then there's no such thing as overlap
2 different issues, overlaps for melee, linetrace for arrows
which one are you having an issue with exactly?
overlaps when swinging a weapon?
they also fall short of the same thing I just mentioned with projectile bullets
well both 😅 but I'll start with the melee probably. I have a feeling the underlying cause is related
if your projectile is only 15 or 20 frames, or your server fps is only 15 or 20 frames, the blade would actually teleport past the character sometimes
the chain breaks at the weakest link here
to avoid situations like this, your overlap check would need to not be animation nor frame dependent
it has nothing to do with ping
Should projectiles be line trace or overlap? since I'm currently using overlap..
so local, dedicated, or client wouldn't matter
hmm ok
if you want bullet drop then it must be a projectile
how can i tell each player only show the team icon? how can it be done?
i have no idea -.-
just set your team to an array and only show the ones in the array?
try attacking with a 60 fps animation, and then try attacking again with 5 fps tickrate
yeah but how can i only show xx
you can debug trace the sword, and you will see huge gaps with 5 fps tickrate
hire someone
well yeah the anim notifies to enable / disable the collider are based on the animation as well so that will be a factor
There's not a lot of nodes for a lot of things. You need to create your own functions for things. For example, you put your widgets on your minimap somehow and associate them with a player. How do you do that? Start there. Use the association to gather it's team property and affect the minimap according to a comparison of the local player's team to the team of the associated one.
For future reference, it seems that FInstancedStruct cannot yet be serialized by Iris. However, it's an upcoming feature in v5.5 it seems.
I was bored so I thought I'd whip up an example, this is how framerate effects overlaps AND traces. The first animation was 60 fps, the second animation was 20 fps. The hit landed with 60 fps, but missed with 20 fps... also a good example of why it's not the best idea to make crucial things framerate dependent. Finally, even if your animation is 1,200fps it will always be capped by your total fps.
this example is only for traces tho but it's the same concept with overlaps, depending on framerate and speed you can teleport right through a collision box
Nice buster sword for effect! I’ll test this tomorrow.
lmao, swords should use overlaps I think
I just mentioned it was the same with overlaps 
how would you fix this then?
Overlaps only detect movement changes, Or something similar to it, if you teleport into a collision box without using sweep, and then teleport out of it, an overlap will never be detected
I'm sure you've tried spawning inside of a collision box before and noticed that it did not trigger until you actually moved
the fix to this specific issue is to not allow the trace to be solely based on framerate. Alternatively you could draw some additional traces to connect from the last trace location to the new trace location to detect if anything was inbetween those two locations during the swing.
that's actually the method we used for our space game, it was massive and so the projectiles were moving so quickly they were teleporting, often leading to situations where they would teleport passed the target...
https://i.gyazo.com/a6b1df9eec43e93eb2776c0e03d4c33d.png
Like this... Frame 1 the bullet is at some location, Frame 2 the bullet is at a new location, but sometimes the target was inbetween both locations, at that point we'd draw a line from frame 1 location to frame 2 location to see if we hit anything if no overlap was detected
how would I turn on sweep on a boxcollision? Is that possible easily?
Does it fix that problem?
Nah, don't think so. The best you could do for the box collision would be to constantly check for overlaps manually, the engine by default only triggers this when movement happens, but you can actually get overlapping actors yourself regardless of of that
though I believe get overlapping actors is rather expensive if too many actors are in there at a single time
because my bullets are going pretty fast and I'm at 35 fps and they are always hitting the stuff they should, even when it's not tick actors
you likely won't have any problem, assuming you didn't upscale your game to massively stupid amounts it likely won't be an issue for you
it's just something that could happen
before optimizing you should check and see if it's actually a problem, just do a small overlap check the size of the bullet every frame and see how far the bullet is teleporting every frame
if the distance is atleast x3 smaller then the players capsule it'll never miss
theres also the CCD (continuous collision detection?) you can try enabling
Never seen that option, I imagine it's doing the same thing though and continuously checking for any overlaps, though it's probably done in a much cheaper way
I'm using UProjectileMovementComponent which probably doesnt this under the hood
yeah, not sure how well it works performance wise but definitely one of the best ways for continuous collision checking
you set this in your StaticMeshComponent
not the projectile component
or your collision component, whatever it is
it's built in by the engine
I'm trying to make unit spawning functionality similar to something like Clash Royale - do I handle spawning those units on the server or do I call it from the player controller that owns the unit?
I don't believe I'm grasping server/client fully so - if I have a BP_GameMode, do I treat that as the server script or can server execution occur within my BP_PlayerController?
select your collision component and you will see it
if its cpp then just set CCD or something like that in constructor
I'm just telling you that the devs added the feature already in that component
you mean projectile movement enables CCD? how would it know what components to do that on? can you share where you saw that code?
you spawn it on the server and give ownership to the client that should own it
Afaik, you manually enable this on your collision components, projectile movement is not related to that.
CCD came out 3 years ago, n1 epic games
it fixes the overlap problem for projectiles
but that wouldn't exactly fix the sword problem
"Projectile Movement does not use Physics, so enabling the CCD flag or setting project settings for physics substepping will not help you here at all."
https://forums.unrealengine.com/t/projectiles-going-through-objects-without-overlapping-even-with-continuous-collision-detection-on/148653/16?page=2
rip
CCD is not related to physics though
"and it already performs CCD"
Weeelp, idk anything about CCD so hope you guys get to the bottom of that I'll be reading from the shadows
How do you know it already perfoms it though?
it has its own version of CCD
doesn't hurt to also enable collision CCD on your component tho
read what Jambax said, it's really it
I had this help my collisions many times before
there's no physic in a bullet, it's UProjectileMovementComponent + Some Particle Effect + BoxComponent
BoxComponent has CCD you can enable as well, jsut enable it and it will definitely help here and there lol
Projectile movement is line tracing which is another safe check, but having CCD enabled as well is also an addition
did you read what he said?
it doesn't seems like it
yeah, CCD and what projectile comp does are 2 different things resolving the same issue. If one doesn't fix it for you, try the other one. They are different methods.
Thanks, how do I give control to the client? I've been running into issues assigning say an index to a player controller and referencing/matching indices to which index should be the client. Am I wrong in considering an instanced PlayerController to be the same as the Client?
doesnt hurt to try out different options, just because its solving a similar issue doesn't mean its the same method.
I've never actually played the game you referenced. if you're trying to move one of the minions around manually then you would call the possess functions, if you have some video examples I could help better
yea, as long as it works, you're good to go!
Edit: Thanks for the responses - I think I'm closer to what I'm trying to do
So if I'm concepting a project, and I know eventually I will want a multiplayer element but I have no knowledge of how replication and multiplayer works or what the final state of this project will look like right now, how hard would it be to retroactively go back and add the necessary replication steps once I've finalized things for local use? Should I just suck it up and learn replication first or is the process relatively painless assuming I know what needs to be replicated?
Don't. Start with MP.
It is far more difficult to add MP in a SP game than to add SP in a MP game.
I changed it but still the same issue. Strange for me is that the actual value when picking up is the correct only this text is wrong.
Seems i fixed it. I changed the type to replication notify and has to use has authority on begin play when i generate the valuess
Don't use an RPC for this
You generate the values on the server (authority) and it will be replicated to the clients
@broken grail
We didn't do rewinds of the actual players, but we stored history of their transforms server-side and hit tests were performed against that history state rather than the real players. Kinda rewind in a sense, but also not really.
I see, makes sense
I did similar with projectiles, we'd rewind the transforms of their hitboxes when within vicinity
well it was super simple lol, just had to override GetNetConnection
interesting... Can they each return a different net connection?
like can multiple clients use the actor to send rpcs?
i didnt test it yet
but from i see in source code it should work
screen 1 - what decide if a client can send RPC to server
screen 2 - what gets the connection on AActor
screen 3 - So technically, if i give the net connection of my player controller it should work
the get the connection from the actor owner
so either you change the owner, or override the returned value
I guess that's one a time
Does SpawnActorDeferred work properly for replicated actors?
Considering all PlayerControllers are on the server and every client has it's own version of PlayerController , does it make sense to setup InputContextMapping with AddMappingContext on the server or should setting it up on the client be good enough?
Makes no odds
Client should be the only place
So if we would override the NetDriver to get the net connection from local player controller instead of the target actor, can we basically send server RPCs over any actor?
Maybe, didnt fully tested
But its should be uncommon, if you abuse this it might be a proof of bad design
RPC? I changed the Set Text to Custom Function with no replication and its still fine
When destroying buildings with chaos in multiplayer what is the best way to replicate the destruction?
can someone help me understand why does this overlap execute twice on the server? the gameplayeffect fires multiple times when playing as a client.
in my head its working out like this. client tells server it wants to fire a projectile through an anim notify.
server fires projectile, it then overlaps another player and onSphereOverlap executes, the effect is applied, Destroy is called.
on the client the bHit bool is set to true.
if the overlap replicates to the client first then bHit will be false, the sound and niagara effect will play and bHit will be set to true then once Destroyed replicates bHit will be true so that condition should be ignored and no further effect will play.
if Destroyed replicates to the client first bHit will be false and the effects will the play an destroy the local instance of the projectile actor.
but in practice the server executes the gameplay effect twice and the clients execute the effects sometimes once, sometimes it seems like theres a stack of 5.
the projectile is spawned from an anim notify and the SpawnProjectile function should only happen on the server
if(!CurrentActorInfo->OwnerActor->HasAuthority()) return;
void ABaseProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if(GetOwner() == OtherActor) return;
UGameplayStatics::PlaySoundAtLocation(this, ImpactSound, GetActorLocation());
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this, ImpactEffect, GetActorLocation());
if(HasAuthority())
{
if(auto TargetASC = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(OtherActor))
{
UE_LOG(LogTemp, Warning, TEXT("Hello World"));
TargetASC->ApplyGameplayEffectSpecToSelf(*GameplayEffectHandle.Data.Get());
}
Destroy();
}
else
{
bHit = true;
}
}
void ABaseProjectile::Destroyed()
{
if(!bHit && !HasAuthority())
{
UGameplayStatics::PlaySoundAtLocation(this, ImpactSound, GetActorLocation());
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this, ImpactEffect, GetActorLocation());
}
Super::Destroyed();
}```
Hello internet people. I'm trying to make a character creation system and one of the features i want to add is an ability for the player to import a custom texture for the face and body of their character. How would i go about replicating the custom local texture if possible? (my game has a multiplayer mode but will not be an mmo)
Now i have the issue that the server is not getting the data from the client.
On client side its updating the new server name. but the server to get the new client name.
The client doesn't not replicate variables to the server, you'd need RPCs for that
This also looks slightly cursed
Ok So I would Like to spawn the second player as a different actor while playing as the listen server or client, is there a place I can set that?
Just to clarify, there's no way to do a multicast to everyone except the owner right?
Or any other ways to direct a multicast?
Ex: Owner makes a particle, sends to server, server sends back to everyone including owner, even though owner doesn't need it
Not at the moment no
There's a PR to add support for this in the future, if it ever gets merged
Cool, thanks for the info
Just a bit odd considering repVars have this but multicasts don't 😛
Hi quick couple of questions here, I run this and the server can damage the enemy (I see the health decrease) but if the Client hits nothing happens the Event ApplyDamage doesnt trigger at all, I saw somewhere someone said that you have to run the Apply Damage inside a Execute on Server custom event (Which i dont undestand because the Apply Damage shows a "Authority Only" and states only run on server anyway.
And can someone show me how I would go about making the Client able to damage also please ? I,m guessing its because all the code before the line trace is not run on the server so it,s all run on the client before the server event fires. ??
You kinda want to do the whole Trace in the ServerRPC
Otherwise the Client can tell the Server to damage any kind of Actor in the Scene.
And the suggestion to run the Damage event on the Server is correct.
The Authority Only part only means that it won't run on Clients. Not that it automatically moves the call to the Server.
When you press the F key, you are local.
The reason why your screenshot doesn't work is that you are using a pin from different exec line
Ahh so i would do better having a Event Run on Server (Perform Line Trace) and then do all the rest on the server
That is not allowed
Oh ok never knew would be better to pass it as a parameter?
Let's assume you don't care about cheaters, you need to send the BP_Enemy pointer to the Server via a param
Yeah, what you are doing there is trying to access a Pointer that points to Memory (RAM) of the Client ,on the Server
That's literally impossible :D
lol that makes sense 🙂 thank you for your amazing explanation!
More specifically speaking, this will basically result in the Server trying to damage a nullptr
In C++ this isn't even possible
void ASomeActor::OnFPressed()
{
AEnemy* TracedEnemy = DoSomeLineTrace();
Server_DamageActor();
}
void ASomeActor::Server_DamageActor()
{
/// Where does BP_Enemy come from? :P
TracedEnemy->ApplyDamage(..);
}
vs
void ASomeActor::OnFPressed()
{
AEnemy* TracedEnemy = DoSomeLineTrace();
Server_DamageActor(TracedEnemy);
}
void ASomeActor::Server_DamageActor(AEnemy* EnemyToDamage)
{
EnemyToDamage->ApplyDamage(..);
}
But again, that allows cheating
So this would look better?
Yes
Yeah the second RPC is then redundant though
And you gotta make sure you use the right values for the Trace Locations. Your Arrow there might not point in the correct direction on the Server, depending on how you rotate that thing.
Most of the time, one uses GetBaseAimRotation, and the Camera's Location to do the traces.
Somewhat depends on the game of course
the line traces appear to go all in the right location on the clients but ye maybe the server is line tracing from a different direction now because im telling the serveer to run the line trace and not the client.
Yeah it depends on these two
Idk how you position/rotate teh Arrow_1 Component
If you only do that locally, it will not be in sync
Its attacjed to the actor using the 3rd person template
so I would imagine it would replicate its transform details too.
but can test it 🙂
Also on this note, don't make this assumption even out of netcode. Never mix your execution lines like this in BP. It sometimes works because each node caches it's output. But you will end up with some annoying to solve bugs because of it when it doesn't do what you intended due to multiple calls to the top line or timing differences calling each line differently, etc.
Thank you @kindred widget !
Yeah right, it#s generally the rule to not cross the wires. Jokes aside, if you take a value from a pin of a node X, then you should only use that value in nodes that are part of the ongoing exec wire.
If you call any function or event that starts a new exec wire, you shouldn't start pulling the value all the way to that one
That's what params are for
Its working as expected now you can see Client 1 and Client both shot different line traces and damaged the enemy 🙂
Many thanks guys, Its so hard to find easy to understand answers on the internet sometimes I spent a good few hours trawling the internet and numerous videos trying to find the information you guys have provided me with in less than 10 minutes, I super appreciate it!
I,ll have to search for particles and stuff next, I looked at the https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/ and https://wizardcell.com/unreal/multiplayer-tips-and-tricks/ which seem nice for the theory side of things but doesnt offer too much with practical examples, So you kind of end up feeling a bit like "I,m reading it but struggling to understand "How to use it", If this makes sense.
good day.
if i set the transform on a static mesh that's replicated (let's say on tick or smth). does ue performs prediction and tweening on that mesh on the client side? or is that only done for movement components?
Only the CMC and maybe the ProjectileComponent does smoothing
Everything else simply applies the Transform when it arrives
gocha, so the server would be potentially sending updates every tick to every client in the above case right?
Unlikely. That woudl be a lot of bandwidth
Depending on update rate and other factors, it might replicate less often
The Server could, for example, have a lower frame rate than the client.
Guys, I have a question: I'm spawning a Niagara with RPC, making a run on server event execute a multicast event that has the spawn system attached. The server doesn't have information about the Niagara that spawns. My question is, is there another way to do it? Generally, when I need to spawn something, I do it from the server and while it's replicated, it's reflected in all the clients. But in the case of the Niagaras, I don't know how to continue. Thanks.
thanks a lot man. yes considering im targetting 100+ clients.
i've read a couple of times that things like particles and sounds usually are spawned on clients with rpcs or rep vars to save performance. im not an expert but yours sounds like an ok approach.
i have this component, owned by the pawn. have multiple pawns. im calling a rpc that is netmulticast from the server. but if i set it to Ureliable, it ONLY gets called on the server, only if i set it to Reliable is called on every client.
Any idea why? (i don't have anything network related filtering yet (like priority netculling etc). I tried this a few times, it's 100% reliable/unreliable.
also using variables with replicatedUsing don't get called :((((
If the particle effect is a one-off, RPCs are fine
However if it's stateful (on/off) you're want to replicate a property, like a boolean for example, and use a rep notify for clients to enable/disable the system
I've made a predicted bullet actor and this is now the error I'm getting, does anybody know thre reason why this happens?
LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: ObjectName: BulletActor_305, ObjOuter: /Game/Characters/UEDPIE_0_Test.Test:PersistentLevel
According to this post: https://www.reddit.com/r/ConanExiles/comments/5sgi9b/help_withserver_log_errors/, the error should be ignored since it's been an engine problem for over 10 years
https://wizardcell.com/unreal/persistent-data/ im useing the server travel method in this and very time me and my ferind tried to travel it crashed
what would this mean? it comes up when im sprinting. there's no visible error happening but curious what it means
LogScript: Warning: FLatentActionManager::ProcessLatentActions: CallbackTarget is None.
Did you have like a delay or a timer for an actor that no longer existed? That's my guess anyway
there is a timer for stamina drain so maybe that is it
Yeah sounds like a timer was started and then the actor was destroyed before the timer finished
hmm that wouldn't make sense as the character wouldn't be destroyed at all
at least not when im getting that
Are you doing this in blueprint or cpp?
I believe in cpp it's possible to call a delayed action without specifying a target for the callback
the sprinting is cpp i had someone customize the movement component, so not fully sure what exactly was done but i know it was fairly straightforward to basic sprinting , so if that's the case then maybe it's fine
for network relevancy on late joiners. How do you guys recommend me use rep notify on a physics based object that was moved?
I was thinking rep notfiy once the object sleeps, but I know that wont cover all cases
What do you mean? RepNotify for what?
its a physics based object (cube, sphere). It gets moved around the scene. When a late joiner arrives and the object is no longer moving. The object is incorrectly positioned.
repnotify the staticmesh actor *location would correct this no?
Replicated Movement should already take care of this
Do you mean a physics actor that only replicates where it starts simulating from, J?
In that case at least make the rep condition to Initial Only. From what I understand it does replicate but its not perfectly in position the first time someone joins regardless of the existing replication logic
How would I replicate a collision box location that is constrained to my motioncontroller hand to the server as the ones there are not moving
is the motioncontroller hand already replicating it's transform? If it is why don't you just attach the collision box to the hand
yes I did it like this , Not even sure its correct method , first I set the local transfroms of the games hands for the IK to follow , and then set them on the server?
But My collision boxes act as the physical hands and are simulating,, The weapons attached to those but on the server Im not sure how to make them move .
so I just turned on component replicates on the motion controllers and now the boxes move but there not in the correct positions , weird then I set the constraints and the boxes to do the same and things look better but there is some jitter on the boex even when Im not moving the hands.
Hello, I have a problem with Character Movement Replication. When I testing on far client tests with Steam testing with Listen Server. How can I improve this issue? btw ms around 20-50
show the code for the movement
looks like the player is fighting againts something
oh sorry I forgot to show it
hm but its not a custom movement a default movement I m usin 🤔
btw I tried to change both NetUpdate frequency and MinNetUpdate to 200 and 400 too but all same
hmm I thinked system already simple replicating for character movement so didnt tried different anything for it
you want to test with lag as well in editor
0 ms doesn't exist in reality
and a tiny bit of ping makes a lot of difference if the code isn't right
oh when I test in 0ms it doesnt shown any visible problem
ahhh got it now
well 0 ms is what you call a fake test
thenn what u prefer to me 🤔
😅 I m pretty new for this things replication so cant thinking about movements and replicating same time lol
well changing the walk speed in blueprint not gonna give you the smooth result you are after
because this is working outside the cmc framework
oh but changing location doesnt give me simple movemental aceleration too
@karmic trellis https://www.youtube.com/watch?v=urkLwpnAjO0&list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk&ab_channel=delgoodie
you can see how he implement sprints
https://discord.gg/uQjhcJSsRG
In this video I am introducing a series I will be making which explores the character movement component and how you can extend it in depth.
0:00 Intro
1:00 What is the CMC?
2:00 Do you need a custom CMC?
5:35 What does the CMC provide?
7:10 Outro
humm I will check thanx
oh ue dont have a basic ready to use template/code for this?
blueprint lacks a lot of feature when it comes to mp imo
tldr , you change the walk speed based on the bit in FSavedMove. No blueprint solution for this
any other attempt will result in de-sync
😕 ok thanx
Is ChecksumMismatch (and disconnection of client) happens only when a confliction happens? We were able to fully experience main menu in two different game versions but one got kicked after server travelling to game level due to ChecksumMismatch. Do I need to manually check if the versions are same to prevent players get into same lobby if they have different versions?
Im having issues with my respawn system.
What i do is:
From the respawn function in the game mode i call:
Character->Destroy()
RestartPlayerAtPlayerStart(Controller, PlayerStart)```
After respawning, i want to update the HUD (the following is for clients):
so in `MyCharacter::OnRep_PlayerState`, i call a `MyHud::InitHud` function with as parameters the player controller and the player state.
The problem is that if i try to get the character from the player controller in `InitHud`, it fails.
When the client first spawn at the start of the game, everything goes smoothly
not sure if this is appropriate but what does SetReplicateMovement(true)? if I have the bReplicates already set to true? Is this a physic only thing, if yes then I would be able to disable it a lot
That's what it does, replicates the movement/physics/transform
bReplicates seems to also replicate the transform tho
You need both
bReplicates will set the initial transform only when it's spawned, as part of the spawning packet
bReplicatesMovement takes care of actual movement replication
so for instance, a static bullet that never moves would be good by using only bReplicates, and a moving bullet should have both of them enabled. Right?
Basically bReplicates for any replication at all
bReplicatesMovement if you actually want transform updates
Thanks!
any reasons why onrep function wont be called by engine when a array entry change ?
its a array of custom struct, i tried with ALWAYS but same results
it gets calls when i fill it and set a valid ptr
but when i edit other members of the struct its not reping, i have a simple override of NetSerialize to do atomic replication
hello again. I have a question for implementing an in game invite system. The goal is to select a player from a server list (this is a dedicated server), have a notification pop up asking if they want to accept (I have a UI for this already), and then on accepting have them teleport to the inviting player and change their character.
I have done countless hours of research and trial/error on this, but I have come up short every time. Does anyone know of a method to accomplish this (or if there exists a store package that accomplished this)?
Thank you for all of the assistance
Hey, so is it possible to have some players in another level?
Ex: In an open world game, the server must spawn all enemies for players who go far away, and thus the server must have those areas loaded
But what if a player goes into another level, like indoors. Can the server also somehow load that level in order to spawn the enemies?
Or should that level be hidden somewhere within the same world?
It would have to be in the same world
The engine doesn't support having different levels for diffferent players
Ah, so if it's an infinite world, there's not really much space to spawn these in
So does that mean it'll have to spawn like, 1000 ft lower or something?
lol
alright, thanks for the info man
will prob spawn lower or higher, and render everything else invisible
any ideas ?
If you're using C++, you need to manually call OnRep after modifying the array
does anyone know why me and a anouther person game crashes when i load a new level
i dont have issues on server, only on client
There is a box inside the AI character. My goal is to hide the mesh of the AI character only for the character that triggers this box.
(Run on owning client or is locally controlled did not work, or I did it wrong...)
Sanity check, does a rep notify get called for an unmapped actor reference on a client?
Or does the engine wait for the actor to be mapped before calling the notify?
It's just a UPROPERTY(ReplicatedUsing = ...) AActor* SomeActor; not a struct containing an actor reference
Anyone knows why a replicated actor component would only trigger netmulticast reliable but not unreliable? also variables don't trigger the onrep.
i have no special settings in the project and neither have i overriden any of the network relevancy related functions.
im on c++.
Maybe you are saturating the bandwitch so unreliable RPCs are droped, where are you doing that ?
Also for the onrep, are you in BO or c++ ? What type is the var, are you sure you are setting its value on server (and its a new one)
nopes, it's just sending one every x time (like .5secs). also not a single rpc arrives.
yups im sure the code is correct. im setting it on the server. it's a ustruct.
You want to be more specific.
Your goal is to hide the mesh when the overlapping actor is the LOCALLY CONTROLLED character.
is locally controlled on otheractor will work.
You'll have to cast it to at least Pawn
- this easily saturated the bandwitch
- why tf do you send a multicast each.5s ?
Sounds like design flaw
Show declaration and stuff of it
it's a movement replication. ive researched and this is the way to go.
the declaration is fine. ive crosschecked it with other classes that ive done.
also, reliable works, no drop frame. i've tested replicating on every tick and doesnt get saturated or laggy so it's pretty fine.
i have other actors that replicate variables and have rpc and they work fine. but not this component.
Saturating the bandwith isnt directly linked to frame lag
no, but movement lag. if it's saturated the rpc won't get in time.
What kind of movement is it ?
i see. i cant share due to contract.
i was wondering if anyone had any idea of why this things happen, thanks anyway.
Hey guys, does this bind event node get replicated? Or do we have to encapsulate it inside of a ServerRPC in order to bind it on all clients? "BINDED" get's called on both server and client but the "play montage" print string only gets called on the server.
no
just movement. replicating where certain objects are during time.
they don't have a movement component.
Its only bound in the context its called
So for example only server or client side
But you can bind them in each side
This means calling the broadcast on each
If I call it on server and owning client, how will the other clients be updated then?
the context is we are trying to replicate an anim montage
so we are trying to locally broadcast a delegate which will trigger the anim montage on each client
You will need a multicast or reped var
I guess
ok so I have to multicast the subscribtion then?
Well if you want all clients to get it you need to bind locally on all
And broadcast with multicast/onrep var once
hmm ok I think im starting to understand
thanks so much! let me go try to act on this advice 😄
bump
hey just wanted to share my findings on this. Not sure if the fps is running differently on the dedicated server but since notifies get 'qued' they can get missed when things are happening fast. This is especially problematic with something like a enabling colliders on melee weapons. Besides the usual suspects which I already had: Visibility based anim tick option' set to Always tick pose and refresh bones on the mesh and the notify set to trigger on dedicated server You also need to use branch point for the montage tick type. You can only have one of these per frame but it ensures that it triggers reliably. Thanks for the help on this!
If I call a server RPC, does that thread that called it wait for a response or acknowledge of some sort before it continues?
To make a death + respawn system, would it be better to destroy the character and then make a new one, or to hide the character till respawn, and just reset stuff like health and similar?
I feel like the engine is more designed to unpossess the previous character and possess the new one.
What does unmapped mean?
The more I digg into the code, the less I understand the documentation. And only for player movement replication 😦
Reference replicated but object does not exist on client yet
Reference replicated on who?
When someone says something is replicated on client, it means it has arrived on client.
Rep notify in cpp for clients gets called when the value is updated
In certain cases rep notifies can get called with an unmapped object
i.e. object reference in an array or struct
Wondering if the same applies to my case
Engine code says possibly not
But I'm not entirely sure
In the actor component's constructor, did you call SetIsReplicated(true) ? Because if I am remembering right, unreliable multicasts don't get replicated for whatever reason if you don't call that function
you've hit in the nail. the actor was replicated but not the component. thanks a lot!
i cant sorry. im not allowed.
Oh I mean it's sorted anyway ^^
thanks for the help anyway :) i really appreciate it.
Interesting though. Probably has to do with unreliable multicast RPCs being routed differently, I'm intrigued now hah
Glad to have helped!
it does, but if its no longer moving. The location isnt sent when a player joins late it seems
could force the actor to be net dirty when the new player joins
No rpcs are async
any reasons why onrep function wont be called by engine when a array entry change ?
its a array of custom struct, i tried with ALWAYS but same results
i have a simple override of NetSerialize to do atomic replication in the struct
the struct has multiple members like a UObject ptr and a uint8
the OnRep gets called in some situations like: filling the array, setting the UObject ptr to a valid one, increasing the uint8 var, but not when i decrease it
Doesn't make sense really, that's the point of replication. Might need to debug it
No reason other than either a) it wasn't sent or b) the client already decreased that value locally so the received value doesn't differ from local one
OnRep only gets called (by default) if the received value is different from your local value. Otherwise it skips.
even with REPNOTIFY_Always it doesnt get called
It's not being sent then most likely
So Server might think you already have that value, or you have a serialization error etc.
Bumpity if anyone knows
Might just have to try and whip up a scenario where I can test that otherwise heh
my net seri is pretty straight fwrd
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar << Item;
Ar << SlotIndex;
Ar << Amount;
//Ar << MaxStackableAmount; Only used by the server
bOutSuccess = true;
return true;
};
im setting the Ops to
I'm getting PostLogin before the GameMode::BeginPlay for the listen server. Is this a constant order or is it open to change?
well if the player joins later he can call PostLogin after the begin play
so no order
For the listen server, i'm gonna guess it's likely to have that order consistently
Since there's no latency related issues
I'd check what calls BeginPlay on the server
The gamemode handles that differently afaik
Should be fine then yeah
Hello , I'm Learning multiplayer
And i'm stuck badly
i will aprecicate if someone help me out 🙂
that multicast isn't necessary, the spawning of actors is automatically replicated if the actor itself has "Replicates" set to true
upon pressing left click -> check if there's a blocking hit -> SpawnRunOnServer(HitLocation) -> SpawnActor
Thanksss
you saved me ❤️ 😃
mine went little bit diffrent (would it cause any problams?)
if there's no blocking hit then there's no point in sending that packet to the server :p
waste of bandwith, that stuff doesn't grow on tree's! 😛
For some reason my button turns twice even though the function which does set the rotation isn´t called twice. Replicate Movement is also turned of but the Server still replicates the rotation down to the first client somehow. (The button is its own child actor attached to the Terminal, When not attached the button works fine without this error). is there some check box I forgot or what am I missing? Thanks for any help 🙏
show the code
void ATerminalButton::OnInteract(UPrimitiveComponent* HitComponent, APlayerController* PlayerController)
{
if(HasAuthority())
{
bIsRotated = !bIsRotated;
MARK_PROPERTY_DIRTY_FROM_NAME(ThisClass, bIsRotated, this);
StartRot();
}
else
{
bIsRotated = !bIsRotated;
StartRot();
}
}
void ATerminalButton::OnRep_ButtonRot()
{
StartRot();
}
void ATerminalButton::StartRot()
{
if(bIsRotated)
{
UpdateButtonTimeline->Play();
}
else
{
UpdateButtonTimeline->Reverse();
}
}
void ATerminalButton::UpdateRot(float Alpha)
{
const FRotator NewRot = FMath::Lerp(CloseAngle, OpenAngle, Alpha);
this->SetActorRotation(NewRot);
}
Interface is one time called by the local client and also but the server(if server intercats only once)
Hey guys I can't understand where my replication is failing :
Ce first screen is my playerstate, and the second is my player controller who updates my playerstate boolean, but i don't see the logs being printed
Especially this one :
UE_LOG(LogTemp, Log, TEXT("HANDLEPLAYERREADYSTATUSCHANGED"));
Does is actually work for the server only? if yes, then does it work if you simply remove replication from bIsRotated? because I'm wondering if the reason its rotating is replicated rotation (that said it seems a little smooth for replicated rotation but it may be related?)
GameMode only exists on the server
That check of yours probably belongs at the same place you set bIsReady
I understand that the GameMode only exists on the server. So, this means I should probably call the HandlePlayerReadyStatusChanged function directly in the setreadystatus ?
Yes, because right now you are doing it on repnotify which happens on the client, which then obviously fails the if
So i'm suppose to run repnotify on the server directly ?
No? there is no need for a repnotify there at all, but you could, I suppose. It makes little sense though since the client side of it will always fail.
The thing is, I'm trying to establish a relationship between the PlayerController and the Ready State in the GameMode to know if everyone is ready. The issue is that when I call my function on a client, it updates the Ready State of the host instead of their own. I had a hard time understanding this interaction
sry but can´t really follow your thoughts here
Well the easiest way to solve that is to move said logic to GameState, its kinda fitting too since it only handles the state of all players.
the repnotify is for the 3th client (or4th)
That said, if you just want to have like ready checks or whatever by peoples names you can just read their playerstates, and if you want to then start a countdown or something to start the game that would just be initiated by the server and replicated via the gamestate as either just a bool or timer, or rpc or something..
oh I understand but in that case I don´t have network prediciton
and isn´t there a way to use replicated values inside of the Actor with out automatically replicating his own rotation
Oh I think I just noticed your particular issue, its the else in the interact. Try removing it, if it works, but you find it too unresponsive you could add another flag to hold the current visual state and only activate it when it changes.
sry you mean removing the StartRot() call?
Just removing the entire else
where can I add these falgs though?
I'd probably just add them in StartRot()
sry I mean what is their name so I look up the documentation
Oh, I meant you just manually add such a thing.
That said, if I were to do it I'd go all the way and just manually rotate the button and only have bRotate act as desired direction, and manually rotate further on the client side so if you click fast or click halfway through it doesnt do work things. 🤷♂️
yeah thats the way I wanted to do it
thats why I added the replnotify condition
void ATerminalButton::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//Set up the params for the replication
FDoRepLifetimeParams RepParams;
RepParams.bIsPushBased = true;
RepParams.RepNotifyCondition = REPNOTIFY_OnChanged;
RepParams.Condition = COND_None;
DOREPLIFETIME_WITH_PARAMS_FAST(ThisClass, bIsRotated, RepParams);
}
but since when does it also replicate its rotation when replicate movement is turned off I thought enabling replication just give the ability to replicate variables inside the actor
Thank you though ❤️
Yeah ideally you never use replicate movement for just a rotating button. Have you debugged whether the StartRot only calls once for each machine (server and client)?
also trying removing the else condition from the HasAuthority just for testing purposes
It is possible the client Rotates it, then the server changes the rep notify variable which then triggers another Rep Notify on the client, essentially re-rotating it again
And make sure Replicates is true bt replicate movement is false
I have debugged and the startRot only calles 3 times (2 Clients, 1 server)
Also thought that but when debugging the rep notify it only triggers once for the other client (because of the RepNotify Condition)
I have it this way On the Actor itself as well as the terminal it is attached to
did you try this? since thats why its called 3 times
one is by rep notify and the other from your else condition
No one from the else condition and one from the if state directly since when server its true
When Removing the else, it only gets called twice (once by the rep notify once by the server)
I have 3 player
test with 2 players first, but isnt it intended? One should be server, and then once for each client
Yeah the problem isn´t the code the problem is that the rotation is getting replicated like Replicate movement was enabled but it isn´t
Thats why when I place the button normally everythign works fine
like the replication network prediction, no issues at all
But the moment I attach it to some kind of actor (even a blank one) it replcates the rotation like replciate movement is enables
which means its something wrong with the code OR theres some bug
I do know that you should never use child actors especially when replicating stuff
so you better try that without a child actor and it will most likely solve itself
Ok why is that?
Cause they are buggy, and often have replication issues as well. At least thats my experience with them and I was always able to solve them when simply using direct actors
you can attach it in the world outliner instead
or spawn in via its parent BP and attach manually via code
If child actor is the issue, I really wouldnt bother investigating it since child actors are horrible
yeah ok because Iam debbing this now for like 4-5 hours and like the code is clear no issue with that just when it comes to attached
Attached is different from child actors
ok thx I will try this out ❤️
A player's ready state should live in PlayerState if it's meant to be public, can live in PlayerController if it's meant to be private
Should go in the playerstate regardless, IMO. Just don't replicate it if you want it private. Cause someone's gonna want that shit shown, then not shown, then shown again repeat 500x before game releases. And I'd rather click the Replicated checkbox and remove it from UI code than have to constantly move it back and forth between Controller and PlayerState. It's the state of the player, stick it there.
I'm wonderying if that's good to do in a multiplayer game? since I want the player to be able to be replicated to everyone around
I think you might be right, but im still getting the same results. I sorta narrowed it down tho. So if the ball is part of the world spawn, it doesn't replicate new position if moved by a client when the new client joins late. (The late client only sees the actors origin location)
However, when a client moves a server spawned in actor that isnt world spawned that actors location is always replicated correctly even if a new client joins late. So im sorta confused why that is...
when the world begins are the actors spawned by server?
I have a question related to multiplayer. Lets say I want to equip a item. When I equip this item I have to change my players pose. How would I handle the changing of the character pose? Assuming the networking for the weapon is already setup and replicated. Would I do a client RPC telling the client to change the pose? Would I set the pose to a replicated variable? If I send a RPC do I have to do a multicast for other players so they can see the change?
Pose is driven by the held item
just replicate held item and the rest is dependent on that
ItemI'mHolding (replicated, repnotify)
Yeah thats what I was thinking except my current setup doesn't have a concept of a 'ItemImHolding'. Basically I have containers. Each container has a rule for what item goes in it. So if I create a container as primary and a container as secondary I don't exactly have a way of determining which one is held. I guess I would need to replicate something that says which container is the "helditem" container?
how would i go about replicating a state change in an animation blueprint?
Dont
The anim bp should be dependent on some replicated state elsewhere.
so for example should I be reading the state of my player in its animBP on tick to update the animBP's state? or is there a more optimized way to do it not on tick?
It would be exactly like that, dont be afraid to use tick
But ideally do cast on Animation Init to your custom character bp and save its reference in a variable which you can access from tick
Apparently that is really not a good thing to enable
That's only needed if the component has replicated properties or RPCs in it. Which for most native components is not the case
You don't need to enable that for the component to exist on the clients
yea that fixed the problem!
anyone knows if there's a simple way to do a client-side animation/tween when an actor stops being relevant? (other than manually rpc and animate)
Im trying to avoid the pop in/out. I have a custom isnetrevelantFor.
Anim bp reading state on its own tick is fine, how do you think locomotion systems typically work?
Is there a good way to encode a specific asset class, such as UCurveFloat as a small integer for networking from server to client? Does Unreal have a way to keep all assets of a certain class in a deterministic array?
already is
how big do you think a pointer is
Unless you're talking about some runtime-defined curve, in which case you'd probably have to compress it yourself. But it can't be that big, a curve can be tiny, it's basically just the keyframes
It's something like 40-80 bytes the first time an asset is referenced across the network, then it's like 4 bytes after that.
Hello. I am updating an old project from 4.24 to 4.25. One of the changes is that Actor->bHidden is now private. But I have a field calling DOREPLIFETIME_ACTIVE_OVERRIDE(ACustomActor, this->bHidden, false); What would be the appropriate replacement macro?
there's a function AActor->bIsHidden() but that doesn't fit the existing macro.
It's because assets, or pointers to assets specifically are serialized as paths. But once sent once it can be mapped as such so that the client can look that back up without having to send it again.
I'm guessing the server needs to keep a record of asset paths sent to every client and then look that up. Unreal has a system for this built-in?
I think this might work for you:
this->IsHidden()
I don't have a 4.25 C++ project so I can't verify if that function is available
That changes it from a property to a function. I need to know what macro I need for a function instead of a property.
just replicate/rpc the reference and it'll do its magic
how many bytes/s are you currently spending on this?
The function returns a true/false value. If the macro is complaining because you're using a function within the macro itself, then promote the function's return value to a variable and then use the variable.
bool bIsCurrentlyHidden = this->IsHidden();
DOREPLIFETIME_ACTIVE_OVERRIDE(ACustomActor, bIsCurrentlyHidden, false);
The macro expects a UProperty, not just a value
Still designing this system and looking at my options. It is some custom animation data that would be sent every update.
quick question; would anyone know what would cause a client package the inability to connect to the dedicated server package? It tries to connect but times out, and the server doesn't even register the connection attempt (it shows incoming data packets but it does not respond to them)
the log stays blank on the server
What does the Client log say?
just a sec
[2024.10.04-02.59.11:522][784]LogNet: Browse: [server_IP, I edited this]/Game/Hunted_package_test_WP
[2024.10.04-02.59.11:522][784]LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
[2024.10.04-02.59.11:522][784]LogNet: Created socket for bind address: 0.0.0.0:0
[2024.10.04-02.59.11:522][784]LogNet: IpConnection_2147479956 setting maximum channels to: 32767
[2024.10.04-02.59.11:522][784]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2024.10.04-02.59.11:523][784]LogHandshake: Stateless Handshake: NetDriverDefinition 'GameNetDriver' CachedClientID: 2
[2024.10.04-02.59.11:523][784]LogNet: Game client on port 24015, rate 100000
[2024.10.04-02.59.21:523][464]LogNet: Initial Connect Diagnostics: Sent '9' packets in last '10.002254' seconds, no packets received yet.
[2024.10.04-02.59.26:441][799]LogStreaming: Display: 0.002 ms for processing 83 objects in RemoveUnreachableObjects(Queued=0, Async=0). Removed 3 (1010->1007) packages and 3 (2264->2261) public exports.
[2024.10.04-02.59.31:525][144]LogNet: Initial Connect Diagnostics: Sent '10' packets in last '10.001858' seconds, no packets received yet.
[2024.10.04-02.59.31:539][145]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.00, Real: 20.00, Good: 20.00, DriverTime: 20.02, Threshold: 20.00, [UNetConnection] RemoteAddr: [server_IP, I edited this too], Name: IpConnection_2147479956, Driver: PendingNetDriver IpNetDriver_2147479957, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
I blanked out the server IP
Did you port forward?
As I am relatively inexperienced with development, I am unsure (tbh idk what that means exactly). I know that I am currently using a command line "open [serverID&port]" to access the server. It worked and then suddenly stopped working. I am unsure what I did to cause the issue
older versions worked
oops, forgot to tag you
I am working with a small indie company and am currently their ownly reliably available dev when it comes to UE5 coding work...and I still know little (think potato level skills)
In a summary, how Pickables Objects per client are done ? Like imagine if you create a pickable coin but instead of once picked by a client it disappears for everyone, it disappears only for the one who picked it up but still there for others to pick it up too.
Like I can do all the logic of picking on the Client but it's not safe and people could cheat, so what's the right way of doing that ?
Do it on the server but store the info per player, I.e. on the Pawn or the PC.
Do what on the server ? And what info on the client ?
Run the logic on the server on the pawn for example. You could store an array of coin indices on the pawn which the player has picked up.
The client code uses onrep or queries the array to decide whether the coin is visible or not.
But is that scalable ?
Do the logic on the server on the pawn class runs for everybody or only the owner of that pawn ?
Yes it's scalable, you can choose to run it on server or client or both by using HasAuthority check
Very unlikely that such a mechanism would be the source of bad performance in your game.
You could choose to do it the other way. The coin itself could store a replicated list of players that have picked it up. Easier to write but more inefficient.
Wait, who owns the Pawn ? The server or the Owner of the pawn ? It seems obvious that it's the owner but at the same time it's weird as we can't trust clients, and as the owner of the pawn is the Client, I'm not sure about the Player owning that pawn 🤔
It's to do with the Role. The owning client has the local role of Autonomous Proxy. The server has the local role of Authority.
Any other clients that have that pawn (they can see it for example) will have the role Simulated Proxy.
Autonomous Proxy can send RPC to the server but they still do not have authority role.
So what would the logic of that coin would look like ?
You mean the second approach of doing the logic on the coin?
The best approach
The easiest for you would probably be the second. So in the BP for the coin you have a replicated array of pawn references.
Use a HasAuthority node in On Collide so it runs only on server, and add the colliding pawn reference to the array.
Setup OnRep for the array, and if the array contains a ref to the local pawn, hide it on that client.
Something like that anyway.
how to hide it on that client only ? Because OnRep will trigger for everyone if I'm not mistaking
Yes that's why you check if the local pawn ref is in the array. Only hide it if that is true.
I'm not sure to understand, because hiding it if the local pawn ref is in the array will still hide it for everyone
No...
I think I'm missing something 🤔
Like to me the presence of the player ref in an array doesn't make it hide automatically only for him, there's a middle step I'm missing that makes it hidden only for him
like the logic part
Each client runs onrep themselves. So say there's 2 clients and a dedicated server.
The server adds C1 to the array.
C1 onrep runs and he sees that his local ref is in the array so he hides it.
C2 onrep runs and his pawn is not in the list so it stays visible.
how does it "see" that his ref is in the array ? Like wouldn't that array be on the server, while the OnRep will execute on the client ?
Like how would the server communicate that info to the server ? Through RPC ?
The array is replicated.
I think you might need to understand the basics a bit more before trying something like this.
Oh that's the info I didn't have to make me understand
but it feels like it's not the best way in terms of networking as a replicated array is alot even more when there will be multiple of the object / coin spawner 🤔
Yes like I said its more efficient to store a list of coins that are picked up on each pawn itself. And make sure the array is replicated to owner only. But it's more complicated and I can't explain in detail how to achieve it.
But... don't worry about approach 2, it is not terrible. And it's easier to write and easier to extend too.
If I'm not mistaking there's a networking condition property that could be set to OwnerOnly, is that what are you talking about ?
which one is approach 2 ? 😄
Store on the coin
In C++ I would use COND_OwnerOnly. There's possibly a blueprint equivalent.
but how's that not the best if it's easily extendable ?
It's named like that too in BP
It's always about tradeoffs. Do you want the most efficient use of bandwidth in every case. Often it doesn't matter for many things so choose the simplest approach.
My goal is to create the best Object Spawner, so imagine if Epic Games were to do that (like they do in Fortnite) what approach would they go for and why that one over the other(s) ?
There's no best one
It all depends on your game and its requirements
You could spend months working on one with little benefit over one you'd make in a few hours or days if your project doesn't need it
Are you familiar with the Devices in Fortnite Creative ?
Googled it real quick, I am now
My goal is to recreate this one https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-item-spawner-devices-in-fortnite-creative
Use Item Spawner Devices to spawn items that players can pick up and use.
Make one that fits your needs, and if issues arise in the future, fix it then
That device seems pretty simple to me
No, that's the whole purpose of that device is that it fits alot of creator to create any map they want in Fortnite Creative. That's the goal I have, create devices like these (I will add more feautres than devices) so it can fit as many game types as possible so I can make any game type I want later
Like for instance for that device, what do you think Epic Games went for in terms of way of doing it and optimizations, etc...
Doesn't change what I said. Your needs are a flexible device that could suit multiple game types.
Don't worry about optimization until it becomes an issue. Apply what you know while writing it, don't spend too much time on that
😦
Think about a few things you think creators would like with your item spawner. They can always request new things in the future
An item spawner really shouldn't be super complicated
The server spawns an item. You can have settings on it that change how that item is spawned. That's pretty much it
It technically doesn't even need to replicate if the item itself is replicated. Depends on the data your spawner needs to send to clients, if any.
And again, depends on your game, we don't know everything you know about it
Yes an no, like for instance I'm already doing that on a UGC plateform but it's very limited so i want to do the same but in Unreal where there's no limit in tools
Again, I'm not doing that for a game (as I don't have any game), I'm just trying to create a general set of components / devices for me (and maybe people later if I sell it on the marketplace) to create multiplayer games of any type by just putting those devices in the world and changing the settings to fit their needs.
Like my goal is to recreate this big "easy to use" framework to create multiplayer experience by writing as few lines of code as possible and changing only properties to fit your needs.
I hope it's clearer with this now 🙂
Different games are built differently with different needs, you can't really create a one-size-fits-all solution. Make your product, sell it, and your customers will then ask you for additions if they need
This channel can't build your product for you. If you hit an issue while building it, ask away
But fortnite succeeded at creating a one-size-fits all 😦
Not really
how ?
UEFN mods are just mods. Fortnite's solution fits Fortnite, which mods are just built on top of
Games are wildly different
All UEFN mods share the same base - Fortnite
Games share the same engine, but that's it. They don't have any other similarities.
So while Fortnite's solutions fit all UEFN mods, because they share the same base, they wouldn't fit other games.
And that's what I want too 🥲 That's why I'm asking for that Object Spawner, what would be the best choice (like if you were Epic Games and created that in that context), what approach would you take between having an array on the Coin Spawner and having and array on the player controller 🤔
An array of what
If you want it to be simple for people to use, keep the logic contained in the spawner only.
the other approach would require users to modify their pawn class
On the Spawner : An array of all the players in the game who picked up the object
On the Controller : An array of all the objects the player picked up
Like the goal here is to create an object spawner that can be picked up by everyone, and once picked by someone it disappears only for him and other people still can come pick it up for them
Why does the client need to hold any reference
One way is to spawn on server, then spawn on respective client locally
So the client's one is just for visual
Server checks when the collision happend on its machine. And just tell the owner of the colliding pawn to delete its version of the coin.
I dunnoe if that fits a system, sounds like something specific to game type or use cases
Maybe it's just me but one of the reason why I avoid plugins, especially the ones like quest manager or dialogue is they are not catered to my use case.
What people say above rings true imo. Many core system are project specific. You can only get soo far trying to make something as generic as possible.
Heya, can I somehow convert a replicated actor into a UUID, replicate it, and then convert it back to the proper actor?
Trying to reuse some code that has a float signature, but use it for passing a player, basically
Or I guess, there's a Player/ClientID somewhere right?
Replicating a Pointer to an Actor already replicates the Guid
Only the initial package has some additional information iirc
Yeah but I'm reusing a big system that has a param for a float already
So it would be ideal to just use that. I see APlayerState has PlayerID, I guess that would be the right one to use right?
Not at all
PlayerId so some remnant and arbitrariy number that identifies a player during a session and is not persisted or anything. 99% of a time you don't use that number at all.
Oh lol, I know they all change per session but imagined they are at least properly replicated
The NetGuid that is used to identify a replicated UObject over the net is handled by replicating pointers.
The float param you have is not suited for that
Ah I see, and there's no way to obtain the netGUID?
You can probably get it via the PackageMap or similar. But no clue how to parse back and forth, cause one usually doesn't do that by hand.
It's really just in the multicast, to see if the local player made the server call
Yeah true
Can't you just call the RPC in a Client-owned Actor?
Then you don't need to send the Player along
I just deleted some of my rambling, but tldr:
I can pass the player actor through rpcs, and then check if it's local while loading my primary assets -- which is where the issue actually was with using a float, not in the RPCS. 🙂
Thanks for slapping my brain into gear eXi