#multiplayer
1 messages · Page 178 of 1
Usually to do this you just set it to regular replication on the character and on update animation you get the bool from character and set the bool on abp
I'm not sure about repnotify
I mainly meant that you shouldn't inform everyone manually of the boolean change in the OnRep
Either have other systems ask for the boolean, or bind to a Delegate you can call from the OnRep.
So your Server doesn't have the AnimBP value as true?
You aren't setting it to false anywhere else, right?
no, it doesn't get set over in the animbp from what I can see, despite the logic that sets it running on the server, according to debug. so odd.
Can you, inside the AnimBP EventGraph, get the Character (TryGetPawnOwner) and grab the boolean from it and print that?
Want to know what the Server says for that
I just double checked that there is no other code setting that boolean, and there isn't. Some improved find ref tools in 5.4 by the looks
I have to head out, I apologise, but I will do that asap and get back to you with an answer.
Yus
Hi! So i have a problem. I'm trying to connect to my friend (locally) and the friend is in a map called "FirstPersonMap" and it looks like its trying to connect me to the main menu of the other machine? I'm very confused so any help would be greatly appreciated. When I click the join button nothing happens and I get this in my log
[2024.05.06-20.05.26:875][983]LogGameMode: Display: Match State Changed from InProgress to LeavingMap
[2024.05.06-20.05.26:875][983]LogGameState: Match State Changed from InProgress to LeavingMap
[2024.05.06-20.05.26:875][983]LogGlobalStatus: UEngine::Browse Started Browse: "192.168.1.12/Game/FirstPerson/Maps/MainMenu"
[2024.05.06-20.05.26:875][983]LogNet: Browse: 192.168.1.12/Game/FirstPerson/Maps/MainMenu```
When can I be certain that both pawn and player state of the listen server's host player are valid?
ok i found the issue my reff i used get player controller index 0
this is on the player pawn what ref should i use
get controller +
not sure if I understand your question, but... By checking manually, there's no callback that says these things are ready, you usually just check every x amount of seconds for them to be valid
what are you trying to do
im trying to get a ref to that player pawns controller
for each player
or rather so that player pawn gets its own controller
get controller -> cast to playercontroller
yeah but im getting controller 0 from both server & client
yeah, it's getting the controller of the pawn
so they would end up getting the same controller
you can plug an is locally controlled bool in
but it would only help debug the issue, it wouldn't really change anything
so all 4 prints have the exact same controller?
that beginplay will fire twice on the client, and twice on the server
2 prints should have the same controller, 1 print should have a different controller, and one more print should be empty
If that's not happening then something else is going on, maybe add a delay before casting to see if anything changes
hm
yeah, I just got the same result as you, adding a delay before the casting node fixed the issue
you need to call that code somewhere else
oh
possibly on possessed
do an RPC to client to tell the client that they've successfully possessed the pawn, and then run the code
that looks correct to me
the clients controller is C_0 in this case, and the servers controller is C_1 in this case
the reason the server has 2 prints is because the server knows about the clients controller, whearas the client doesn't know about the servers controller. If the client knew about the servers controller, then there would be 4 prints total
Little question. I have 4 local screens. So i guess all those local screens has their own "instance" Is there a way to make get game from Screen 1? to retrieve who is the gamecontroller associate to the screen? but with a more generique way?
hm mkey, so it shold be "correct"+
I build a widget where i need to find for the screen what is the controller, and for the controller what is the pawn
but it's possible if i can access to the screen instance automatically
it is correct, you can do an is local controller check if you want to remove the second servers print
ah ok tyty
I'm sorry boss, I can't understand what you're trying to say
all of them have their own HUD. So i have HUD for screen 1, HUD for screen 2, HUD for Screen 3 and HUD for screen 4.
How can i get a HUD. and check base on that hud what is the player controller?
Is there a function that return me the list of HUD, and for each HUD the player controller?
GetHud(1) --> GetPlayerController(0) --> getPawn
GetHud(2) --> GetPlayerController(1) --> getPawn
GetHud(x) ---> findThePlayerController ---> GetPawn
PC has both GetPawn and GetHUD
from HUD you can access PC and get pawn from it
you don't need to find it, it should be directly accessible
but you see i'm inside a widget
with that one i have to specify the player index
but i don't know the player index for that associate HUD
that is "global" finder, you normally almost never use them. and for your complex case it is kinda poison
widget has owner context, it has GetOwningPlayer and others context-valid accessors
Possibly GetOwningPlayer
LocalPlayer, while it sounds like it's the "local" Player based on network context, is actually a different Class called ULocalPlayer :P
BP peeps don't often get into contact with that.
@chrome bay Where are you at on this? I did a little bit of testing and I only see properties that have been modified from the default state as being sent again every ForceNetUpdate/Flush call not all of the replicated values, were you speaking just in general or did they change something? Sorry for the ping
@short arrow another thing
on the client the fade in is access none on client
this is from a actor component on the player charcter
why would a client get that resault ?
I'm one of those he mentioned that don't realize this, although it makes a lot of sense.
But the question is, how do you know? Are you for example expecting an OnRep/RepNotify to get called and it's not?
Unreal network insights, every ForceNetUpdate that is called AFTER the value differs (even if only changed the first time) is still replicated. I assume it has to do with no shadow state being stored so maybe it compares to the StaticClass(). That would be my guess
That's it, if you're using insights, then it should be true.
I don't have the engine at hand, but indeed I would have the same assumption, unless the shadow state is stored in the ActorChannel, then the plot would only thicken
Hmm possibly, I tried 2 different ways
- with Initial dormancy and just calling
ForceNetUpdatewhen I change it, this had the actor channel setup and creation cost right there at the time of calling as well as the normal replication of the actor and every call after was just the normal replication cost (with the values that were only originally changed) - with awake to begin with and then I change the value, set it to dorm_all and then after a few seconds I call
ForceNetUpdatein a loop with a few seconds delay in between, that has the channel cost only when originally connecting and even though its set to dorm_all after that when I call ForceNetUpdate it doesnt pay that channel cost again, only normal replication of the actor.
Do you know if I need to wait some time for a channel to be closed after going dormant?
Hum, interesting. I'm almost sure it's hardcoded as 5 seconds in the engine
is this not enough to possess an actor on client, I'm able to jump and use some other inputs but not look around or move
the function is called in begin player passing in 'this'
I was waiting 3 before calling force so that may have been it
You shouldn't need to call a server RPC from a function already calling on the server (in this case being BeginPlay)
A HasAuthority check in PlayerController's BeginPlay with that Possess call should be enough
But if you are already able to pass it input, then it means you are already possessing it, so it could be something with your input binding etc.
how do i let clients call server rpcs on widgets?
Hey, just reading your Tips and Tricks blog article and you mention structs replicate atomically when they override the NetSerialize function, would you see an issues with a simple dirty flag int that represents which values to deserialize on the receiving end? like a struct with 8 values could have an uint8 as its flags like 00010010 and then you can just re read that an be like oh, I only need to try deserialize values 1 and 4. Would there be an issues with this method do you think? Basically just a way to ensure the NEEDED values all arrive together without re sending wasted repeats?
Does it need to be an RPC? Why cant the widgets be local to the client
yeah basically when clicked on a button it's effecting something on an actor
Have the RPC be on the actor if it's an actor owned by a player
Else route it through the player controller
you would have the widget owned by the player or have some kind of callback to the player in order to send the RPC, you can only send them through your controller or something owned by it
It has to be a replicated actor though. Widgets can't do that
true
There should be no issues with this approach ™️, I saw other people do it 😄
It's not as easy to maintain, but saves some precious bytes
A multicast in the PlayerController is awkward. It says to REPLICATED TO ALL, but it's potentially to ALL. PlayerController doesn't really exist on all instances. It's server + owning client. For the listen server player, server and owning client is really the same instance, so the function was really just running on the server @brisk swift
A multicast should instead exist on an actor REALLY replicated to all, say a PlayerCharacter for example
yeah i got it working, ty for your help
Whats the difference in lobbies and session? Like both do the same job to connect player in a same ip right?
Hello
I have bought 3 controllers USB for testing purpose. (8$ the controller)
The controller is recognize by Windows but doesn't work into UE. Is there something to do to be able to use a random gamecontroller?
you can see into widows the controller works
is there something to do?
what's this doing in #multiplayer ? and yeah, you need to configure input. if it's a standard xinput (ie. xbox) controller then that's fairly easy, if not then you'll be looking at rawinput
is log in is compulsory if I want to create/join session in EOS? cause iam having log error saying user not logged in
but the controller PS4 or Xbox works. but not and markless controller. it's because it's related to multiplayer
i bought them to easily test the 4 local multiplayers game mode... but if they don't work it's annoying
Hey there!
I'm currently struggling to replicate a value-change of a replicated TObject and was wondering what I am missing so this works correctly.
I have an UserCommentActor that is spawned via a ServerRPC and that actor is assigned a CommentData* : UObject after spawning. (CommentData is created on Server)
The CommentData has a bunch of variables inside which are marked as UPROPERTY(Replicated), for example the ReferencedUserCommentActor*, pointing to the UserCommentActor.
That CommentData* field inside the UserCommentActor is marked as UPROPERTY(ReplicatedUsing ="..."), inside a DOREPLIFETIME macro in GetLifetimeReplicatedProps and part of
the ReplicateSubobjects method: bChanged |= Channel->ReplicateSubobject(CommentData, *Bunch, *RepFlags);
This works properly and all clients can see the correct data.
The next step causes issues: The user has the functionality to add responses to this comment, which are stored as TArray<CommentData*> inside the CommentData class. After the client
has typed in the proper information and clicks on CreateResponse in an UI, I access my PlayerController and invoke a Server_RPC.
Inside the Server_RPC I create a new CommentData* Object, access the referenced UserCommentActor inside the original CommentData and call AddCommentResponse(NewCommentData).
However, this new response is not properly replicated to all clients. I am seeing this new response on the client who created it.
So I kind of was wondering if I am having the correct approach to create these responses and something is missing with the TArray replication or this approach is just incorrect.
Grateful for any advice!
and what is the good # ?
#ue5-general possibly, by rawinput is documented, but it requires bespoke configurations for every unique type of controller you want to support, which will be hard with some $8 temu special
@violet sentinel @sinful tree i found the problem. I can't test steam session on editor appareantly, are working in build with 2 pc and different steam account
What do I have to check to see ''running'' and overall all animations of each characters in multiplayer? Right now I can only see animations of running on one of clients. The idle animations are working correctly though.
😢
Assuming you are using the default Character class as Parent, your AnimBP would need to grab the Velocity of the CharacterMovementComponent and then take its Size/Length to drive the Running Blendspace
The default ThirdPerson Template should have an example for this fwiw.
Why isn't my fast array serialiser updating newly joining clients? Is that expected behaviour or what details should I add?
UPROPERTY(BlueprintGetter = GetCustomArray, Replicated, VisibleAnywhere, Category = "Custom")
FCustomArray CustomArray;
if(Index != INDEX_NONE)
{
UE_LOG(LogCustomArray, Warning, TEXT("FCustomArray::Append() - Index: %d"), Index);
CustomArray[Index].Index = Index;
MarkItemDirty(CustomArray[Index]);
OwningComponent.Get()->Add(CustomArray[Index]);
}
}
Game stats is for rule related events that need to be tracked and synced. Such as how long the game has been running, players in the game, could be points each team has ext
Game mode is server only and is for the rules of your game. Like how many players are needed to play. Where is everyone spawning. Are there teams? Ext
anybody know how i can replicate a variable in a Uobject that is in my player character?
Yes. Though you will probably want to override and implement your own functionality
What's an effective/efficient way of broadcasting player movement inputs (such as Last Input Vector from the default Movement Component)? I have vehicles I need to animate reactions to inputs before any movement actually occurs. Using the Lyra frontend. Looking to improve the current hacky solution shown.
Hey, is anyone off the top of their head aware whether bShouldAdvertise in online session settings can be changed mid-session in Steam OSS? Or is that a creation time setting? I'm aware of other options that can be updated but I'm not sure for advertising the session altogether, thanks in advance!
Is there a recommended solution for having a single server with players in different levels? (I.E. totally unable to see each other, etc.)
I've been experimenting with having them all load in a world partition level separated by some distance. And trying to work out the mechanics of only having a client load a single level and not the other areas.
In a dedicated server scenario you can likely use level streaming and load the level just for the server and that client, but that wouldn't work too well in a listen server, since the host would need to have all the levels loaded too (as in every single "separate level") so the player/s actually in that level can actually walk on anything, etc (unless you were to use client authoritative movement)
Level streaming seems to be obsolete and has been replaced by world partition. So my solution with world partition should work. Just curious what the standard is.
That I can't directly answer, but with what knowledge I do have, there likely isn't a massively straight forward solution given Unreal is typically server authoritative and the server/hosting player is expected to have geometry loaded if a client is to be able to traverse it
Loaded != visible.
Of course, that's not what I'm confusing here, I realize you could hide that/everything in that level, the point I'm making is it's not "straight forward" to do what you're asking 🙂
The proper solution would be to utilize separate world instances. Unfortunately this also isn't built into the engine for multiplayer, so it would require a massive engine overhaul.
https://www.unrealengine.com/marketplace/en-US/product/multiworld
This asset here, has the feature of being able to have multiple worlds running, and can be used in multiplayer, but the extra worlds are not replicated - so the client can still stay connected, but they're basically running the extra worlds on their own computer (which isn't what you want).
Without knowing much about the older level streaming method, it seems like the way to go would be to load the separate levels some distance apart in the world partitioned world, and use some combo of data layers and masks to prevent users in one level from seeing users in another level.
This raises a lot of technical questions, but first and foremost is - do the clients have access to information about the other loaded levels even though they cannot see it? Etc.
@sinful tree looks like in Multiworld all those worlds run on the server correct? That seems fine.
No. The multiworlds run client side only.
While the Main World is network-replicated as usual by UE5, Secondary Worlds exist only on the local clients and are not network-replicated.
The feature I want is for players to be able to warp between different self-contained areas. Such a thing can be achieved simply through world partition, but the one troublesome spot is that unless you place each area further than the render distance, clients could see one area from another, which I don't want.
Here's a good example I can think of...
Let's say you had a town that had a building that multiple players could "enter" to then access their "home" which they customize to their liking.
If you had multiple players going to the home, you'd need some way of properly instantiating those interiors.
An example is easy. You have different worlds that you can travel between via portals. These worlds are relatively small.
Hmm.. I see. Could do some kind of octree implementation and turn off visibility for all actors outside your viewing range
Yeah, I think the straight forward solution is to do that. Ideally the server would only serve information about the world you're on and not the other worlds to save bandwidth and what have you.
The other solution would be to spin up a new dedicated server for every world generated and handoff the clients between them as you go.
Yep. I think you can also do something with relevancy and the replication graph, but that's going a bit far
First steps to server meshing lol.
Need a master server to handle the data transfer. Or could make the servers talk to each other. That's another networking hurdle to deal with
One server to list servers and their connections and pass off data. Yeah, I mean, nothing there is trivial.
Another option is to just allow client auth movement whilst they're in "their" world instance, of course this only works if you don't ever want other players in those instances too, this way you only have to locally load that level
Nothing wrong with Client authoritative, but this causes a lot of its own problems that are more complicated than the other solutions.
I think the visibility stuff is the quickest. I'd use some kind of bounding box when the player enters, turn on visibility, when he leaves, turn it off
Ez pz
Maybe use a replicated state instead of RPCs to handle late connections and disconnects.
Every solution here is fighting what the engine is designed to do, so the ease is relative to "extremely hard/awkward" 😅
Is there a specific cause that a local player triggering an interaction from a connected client wouldn't give a true value for IsLocallyControlled? Notable features, this is already a mutliplayer project, the character is running around and I'm triggering an event from an interaction, but it only works properly on the server, though the signal is making it all the way to the client too, but this one part is not true on the client.
one solution is their bog standard world partition system, but with limited visibility. This doesn't seem like its working against what the engine is deinsed to do.
I mean, the engine isn't designed not to do what they want to do. It's just choosing the implementation
Nor would spinning a sever up for each world and allowing the player to move between them. That's not built into the engine, but certainly isn't anti-unreal way.
but multiple worlds on a single server, yes.
If it's locally controlled on the server, then it wouldn't be locally controlled on the client.
But If I'm specifically the connected client and perform the interaction then check that I'm locally controlled, that seems to be returning false, which is what's confusing me
The issue then is, is the referenced pawn you're passing to the IsLocallyControlled function actually the one that is being locally controlled by the client?
I mean I think so I'm running it locally with direct player interaction before sending the signal to the server, which is what this snippet is (before sending the signal to the server), maybe it's the interface then, I hadn't implemented it, but it's running off base input 'f' key off the local player and passing itself as a ref as the interactor
So the flow is:
Player Input on Pawn > Call Interact Interface passing reference to "Self" for the pawn to another actor?
My little debug
Correct
Oh my, I reversed the trace, the interact is actually sending the signal to the server if it doesn't have auth, this is the root of my problem I'm assuming
Yes, the pawn wouldn't be locally controlled by the server if it's locally controlled by a client.
I hadn't expected base controls to run their signals to the server, so I hadn't checked the projects set up of the base classes initially. Thanks for your help
Or at least I assume that's what this is doing
Though, this is still supposedly firing locally too, so not sure why it still doesn't trigger
Nothing here fires locally
What your code says:
I've pressed an input for Interaction.
Check if I have authority of this particular actor (clients usually do not if it's a replicated actor spawned by server, and all the rest here is assuming it's a replicated actor spawned by the server)
If I do not have authority, ask the server to continue to execute "Server Interact" --- From this point on it's the server executing the rest of the code.
If I do have authority, call "Interact" --- The server initiated the input so the server would still continue executing the rest of the code.
As you're running on the server, the server will determine whether or not the pawn is being "Locally Controlled". "Locally Controlled" literally means if the player controller controlling a pawn is controlled by this computer running this code. If the pawn is controlled by the host's playercontroller, then the pawn is locally controlled and return true. If the pawn is controlled by a client's playercontroller then the pawn is not locally controlled, and return false.
You can test this on the pawn itself. Put a print string on your input and print out "IsLocallyControlled". Put another print string on your "Server_Interact" event and again, print "IsLocallyControlled".
Then you can press your inputs on either the server or the client, and you should see "True False" for the client but "True True" for the server.
interestingly this is the input I'm seeing it's never true true at the server_interact, or at the input trigger itself.
Again, if this is a client owned pawn, it wouldn't be locally controlled on the server.
If it's the server's (host's) pawn, then it would be locally controlled on the server.
Right now I have it so that the player interacts, triggers the event, and then the server replicates it by a server call, does it make more sense that I just lean into the existing framework that's here and have it so that the server just tells the clients that's what's happening instead? That's what is making sense to me in this case.
Right now you're having the client call to the server to perform the interaction entirely. Nothing is happening client side at all other than their input press.
Yeah, I suppose that is the issue I'm seeing, I think I've got it now, the server interaction is what initially was throwing me off, and I have been wondering how to salvage what I've got set up
I need the clients game instance in playercontroller on begin player but Begin Play is a server ran function right? How do I get the clients game instance from there
Pretty sure begin play runs on server and client
@sinful tree Thanks for your help, I was able to get it working properly now that I understood the server's role in the input system I had.
You don't
dm now got it to work
So I have a user widget with friends list displayed and invite/joins. How should I go about updating this to change when a user logs in/out. Currently I just re-read and populate the list on a set interval, is there a better way to handle this? I couldn't seem to find anything in the friends interface.
Use the PlayerState Begin Play and End play functions. If you ever need to know mid-game who's there, you have the Player Array on the GameState which is an array of current playerstates in the game.
I meant more status of friends on platform (Steam) not ones in game. Currently when I open the friends list it refreshes and then on 15 second intervals, but I was thinking that there was for sure a better way to handle updating the list when friends log in/out of Steam if the Player was to just be sitting on that menu.
just to follow up on this, the failure of the client animation on the listen-server came down to some additional death logic where I was (stupidly) detaching the owning client's controller in lieu of disabling input - that must have been doing something like changing the network role of the autonomous proxy so that the rep notify was going into the ether. You're line of questioning led me to discover that, so thank you and those others that contributed.
Multiplayer is so discouraging. I can't even figure out how to fill the names in the "lobby".
Interfaces can be replicated? I am about to refactor my blueprints to not have so much "Cast to.." nodes but I am in doubt if Interfaces are limited on network replication
Interfaces can't have state, so there is no point in "replicating" them, and also it makes no sense, so no they can't be replicated.
You can do that just fine, but first read Eren's pin in #blueprint
PlayerState has a PlayerName property. This channel had a thousand Q&A on the topic, so the search tool might help you with more practical examples
thanks, many "myths" were cleared 🥲 very interesting reading
Is replication graph different to iris, as in are the mutually exclusive?
My project is reaching a crossroad where I think I need to look into my options before I start building up my replication code and refining it.
I am about to start looking into replication options and if my project even requires something more custom than the default provided systems. I understand that iris is the new kid on the block but I am not sure if it completely replaces the replication graph or not. I also know very minor details of each system.
@hollow gate Quick note about the PrimaryVisualComponent.
It might be worth allowing a USceneComponent and adding an Interface option so people can specify the Component via a getter.
We don't use a single MeshComp on our end for example.
Iris, afaik, replaces ReplicationGraph due to already taking care of such improvements. Not not 100% sure.
@hollow gate There also seem to be a few logs that specify e.g. NetSerialize while you log them in the Simulated version. probably some more things. mostly just skimming through
void UMoverComponent::FinalizeSmoothingFrame(const FMoverSyncState* SyncState, const FMoverAuxStateContext* AuxState)
{
const FMoverDefaultSyncState* MoverState = SyncState->SyncStateCollection.FindDataByType<FMoverDefaultSyncState>();
USkeletalMeshComponent* MeshComponent = GetOwner()->GetComponentByClass<USkeletalMeshComponent>();
if(MoverState && MeshComponent)
{
FTransform ActorTransform = FTransform(MoverState->GetOrientation_WorldSpace(),MoverState->GetLocation_WorldSpace(),FVector::OneVector);
MeshComponent->SetWorldTransform(BaseVisualComponentTransform * ActorTransform);
}
}
Shouldn't this use the PrimaryVisualComponent?
Instead of grabbing a SkeketalMeshComponent?
that is actually epic code the visual component , i don't see why it wouldn't be a scene component. it doesn't really need an interface . can be a setter function on the mover component maybe
Yep, turns out I had to read the docs, who would have thought
Iris does not support replication graph.
Alright well I think I will ditch replication graph and look into iris. Do you have any experience with it, if so how was it?
No experience. Don't know many people that use it yet.
i don't know why it didn't work for me using the primary visual, to make sure it work i just did quick cast. forgot to look at it again. thanks for the reminder
can you elaborte on this please? i didn't understand
void FMoverDataCollection::NetSerializeSimulatedDataArray(FArchive& Ar, TArray<TSharedPtr<FMoverDataStructBase>>& DataArray)
{
/// [...]
UE_LOG(LogMover, Error, TEXT("FMoverDataCollection::NetSerialize: ScriptStruct not derived from FMoverDataStructBase attempted to serialize."));
}
net serialize function are on the "user" side. mover implements them. they are not part of NPP per se.
TEXT("FMoverDataCollection::NetSerialize
ohhhhh. thanks
you can clearly see, it's mostly copy paste 😅
Yeah no worries. I'm just looking through it at the moment, cause my SmoothingComponent solution seems jittery. Not sure why atm.
i tried to keep epic code as it is as much as possible
higher chance PR would get accepted or at least used
Makes sense
hm hey
that's weird.. smoothing in NPP does make it easier to smooth all kind of things in your state.. for example i have mover controlling all montages in game.
they don't even replicate with RPC. mover sets montages time in anmiBP to what it says. and i smooth the time in just like transform in smoothing function
and simulated proxies set the montage time in normal finalize
im using this to spawn floating text for players
For a FirstPerson View, why would even Smooth the Rotation of a FirstPersonBody Mesh?
Shouldn't that just follow ControlRotationYaw?
it works but its fiering twice for the clients serverside & client side
how can i make it only fire on client
if mover is controlling the rotation , which it is. you need to smooth it
and also if i switch to is remote then it wont spawn on host (listen server)
But we aren't smoothing the Camera either
Rotation-wise that is
It just uses the current ControlRotation
and mover would set its rotation, we need to smooth the camera transform too. that is why camera needs to be attached to the mesh
we are only smoothing the camera global rotation , which is parented to some scene component. if that scene component rotation is jittery final camera transform is jittery too. jittery transform + stable camera rotation = jittery camera transform. but jsmoothing the parent transform doesn't make the rotation of the camera jittery. camera rotation is not set by mover
@hollow gate But why would I smooth the ControlRotation? Like, we take the ControlRotation every SimFrame and send it to the Server.
In between the SimFrames, we are now Smoothing from Last ControlRotation to new one. That introduces sluggish feeling for Camera and thus Aim.
We have the actual ControlRotation values of the Player in between the SimTicks, so why not just use them instead of Smoothing them?
And I don't mean corrections.
but we are not smoothing the camera rotation. camera keeps global rotation = to control rotation , parent rotation do not matter
To be more precise, we smooth the SceneComponents that otherwise use ControlRotation
mover sets the scene component rotation. we can't use control rotation yaw by enabling that bool on the pawn with mover
We are using ControlRotation for the Camera though?
And with that for the FirstPersonArms/Body.
for camera yes, mover only touches the scene. camera rotation does not care for its parent. it always follow control rotation
Sure okay, but why would I not do the same with FirstPersonMeshes?
I assume I would?
I can't parent the BODY Mesh to the Camera fwiw
- NetworkSmoothedSceneComp
- CameraComponent
- FirstPersonArms
- FirstPersonBody
- CameraComponent
Guess that's wrong then
but the camera location is based one the parent, so it will be jittery
The thing is, the location smoothing that I can see seems fine
It's the rotation that is not working fwiw
it should be the exact same thing for first or third..
camera is attached to some scene component
that is smoothed
Yes
Location-Only
- NetworkSmoothedSceneComp (Loc + Rot)
- CameraComponent (Loc) (ControlRot)
- FirstPersonArms (Loc) (ControlRot)
- SomeOtherMesh (Loc + Rot)
- CameraComponent (Loc) (ControlRot)
you can try it, just don't use the smoothed rotation. as for the NPP inplementation , you can just not use the rotation in get and apply delta functions of sync state
bit confused here.. camera that has only location smoothed , can't have children that have both rotation and location smoothed. camera children should already be smooth because they follow camera rotation given by what you said
did you try setting camera world rotation after smoothing?
get its rotation pre applying smoothing, then set it back to that post smoothing.
Maybe I'm not clear, so let me rephrase:
I have a NetworkSmoothedSceneComp that the SmoothingComponent (and later NPPs Smoothing) smooths the Location and Rotation of.
I have a CameraComponent attached to that, which uses ControlRotation. That means Location is Smoothed, Rotation is current RenderFrame one.
I have a FirstPersonArms Mesh attached to the Camera, so it follows the same Transform as the Camera.
The Location Smoothing and the ControlRotation feel smooth and are working.
Now I parented some other MeshComponent (a cube for now) to the NetworkSmoothedSceneComp, which doesn't use ControlRotation, so here both Location and Rotation are smoothed.
This Component looks really jittery when I rotate on the spot.
so this other mesh , from your camera perspective looks jittery? can i see a gif or something?
I can't share a gif cause NDA
And yes, it looks jittery
I basically spin in place
I can DM you some log numbers, maybe you can make sense of them
sure i can try
How accurate would you say GetBaseAimRotation is? I am looking at jambaxs better burst combos article and the only thing I am a little worried about is the direction for impact particles or blood splatter effects?
think of a group of AI close together coming toward you, the delay could cause the wrong enemy to be the impact point for the linetrace/bloodsplat as a proxy
Really depends on how much you care about accuracy, you could just pack the impact location and send it as unreliable. It really is a case by case basis and how much your game relies on accuracy of information
can someone explain UPackageMap the comments say it has something to do with mapping objects across game instances/servers.
I ask because I want to know when I need it + when I can use the WithNetSharedSerialization like so
enum
{
WithNetSerializer = true,
WithNetSharedSerialization = true,
};
my understanding is WithNetSharedSerialization needs to be false if you're serializing pointers.. like a pointer to a data asset or spawned actor
might be more to it tho
Hello, this is how im displaying floating damage for each player it works as insteded except on the client side it fires twice one on client & server whats a good fix for that ?
using switch on authority and going remote only ruins the host side so the host dosent se it ?
also Skeletal Mesh Assets dosent replicate :/?
skeletal mesh component doesn't
you can replicate a skeletal mesh asset reference though
I hate replication! so, heres my problem. how do we display the widget/material created by the server to each client?
@lone pumice you would have to pass the information to an actor or component owned by the client. From Game mode you can pass a custom event to the clients pawn which can then open the widget for that player. The Player State as I understand is also valid for passing this kind of information.
you can't. make server send source data to clients and each client would create the thing locally
I'm having issue with this "Get Render Target" node. when I set my Texture Parameter value into something premade, it works fine. but when I use this node. It does not show anything. been driving me nuts for days now. basically whay I'm doing is, I want to take the render target of the widget and display it into a material. on the server it works fine. does it have something to do with the "Get Render Target" node?
if someone has something visual on how blueprint would be used to display ownership, and the use there of for client interaction with in game objects it would be greatly appreciated.
Why is widget main dynamic material a replicated property?
For anyone that has done multiplayer proximity voice chat using the VOIP component in BP, have you ever run into the issue where the server can hear all clients attenuated (proximity voice), but the clients can not?
I am doing the full setup on both client and server, for each player, and only once all players have finished connecting to the server.
I have tried about 10 different setups and ways of initilization and am simply thinking that I must be missing a certain piece of knowledge or a node that the engine has that I am not aware of. Days of searching online has not provided any solutions to this problem.
Does anyone know how to scale buttons based on number of local players? I'm making a splitscreen game and the UI needs smaller buttons if there are 2 or even 3 players (it's vertically split)
Can anybody help me fix this? Im using a blueprint to shift my walls but walls are shifting differently for host and client.
both object itself, scene root and wall mesh is replicated
and this is the code Im using
Getting values in server and promote them to variable and using it in multicast fixed it, I forgot multicast values dont replicate...
Hi all, help please, stuck on a problem, I have a single main menu map where I set whether I am the owner of a room, I pass in the game instance the value of owner, then go to the server and the server always considers my variable whether I am the owner false, pls help guys
Yo guys i need some help, i am trying to get my game into multiplayer and my combat works this way that every animation where there is like a sword attack triggers the hitbox on an montage notify. i use the "play montage" node. now here is the problem. i need to multicast the animation but i need the info of the notify on the server (since the hitbox is playing only on the server). Going from multicast to server makes it probably fire off on the server multiple times wich is really bad. any ideas?
Or such things as "increase a server number when completed" i cant do it cause of the multicast. i have tried to play a animation seperatly on the multicast and play the animation only on the server. but that caused the problem for example that the multicasted animation cancels the server animation wich leads to me not reaching the notifyer
Can't we use level stream in multiplayer?
aur when I open a map after creating a session using server travel, it crashed
Hi, one question, im using Simple Move To Location, the movement looks good in all the clients and server, but looks weird in the self client, why is that? Thanks
The multicast invoked by the server will only play once on the server, so you can get your hitbox data from the server through the AnimNotify. No need to worry about it running on the server more than once.
Unless you're talking about the hitbox triggering on tick, causing something to be called multiple times. That can be solved with flow control, and you don't need to invoke any events more than once per hit.
Ahh okay thanks 🙂
What's an effective/efficient way of broadcasting player movement inputs (such as Last Input Vector from the default Movement Component)? I have vehicles I need to animate reactions to inputs before any movement actually occurs. Using the Lyra frontend. Looking to improve the current hacky solution shown.
What's wrong with this?
Looks fine to me, it can probably be a replicated variable though
with SkipOwner condition
Thanks, that's something. I've been trying to get away from Event Tick.
Something somewhere is going to be ticking to send that vairable to the server as fast as possible
is last input vector sent to server in CMC?
No, which is the frustrating part. This will be alright though.
So why is this vehicle using cmc anyway? What's going on here lol
It's adapted from Lyra and uses the LyraCharacter Pawn. Ends up working pretty well.
Why is it not just using the character movement state like a regular character does? Movement is predicted for characters so there should be no lag
What actual end result are you after?
Actual movement works just fine - the throttle is for animation purposes only, since it's a flying drone whose thrusters move around independent of the actual pawn movement.
Why not just derive acceleration and use that?
Because the thrusters need to be able to move around even if the drone is stationary.
OK so you need to sell "trying to move but literally can't"
bascially the drone version of running into a wall
I could swear there's something about the "want to move" state that is handled by CMC
is there any bp workaround for replicating UObjects?
any posts i've seen are c++ only and very old
i created states for my player character from an abstract UObject base class, and would like to sync this to players joining in progress
There is not. You have to both override the BP can network check, and also either enable your outer to replicate subobjects via a list and make calls to that or do the replicating of subobjects yourself in the override for it.
Maybe use the input event of the character movement, assuming you're using Enhanced Input and you're getting the last input vector based on directional keys.
On Started or Triggered in the input event, you should be able to send the RPC once every time the input vector changes rather than on tick.
Otherwise I don't see anything wrong, but you could consider using a RepNotify with SkipOwner instead of a multicast, if you need to locally predict the throttle. Maybe it works fine as it is?
Did I get this right that I have to actually Multicast running animation for example after issuing command Move To?
Context:
1.I have unit selected, I right click on the ground location. I sent by server Unit Move Command which is AI Move To.
2. The problem is that I can see running animation only on server.
3. Now after long thinking I realized (not sure if right), that I have to actually Multicast the running animation itself after Issuing command? So that would be like here:
and this is from PlayerController
Why does the animBP not just respond to movement like normal?
This is kind of where I'm lacking knowledge. Where to set that and how to do it?
Look at the template projects
most specifically, the blend space used by the 3rd person character
you just feed movement variables in to it, and a blend between idle or movement animations comes out
Do I have to set it so it replicates or something like that?
no
nothing about this should involve networking
the fact that the thing is moving is enough
if it is moving through the world on server and client, that's enough. The animation can be driven by that
and it will be driven by each client itself ?
The server doesn't need to say "It's moving, and also, it's playing a moving animation"
just saying "It's moving" is enough
Got it. Not sure how to implement that 😄
Right now do you have the actual movement synced up?
not the animation, the fact that the thing is moving through the world
I mean I can see them moving on both sides
ok so that's enough
but only server is seeing ALL animations
locally, on each side, your anim BP would look at variables and blend between animations
look at the 3rd person template project
just like Manny anim BP?
Ok I will do some research, just one more thing. This will apply only for the movement animation right? If I want to do like Play Montage, I have to multicast this thing?
the Play Montage would be for example for Attack
hi i also have a question if you are free 😄
basically, im trying to move a cube, and somehow it doesn't send only the z axis to other clients, but for the server it works great
which probably means that when i multicast, it doesn't work and i dont know why
Yes
Or multicast "I'm doing my attack now" or whatever
you'll have to multicast something
or replicate it
Don't use the camera's stuff on the server
so how do i get rotation of the player at a distance?
Also don't use reliable rpcs on tick
ok, sorry im new to multiplayer (today years old)
reliable is for stuff that absolutely HAS to happen, unreliable is for not as important stuff or things that are time sensitive and will be overwritten soon anyway
So what you're trying to do is networked gravity gun or grabbing physics objects right?
yea
pitch is a thing right? This isn't like a top down
its third person
so, if i got this correct, if i use the camera to get what im trying, it takes each client's camera and get the z position from there?
except for the server and the player
When that tick happens, its using the local camera component for that actor (it exists everywhere)
however, ControlRotation, which presumably is what you're using to drive the orientation of that camera, is not fully replicated
print the camera rotation on tick and see the difference between the owning client and everyone else
i did
its fine on x and y
but z is different only for clients
server gets everything corretly, and the playing client as well
actualy i printed camera position, so 1 second
ok so only the pitch is not registering on the client
i played as the first line "client 0"
when i play on server, it doesn't register on all clients
get base aim rotation
take a look at that
that should be a replicated pitch for you
i'll try, btw i also have pitch rotato on the anim blueprint and it's replication is set to none.
can that be the problem?
Anim blueprints don't need to replicate. They should be reading from the actors that would be replicating.
works!
ty 🙂
but 1 more question, i use it only for rotation. i still get world location from follow camera, is it okay?
Probably not.
Does the camera actually move relative to the the character? Or does it just rotate around?
Hmm, so actually I tried 1 more thing and I launched game as 4 players, and all 3 players can see their own and others animations but not the server. Is this normal?
relative to the player
That was exactly the solution I was looking for, thank you! I think this is pretty much perfect now.
Is it 3rd person or 1st person? Show the camera component in the 3d viewport
3rd person
Just have the carry position based on control rotation + some distance from capsule, I wouldn't base it off the camera location
@dark edge Does this match the code you told me to put because it didn't fix the problem, I'm still having the same issue
Why is SelectedCharacter a replicated variable
gameinstance doesn't replicate
must have been carry over from one of my other tries at fixing it one sec
Do you guys think online coop games like hell divers or deep rock galatic, etc use a server authority model? Or do you think that since it is coop game, they use client authority for simplicity?
That sort of thing is highly specific to features themselves.
Its not something you just toggle between globally.
Replication and the Network is ALWAYS Server Authoritative (because only the Server can make remote changes to Clients, other Clients cant make changes to other Clients on their own).
A Client telling the Server, "I moved here, trust me" is Client Authoritative.
A Client telling the Server, "I moved here, verify me" and the Server responding with a correction after doing the verification, is Server Authoritative.
All true. THis question kind of comes from that fact that i recently learned Lyra is client authority when it comes to hit detection and player movement(dash). Made me wonder if professional games went all out on server authroity or if they were more Lyra
Its one of those things where you as the developer make the decision that you can get away with Client Authoritative on a per feature basis.
Hit Detection being Client Authoritative is just simply trusting that when the Client tells the Server that it shot some enemy. The Server blindly accepts it and deals damage to it.
Server Auth of that would be something like the Server verifying that the Client could infact perform that shot, before applying damage.
Yeah i get that, just curious of commerical games follow that pattern
Of course they do, but its a tradeoff.
They might not do it specifically for those features you mentioned.
yeah that makes sense
But its not unusual to trust the Client in certain circumstances.
Its a measure of how far you are willing to trust them and with what.
Mostly it comes down to how it affects the play experience for others.
I think i ahve been kind of stressing that a trace hit HAS to be server authoritiative, because of cheating, etc. But then i saw lyra didnt do it, and i thought, for a coop game, maybe it isnt as important as i thought
Server verification of hits is more about tolerances than 1:1 validity.
Was what the Client reported to the Server, close enough that we can consider it a legitimate hit.
If it deviates to far, it was either a result of to high ping, or outright cheating.
Some simple verification steps are not unusual to get close enough to remove most edge cases with "trusting the client".
Especially in Coop games.
If you were building a competitive esport FPS (which IMO no body should be doing anymore, its far to saturated and difficult, technically and successfully), then you have an entirely different story on your hands.
👍
Performance is also a major consideration if that didnt cross your mind.
Which maybe something that causes you to favor Client Auth
you mean if you ask the server to validate to much?
Yes
yeah that makes sense. Honestly havent thought that far ahead
There is a somewhat popular Scifi FPS game people still play that supports hundreds of Players per server
I forget its name.
But the main reason it can do that is because its movement is entirely Client Auth
interesting...
ah yeah, that game fits
They conciously decided to do that, to be able to handle that number of players.
Mind if i ask what you would do, say if you were building a coop shooter. Would you trust the client on hit detection and player movement?
Thats a difficult question to answer without understanding the entire context of other features of the game.
How many Players?
How much AI?
Does it have tradeables?
Does it have purchaseables?
Lots of questions
That may not exactly have anything directly to do with an individual feature being Client Auth or not
But can have major impacts none the less.
Especially when talking about Hit Detection/Verification and/or Player Movement.
I would say though, that you can be less concerned about it in a Coop game.
Especially from an intentional cheating perspective.
The impact of cheating is less so in a Coop environment.
The incidence of cheating is going to be less as well, since the "competition" isnt so much about being pitted against other Players.
that's what i was thinking as well. Appreciate your opinion though! Sometimes its nice to talk through things, so thanks for your opinion and time on this
No problem.
hello guys! i was hoping you could help me make sense of something.
in the picture i have two sets of code to obtain de direction which the player is moving, the one disconnected at the bottom (which dosent work as i need it) and the one connected at the top, wich all it does is getting the corresponding inputAxis from the default movement blueprint. Dont worry to much about what comes after the booleans, all there is a system which activates one niagara particle or the other depending on the direction
my problem here is that if i use the disconnected system, the particles replicate just fine, but if i use the one that gets the input axis, the particles dont appear on the other client at all.
what could be the problem here?
oh, and before i forget, even if i set the variables to replicate, it dosent work either
Inputs are local only, unless you tell the Server to replicate them (from the Client producing them), they wont have any impact on others.
i see
i was trying to, but the thing is, velocity returns to me the direction in reference to the world, so it dosent work as i wanted
Right, so what do you want?
That is what Velocity tells you.
Inputs are "where I want to move locally".
Velocity is "where I am moving right now".
does it? i mean, when i face one way or the other in the world, the velocity changes, for example, if im facing the Y axis, my movement is 300 in Y, 0 in X and that gives me errors when i try to spawn the particles
was it something about getting the lengt of the vector?
What are you trying to achieve exactly?
welp, guess ill be more specific, i just dont wanted to put more stuff in the question to avoid confusion, but it seems that im doing the opposite D:
you know valorant?
Being specific is better than being vague most of the time.
Ive heard of it, I dont play it.
welp, there is a character that impulses herself with a gust of wind in a direction, and (i do belive, using a widget) particles appear on a direction depending on which way she propeled herself
This video showcases all of Jett's abilities in Valorant.
Full Jett Agent guide:
https://runitback.gg/valorant-agent-guide-how-to-play-as-the-speedster-jett/
if you notice the lines that appear on the screen, they will go backwards if the character goes forward
That would just be decided by the Characters rotation.
how does the rotation gives me the direction in which the lines would move?
Because rotation is a direction?
Reverse the rotation and you have the backwards direction of the Character
so if my character is moving to the left but facing forward, the rotation can give me that data?
Ok in that case you want Velocity then?
sorry if i sound totally lost, but it seems counter intuitive to me even tho it must be logical
Reverse the Velocity and you have the opposite of the direction they are moving?
i see
Its just a Dash ability right?
You must have some value that tells the Character which direction to Dash?
That value becomes what you need to do the visuals.
The reverse of the Dash direction is the direction the visuals need to be facing?
i do! its basically the same system that i tried to use for the particles to work
So whats the problem?
let me try to take a picture of it better
While we're on this, is there anything already replicated in CMC that pertains to input or attempted moves or anything like that?
Like, for if you wanted to sell "Trying to move but can't"
Simulated Proxies are just dummies following the result of what happened.
They dont know anything about much else lol
They certainly dont know what inputs were passed to the server
Its unnecessary information 99% of the time.
sorry, light went off and then i decided to try to fight the bug for myself for a little more until i fixed, which i finally did, this is what i changed to get the "local velocity" of the player
Hello everyone
I just need a bit of help
I have an interaction system for my tiles and tower defense game which is multiplayer and PVP
the way it works is that a widget calls an event in the owning player, since widgets are client based anyway. That player passes info into an server event which is passed into a multicast event which spawns an actor on each client and gives it a component. That part seems to work fine
the issue is when Im trying to destroy it
I want to sell towers so I have been doing it the same way, using the component inside the actor, it pulls the data for how to set the instances for the map back to how it was. That works fine on the multicast but when I try destroying it I can only destroy it on the server. It has the accessed none error which I find interesting because I gave the information to the client telling it to delete a specifc object.
Ive got screenshots
so it doesnt delete the actor I want it to delete
first one is to buy
second one is for selling
Im doing it through an RPC, rather than through the server spawning and deleting it because I want the object data to be on the client, so that the client can interact with it
the widgets can call them all fine and the update instance works fine
its just the destroying of the actor thats a bit annoying
wait a second maybe the reason it returns none is because that reference was never on the client
each client spawns their own actor
nope
not working
target one is the instance, target two is the actor I want to delete
when the player clicks on it it stores the reference to the selected tile
and when I press the sell button it should destroy it
by calling this script
yep
Been trying to sort it out for 2 days now but honestly I dont really know what to do from this point on, because the thing is, if I make it on the server but set it to replicates
wait
actually
got an idea
no nvm
I dont think it will work
because when I make it on the server the interaction system stops working
I want each client to have their own copy of it because I want them to be able to see different versions of it
so when the player interacts, it creates a white outline but only the client who is interacting should be able to see it
which works fine
however if I do the selection on the server and make it and remove it on the server, that actor is not going to be client based
meaning I cant let the client see a different version
if that makes sense I guess
OKAY
SO
I figured half of it out
💀
the other half im still working on
the interaction system I made was made in a way expecting the client to be able to remove the actors themselve
but they dont have the authority to do that right
so the server has to
the clients cant pull some information if the server makes the actor, so I am having to add in certain events into the code to allow for the owning clients to gather information to select and destroy tiles
weird question :
when a client connects after a while (the level is loaded for all previous clients and server), will begin play trigger for the client on the already loaded actors placed in the level ?
Yep
Hello, i am trying to add multiplayer to my game, however the client player seems to be stuffing up when compared to the server player, for example. Instead of scaling to be 10 times bigger, its much more. Another being, when i press the sprint input, it doesn't sprint.
Any help? 👍
You could try AActor::GetUniqueID, Not sure if it's synced between client and server tho
Returns the unique ID of the object...these are reused so it is only unique while the object is alive
yes. BeginPlay is when the actor "begins to play" on the client
many parts of multiplayer are simply not available in BP - that's why c++ tends to be needed for multiplayer for some of the lower level parts when you need extra control
Begin play does also fire server side just to clarify
regarding this, I had to add more stuff to my interaction system and make that multiplayer because the clients cant access the data for the object that is on the server
It fires once on server, and once for each client afaik
Indeed yep
yes, but if a client joins late, the server wont fire begin play on the existing actors, just any new ones. The new client fires begin play on all actors
just to clarify that part
you can use names (if they're stable) or pointers to actors (they're locally unique) as identifiers
you can have a struct that would have a pair of identifiers , then you got two options:
- have a map pair type to float.
- array of structs with 2 identifiers + variables you want to associate with pair. with functions to find element based on input actors
for bp-only i'd say option 2
Ah yes better clarification thank you 😄
thanks for the answers
now i wonder if it costs more to do ServerFunction -> ServerFunction rather than SomeFunction -> ServerFunction or SomeFunction -> SomeFucntion
i would assume it doesnt change much (or anything) to execute a function on server if we are already on server
Did you check? There should be a GetUniqueNetID node, which allows you to associate the ID with a specific Player State.
Hello
Someone know why my multicast only call client and not call server? i dont have a switch has autorithy
Lets say I wanted to wait for all clients to connect before calling start game, how would I know if someone is currently in progress joining?
Basically clients need to send some information and with that I customize some stuff (like item customization stuff client side that needs to be shared), I am having a race condition where code assumes playerstate is valid and the data is sent, but its not. Any tips would be great
@torpid whale It's only calling on one client, not all clients? Then you're probably calling the Multicast from that client, and not the server. The server must call it for all clients + the server to receive it.
im calling from the server
O
So if you print string the multicast event, there's no server?
nop
only client
I put a has authority and connect the authority pin, and it doesn't print anything
maybe you call server from else where?
another event?
yea
i had a problem yesterday that if i called server before MC then it would fail, but if i call only MC it succeeded
because server was called on another event that sent it through interface
There I saw this message in the outlog, I think my actor does not have a valid connection for the rpc, I will be trying to change the order of execution of the events, thank you all
is there a quick way to sync actor physics? (not static mesh)
The way I do this, and I'm not saying it is the best, is that I have my client RPC to the server the stuff. Stuff acknowledges it and then RPCs back. I then just wait for everyone to RPC to the server that they're "ready" before actually starting the game.
sync what about them? THere's been physics replication in the engine for years
well maybe not the physics, but what do i need to do in this situation?
even if i bump in a cube it gets out of sync
Quick question....Im hoping it's simple.
So, I am basically rendering a target using a Camera floating far above the First Person Character. to simulate a Minimap. All is setup fine and I see me on the Minimap as it should be in 1 Player. However, in Multiplayer, the camera focus seems to only work for the first indexed player, all other players see what the 1st Indexed player sees. How can I make these cameras only show what is on the Owning Client?
@dark edge this is the same cube for everyone
Two things. Make sure you disable the render target capture on pawns that are not the local player. Second. Don't use an asset in the content browser. Createa new rendertarget and pass it to what you need. This way each PIE session creates it's own instance. If you don't do the secodn thing, then it'll work normally in standalone and cooked games. But PIE instances use the same asset and so one drawing to it will overwrite the rest.
Thank you, I will look into this for sure!
Could there a reason for that Repnotify runs on every client except owner client?
If i print in repnotify:
1 Client 1 Dedicated Server - Only server prints
2 Client 1 Dedicated Server - 1 client and 1 server print
Is client setting it anywhere else?
Only two reasons a repnotify doesn't run. The value is already the same as what the client has and you did not mark it AlwaysNotify(not sure if BP has this?), or the variable is marked IgnoreOwner on it's conditions.
Well, that or the value didn't replicate to one client because it was considered not relevant.
Yes, it really was skipOwner. Thanks for your help
I couldnt find it for hours 😄
It is not my project, so i was not aware of it
You get used to it. 😄 Just have to go through the checklist.
Hi, anyone know how to replicate a USkeletalMeshComponent with physics over the network in c++??? If someone does dm plzz
Hello how to make this work in multiplayer?
replicate the events
would i use repnotify or do a multicast?
depending on what u r trying to do
Do you have replicate movement turned on for the cube?
repnotify for that
but i wouldn't repnotify the parameter, I'd repnotify the boolean state
so the timeline can run independently on all machines
from what i know, only static meshes have that.
i looked in details of the cube actor and it doesn't have it
i see it in class defaults of the blue print, but its not working
i think it has something to do with forces
because gravity works well, but if i add force to it then it breaks
add force where
is this just a static mesh actor or did you make the class? Make sure replication and replicated movement is on. I think server-authoritative physics is on by default
Hey thanks for the response i set it up but idk if im doing it right. what should i change?
oh wait i got it working i made the toggleTransform event run on server
thanks for the help!! :DD
how do i solve this issue of replicating a mesh between server and client??? here are both. Server and client views and my code
its a regular blueprint. not a static mesh
with a default scene root, a cube static mesh and a collision box
i just noticed that there's a replicate on the static mesh inside the blueprint as well
and its ok now 🙂
but very laggy
laggy or getting corrections all over the place?
like stutters
replicated physics is NOT trivial
especially with interactions with characters
since character movement is predicted
when one character grab another the character grabbed input is disabled and its also attached to other players hand, no movement in character grabbed is performed by its own
@dark edge so if i want to achieve what i have right now, how do i do it otherwise?
I have a camera in the menu and want to move it through a UI button press. Now, I would get it through "get actor of class" but other players can join my lobby as well and then it wouldn't work because everyone would have his own camera and this node would get me the wrong camera maybe which would lead to a different players camera being moved instead. So how do I reference it correctly?
I managed to move it like this but not to the right spot if I cannot set a new view target
so I would like to know if there is a different way to move the owned camera
tune the physics replication settings
the default correction settings are super strict
does it at least agree on all screens?
An Interface call might work maybe and then I move it from a different blueprint other than the widget bp. Can anyone confirm?
Is this a standalone camera actor or a camera on the pawn for the main menu?
a standalone one
just make sure the camera is not replicated than everyone can tell it to move however they want
Every computer has 1 camera on it which can be moved around independently
Okay, thanks!
it does agree
it's sort of stutters because it fixes it self
Yup that's the default physics replication settings being super strict
find them in the project settings and loosen them up
ok ty i'll get to it 🙂
Hello, the player characters are moving laggy. When testing in the editor everything is normal. When I test it with my friends using the Steam subsystem, there is a lag. How can I fix it?
sorry, but i dont understand how to loosen up the physics defaults, and i looked some stuff up and came across ownership. from what i understood, the owner is incharge of updates. i think that the server is the owner although the client is moving the actor. can it be the problem?
How do I mark a replicated property as alwaysnotify? Not finding it on goog, thanks.
I don't know if you can in BP.
Im using c++ intellisense not giving it to me
It's the thing you do when overriding GetLifetimeReplicatedProps...
Example here uses a property named "Health" within the USpaceAttributeSet class.
void USpaceAttributeSet::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
DOREPLIFETIME_CONDITION_NOTIFY(USpaceAttributeSet, Health, COND_OwnerOnly, REPNOTIFY_Always);
}
is there no ENetRole switch?
Thanks so much
How could I add my character to a seat in vehicle without messing up replication?
GAAAAAS 🥳
No one knows? 🤔
Hopefully the motion matching template is replicated out of the box when it gets released, so we can copy the approach 🤞
Repnotigy + multicast is your only option in blueprints lol
Oh your question got answered already kekw
I'm experimenting with a top down turn based game just getting it setup. Where would be there best place to store the grid for movement? I'm assuming the playerstate or gamestate?
Off the top of my head, I would think the "Grid" would be a separate Actor altogether.
Since you would want to align it with the World as you require.
I would put it in the WorldSettings, which can be referenced anywhere.
You can also conveniently link it directly in the World Settings details panel for the level as well.
im not sure what you mean. in the gamemode?
No?
The World Settings is an Actor as well.
Which you can override to add your own properties/functionality to.
Like any other Actor.
Maybe you need to do some research on the World Settings
I was not aware that's an actor
The default World Settings class can be changed in the Project Settings.
interesting
how do I create a new world settings class
i dont see it as an option to create a bp or im misunderstanding
Its probably not Blueprintable. Meaning you would need to create it as a new C++ class.
Im guessing you are BP Only.
yes..
Well then just put it in the GameState or something
you making me want to dive into c++ now lol
agreed. that'd probably require to download source. Idk about that right now
No it doesnt.
The Launcher builds without source are C++ capable.
Maybe you need to learn more about it 🙂
Dive in
I'm diving into top down turn based to help with my cousin to make a game so I don't want to scare him off just yet. lol. But I may want to dive into c++ though.
can I edit the engine with having source version?
can I download symbols to do that?
You can only make modifications to Engine code with a source build.
You dont even know C++, I wouldnt worry about that.
Start small, the engine is an extremely technically complex piece of software.
how is a driver added to a vehicle in a way that doesn't break movement?
currently I fake it but I would like for the character to be shot in the vehicle
What do you mean by "doesnt break movement"?
I believe that it breaks prediction and makes it jittery.
disabling the cmc while they are in the vehicle doesn't help
If the driver is a Character and they are in a seat of a Vehicle, they wouldnt be moving on their own at all, so how does prediction come into that?
im not sure. I just know it breaks the vehicle from moving attaching them to the vehicle
Ok so thats a separate problem.
You have 2 Pawns right. The Character and the Vehicle.
When you are the Character you have possession of it.
yes
When you go to get into the Vehicle. Your Controller possesses that instead.
And you attach the Character to the Vehicle.
Until you exit the Vehicle.
Thats a normal setup for something like this.
yes but it breaks
Nothing jank about it.
It breaks because you are not considering all of the interactions between the Character and Vehicle
You need to disable all collision the Character has with the Vehicle.
Since it would be inside of it.
i do
Well you arent if its breaking
Anything attached to the Character that would follow it would also need its collision disabled for the Vehicle as well.
Trying to call something in the PlayerController on loading into a level/session. Is there something that exists in the PlayerController, I know I could handle it elsewhere but I thought there might be something in here.
hm. I may had a component that was interfering. it snaps the wrong way tho. I have this working by getting the character that interacts and setting a skel mesh component on the vehicle
but I may be able to get this working this way which is way better
@neon summit An alternative is that you leave the Character Actor itself where it is when it enters the Vehicle and you instead attach just the Skeletal Mesh component to the Vehicle.
Obviously you would want to disable all collisions to other Actors so the "invisible" character doesnt interfere.
that is how I was doing it before
When you exit the vehicle you just teleport it
right thats my old setup.
There isnt any "correct" solution.
Its more about, what works best for your use case.
how can I do a repnotify and pass values back to the character
You need to explain what you mean better
Not sure what exactly your referring to there
Ok?
i need to do the attach on multicast or repnotify.
back on the character but I need the player driving position
If you attach the entire Character to the Vehicle you dont need to worry about that
RootComponent attachment is already replicated
well it doesn't show for client
Looking at it now, SceneComponent attachment is also replicated
What you can do, is in the Vehicle, have a property called APawn* Driver or something that is replicated
That is what would be RepNotify
You can then manage all sorts of stuff from that
I found I had to repnotify on vehicle on old method too on possessed event wait.. im dumb lol
this my old rep function on vehicle. but would this allow bp_basecharacters to see also
im confusing myself im tired
wym by property?
A variable
i thought so
Kinda but also not, they have many names.
Variable
Property
Member
To name a few
hm. im not sure how to write the rep function.
after attaching in the rep function it doesnt work for server either
I'm not sure why but the client doesn't want to attach the character
Try to go over the compendium few more times.
What do you mean expensive?
An RPC is as expensive as what you transmit through it
A Multicast is just N number of regular RPCs, N being the number of PLayers
Maybe, but that doesnt tell you anything because an RPC can have different data attached to it.
Not really, you should just aim to reduce the need for to many RPCs
And the amount of data they send
Avoid Reliable RPCs if you can
And favor Unreliable
Etc
Exactly, it shouldn't be a question of how many RPCs can I have but instead, how little can I get away with
What would be the correct way to handle damage regarding the Network Prediction Plugin (NPP)? Currently, I have it 'working,' but it seems like a lot of work for this. My current setup (based on MockSimulation) is as follows: HealthInputCmd (IncomingDamage, IncomingHealing), HealthSyncState (Health), HealthAuxState (MaxHealth). These are wrapped into a HealthComponent that allows me to interact with IncomingHealing and IncomingDamage (the input command), which are later consumed during simulation. Thanks!
I'm not sure I would pipe health through NPP directly.
At least not Input wise
I mean if you use NPP in FixTick
You can just modify the health SyncState from SimTick of e.g. your weapon simulation
ah so its correct / safe to modfy a sync state from other comp as long as is during SimTick method?
I would say so but only when you use FixedTick on the NPP
Cause then it also gets reconciled together
yes, thats the one currently using
I wouldn't send any kind of variables that aren't input or local only related
That is a hell to fix for cheaters
yeah, my main confusion was due the simtick requirement
Your e.g. weapon simulation can predict locally and modify the sync state. And I guess you can use Finalize frame to forward the value to your UI via callbacks or so
I'm not sure if that all works tbh
I ama also new to that stuff
yes, will try modifying sync state and see how evolves
I appreciate your help. I think all we are new regarding NPP 🙂
It could be that modifying SyncState directly could have issues with keeping history, cause only the OutputState is properly doing that
You might be able to ensure the Health Sim ticks last and then instead of modifying the SyncState you simply add pending changes that are applied in the Health's own SimTick
But that's just thinking out loud
Yeah, npp requires a new way to interact
also, not helps all included examples are self contained, I mean, they modify their own state not other state (i.e: others components)
Yeah. Doesn't help NPP wasn't applied to a full fledged game yet
I don't think we will predict health changes on our end
yes, so you suggest regular methods to handle health?
I see, thanks for help! have a GN
The main issue with prediciting health is - what happens at the extreme of like 0 HP. Does the client "predict" the actor is starting to die, and show that montage and remove their target ability? But what happens if that "rolls back" etc - its going to look really bad to a player to think they killed someone/something only to see it pop back to life a few moments later...
Client values are just for the visual anyway, imo. You probably want to let server deal gameplay events like death.
Client can reduce hp right away if it want to, but it shouldn't have any say/authority to decide if the enemy should die.
It dies when the server version dies.
In my experience playing multiplayer game in laggy environment, the HP bar just stays at 0 until the death is confirmed by the server
Hello guys, I made a lobby system with an invite only session, after players join I would like to do a matchmaking search and transfer all of them into the session that gets found. Somehow either only the other player joins or me. Does anyone know why? Thank you in advance
It's 10am. But I shall go back to bed!
I think you'd draw a line somewhere
Predicting health is mostly done for instant hit feedback
And with everything in FixedTick that might also be fine
But I would probably try to predict as little as possible
The only things we have relying on each other atm are Weapon and Movement
So that doing stuff like ADS makes you slower, and moving makes you hip fire worse etc
Hi, I have an event that runs on the server and is reliable. It checks whether an actor has a certain property. This works fine when I use any other component, but it only works sometimes when I use the bp_castle component and causes an error saying that it read none when trying to access property
It triggers when I click on the actor, however sometimes it just reads nothing thats being passed through. I tried different meshes to make sure it wasnt the collision
thats the code for detected whether the player did interact. It normally works with the interactable component, but when I check for castle component it only works sometimes
maybe an issue with the blueprint actor
it spawns it at the start of the game
when the map is being generated
Okay I di some debugging, Sometimes the server just isnt recieving the actor, I set it to reliable, so I dont know if Im missing something at this point, I tried a delay as well
If anyone knows why the actor isnt being passed into the server object valid event I would appreciate any help. It works for other actors but not for the castle, even though it is being detected on the hit
im going to see if I can save it as a variable first and if it doesnt work, then call the event again
Okay I got it working but its a temporary fix. I keep calling the entire thing again if it doesnt select the first time
keeps doing it until something is selected
Morning.
morning how are you
I'm doing alright...day off. How are you Yoru?
thats good. Im doing well, Day off from college here but my final is due in 3 days so Im trying to finish this game hahaha
its a pvp tower defense and offense game made fully in blueprints...
most things work at this point
ive only got the simple stuff left once Ive fixed the bug with selecting the castle
Ooooo n ifty.
Yeahhh I wanted something fun but I added a twist to it
I mean Im probably gonna continue development for it and release it for both PC and Mobile as I set the UI in a way where it works for both, but Im not sure about whether its gonna be good to implement a dedicated server as I probably cant afford that
After this Im gonna develop a survival type game thats low poly and involves rpg mechanics and levelling up
but yeah way too soon to think about that
I say it's never too soon. You can keep it on the stove...but just keep it at a low simmer back burner sort of thing. Be content with the idea you're not cooking yet, just doing prep work.
to be honest youre not wrong, Im aiming to release the current game by the end of this year hopefully, but I do need some sort of devlogs online to gather a small audience.
its gonna give a good experience for the next game
I have made other multiplayer games before but they were college projects part of game jams. I added in steam support and everything, the only issue being network prediction as the pawns were spaceships or tanks and they didnt have the CMC to account for that
I'm green as green can be. trying to work through the setup for multiplayer...It's going rough. I'm playing with Playfab a bit and it's nice. Blueprints work GRAND coding is fine too....but things are weird...I break a plugin...it compiles for the editor. I leave the plugin code unaltered...it doesn't compile for client builds. But will for server....
interesting, thats actually pretty cool but weird 😭
playfab provides dedicated servers right? from what I can remember at least
Yeah yeah...They offer a LOT. I had things working and now they're not.
so, I solved most of the problems in my blueprint, but there's this particular problem:
Love that comment 😭
So what are you trying to do exactly?
the problem is that at the end of these teleport actor, there's a call to the widget, but it access none if search for widget reference
why is that?
sorry for spam
You have to get that specific widget.
OK.
then assign it to a variable
as you can see, on top right is the widget creation and assignment of variable
in the same blueprint
it is replicated at the beginning of the flow
why does it access none?
I mean if you just have one instance of that widget you could try and get it while it's created and then go from there. I ran into this. ALOT with the UI stuff.
And when you placed the setter...you dragged OFF the create node?
Just creating a new variable will not be the same as getting THAT specific widget.
I really cannot understand the error
I'm beginner and need to finish this for a commission( this is not my main work and surely will not redo a multiplayer thing soon)
I'm primarily a professional 3d artist xD
I'm a bartender so. Hey. We're all learning.
so could you explain to me the problem like I was a 5 years old?
If I remember correctly.
It's like this. Imagine if you had 3 of those widgets created but needed just one specific one. How would you get that one? Between three identical widgets.
I would have THOUGHT just creating an object reference variable would be enough.
but it's not
cause the programming logic is a whole dimension
and the F*** button doesn't help us
You physically need to drag off that create node and store what comes off that node as a variable and NOT create a new one and then set it to what you created.
?
I didn't understood
I created the widget and set the variable every time the F button is pressed while hovering the interaction area
what's wrong with that?
and it's made in the character
should be instantiated
in the flow, when I press the F button, it create the widget
then assign as variable
then , down, when receive input from the widget button pressed( there are 6 buttons one for each floor) starts off the teleporting
and then redirect to widget to close it
what's wrong with that?
Well I don't think there is a way to explicitly destroy widgets via blueprints as far as I have figured.
how to close this damn widget?
Ran into the same question.
Well I arrived at an answer for a question I hadn't asked yet but...it was interesting to see. Concerning how I should put this ui together.
Well then this is part of the problem if you are creating that widget.
many many times.
It's akin to having 50 face down cards and asking the engine to give you the ace of spades when they all look the exact same. AS FAR AS I HAVE COME TO LEARN.
--allegedly remove from parant doesn't exactly just unload the widget. Haven't delved deeper into. But I crossed a few conversations talking about it.
I just need a way to close the widget of the player owning it, but cannot find one
going back and forth from character bp and widget bp
with custom event
only to get the accessed none error
from the little bit I saw...you'd have to do it in c++
I can't say for sure I haven't really had a need to delete user widgets directly UI isn't that messy....yet. all placeholder stuff.
In that case...you are in deeper waters than I can safely chat in. I understand Replication 100% but how the engine specifically handles replicated events and variables. Eh...I don't know.
Well how could...it work?
T_T
I'm just cautious. Bad advice is worse than no advice at all.
You need to tell the owning client to remove
@neon summit but this approach is correct to initialize the flow?
Yeah but depends on your setup tho
what do you mean
Where do you store your widgets
ù
even with another replication on the call, doesn't work
the elevator widget is child of main widget
it cannot recognize this variable
at the end of the teleport actor
oh forgot to set the replication event correctly, retry
okay somehow managed to solve it lol
needed anothe replication
r*
yeah my artwork
I'm so proud of myself, being a null in programming xD
it don't work again XD
still accessed none?
now it reverted on back, where it flashly teleport briefly , but not move in any room
no error
bah
why with this setup, it print 2 time "is client"
I have 2 player start, but with the branch I choose which is client and which is server
how can I obtain 2 same print is client?
because the server is also a client
how to prevent that?
using has authority?
but if i print server side
it says 2 times too
do a is locally controlled branch
i'm fixing the line trace of actor component
you could try has authority ig
in which designates lines to interpret ambiance and find collision with bp interaction area
the same, 2 print is server, 2 print is client
remove the is server check
i simply want that every instance of character run the code