#multiplayer
1 messages · Page 40 of 1
Check the log of your dedicated server for this line to find the port it is listening on:
[2022.12.06-16.07.03:371][ 0]LogNet: GameNetDriver IpNetDriver_2147482494 IpNetDriver listening on port 7790
@versed thorn I just ended up thinking about your problem. Couldn't you be able to possess the pawn with an AI controller, and using the GAS through that? that way the pawn isn't possessed by the player controller, but is still possessed. I would imagine that GAS is still replicated from AI possessed pawns.
this how I started, but target system doesn't work for simulated proxy
So the GAS is useless for AI controlled pawns?
targeting part
Maybe just use a seperate targeting system. Or is it too integrated into the whole system?
as I mentioned, I'm learning GAS, this is the whole point
Yeah, i'm also not familiar with it. Bummer though, i think i will end up hitting same wall as you
if this is truly a problem
don't panic before time, just wait and see if it would be good fit to use custom target logic for you
Lets say a game used dedicated servers for a round based game. It needed dedicated servers because of the size of the world and all the data it has to crunch...but it never relied on anything like 'skilled based matchmaking'. It could pair you with anyone so none of that mattered.. ....Would it make sense for someone to start a game as IF it were a listen server and control parameters in that dedicated server. So "start game" creates an "instance" that people can join. ..but then how does the client who started that server instance changes parameters when they are just a client. Would it be as simple as doing other checks like only the player ID who started the instance can change game related stuff
If I want to do loging so I can tell if the server or client is running the code logic in C++. Anyone know the best way to do this?
getworld()->IsServer() ...i think? Im prolly wrong
lol
yea but authority is just who owns it though isnt it
I always just use a straight up is the server check
I usually use NetMode
since HasAuthority() can return true on clients if the client owns the actor iirc
Which is the point, yes
If only the client owns the actor it doesn't exist on the server
If it just owns it but the actor is replicated, then no, HasAuthority will not return true
In other words HasAuthority is always the correct choice for "can alter state for everyone involved"
Okay I'll use HasAuthority() and then put debug statements inside that check?
Sure
how to detect initial replication in OnRep_ because of actor becoming relevant ?
im using GetGameTimeSinceCreation() but it doesnt work
Thank you my logging works on server only
I'm a bit new to replication, and maybe someone can help me here. I have a player controller, which can select a number of units. It works by sending a handle input event to each selected units when selecting a location or actor. The processing of the input will happen on server side, in the object itself (Like checking if the player who sent is the owner of the unit, however i don't use the owner system here as it is possessed by an AI controller, which claims ownership. RTS style system.)
However, only the listen server is able to send input. The client gets nothing executed in the object. (Only if i run it client side, but then it just fails to get compare the owning players, and i don't want this happening for obvious cheating reasons.) Anyone can help me with what i did wrong? Attached picture is from player controller
And this is in the object
The Process on Server string never gets run when the client attempts to do anything
but the other two strings do
guys I have this problem when I connect to session sudennly I have problem with loading map it never happened to me before
in log is 7777
hello, i am back to trying to figure out why remote characters fall through the floor, my server has the characters in the correct location but the local client seems to have something set that isn't generating a collision
Maybe the collision isn't replicated?
could be, what setting is it to replicate collision ?
Don't take wires across execution paths. The server won't know these values unless it executes the same code where you're pulling them from. You can add inputs to events which would then let you pass information through the event.
more than simply bReplicates = true; ?
out of curiosity, why is MovementMode enum replicated through RPCs instead of DOREPs in CharacterMovementComponent
did devs find it more performant to replicate MovementMode "sparse-ly" rather than through property replication?
nice valhalla
hah u know valhalla? thx
pretty clean I hoped for rare but unlucky
so it seems the local client doesn't collide the remote character with the floor
so the floating character disappears through the floor should there be no movement input
if i move forward i will collide with where the character should be
so it must be on the server
ah okay, i understand. Thanks. Maybe it will work
do you have replication enabled on the actor? do both client/server instances spawn root component with collision enabled?
i can't see why it isn't but let me check
also check the collision channels to make sure it agrees with your floor
if that was the case, shouldn't the local player fall through? and i shouldn't get blocked on the server
landscape is set to block all, the capsule is set to block all, other than my poor retargetting effort, the sub skeletal mesh is block all
the blue skel isn't else i have issues
just to be clear...it sounds like the character is colliding with floor on server, but on client it's falling through?
and since replication is turned on, the server will adjust the actor back to floor
and the client will send it falling agian
so both local characters are correct
so your issue is with a simulated proxy
ah is that what you call the remote client
locally both are fine, the proxy is falling through the floor, once movement has stopped
however i can run into the other proxy
and collision events trigger
if you check the details of the simulated proxy character, does the collision stuff look correct
while game is running
sorry i'm still learning myself so just spitballing
now you might need to teach me how i check, is that ejecting and something?
the collision is working as expected
the larger character can't walk through
in the Outliner window while game is running or paused, select asset and view Details window
looks to be falling
It worked! Yay thanks :D
Try start your dedicated server with the -local option e.g. MyGame.exe -log -local
I found this works for me when testing on a LAN (not across the Internet)
Without the -local it doesn't work
But on my Linux server on a remote server in some other data centre I don't need the -local
I'm going to be jumping head first into multiplayer game making via blueprints. Any tutorials that you guys suggest? I have been using UE for years now but never played with multiplayer much
the compendium in pinned messages is good
i am here once again asking...
in rts multiplayer, are physical attacks (or any action/ability) multicasted separately on all units? are they batched into 1 call for a group of units executing an attack on a particular frame? any guidance/docs on this greatly appreciated
but I am running my server on other device and client too
In your house? That is a LAN
If run on remote server (I mean a completely different building) then that is over the Internet (a WAN).
Question to all : Say I want to create a multiplayer game where you can cast spells of varying casting times. That is they take a specific number of seconds of arm waving before the spell is activated. Would you use one animation montage containing a looping section for all spells or a different animation montage per spell? Also, would you use RPCs or RepNotifies to react to the Montage Notify that is placed somewhere inside the montage to activate the spell (to spawn a fireball or something)?
Does anyone know how UClass net serializes? Having trouble finding the actual function it uses.
Want to know if it ends up replicating the path name or something more efficient.
no one machine is in my house one in my parents house I am using two different networks
If a player wants to host a match with a dedicated server...am I able to run some type of command to execute the server instance
That's backend stuff, you'll have to have your own system to spin up instances etc.
Don't fuck up and spin up 10k x as many as you need, heard about someone doing that lol.
Unless you're talking about a machine-local dedicated server as a separate process.
Are you using 5.1? There is a known major bug in 5.1 that Anim notifies are not working in some instances of multiplayer. It’s on the Unreal bug tracker.
I would assume it’s going to be did in the next patch , as it’s the highest voted bug at the moment affecting 5.1.0
Yes I am using 5.1. Are you referring to this bug? https://issues.unrealengine.com/issue/UE-170093
Yes
Ah ok that must be why then. Thanks.
Anyone tried to send FVariant over RPCs ? It's not declared either as a UCLASS or USTRUCT so UFUNCTIONs don't accept it as input
I feel like I'm doing something wrong because Epic comments in the FVariant definition mention using FVariants with networking
Ah well it seems like FVariants are not union types and are pretty much useless for the purpose of a union
This will NOT work
Yeah crash was encountered 😅
Does it crashes in cpp ? In C it doesnt, it just returns garbage values
if I call GetPlayerCameraManager from a pawn not possessed by the local player and ask for index 0 will it not return the local player?
assuming there is only 1 client, so index 0 is always the local player
There is only one PlayerCameraManager on each Client. So its always the local PlayerCameraManager.
It shares the same lifecycle as the PlayerController.
thats weird, im getting a read access violation error from calling this from a pawn not possessed by the player
FRotator CameraRotation = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0)->GetCameraRotation();
this pawn doesnt have a camera though
You should always check your pointers.
You arent checking the return value of GetPlayerCameraManager isnt pointing to nullptr before using it.
i dont see how that would ever be the case, it works for the possessed player every time
Where is this code being called?
on tick for both the pawn and player
The PCM might not have been created before the first tick...
should i add some sort of delay before calling the function on tick
No, just check it before using it and provide some default value if its not valid.
Or output an error of somekind so you have a chance to see if its invalid later as well.
Hello, I’m having some problems with spawning a projectile in multiplayer. The spawning works but for some reason the projectile stutters when moving and the orientation is wrong. Link to the video is below
Has anyone ever had issues where in your custom movement mode you can't jump? I override IsCroucing() and IsMovingOnGround() to include my custom slide, but it fails here in Character.gen.cpp - it returns false meaning CanJump() returns false, but I can't really read what's going on with the ProcessEvents.
bool ACharacter::CanJumpInternal() const
{
Character_eventCanJumpInternal_Parms Parms;
const_cast<ACharacter*>(this)->ProcessEvent(FindFunctionChecked(NAME_ACharacter_CanJumpInternal),&Parms);
return !!Parms.ReturnValue;
}```
Says that "Customizable event to check if the character can jump in the current state. Default implementation returns true if the character is on the ground and not crouching" - how would one customize CanJumpInternal()?
Has anyone tried messing around with the new SmartObject system in multiplayer? I'm curious if there's something you can do to get the SmartObjectCollection to net load on the client. As far as I can tell, by default it's never present in the clients' world which causes a lot of the features not to work if you're trying to predict things locally.
You need to override virtual bool CanJumpInternal_Implementation() const;
BlueprintNativeEvent create a *_Implementation() version that is the one that will run if a blueprint hasn't implemented the event itself.
So either you can override that function in your C++ character subclass like any other virtual function, or you can override the CanJumpInternal function in your character blueprint and do it there.
SO's aren't supported for network as of yet. I think it just barely missed the cutoff for 5.1.
That's what I figured, it didn't seem like they had any support for it out of the box. Nice to know that it's coming though, is there a roadmap entry somewhere for it?
I don't think so. The roadmap stuff is nigh useless at this point anyway. We won't know what's actually coming in 5.2 for awhile.
But I think mieszkoz was talking about it in #gameplay-ai or #mass
Don't remember where I saw it. But one of those two channels
My use case is a little abusive anyway, I was experimenting with using them as the basis for all interactive objects in my game, including human players (which run locally for prediction).
Thanks, I'll poke around in those channels!
(Found the thread btw: #gameplay-ai message)
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
We will support client-side smart objects in the future, especially that there is internal work to support player's interaction with smart objects. Clearly I was just ahead of the game. 😉
Thanks again!
thank you! I got it working now! 🙂
bool AMMOCharacter::CanJumpInternal_Implementation() const
{
if (MMOCharacterMovementComponent == nullptr) return false;
return bIsCrouched &&
MMOCharacterMovementComponent->IsCustomMovementMode(CMOVE_Slide) && JumpIsAllowedInternal() ||
!bIsCrouched && JumpIsAllowedInternal();
}```
So I learned that when you make a custom
FSavedMove_Character for custom states in the CMC, you need to store inputs in there, even if they're not being sent as a flag, so it can be used for replays. E.g A crouch bool for sliding. Is this also true for input that CANCELS your custom movement? E.g pressing Spacebar to Jump to cancel a slide. Should you store that in your
FSavedMove_Character too for replays?
Because it being present in the header, as well as the cpp is more consistent
Another resource I read:
Besides marking the variable as replicated, you’ll also need to implement the
GetLifetimeReplicatedPropsfunction in the actor’s cpp file. One thing to take into consideration is that this function is automatically declared internally once you have at least one replicated variable, so you shouldn’t declare it in the actor’s header file. The purpose of this function is for you to tell how each replicated variable should replicate. You can do this by using theDOREPLIFETIMEmacro and its variants on every variable that you want to replicate.
I think it doesn't really matter
#include <iostream>
class Parent {
public:
virtual void Job();
};
void Parent::Job()
{
std::cout << "Parent::Job()" << std::endl;
}
class Child :public Parent
{
public:
void Job() override; // this declaration cannot be removed!
};
void Child::Job()
{
Parent::Job();
std::cout << "Child::Job()" << std::endl;
}
int main()
{
Child c;
Parent* p = &c;
p->Job();
return 0;
}
What’s the best way of getting a reference to the player controller of the actor that hits a collider? i tried getting player controller or the pawn 0 but it wont let me spawn in the right place. ive narrowed it down to something involving the client/server system because i rewrote this level transfer in a fresh project and it works fine, and my current setup spawns a new pawn in the right location but not my character
That should output the child one, MOP
Hit Actor > Cast to Pawn > Get Controller > Cast to Player Controller just off the top of my head
Ok I’ll give that a shot in the morning. Thank you. This level transition is driving my nuts lol
How do you make the player character capsule not a brick wall to other players? IE like in PUBG, getting hit with a car sends you flying.
Collision settings. If you click on the capsule and check the settings there should be collision presets which you can change to custom and select what it does and does not block and ignore
That would just make it hit or pass through, not react to being hit
That's not what you asked for. Make sure your capsule generates overlap events and override the overlap event for your character
Yes. I know this. It was posted to compare declaration void Job() override; which is mandatory with declaration void GetLifetimeReplicatedProps(...) const override; which is optional even though the actor has replicated properties.
So a character capsule getting pushed by a vehicle is custom code, not just a physics setting?
Yes
Like a player being able to push through a crowd of AI capsules, that's all overlap code instead of physic 'strength' so to speak?
Probably. I haven't look into it at all so I can't give you a definitive answer
But pushing things around usually requires you to simulate physics on one of the actors involved. Doing this on your player will ragdoll them and doing it on a vehicle would probably stop it from animating and being drivable. That's just a guess though
Joyous lol
This is probably stuff you could find out by googling, or maybe #ue5-general would be a better place
I googled "ue4 push player out of the way", literally the first result https://forums.unrealengine.com/t/how-to-make-players-push-each-other-out-of-the-way/576476
I have a basic cylinder collision around player that pushes all other objects away, collision setup looks like this: It works like it should, when this collider touches specified objects it will push them in opposite direction of player. Problem is that when 2 players collide with each other, they both instantly stop unable to move in their ...
Took me about 10 seconds including the time to load that page
I don't understand why the server RPC is bound to mouse click event directly without checking HasAuthority() as written in https://github.com/pstricks-fans/Elevating-Game-Experiences-with-Unreal-Engine-5-Second-Edition/blob/a361e28a70c07e4605f1cbed8ee26b6bff1bfb6b/Chapter17/Exercise17.01/Project/Source/RPC/RPCCharacter.cpp#L84
Should the server RPC be invoked only in the server?
Appreciate you, even through the sarcasm / condescension
It doesn't particularly matter. If the server calls an event that would normally be a server RPC then it doesn't send it over the network, it just executes it.
In the case of a mouse click it can only come from one of two places: A client, who would probably want to send the server RPC, or a listen server host, who doesn't need it to execute as an RPC but still needs it to execute the server related code anyway, and it will.
OK. THank you. 🙂
im using rep graph; after attaching my main player character to a vehicle pawn, then possessing the vehicle pawn and driving away, once I exit the graph range, it hides the player character?
Hey guys, I'm having an issue with my dedicated server, when I turn the packaged shipping server on, it gets stuck after LogStats: UGameplayTagsManager::InitializeManager - 0.004 s, it does nothing after that, no error message, nothing. Even if I leave it for a few minutes. I'm not sure how to go about debugging this, could anyone maybe give some tips or help?
I'm on UE5.1
when client receives a replication packet, it changes all the properties then call OnRep_ yes ?
because im accessing another replicated property in OnRep_
Yes, when the client variable has been updated OnRep is called afterwards
is there a tutorial for VR multiplayer somewhere i just can't get it?
VR is identical to non VR as far as multiplayer goes.
So in bps would that be the other actor node of a box collider set to overlap?
can someone explain why this doesnt work for client. in a bp i rep notify the setting of a variable off of "switch has authority". then in the rep notify i just set the skeletal mesh to that variable and then set its animation. this works on listen server, but not client
It probably didn't change anything. In BP calling Set will run the OnRep on the server. But when that value arrives on client, if it hasn't changed anything, no OnRep. There should be an Always setting on the RepNotify I think, unless that's C++ only.
ok, thanks. let me try somethings
ok now im confused, after telling it to set the cockpit variable, i tell it to assemble, the client attempts to assemble the meshes following its rep notify function but it wont set the skeletal mesh before that
I have a really odd Replication issue (Dedicated server), apologies that I can't share screenshots or videos (work project).
Basically, I have two clients connected to a server. One possesses a pawn and flies (helicopter) around for a bit. On the server and the Autonomous proxy, the replication is as expected. However, on the Simulated proxy the helicopter is doing all sorts of crazy shit, primarily rotating endlessly around it's X axis. Are there any reasons that the position, velocity and rotation aren't being replicated properly (it doesn't happen immediately, takes about 20 seconds before it all goes haywire).
Does anyone have any idea what the hell might be going on? I thought the Unreal replication system would replicated pawn position/velocity/rotation pretty reliably
hey, by chance did you ever make headway with this?
Unfortunalety not, didnt had time to look into personal stuff
afaik its due to mappings/abilities dissappearing from ASC that is on Player Controller
No worries, thanks for the reply! I'm digging into it a bit, and will share my findings here. So far I've narrowed it down to 2 locations to where I think could be the solution: LyraPawnExtensionComponent & LyraHeroComponent
Both are documented by Epic in Lyra's documentation as being important with possession/unpossession. Likely it seems its the pawn extension, but I need to get some more caffeine in me, and dissect more.
And yeah, it's certainly mapping poofing. It seems its holding other abilities still though, or at least I assume that so far since when I repossess a pawn, the pawn will hold its gun still properly with animations & all the UI shows abilities still, which I assume wouldnt be the case if it really nuked all of the abilities granted period.
I did a LOT of digging for any sort of function or loop hole with initializing those components through blueprints last night, but with no progress. Best I got was getting the character to not T pose, and actually animate properly still after repossession, which I guess...is some progress lol
I'd like to put a bounty on this information about how to properly handle re-possession of a Lyra character. I got a REALLY good AAA quality 3D modeler with 10+ years of experience thats willing to render his services in a barter (free custom model for the bounty hunter, provided the information pans out) for USEFUL information on how to re-possess a Lyra character. Attaching a screenshot of one of his models, will give his ArtStation if asked. He actively works in the industry & I personally can speak for his AAA practices in workflow.
Regardless, I'm going to keep working on this issue, and go full detective mode. Just putting this out there in case I can't get it figured out in a timely fashion & someone else sees this who could use his services who knows how to make this happen
Idk how proficient u are with coding, but i've had a possible solution relayed to me some time ago, and it is to clean the pawn OnUnpossess() and then call ULyraHeroComponent::OnPawnReadyToInitialize() in OnPossess().
Lyra definitely is not set up in any way to allow you to "reuse the pawn" during the session (it just solves a lot of possible multiplayer issues). I assume one of the approaches would be to instead of fighting with that approach - use it to your advantage - and instead of repossessing, simply destroy the old one on leaving the vehicle and respawning the whole player pawn when he leaves the vehicle in the new spot.
If you are set on repossessing due to game design or just you want to do the things "properly" though. There is a lot of stuff to take into consideration (thats why i kinda gave up), basically :
You have to dig trough hero pawn component, the pawn extension component, the ULyraGameplayAbility_Reset, the ALyraGamemode (where player restart can be requested),ULyraHeroComponent, ULyraPawnExtensionComponent(look into handle controller changed)
I'm still pretty green around the gills with C++ honestly, I've got years of blueprint experience, but only about 6 months of C++. Learning very fast though. Appreciate the information, I'll keep this all in mind as I go through the C++ for all of this
Give me a ping if you ever get it to work 😉
Will do 😛 (thank you!)
/** Pawn data used to create the pawn. Specified from a spawn function or on a placed instance. */ UPROPERTY(EditInstanceOnly, ReplicatedUsing = OnRep_PawnData, Category = "Lyra|Pawn") TObjectPtr<const ULyraPawnData> PawnData;
wonder if I expose this to blueprints, along with some of the init functions if that would do the trick
A dark age of Camelot freeshard just launched. They already have 3200 players on the same server and there are no instability complaints. I wish ue5 could be just as capable https://eden-daoc.net/stats?sid=211df259c9eef0578d47cca2d970a8c8
I've heard from someone who stress tested UE5 that it is the cpu-cost of the UCharacter class which is the bottleneck on the client end.
Indeed. I can think of situations where there could be 300-500 players in one area though. During sieges and realm-vs-realm battles. I've seen it happen personally. I often ran in a battlegroup of 100 people from the realm of Albion. It often encountered another battlegroup of an opposing realm, of similar quantity, e.g. the Hibernians or the Midgardians. There are 3 realms in this game so its quite common that 300 players meet at some crossroad location and battle it out. Or a bg might hit another bg that is laying siege to a keep, from behind.
Its like a big battle D&D game with old style graphics that have no normal or roughness texture maps.
The 3 realms have their own areas where the other 2 realms cannot go though. This is their levelling up area.
Anyone have any articles or advice to start looking into lag compensation? I.e. client vs server when a player casts an ability, what happens for those that lag
Primary looking at MOBA, but imagine shooter is just as relevant
Hi guys, when running my dedicated server it gets stuck on LogStreaming: ProcessPendingCDOs: Creating CDO for 'Class /Script/MyGame.NonPlayerCharacter' for request id 35, releasing 1 nodes. 16 CDOs remaining. there's nothing really special in the constructor. Does anyone know where this problem can originate from?
Hey, what’s the best practices to avoid rubber banding
Like I see big games like scum which is made with UE4 on a server with 65ms you can actually feel the lag sometimes
This is due to packet losses but still I need to understand what need to avoid and what to check
Depends on your game, the default character movement component does a pretty good job. If you have custom or complex movement modes then you need to duplicate the CMC into your solution so that you can implement custom packed movement data. Also make sure to setup and use your own client prediction whenever you can to help smooth out the experience and minimize the feeling of lag for the players.
Thanks!!
Hello, Help, i am trying to make a matchmaking system but me and my friend are not in the same matchmaking, what did i do wrong?
Additional information:
Unreal Engine 5.1
Listen Server
Someone has to create the session and it has to finish loading before someone else can join it
Looks like you're trying to join a session then create if it fails, but you need to use the top output pin on that Create Session node, the success is just what happens after (i can see why thats confusing)
the open level needs to be connected to the pin above
Excuse us, it's the first time we've worked with more people and with multiplayer XD, do you advise us to continue with the listen server or to lose a day to then have the dedicated server to load on Play Fab?
Sorry for my English
That is, I know that the dedicated server is safer since the data is not exposed and therefore cannot be changed, and it is also more performing, but it requires money and time... Anyway, thank you very much, you have been very kind 🙂
I dont know anything about your game so no, but this is a topic that has been well documented already.
The difference between listen and dedicated is something you guys need to decide together as a team because your choice dictates how to build and design multiplayer in your game.
thank you 😄
Is your vehicle class custom? If so, take a look for this in the default VehicleMovementComponent, it fixes characters not being shown when you come back within net cull distance of other actors MarkForClientCameraUpdate
Does anyone know if we have to store input in a custom FSavedMove_Character if we use the state of our acceleration to influence if we can exit the custom state or not? E.g if we are sliding, then press "s" to accelerate backwards which cancels our slide.
The doc seems to be inconsistent. What do you think?
No. The prefix is saying that "this will be RPC'd to Server/Client"
The term "called on" and "executed on" are used inconsistently here.
They mean the same thing
It's like being pedantic about it being a function or method.
If you look at it like "this function would be called on the client" then it makes sense. You're making a "Remote Procedure Call", so the function would be called on the client. You are calling from the server.
Just like you could say you're calling a client RPC on the server, and that calls it on the client.
My understanding as non-english native:
ClientRPCFunction_Implementation()will be executed only on the CLIENT version of the replicated actor.ClientRPCFunction()is called on the SERVER version of the replicated actor.
How often do you guys synch transform and other variables. How many times per second?
5 to 10
Whenever it is needed
No hard number
sync it when necessary
Too many game-specific scenarios to give a definitive answer
You may only need to sync it once. You may need to do it in tick.
It just depends.
ok
morning, i am back to trying to figure out proxy characters are falling through the floor
Hi guys, I've to make a teleport responsive for multiplayer, with client prediction, someone can help me?
I'm getting this error: "Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LazyObjectPtr.cpp] [Line: 22]" when the player joins a session and try to open the level map. The listen server player is already one the level, but when the client try to joins I get the error. I have tried the same code but, with an empty basic level, and I don't get any error.
Any idea?
Thanks!
Have you disabled "run under one process" in the advanced settings? Might help if it's getting confused.
It works, but I don't know why.
Maybe the level is too "heavy" and my computer is too old.
Run under one process runs all the clients in the single engine instance and it can get messy. The engine can't tell the difference sometimes.
That never happens at runtime, so it's probably a bad thing to use it at edit time.
Finding what exactly caused your issue is probably a waste of time if it works in different processes. (It's likely an engine edge case issue.)
I don't remember, but I think I tried this level with two players and it worked without any problem. I don't know why it doesn't work.
Thanks. I will continue without "run under one process" enabled.
Do you usually playtest using a separate process?
I started doing it recently
When I was doing mp stuff yeah
Even if you don't have any problems, it's not a real test of mp simply because it's all in 1 process.
Why would you test in something that isn't the same as the runtime environment?!
It makes a considerably difference!
hello, i am back trying to figure out why the proxy is floating and then falls through the floor, so i've tried a number of things, i tried a fresh project to test if (see code) would cause a ACharacter to fall through the floor in a player as client, it did not, I was hoping this was the issue
i've tried different replication options, replication of different character components, none made any changes in behavior
the character seems to be in the correct position still on the server as a local client can't push past the location of where the remote player should be
yep, that's a good point
oh i've managed to get different behavior between the big editor game window and the pop up, should there be a difference between the two?
i have a question about multiplayer and widgets. i know widgets only exist on client. thats what my question is about. if i do a debug string on the widget as object and get display name the widget name is the same on server and client. is this correct behavior or am i missing something.
whereever i create the widget, pawn/controller/hud the resulted widget name is always the same
widgetname_c_0_1
i don't really understand if we don't create a widget on the server, how can it even exist? let alone have the same name on both
it exist on the local player controller
so a server has its own widget
and the client has 1
i avoid creating widgets on the server, what good can it do?
ur doing good
but thats not my question
is it the correct behavior the widget has the same name. i suppose it is., since it only exist locally
and thus have the same name
there is no faulty behavior in my game atm
shouldn't even exist on the server
don't put your domain logic in your forms
but ran on the local controller
im not using dedicated server
atm i have no faulty behavior im just wondering if the widget name is correct
I think the naming is correct, if I am not mistaken names are assigned like `<ClassName>_<InstanceNumber> or something similar
since the widget is created local, it has the same name?
So the order of instancing is the same on client and server
ye I don't think I've ever used names or had any issues with them
just make sure you use widgets locally and they are multiplayer unaware
i have no issues atm, i just needed a verify that the widget name is correct/same on client and server
forgive me, but that sounds like you are doing something wrong
im not bro, ur misunderstanding
im NOT creating a widget on a server
im creating the widget locally on a server / client model
then a server locally can have a widget just like any other client
just forget about the names, chances are you don't even care
exactly
this has a code smell to me
ill post the widget creating..
why? he is just creating widgets
he is worried about what the server thinks the name of a UI is, i would bet that he needs to keep some domain logic in sync
Pretty sure it's correct behaviour though. It doesn't ultimately matter what it's called anyway as its not multiplayer aware. So whether they have the same name on different clients or have different names on different clients really doesn't matter. I believe you can even give it a random name if you want 😄
that is code in your gamemode?
nope
on client
pc
as i said before, i have no issues atm. im just wondering if the naming is correct on the widget
i just wanted some info
It is just fine yes.
thx for the clarification, then i can continue
back to trying to figure out why proxy character fall through the floor
how can i check properties of a character while the game is running in editor?
blueprint debugger
Debugger yeah or the famous print messages 😄
i want to examine the collision settings
under viewport
u can show collision
where it says show
u can enable collision checkmark
while the game is running, not sure if you can see one character is floating, when it stops moving it drops through the floor
i assume its the capsule that stops this from happen
input should be done locally and a call to run on server
so both game instances are in sync
input and then no input and bye bye
the server has the right location for the character
server trying to correct u to other position
so you can't move through it
i have 0 knowledge of cpp
maybe someone else can help
anjd yes
u need to call add molvement input locally
and a call to server
so both instances of the game are in sync
they do seem to be in sync, but then when movement stops
however it won't take long to add this
gl!
that isn't the problem
sigh
the characters are moving so movement is being replicated
also i can see the standard calls being made
its like the local client is doing something with the proxy client
so if the location only changes on the proxy character, it must be related to a component not being replicated or initalised properly
is it possible to change the shape of ACharacter capsule to another component?
I believe the GMC marketplace item does it? I dont think you can do it (easily) otherwise?
I'm trying to wrap my head around an issue I'm having with my vending machines.
Everything works fine on server, but things start breaking on clients.
- Player (client) goes to vending machine and attempts to buy an item
- Vending Machine runs Player::Inventory::AttemptPurchase()
AttemptPurchase() -> updates the player's cash if the purchase was successful.
So in other words what happens is:
VendingMachine->Cast to Player()->GetInventory->AttemptPurchase()
The player's cash just goes out-of-sync although I'm running AttemptPurchase as a multicast.
I'm honestly just pretty lost and have been trying to fix this for the last couple days to no avail.
If you are adjusting their cash - that is stateful and therefore you want an RPC, not a multicast
There's a guide somewhere - 1 sec
Multicast is an RPC. I think you were looking for replication. 😄
i meant onreps - but yeah - its past my bedtime for me 🙂
You could subclass and change the root component and possibly reparent other components. But I'd be really wary of the 10k some lines of code in the CMC. I'd assume a decent amount of it assumes the root component is a capsule.
Thanks @woven basin I'm certainly lacking high-level understanding on this.
What I'm confused about is that we do have the PlayerState class and so in theory I could just have cash be a variable of it and this would solve the problem too right? I'm not sure though.
yes - PlayerState storing a player's cash count is correct
and you update the cash via an OnRep from the server
Btw, is OnRep == RepNotify
Read Exi's guide about Multiplayer and stuff if you havent already: https://cedric-neukirchen.net/
This would mean that I should have my Inventory component store it's state entirely in the PlayerState right?
yes - this would be a fair statement
Yeah I've read it multiple times but either I'm lacking brain cells to apply the knowledge to my scenarios or I don't know what else haha.
@kindred widget its possible to change but whether the CMC would handle anything fine is a question
this is what I want to move.
actually I realized right shape is capsule but needs rotate
there are times you might want inventory on the Pawn, like if you can die and leave the items behind etc - but even then it can be managed on PlayerState... that's personally how I do it, but I'm a newb at this stuff too
My current scenario is a great example for that:
I've got a vending machine that obviously lives in UWorld, now I don't know for example if:
The Vending Machine actor has to be replicated (whatever that little checkbox does in this context...)
And further the vending machine executes RPCs on the player BP but again there I'm not sure how and if at all stuff like multicast/run on server only/run on client only apply to this as the execution is run by an actor in UWorld, the vending machine blueprint.
I fail to extrapolate answers from the network compendium to this situation hence me being stuck.
@tacit bough Client should generally only do the interaction and get the new replicated state returned to it.
(ClientCharacter) Press F > IsInteractable? > IfTrue ServerInteract
(ServerCharacter) InteractWithVendingMachine
(ServerVendingMachine) IsInteractionValid? > DoSpawnStuffOrGrantItem > TakeMoneyFromPlayer
Several Hundred microseconds later client gets the replication from the spawning, granted item or money. The only RPC being involved is the ServerRPC to let client tell server it wanted to do something.
So in other words:
*VM: vending machine
client->interact with VM
VM->(run on server) remove cash
(simplified heavily)
Kinda. Except you need the RPC in a client owned actor, hence the second line. You can't ServerRPC through the VendingMachine.
You would need to have a method on your PlayerController called something like "InteractWith" which takes an actor parameter.
When you ineteract with the vendinr machine, call that method and pass the vending machine as the parameter. Then deal with it on the server.
@latent heart is this not the same setup?
(When a player gets close to the vending machine, an event dispatcher is bound for whenever the player tries to interact with the machine)
So, effectively I'm executing code on my player when I refer to it via the player reference I've got in my vending machine, right? Or is that precisely what @kindred widget you said is not correct.
This is run (inside the vending machine) when a player interacts with the machine):
As far as I can tell the Player::Inventory::AttemptPurchase() event is run from the player
Is the inventory component created client-side? Or the entire character?
@latent heart this part:
Server RPCs will only run on actors replicated from the server.
the inventory is a component on the player character
That isn't a Server RPC. That's a broadcast RPC.
isn't the PlayerCharacter class (the parent class of my player character class) replicated by default?
It is. You're doing it on your main character class, though? (A component within it)
No, I'm doing it from within the InventoryComponent, a comp I attached to my character that I made myself
Also, your attempt purchase should be done on the server, not the result of attempt purchase being told to the server.
That's where my limited knowledge lies.
The vending machine is an actor that lives on the server no?
Meaning that any event calls would automatically be run on the server?
No.
Basically every actor lives on both the server and the client. They are 2 completely separate eco systems - they are linked only very tenuously by RPCs and replication.
If you interact with the vending machine on the client, everything you do will be only run on the client until the send a message to the server telling it what you're doing.
The execution flow should be (very vaguely):
- Interact with vending machine
- Tell server you're interacting with it (plus any parameters)
- The server processes this and either accepts the request or denies it.
- If it is accepted, it changes things and updates the clients
ohhhh so everything the client sees (also stationary actors) are proxies too.
Correct.
Except stationary actors, they're a bit different.
Any actors in the level aren't replicated at all and just exist from the get go.
They can be updated by the server, but they aren't created by it.
Doesn't really apply to stationary ones, because they can be dynamically created too, just anything that exists in the level itself.
But that's what I assume you meant!
see that's what I'm not getting.
my vending machine exists on the server, so any client interacting with it interacts with an actor on the server.
Oh wait... the execution flow exits the server whenever I try to run something over a referenced actor?
The execution flow never goes to the server at all.
If so, would this solve it correctly?
Unless you specifically tell it to.
That seems more correct
Though I would pass in the vending machine class, rather than the price, as your parameter.
I'm sure the purchase method can work that out.
Currently your server event won't know a) what vending machine was used or b) what item it's actaully trying to buy.
You may even want to pass the vending machine instance you're interacting with.
If that matters.
Yeah that's currently split into:
yeah, also an idea. I mean I can think about tidying everything up after I get the netcode of it all working.
Just so you know, the flow coming out of that server method isn't run on the server.
That's continuing on the client.
Only the code in that 1 function is being run on the server.
okay I think I'm confused about something rudimentary here.
Just to test things out here's the current setup:
VendingMachine::OnInteract->Player(Client)::Inventory::RemoveCash()
No server RPC or etc. at all
That will work locally, for sure.
and it works on the server
and I don't get why O.O
the cash variable isn't replicated either
neither does the inventory component replicate
Maybe I'm not using the right term. What I'm trying to say is that the server knows the correct cash value of the client.
Are you playing on a listen server by chance?
no, on "client"
I've got a debug message showing me the current player's money and it's got a "server:" in front haha
that's exactly why this is tripping me up
Are you playing with 'run under one process' on?
It's in the advanced settings.
Turn it off.
🙂
Turn it off.
still works
I haven't used Iris before. 😦
It's a new replication subsystem (used in Fortnite from what I can tell), so perhaps a lot of this magic comes from that lol
Yeah, I know of it.
Yeah, I might want to look into it, might explain the weirdness going on here.
It still shouldn't break server authoratitiveness.
How is your "server" determined?
could you rephrase
Well, it says "Server: ..." how do you determine if the srever is printing that message? Or is that automatic?
It's automatic, right?
well usually that's added to print statements whenever something's being printed on the server.
Yeah, automatic
I could do a switch authority branch to check if it really comes from the server
No no. it's cool.
Now you've got "run under one process" turned off, it won't print server messages on the client.
Therein, you're running on a listen server.
Rather than a dedicated one.
you think? Although I'm running like so:
It really shouldn't print server messages on clients 😦
yeah, I totally agree with you on that
It might really just be an effect of the new Iris plugin tbh
That's my only guess
Add in a print string at the start of the chain, when the overlap starts.
(I did not know)
How does your Interact event work?
I see you binding it, but not calling it.
Wait I ran it again now, with separate processes and after adding the auth switch the client doesn't print any messages any more
it's called by the player
as a server RPC
does this mean everything after it is run on the server as well? or no
You're binding the event on the server and the client (because the overlap happens on both the server and the client - the client tells the server it's moving)
So when your Interact event triggers, everything from that point on is server because you're specifically calling it on the server.
ok that's one thing I was always confused about. As in "when I have an event that comes after a server event, is everything run on the server or not?"
oh so just because it's bound on the server doesn't mean the callback is executed on the server?
If this wasn't a "Replicated to server" node, the lower green box would be red and would run on the clinet.
okay
It's bound on both the server and the client because it's triggered by your character moving. That happens on both server and client.
But the actual interact event is called specifically on the server, so the event (the red/black node) runs on the server.
And everything in the execution flow from that point is on the server.
So I could keep my AttemptPurchase logic just the way it was with no extra net stuff like (run on server) etc.
as everything after the interact callback is run on server
You have to remember, there are 2 copies of this actor. They're both being bound to their local versions - meaning there are 2 events, but only the server event is ever called.
Correct.
OMG.....
jesus
yeah, thanks for pointing that out. Of course since it only ran on the server this whole time nothing ever happened on the client
Indeed!
The reason that didn't seem to be a problem was that up until now I thought that when somthing is run on the server, stuff automatically runs on the client, but that's of course not true.
And one of the reasons for that is that everything, every actor exists on both the server and each client. And if I want to change some state I need to be explicit about the netcode aspect.
Just the server occasionally says "hey, this value has changed" to the client.
(Plus RPC functions)
What I did now is have my interact event run as a multicast. Meaning things should work seemlessly for stuff like opening doors in the world and etc.
I'm guessing there's a downside to this too though, right? Otherwise everyone would just run everything as a multicast
I'm not sure that will work as you expect. Depends on the event.
(apart from anti-cheat of course)
Opening a door, for instance, you might interact on the client, tell the server you're interacting and it triggers the door open - but what is that door opening event?
Is it an animation you play? Is it the door physically rotating?
e.g., that would just be the door mesh being displaced or running an animation.
Will the server update the client without needing a multicast because the door's transform replicates?
Should the clients also run the opening translation?
say it would play an anim. Wouldn't the anim play on all clients and the server in case the door was opened via a multicast?
For that specific example of a stateful actor, you should trigger events through stateful replication (perhaps with an additional RPC to give it a quick start)
Oh... yeah tbh I never understood when or how to use the "replicates" flag in Unreal Engine.
Replication is specifically the server telling a client about a change in some value.
E.g. A door would have 3 states (potentially) closed, open inward, open outward. You wouldn't replicate animations for this, in fact you might even turn off replication of the door's transform - you would just replicate a state, closed, open inward or outward, and when the door receives the updated state, it animates locally to the correct position. Whether that update is because it was set on the server or replicated from the server to the client.
Or you might replicate a "rotation" value of the door and then the server/client interpolates towards that rotation when it receives an update.
Of course that won't work with physics, it's just a kind of static animation, but that's one way to deal with it.
Doing things statefully like that means that late joiners get the correct state of objects.
Yeah, I just read the article you provided. That's something I'll have to think of as I'm working on a game with a persistent world.
I provided an article? 🙂
yeah, only use multicast RPC for one-time events
on you're right haha it was someone else. The article was about OnRep etc.
Yeah, you definitely don't want to over-use them. If it's something that updates constantly, better to rely on regular replication with a high net update priority/frequency.
I'm confused about one thing.
My Interact runs as a multicast, meaning it should also execute on the server right?
I run DestroyActor() once I pick up an item from the ground. This doesn't work when the interaction happens on the client. How come?
Multicast, if run from the server, executes on every client and the server.
If you run it from a client, it runs just on that client.
However
You should not multicast destroyactor
You should run it once. On the server.
say I'm the client, what would the event flow be like?
Same as it is for your vending machine
client wants to destroy thing -> asks server to destroy thing -> server accepts or rejects -> server destroys if accepted
well the setup I've got on my vending machine is interactCallback(multicast)-> do all the stuff
I've got literally no net-stuff inside my vending machine.
You don't want to be using multicast for that
how come? I mean at least feature-wise it's working as expected.
Simply updating your component on the server should suffice, if you have replication set up correctly.
If you multicast the changes, it's likely you're just doing the work twice.
well before all this I had Interact set as running on server. So you're telling me I should have my Interact event run without any netcode specification?
This should not be multicast
It should just run on the server (it currently is)
If that doesn't update the clients properly, the error is elsewhere.
huh well yeah, if I change that part then the client-side inventory doesn't work anymore.
Then your inventory system is ill-designed.
well there isn't much design to it. It's just an array variable inside a component that I attach to my player character.
Let me put it another way, how is a client who joins after that multicast meant to know what items are in the inventory?
It wasn't there to receive the broadcasts.
you mean new players are supposed to be aware of other players' inventory?
If you're only meant to be aware of your own inventory, why is it a multicast, sent to all players?
Multicast RPCs are sent to every client for whom the actor is relevant.
you're right on that. I just changed it to "run on client only"
(or component, I suppose)
how is this an issue? performance-wise?
I mean it might be sent to players other than the intended one if it's multicast.
Your inventory component will be replicated to all players (unless you've set it to only replicate to the owning player)
because gameplay wise I'd think this would mean that when player1 does something and it runs a multicast, then all other players would suffer the same effect. E.g., player1::GiveMoney() --> give money to all players.
No.
It would simply give player1 the money on each client.
Which the server would then (hopefully) overwrite when the correct amount is replicated later.
RPCs are basically instant. Replication is not.
oh... so all the "executes on all" for example would be more precisely "run on current actor, but replicate the changes happening on this actor to all other actors in the world"?
No
Executes on all literally executes that function on each client (and the server)
Not the effects of that function, but the function itself.
That may be the same, but it may not.
Clients may have outdated information, for instance.
how is there a difference between this?
doesn't any change invoked by a function call invoke that? How can a function run without changing anything? O.O
Let's say you give player 5 $50 on the server. You wait for replication to update everything. Just after doing that, you run a multicast GiveCashToPlayer5 function. The clients haven't received the $50 update yet because replication can be slow, but they're now giving player 5 some extra cash - so the effect is different.
Because player 5, according to the client, has original amount + give cash function amount, not original amount + $50 + give cash function amount
And then the server comes along and replicates the correct amount later.
meaning the clients and server would be out of sync over player 5's cash status
Correct.
Clients and servers can never be in perfect sync. It just can't happen.
Don't rely on it.
Again you have to go back to this idea of the server and every client have their own actors, their own copy of every piece of data.
And they aren't necessarily the same or updated at the same time.
Multiplayer is a dick. 🙂
hi all, I'm testing listen server multiplayer with PIE. when I press eject in the editor window I view the level from the hosts perspective, and not the client who the editor window is actually running. How can I view clients world with eject? thanks
say I've got GiveMeCashMulticast(50) and let it run.
PlayerId: 5
players 1,2,3,4 all run Player5::GiveMeCash(50) + player5 themselves run GiveMeCash()
so
p1: p5 has $50
...
p4: p5 has $50
p5: I have $50
server: p5 has $50
say p5 runs GiveMeMoney(50):
p1 - p4: p5 has $0
p5: I have $50
server: p5 has $0
If I don't run any replication on values like this, multicast sounds like it would always be fine as an operation.
If I was to tick the "replicates" checkbox on the "cash" variable. If I ran p5::GiveMeCash(50) --> would this replicate to all clients and the server (just with a delay)?
Generally speaking. I strongly advise you literally never use a Multicast while learning UE networking. 95% of basic implementations require only a ServerRPC and replication.
Indeed.
To go back to your inventory situation.
You've got a persistent world. If you also have persistent characters. What happens if one logs out and then logs back in? How does he know what's in his backpack? His current version of the client wasn't there to receive the broadcasts.
Haha.
yeah that's gonna be a whole different beast. I've planned on coupling the player inventory with their online services profile (EOS, Steam or else) we'll see though lol
yeah good point
by the way... when a player picks up an item on the ground it's supposed to dissapear. however, "Destroy Actor" just by itself doesn't work when run by the client. I've watched a video on YouTube about replicated actor destruction and they've set it up rather weirdly imo. They made two events inside their player character which invoke the DestroyActor method. Isn't there a better to do this?
(player character):
(Pickubable Item):
how would you go about it? Say a client picks up an item and you'd like it to dissapear for all clients and the server.
My instinct would call for a multicast but Authaer mentioned that in a lot of cases it's better to do it differently
Hi guys, i'm trying to understand the basics of replication and apply them to a lock on target function i did
In the majority of cases, if you're modifying a replicated actor/component on the client, you're probably doing it wrong.
The exception is things like character movement and look rotation.
i just don't really know where to put the nodes for the replication to happen, in what part of the visual script
Prediction looks around the corner
That's an advanced topic! 😄
ok, so as a rule of thumb: changes in the world -> change the state on the server. Does UWorld replicate by itself on clients? Or would I have to check "replicated" on actors etc.?
you want to lock your camera to an actor?
I did literally that in one of my projects.
any guesses? this is the first part of the script
Also unironically Minecraft’s item pickup system is pretty clever when it comes to this scenario 😄
i set up so that the camera is locked to another actor, the movement changes to strafing, the camera offsets and the movement is done through rotation
@charred tundra what exactly isn't working?
wait... is there an open talk or something about how they do this stuff?
i think it's faster if i record a video
@latent heart when you say "destroy the actor via the server". Do you mean by that:
call Item::DestroyOnServer()
?
go ahead.
this ^
To touch on the subject Thom raised about prediction, the client might hide the actor instead of destroying it, but unhide it if the server said no.
how do you ask the server? Isn't that what a "run on server" event does?
Not that I know of, but it's pretty clear if you played the game. Minecraft drops its items in the world and when a player walks near it they can pick it up. This gives the chance to really easily let the server determine which player gets the item with no client prediction whatsoever. But it's definitely not the solution for most games 😦
in that case this piece of nodes should work:
if I got that right haha
That will work if, and only if, "Self" is owned by the player.
Because you can't send server rpcs from via actor not owned by the player.
whaaah
So it's basically a suicide function.
the concept of ownership is foreign to me. So uh... do I just set the owner and then run this? O.O
As I was saying before, use the player controller as an intermediary.
Player controller, player state and pawn = owned by the player
You cannot send an rpc via vending machine, for instance.
how is that any different to executing stuff originating from the player character?
The playercharacter executes the OnInteract callback on the item on the ground
Isn't that in principle the same thing?
The character is owned by the player though.
in this example i removed any replication i tried, so the code is just for single player
i don't know where to put the replications
I'm still not sure what you're problem is. The player tracking seems to work fine...
If you want to use the interaction event you set up for everying, go ahead. It's not standard by any means, but if it works, it works. There's nothing wrong with it.
the code is done so that once you enter the lock on state, animations change
with a blendspace
how would i replicate that to everyone?
is there someplace I can look up the "standard" way to set up interactions and stuff?
i've been trying to do that but i get confused so bad in all those nodes xd
btw is that vivi
Honestly, I don't even know if the way I'm suggesting is any kind of standard way. It's just what makes sense to me.
oh yah, fair enough haha
from looking at the code, could you please tell me what part of the code to replicate?
I haven't looked at the code.
could you please? it's all in the video
Videos. 😦
i'm sorry hahaha, i didn't want to flood the chat with screenshots
if you want i can do it
Works for me.
lol, might as well post some shady links 
might there be some hidden
i always get intimidated when experienced devs start texting for minutes and minutes
For me, I would have an interface, Interactable. I would apply this to actors which I want to interact with and set them up with an appropriate collision channel just for interacting. I'm sure you've got the collision part done already. The interface would have a single method Interact with takes the Player Controller or Character as a parameter. In the Player Controller, I would have a single Server RPC, Interact, which takes the actor implementing Interactable as a parameter. When you interact with actor, you call this method on your Player Controller. On the server side it would simply do Interactable->Interact(self) and that's it. The object then implements what interact means for it in the Interact event.
You just uploaded extension less files. Just use screenshots or something
😄
Hah
Thanks. Deffo sounds like a sensible approach.
bLockOnEngage and current target should have an 'on replicated' event.
And be replicated, of course.
Or whatever other lock on stuff needs replicating.
i set all of the variables on "replicate" and i bet that's destructive
@charred tundra do you use an animation blueprint?
oh, yes
Show us your event graph and your state graph
So what is this lock on stuff supposed to do? Just make something look at a target?
@latent heart yeah, and that part is working for them already. It seems like they want the animation state to replicate.
then the transition is simply whether or not the user is on lock on engage
@charred tundra click on the arrow thingy that goes towards NewBlendSpace and get us a screenshot of that please.
Animation state gets derived from variables on the character.
- Replicate bLockedOn
- AnimBP looks at that and updates on each client locally
The thing about replication is, it doesn't work from Client to Server.
Are you, at any point, telling the server that you've locked on to anything?
no, i don't think so
Okay, so that's the issue.
That's the problem
how would i-
Use a Server RPC
For other clients to know about your lock on status, you need to tell the server. The server then replicates it to everyone.
- Client tells server - "Hey I'm locking on to this thing"
- Server goes "okay - let me tell everyone else"
mhh yea i understood the basics through some tutorials
i just don't know how to do it in practice
When you change your lock on status, you need to send a server rpc to let the server know.
every tutorial i found doesn't explain that in a way that works for me
Create a custom event - then on the right, select "Run on Server" under the replication dropdown (or w/e dropdown it is called for events)
In your character, not your anim bp.
if I understood the others right all you need to do in your character BP is:
okay, following
Wouldn't lock on be client side with setting control rotation though?
I mean maybe a ServerRPC if there's a target effect. But for making the character rotate and look there, it's all control rotation.
that part works for them. It's just the animation state isn't replicating correctly.
should i check "reliable"?
doesn't hurt.
okay okay, done that
Reliable is what you want for this.
Unreliable would be, generally, for constant and frequent rpcs.
oh, understood
Like sending your mouse location or osmething.
like movement?
Yeah.
You could do it that way, or do it this way and look at it as a logic state. Which then feeds into the animbp so it can go into the right animation state. Doing it this way is more simple imo.
after i did this?
Unreliable means UE doesn't care if it gets there or not.
@charred tundra if you've made all the changes and each time the value changes you also call the ...Server event, try and see if anything changed.
so instead of calling the variable directly i should call the event?
and swap every reference of the variable?
No no. If you only need to change the variable, you just need to add a call to that event to your code whenever you cahnge the variable.
This is what a setter function would help with, but since you don't have one, just add the calls.
if I understand the others (correct me if wrong):
- Whenever you lock-on, you update your "isLockingOn" flag inside your character blueprint. And each time you do that you want to call the event that you just made.
This event is missing a bool parameter - the value of lock on...
this right?
If you do that, you need a second event to disable lock on.
Call the appropriate one when setting the value of lock in.
Doesn't matter.
@charred tundra
This is the better system.
ohh i got it
so basically we are doing a box for the variable that gets shared to the clients too
right?
Right names aside, pretty much.
does it work now?
not even on the server? (try both ways) server and client.
yea, nothing sadly
i replaced only the SET LockOnEngage
do i need to do it on the getter too? i don't think
@latent heart btw... I've refactored my Interact flow so that it's just a regular event (not multicast etc.)
I'm having trouble running destroy actor even when I use a server RPC. (tried almost all options possible last 30 min lol)
Show code.
did i miss on smth?
Are you sure the bool is set to replicate?
it is, the condition is set to none
do you guys want my project? it's empty other than these few lines
@latent heart
@charred tundra no, but I can hop on a call with you for a couple minutes to debug it. Join the "Feedback & Support" voice chat channel.
ty
@latent heart wouldn't this solve that?
i don't have the permission to stream tho
No, because you aren't doing it from the server. 🙂
oh lol
I hate to repeat myself, but add a server rpc to your player controller to delete the actor.
Pass the actor as a parameter.
Etc.
I do not.
aaa
giova's doesn't replicate correctly for some reason
*flag
@latent heart I probably misunderstood you earlier than because it sounds like the approach I had going earlier: #multiplayer message
in any case thanks for the great help today! I don't intend to steal any more of your time and thanks a lot for everyone invovled.
Np
I'm spawning a replicated actor in the Game Mode using the Spawn Actor From Class node. The actor spawns on the server, but is not visible on the clients. Does anyone know what I'm doing wrong? 🤔
(4.27 source, running a dedicated server)
The interesting thing is that it all works fine in 4.27 launcher build without the dedicated server. 🤷♂️
The actor is probably not marked to replicate.
hi all, I've got a mechanic where the player can launch themselves and I draw an arc to predict path based on some basic math. On listen server host this arc is accurate at pretty much any frame rate. for listen server clients they fall off this arc above 30 fps. What kind of stuff might cause this?
It depends on the math
But any regressive function can behave differently at different intervals
you need to post pics of the math
sure thanks, here is one snippet that acts differently on server and client
FVector ClampedV = FVector(0.f);
GetCharacterMovement()->Velocity = UKismetMathLibrary::VInterpTo(GetCharacterMovement()->Velocity, ClampedV, DeltaTime, GrappleBreakSpeed); ```
thats run on tick in both, for server its pretty stable regardless of frames, on client its stable only at 30
Heyyy
I have a problem in my gamee
The First One Joining(Creates a session) has the dress selected and the player who joins(joins the session) later , has the default in his own view but when the first one joined sees him , he has the same dress the first one wears…
How to fix this??
Are you sure the client and server aren't fighting each other?
grappling could be quick
Turn these on and see if it still breaks
Is there server correction jitter?
Hello, we are trying to make the matchmaking system for listen server in Unreal Engine 5.1, Somebody can say why this doesn't work, what did we do wrong?
Why are the men wearing dresses?
This question is too vague, you need to post some pics of how this is replicated
is it an ONREP variable or an event?
etc
Zoomed in and only matchmaking related stuff.
Sorry for sending it back, thank you for your patience.
hey thanks for the response, those are both already on. I dont see any jitter but ill take another look
somewhat related question. If I want to launch a character with the LaunchCharacter function, should that run on all machines, just server, just owning client?
Oh wait
This is my codes in player controller
Sorry for the bad quality
This in the set dress rep notify ( in p controller)
The Equip dress I'm casting to the player is not running on the server not replicated
quick question, is there an order to when repnotifies get called for clients?
Technically it's due to how they are laid out in GetLifetimeReplicatedProps but I wouldn't count on that as it can get pretty messy if we start talking about unmapped properties
i just cant seem to understand why this works for both server and client
but then this makes it stop working
and only works for the server
You do not need to call a multicast to set the "Set Dresses" variable. Instead, just set it when running on the server.
The OnPossess event only runs on the server so there's no need to use an RPC. Therefore, you can set the "Set Dresses" variable there without any RPCs.
I mean I've read some documents about how multiplayer actually works but not sure where I can go to actually learn how to implement that code correctly
your best bet is to just make something that works, then ask questions about your specific implementation. as long as you understand how replication and RPCs work and how to use them, theres not much else you can do besides just doing it. if you are lucky you might be able to find implementations on forums/blogs or grab some plugins and study them
Alright
You can think about what you wanna achieve before you start working on your implementation. For example, if your game doesn't really require cheat protection, you can design some of your systems client authoritative etc. It's important to understand how replication works and what do you want
Need add note that I tried join on server launched at my friend and it was successful, I have same settings on my router and I can't join on session on my router ( from different network)
Have an issue where I want to only allow strafing left/right while sliding (custom movement mode in the CMC), But it causes desyncs at 500 ping when I call CalcVelocity for friction. If I call the Acceleration change after CalcVelocity then the strafing changes don't work, but if I call it beforehand, it causes jitter. Any ideas?
Acceleration = Acceleration.ProjectOnTo(UpdatedComponent->GetRightVector().GetSafeNormal2D()) * SlideStrafeMultiplier;
CalcVelocity(timeTick, GroundFriction * SlideFrictionFactor, false, GetMaxBrakingDeceleration());```
Which part in the default character template AMyPlayerCharacter manages player input (left mouse click for example) and propagate it only to the character possessed by the client rather than to ones possessed by other clients?
The PlayerController handles delegating Input via the InputComponent.
What I want to know is the part in which the code delegates the input only to the character the client owns rather than to other clients' characters.
FSlateApplication is where input starts. It's routed through UI, and eventually arrives at the GameViewportClient. GameViewportClient has InputKey, InputAxis, InputTouch, that sends the key/axis/touch to the PlayerController past some conditions.
Consider a game instance as a client with two characters.
One character is controlled by the client itself and the other character is controlled by the other client.
As both characters are the instances of ACharacter, they have the same code.
Which part in the code (cpp file name and line number) that determines the player input must be delegated only to the character the client owns?
The input component on the character probably takes input from the ulocalplayer. I'm sure it'll be funnelled there by the slate application at some point.
You're mostly looking for TickPlayerInput on APlayerController. GameViewportClient sends Keys/Axis/Touch to the controller. The local version of the controller runs TickPlayerInput. TickPlayerInput basically builds an input stack and consumes all keys the GameViewportClient has told it were pressed/released
Well. Half true. TickPlayerInput does other stuff. ProcessPlayerInput builds the stack and executes it.
Is a character with GetLocalRole() returning ROLE_AutonomousProxy directly controlled by the player on the owning client? For example, the player presses W key to move forward, does this action directly control the character the client owns?
Or...
When a player on the owning client press W, the client does not directly control its owned character but calls a server RPC first.
The server then calls the client RPC to move forward the owned character.
I hope my understanding is correct. 🙂
Or both.
I have an OnRep variable for my current ammo. I do my firing logic client side and then notify the server of a hit (coop game, I don't care about cheating). If they are a client, I go ahead and reduce the current ammo count so the client can see it immediately. The server reduces the count when they get notified.
I have noticed that the OnRep does not fire when I do this. If I comment out the client reducing the ammo count, the OnRep does fire. What am I overlooking? (5.1)
What does Server-Owned Actor mean? Is it an actor that is spawned in if(GetLocalRole()==ROLE_Authority)?
Not necessarily.
A server-owned actor is one that is not associated with a specific player. E.g. Player controller, player state, pawn.
Player controller and player state not associated with a player?
I know that OnRep will not fire if the value is unchanged. But I vaguely thought that was server side only. There is an option in c++ to Always notify on all OnRep even if value hasn’t changed. Maybe try that?
Oh but what abt the client ?
The Second One Who Joins the Game , goes to default and sees others in default
While the first one who starts the match , has his dress changed and sees others wearing the same dress he wears..
The value definitely changes on the server.
yeah - but when it reps it down to the client, the client might be dropping it because it is "equal". Let me check
"the OnRep behavior will only trigger on the clients when the value of the variable changes"
so there is a way in the DO_REPLIFETIME to set it to always. I'm not near my computer at the moment, but its like "_ALWAYS" or something as a flag.
-
RPC with
Serverspecifier will be executed onserverwhen it is called onclient. OK -
RPC with
Serverspecifier will be executed onserverwhen it is called onserver. OK -
RPC with
Clientspecifier will be executed onclientwhen it is called onclient. OK
Question:
- RPC with
Clientspecifier will be executed onserverwhen it is called onserver. Why is it executed onserver?
Yeah - completely forgot about this caveat. I was only thinking about the server side change 😅
You are leaving out the word "owned". Ownership is an important part of RPCs
Client rpcs Run on the owning Client of an Actor. If the actor is owned by the server, then the client rpc is just gonna run on the Server like a normal event.
Only listen server can own actor? dedicated server can also own actor?
Both yeah
I watched Tom Looman's course especially the multiplayer part.
He said we need to have 2 PlayerStart actors on the level to make sure there is no collision when they are spawned.
What happens if we have 10 players in a single arena, should I arrange them in advance by dropping 10 PlayerStart actors on the level?
And the default template of third person, there is only one PlayerStart and I cannot detect any collision between players.
If there's not enough starts, Unreal will generate one next to an existing start. But if you want any kind of control over this you need to have enough starts for the max players.
Alternatively you can override gamemode functions to set your own start points some other way.
Hey my multicast event and owning client event is not working
Show code etc
getting this message when I want join session from my pc to laptop both are on different network, ip address is public port 7777 open all settings right
yesterday it was working today not
Need add note that I tried join on server launched at my friend and it was successful, I have same settings on my router and I can't join on session on my router ( from different network)
i did this in game mode
Try forwarding 7778 too.
Can we get a screenshot where the code is actually legible?
Part of your problem is that you are using a replicated variable in the player controller. Player controllers only exist on the owning client, and on the server, so no other players would get the variable being changed.
Your most recent screenshot showing your game mode, is basically pointless to RPC anything in there as game mode only exists on the server. You cannot RPC to clients in the game mode, and clients cannot call RPCs in the game mode.
Depends on what object he's sending the rpc. WE can't see because it's so low res.
Any events in the game mode are strictly going to run in the server, and clients cannot access the game mode.
The game mode can call RPCs in other actors, but nothing but the server can call events in the game mode.
oh then should i go back to player controller
If you want your character to change appearances, you want to use OnRep variables to do it since it is something stateful. This means the variable that changes those appearances needs to be on an actor that all clients can receive updates on. As its to do with your character, then you probably want to put the replicated variable on the character itself.
oh ok
wait ill show my codes in character bp
This is the function , I use it in other blueprints to call this
oh then should i do it in game state?
should i do it in a game instance?
game state
it workssssss
but the dress client wears is not seen by server and vice versa
okay
My settings:
Number of Players : 2Net Mode : Play As ClientRun Under One Process : UncheckedNew Editor Window (PIE) : Checked
When I play, there are two log windows:
- One independent console window prints server's log.
- One
Output Logwindow docked in UE editor prints one client's log.
QUESTION:
How to get one more Output Log window for the other client?
where is the config in CMC for adjusting local client correction ?
my locally controlled char get back to where he was most of the time when he runs fast
One way I know is to attach the debugger to the client you want to see. The other way I know is log the output to file. (There are probably better/smarter ways, they are just two I know of)
How to attach?
Depending on your IDE, once the client starts, your IDE will have an option to attach itself to an existing process.
If I replicate a struct with a tarray, and implement netserialize, will the array maintain it's order ?
yep
There is a setting in editor preferences (screenshot shows the shortcut, should be same location for UE4) for additional launch arguments for standalone, you just need to add -log in there
It'll start two copies of the game in "standalone" with logs (and still connect to the server)
You can use selected viewport just fine if you don't want 2 separate "standalone" clients to spin up
oooh... can we do "-waitfordebugger" there too? that might solve a different question I was pondering last night
I presume so, yes
hello 🙂 i've figured out that characters respawn correctly into the world the second time, I assume there must be something that controls spawning proxy actors into the world
Thank you. Works!
is spawning purely managed by the gamemode? there must be something locally that handles the creation of proxy actors
for skill based matchmaking system, i'm planning to implement openskill algorithm -- wondering if someone has implemented it before. If yes, need help with integration with EOS
replicating data is so tricky to do it in the right order
as long as you keep in mind that every actor replicates via its own actor channel, and there is almost no guarantee of any order
my understanding is you should design and always assuming it will come out of order
you're generall fine
i.e. think of packet drops etc - you cant garuntee anything.
only order of replication guarantee you have is that GameState will have replicated before clients call BeginPlay on any actor
sometimes i need config to be loaded in before i can spawn characters, so i test, but damn it can be tricky
config? sounds like gamestate? if so - see Zlo's post above - that should help solve your issue
i have the rules on a web service, sync between client and server etc is a 🙂
if they need config loaded, then its not a replication issue at all
just ordering stuff server side
generally lobbies help, as server gets all the client side information for spawning the client's actors before they even transition into a game map
doing any sensible ordering when you just hot drop into an ongoing game directly usually requires c++
but as a general rule, your PostNetInit on the PC is the first place you can send a server RPC from and count it will get there
some HandleStartingNewPlayer overrides (as well as functions calling it) can get the GameMode not to spawn players until it gets the data it needs
or in case of level composition, it can also be used to hold off spawning until the PlayerStarts are loaded
Guys
The Dress of the Client Player is not seen by the Server player and vice versa..
Anyone here using Oodle for network compression? The sales page says "can compress UDP or TCP packets like nothing else, saving bandwidth for players and servers."
Given its free now - is there any downside to using it?
is anyone here actually using it though? Anyone had any experience positive or negative with it? Or is it one of those things you only need it when you know you need it?
You need to replicate it
And you should show your code or give more details
Hi guys, someone here has developed a Replicated Sit System? I'm facing some issues to replicate it
Hello, I've got a replication function, I would like to trigger this every time i set chest, even if its the same value
DOREPLIFETIME(AAvalonCharacterHero, chest);
oops
DOREPLIFETIME_CONDITION_NOTIFY( AAvalonCharacterHero, chest, COND_None, REPNOTIFY_Always );
thanks! 🙂
and if i did DOREPLIFETIME_CONDITION_NOTIFY(AAvalonCharacterHero, chest, COND_SimulatedOnly, REPNOTIFY_Always); that should only replicate the values to proxies
This is code ,the same in game state
Wait I'll take a SS of the Game state bp
code in my game state
The Set dress 3 has the logic to equip
I see, what are you exactly trying to do? I guess you are trying to spawn dress on players, but who should tell them to do so? Is it happening through UI by player choice or granted by the admin / game mode?
by ui player choice
now theres just this problem that the client and the server cant see the dress the other is wearing
I want to know how to fix this
You should change your code completely. After the player selects the outfit from the interface, create a function like Server_OnDressPicked in your character and trigger it from the UI. This function must be Server Replicated and Reliable. Get the Id of the dress from this function, then if you are using a Data Table, pull the information from there and create a variable named Dress and mark the Replication Condition part of it as RepNotify. Set the value of this variable from Server_OnDressPicked function so it can be replicated. You will see a function called OnRep_Dress after you create Dress variable. This is where you put your dressing logic.
What you're doing here with my solution is accessing your owning character and firing a server function. This function will set the value of your Dress variable, which is marked as RepNotify. RepNotify functions can trigger OnRep functions whenever their value is changed or the variable is replicated. So you put your dress logic here and when the value changes, this logic gets fired. The reason you wanna put this on your character is to let other players see the changes, because the pawn exists on every player.
Just to extended on that, static meshes themselves don't and changes of the mesh assigned to a component wont replicate, which means that the actual "SetStatic/SkeletalMesh" call needs to happen on all the client/s and in your case (since you're using listen servers), the host itself
I'm quite confused
Should I replicate the Set Skeletal Mesh?
But it affects the player ui choosing
Tried and is not working..,
How are you storing/accessing the "options" of meshes that the players can pick?
I use a variable in game instance
Actually two variables
Row name , Category
The UI and sets the function of the character ( Equip item), the equip item in the character sets the variables of the game instance
Okay, so, the UI should call a Server replicated RPC/event to the players character with the RowName and Category as a parameter, this event should then call a Multicast event passing again, those two values as parameters, that event should then do the actual changing of meshes, etc
Oh it's running on server
I had a event called
Become active slot which is running on the server in the ui
It also sets the variables of game instance and also the function of character bp ( equip item)
Is this screenshot from inside your widget blueprint?
#multiplayer message
when playing on a server and your local character stutters, what is that a sign of?
You should tick ignore client movement error checks.. and Server accept client authoritative position
Worked for me
Okay coming to my problem
Now I just want the server and the client to see the dress the other is wearing
Wrong?
Yes, stuff like this is really bad and should only be used for short periods of time, not just turn it on/off and forget it forever 😅
If it's a game that doesn't really matter if cheating happens, then okay, but in most cases it's really not a good idea
For me doesn't matter for now , like when I give a update next I'll fix itm
thanks
Ah no no