#multiplayer
1 messages ยท Page 204 of 1
Hello i have question, i can't figure out where the problem lies, i made a client predicted crouch system, but it bugs out a little (so the anims are unsmooth and jittery) when the character changes states from standing to crouching. It works flawless with zero latency but at 60 ms its jittery. Is it a anim sync problem or from my replication?
Are you using the Character Movement Component?
Yes
It has a built in predicted crouch.
Yes, but im trying to smooth the transition. I also figured out with trial and error that the problem lies in the timeline that is getting corrected by the servers timeline it seems.
Its smooth when i get rid of the timeline and just set it with a one time task instead of lerping between 96 to 32 over .5 secs
Why is this happening? it looks and runs perfectly on server but not clients how do I smooth it out and make it not lag like that
Use the player camera manager for a smooth transition no need for a custom crouch solution use the built in one
{
Super::UpdateViewTarget(OutVT, DeltaTime);
if (const ASurvivalCharacter* SurvivalCharacter = Cast<ASurvivalCharacter>(GetOwningPlayerController()->GetPawn()))
{
const UCharacterMovementComponent* CMC = SurvivalCharacter->GetCharacterMovement();
const FVector TargetCrouchOffset = FVector(0, 0, CMC->GetCrouchedHalfHeight() - SurvivalCharacter->GetClass()->GetDefaultObject<ACharacter>()->GetCapsuleComponent()->GetScaledCapsuleHalfHeight());
FVector Offset = FMath::Lerp(FVector::ZeroVector, TargetCrouchOffset, FMath::Clamp(CrouchBlendTime / CrouchBlendDuration, 0.f, 1.f));
if (CMC->IsCrouching())
{
CrouchBlendTime = FMath::Clamp(CrouchBlendTime + DeltaTime, 0.f, CrouchBlendDuration);
Offset -= TargetCrouchOffset;
}
else
{
CrouchBlendTime = FMath::Clamp(CrouchBlendTime - DeltaTime, 0.f, CrouchBlendDuration);
}
OutVT.POV.Location += Offset;
}
}```
UPROPERTY(EditDefaultsOnly)
float CrouchBlendDuration = 0.2f;
float CrouchBlendTime;``` I assume your talking about the camera moving that's not smoth use this to fix that just make a class derived from player canera manager and add that code and set the new camera manager class in the player controller
got a specific issue that concerns multiplayer as much as #enhanced-input-system
figured instead of double-posting I'll link to my messages and ask you guys here as well
#enhanced-input-system message
#enhanced-input-system message
Edit: Nvm figured it out ๐
Can you provide examples of what you mean?
ControlRotation is sent from the Client to the Server. Since its dictated by the Client (mouse moves, camera moves, rotation moves etc).
This is limited by the ping, the update rate etc etc.
Its also compressed (to limit bandwidth)
All these things might be contributing to the inconsistency you see
As I thought, the server most likely receives location updates every frame, but not control rotation updates. I'm slowly going crazy :P Do you happen to know any options on how I can act in this case? What method can reliably transmit camera rotation?
Location is predicted by the Client (at least in the case of CMC).
But it is not managed in the same way as ControlRotation
Makes sense. However, I'm still at a loss as to how I should get rotations correctly ;(
I'm trying to implement a playable pawn that has an ability where you press E and it shoots a line trace, and if you hit a player, your pawn becomes "enraged" and won't take your input anymore but instead just runs at the player and attacks when close until the player goes down. All of this is implemented, but it's not replicating very well when the client controls the pawn and I think it's just because the way I implemented it was not the correct way to do it, but I'm not sure. Here's the implementation, I used a "Simple Move to Actor" node that I've been using for my AI enemies which I thought is maybe why it's weird, but I wasn't sure how else to move the pawn to the player. Here's also a video comparing how it looks on the listen server vs. the client:
https://blueprintue.com/blueprint/bkah-q6f/
It's worth noting that the blueprint code runs on both the client and the server, as it's contained in a function that gets called like this:
So my question is, how can I fix the implementation to make the client's perspective smoother?
Another thing I noticed is on the client you see the animation for when the walk speed is slower, vs the server who sees the correct faster walk speed
which makes me think the character movement walk speed is desynced, but it should be correct on the client and server
so, no clue
I'd love to get any tips on this if anyone's tried it before. It looks like for my solution, I wouldn't need to load/unload the levels on a per client basis, but simply turn visibility of sublevel geometry and lighting on/off per client. Do clients have the ability to do this, or is sublevel visibility replicated as well?
Does the character's weapon need to be replicated, or is it enough to replicate only the character?
Has there ever been one or more blog posts or similar on differences in Network Prediction?
While most setups follow the same basics, there are already 3 (or more?) different setups in Unreal Engine (CMC, GAS, NPP), which all slightly handle this differently.
E.g. CMC and GAS are very locked systems, which have their own requirements for Prediction.
CMC
- Client sends constant unreliable RPCs to the Server with InputData and an "EndLocation" of the predicted Move.
- Client keeps track of moves locally.
- Server compares EndLocation with its own result and either Acks or Corrects (via RPCs) the Client.
- Sends and uses Data every Render Frame
- Communicates via float Timestamps
GAS
- Client sends single RPCs whenever they want to Activate an Ability.
- Limited Predictions of some of its features (e.g. No GE Stacking or early Removal).
- Has features for "syncing" the Code Flow of an Ability.
- Communicates mostly with Handles and PredictionKeys.
- Not entirely sure at the moment how corrections are handled, but I know it has logic to predict GA Activation, GE Application and GC Adding/Execution.
- And that those "Side-Effects" (which I don't think were ever actively listed) can be confirmed and corrected, probably via simple replication of whatever the Server sends back after its own activation?
NPP
- Client sends constant unreliable RPCs to the Server with InputData. (almost like the CMC)
- Client keeps track of moves locally. (like CMC)
- Server always replicates Data back to Clients.
- Clients use the Data to cause corrections locally. (opposite of how CMC works)
- Has options to send and use Data every Render Frame or in a Fixed Tick Setup. (some parts still happen every Render Frame though)
- Communicates mostly with Timestamps and/or the actual Frame.
Well, I don't just want to spoonfeed you here, cause I think that question could come up with the next best Actor again, so be so nice and answer the following question(s) (:
- What do you think the answer to that question is, and why?
Well, I definitely need, for example, the amount of ammunition remaining in the weapon to be available to other players. But on the other hand, they will not take this information directly from the weapon actor, information about the remaining cartridges will be in the player's inventory, so it is debatable, perhaps not necessary. But non-replicated actors are easier to work with than replicated ones
Now I'm already trying to switch the player's weapon to replication, I'll see what happens
Network Prediction Systems
@rigid steeple In theory there are a few very simple boxes to check when thinking about this:
- Does my Actor need to support Replicating Properties?
- Does my Actor need to support sending RPCs?
- Does my Actor need to support sending Server/Client RPCs (Ownership)?
- Does my Actor need to be replicated down to the Clients, due to being only spawned by the Server?
If you have a System outside of that Actor, which already handles these points, then you don't need the Actor to replicate.
If your Inventory keeps the Properties you'd otherwise replicate through the Weapon, then that's fine.
If some outside System handles sending the "WantsToFireWeapon" etc. calls to the Server from the Client that produced the Input, also fine.
If you don't need to send any Multicasts through the Actor, also fine.
If you already handle spawning the Actor locally on everyone, maybe again via the Inventory, then still fine.
If that's all a given, then you don't need to replicate the Weapon and it would even be harmful to do that, cause your Inventory then needs extra rules to not handle spawning locally.
Yes, I get it. The inventory will definitely be replicated, and information about what is in it will be available to all customers. But not only should the players have weapons, but they will also spawn on the ground at the beginning of the game, so after all, the weapon variables in it will also have to be replicated, and not only through inventory
Thanks for your tips
The Weapons on the Ground that you can pick up might as well not be Weapon Actors to be fair.
They can be simply PickUp Actors with an Item Definition that then gets added to the Inventory.
Well, I thought that it was possible to make 2 copies of weapons: 1 without replication for the character, and the second with replication, just to spawn it, and so that random parameters during spawn match for all players
I have a weapon system like Escape From Tarkov
Spawning a Replicated Actor will spawn it on the Client, so you'd end up with two weapons.
But isn't it possible to spawn only replicated actors? In any case, replication will be needed for spawn
The server will spawn the actor
When I detach component it does not work on multiplayer it works find when clients are looking at server doing it but clients dont detach
Attachment order isnt replicated so you need to handle that yourself and how to make sure all clients represent it.
@compact flame Attachment is replicated. Reread what you said Tommy. "It works when the server does it but not when a client does." That means you did it on the client expecting it to replicate to other clients and the server. Replication only works from the Server. You have to do the detatch on the server for that actor for it to replicate to all.
Are you certain attachment order is replicated? I was under the impression it wasn't for things like components, not attaching entire actors but i guess if the component if marked as replicated perhaps it does replicate its parent. My mistake.
HI Guys, Thast a Door here. BPInterface- which has the reference of the Instigator"Player"... try to just server can go with true--- but client goes true to. Doesnt it work in a BP?
HasAuthority returns true if the code is executed on the Authority Version of the Actor. For Characters that usually on the Server-side.
So if your Interface is behind a ServerRPC; then it will always be true.
@rocky night
What exactly do you want to test there?
Hi exi! Sorry beginner Multiplayer Problems here... So i just want to open a door if its server if client do nothing. The Interface Call is maybe a rpc, shouldnt it be?
so thats the problem,
should it be with an rpc at all? or just started to Boxtrace?
@thin stratus
If not how you would do it?
Upon further examination I found you need to mark the component as replicated in order for it work and I don't mark things like skeletal/static mesh components (which was what I assumed was being used here) as replicated so I had no idea that was a thing, I had always done that manually. Good to know though, thanks for correcting me.
If you only want to have the Server Player open the door, check "IsLocallyController" on the Instigator
Cause that will be false on the Server for a Client Player.
ahh ok cool i try that
yes and no
for example we replicate the Weapon actor and attach to skeletal mesh
doing this on server is enough to attach it to all clients
cause pawn and weapon are replicated
hi just wanted to double check, if i'm on 5.3.2, is this the correct source build to download? it says only 5.3
Also see where it says tags? Click that. Find the tag for the build you want. Check out that tag.
thanks
oh perfect thank you
Someone that worked with dedicated servers and matchmaking? I would like to ask a few questions if you might be up to it. I can ofc pay you for your time, i just want to understand a couple of concepts when designing my own backend.
I asked because i wanted to have as a talking session.
You're far more likely to get an answer if you just type it.
Also not wanting to hire rather have a small consult session.
99.99% of this server never enters the voice chat. Probably can add an extra 9 on to that.
Alright, so here is my question.
I have so far programmed my game for multiplayer and can get it running on dedicated server (gameplay going well, since i focused on learning this kind of stuff first). The problem i am trying to understand is how i am gonna start making the matchmaking multiplayer.
So far i have come up with:
- I will have a client - main server where all players will connect too, the main role of this server is just to act a broker and answer clients. The main goal is that clients asks the server for a match, this server will match players together, check for the list of server hosted and retrieve one available server.
- The way it will do that is by running amazon api and initializing instances. When a server is found the server information will then be sent to all this clients that will be in the same match.
- The clients connects to the server.
A problem i am seeing with this is that i will have one server build, this build should be able to act as a dedicated server for all clients. But i should be able to initialize the server as for example "match mode" and here i am a little lost and not sure it is a good practice.
The second problem i am struggling is, what is the real point of having that dedicated server at all if i can do this with a random node.js application and just send the information of what server to connect?
You hit the nail on the head at the end there. Why would you do this inside unreal?
Haha idk, i am a backend developer dont know much about game industry and best practices ๐
I think i thought it should need a main server for friends, inventory etc... but i guess that not might be needed
There are some server providers who provide matchmaking "in house" as well. You should check out how they work.
Yeah, i have tested with gamelift but the pricing seems unfair so we decided to built ourselfs. Hosting not a problem but when it comes to matchmaking its a real fog
I just mean what type of infrastructure they use. ๐
oh i see
Hi, I am rather new to UE and multiplayer and recently was working on an inventory/equipment system. I wanted to ask for advice/critique of the idea I came up so far:
- Item system is ItemTemplate(DataAsset) + ItemInstance(UObject) with a softptr to template and array of structs representing item state.
- When map is loaded, client inventory component is restored from save game. I am not sending whole inventory to the server via RPC.
- Then equipment comes into play and for each equippable item I have a config as struct, that consists of a ptr to the equipment item instance and an array of upgrades (another type of item) applied to that item instance:
struct EquipmentConfig
{
TObjectPtr<ItemInstance> Item;
TArray<TObjectPtr<ItemInstance>> Upgrades;
}
And my current idea is to serialize it to structs or maybe somehow serialize whole config and RPC it to server so server will create new instances of those items and then replicate them back to the client. They kinda live in parallel to inventory. And after mission just merge updated item state into client inventory.
Does it sound sane? Or I am missing something obvious? ๐
I attach the character to a moving vehicle using the Attach Actor to Actor function, the character disappears when the vehicle speeds up and then reappears after a while. I've tweaked the network settings a bit, but I didn't get any results. Where do you think I might be going wrong?
This is not compiling, any idea? rider told me it's about the tuple
UPROPERTY(Replicated)
TArray<TTuple<FString, bool>> Test;
Compiler error is: Unable to find 'class', 'delegate', 'enum', or 'struct' with name 'TTuple' [UnrealHeaderTool Error]
Because you should use a struct.
oh ok thanks
Ttuple can't be exposed
I think i have a good idea about how i will be doing this. I might create a tutorial if everything works nicely! Have been thinking about this for weeks and finally have a plan.
Nice. ๐
Are the CMC movement data delta-compressed when Iris is enabled? With structures bellow as an example, will I be transmitting only the changed data, or all the data all the time, hitting the bandwidth limit? Is any special intervention required? I'm sending 3 FVector_NetQuantize, but Network Insights isn't showing any additional load, so I just want to make sure I understand everything correctly.
FSavedMove_Character/FCharacterNetworkMoveData/FCharacterNetworkMoveDataContainer
If anyone has any guidance on this, would greatly appreciate it
Hi, I have a problem where the character reference is null on the client, when OnPossess is fired at the first time, the reference is set correctly and all, but when I want to use the character reference later in a function or somewhere, the reference is a nullptr, and it's only on the client, not the listen server, why is that?
OnPossess is only run on the server, so any logic that runs OnPossess needs to be replicated correctly to the client
Ooh just a minute ago I found out about OnPossess running only on the server, though how can I make this logic replicated to the client? I think I have to call an RPC from server to client?
Or set the variable to replicated
Aah you're right, thank you
I hope you find your answer to this
Appreciate it ๐ซก I just need Datura to lend me more of his genius
have a question about Playfab SDK and their multiplayer servers if anyone knows where I should ask that, thanks!
Fwiw it's usually better to use the existing variables
Controller should have a replicated pawn property
Including an OnRep_Pawn iirc
Check the AController class (:
I'm sure you can find the variable and functions related to it
Most likely on the PlayFab forums?
Hi, which way would you guys opt for a Killcam logic on a large map ? If I'm not wrong killcams scenes happens on a duplicated version of the map you're playing on, wouldn't it be too heavy performance-wise to have 2x the same map in memory (I guess I could also just load the chunk needed for the killcam) ? I'm also wondering how CoD does it for Warzone.
Started getting a strange engine crash when a player joins in co-op multiplayer the crash points to SceneCulling.cpp. Host can start the game and play fine. Join is via EOS. Looking for any hints on what could cause the joining client to crash with a SceneCulling Assertion.
UE 5.4 latest update.
when it comes to AI in multiplayer, how do you get the AI to not be so lagged when doing movement based things? i.e. a knockback when a player hits an enemy ?
How are you calling the event for the client players? You should use things like RepNotify and avoid fully replicated variables or use of multicast as much as possible. The more the client can run locally the less laggy it will be.
currently the event is happening on eventanydamage, but i do have a repnotify happening on the health for other thigns, i could try it there
Hey Ive tried many times to fix this using custom events but it all is for not. Its working on server perfecly as allways and it working for the player that has it but no one else
You should call the multicast from the server rpc
But attachment is replicated so just call a server RPC
@compact flame
So just make a custom event that runs on server and do it through there?
Yes
Hey do we need to add a module dependency to use FFastArraySerializer? As soon as I inherit it for my struct my project won't compile and I have some Unresolved external symbols errors
Go to the definition. You want the Build.cs at in the same module.
All good, thanks a lot !
While I'm at it, should I call MarkItemDirty if I'm modifying the array client side (for prediction stuff)? Or it's only needed on the server to trigger the replication?
I assume the replicated state would override the changes I made client side
Does not seem to be working
i would avoid modifying stuff client side
it will cause the updates to not work
if client is modifying stuff, this should be in a temp scope
How would I do that?
wihout knowing what your doing, ๐คท
Hard to explain in a few lines ๐ Nevermind it made me realize that I could do it without modifying the array client side
The reason I was asking is because of the comments in FActiveGameplayContainer::ApplyGameplayEffectSpec :
It got me confused
Still looking for the answer... Thanks!
I was working on an inventory system for mutiplayer, where each player has 4 slots (back, left hip, right hip, and hands). Each slot is a PickableItem (custom BP) reference, and is replicated with RepNotify, and in each OnRep_slot function, I assign the picked up item to the desired slot by using the AttachActorToComponent
So picking up items is done authoritatively from the server, and works perfectly as expected (only 4 player will be in each game, so the small latency between picking up an item and the client actually getting the item doesnt bother me too much), and even lets player pick up item's from each other back's and so, which is pretty cool, and its a feature I want to keep
The issue comes when I want the players to change the item they are holding in their hands in order to use it.
Since I think delayer item switching really impacts the responsiveness of the game, I tried to implement prediction:
- As a player I swap items in my inventory, then notify the server of my action
- The server does the action, and when it is replicated on the client, the client is already in that state, so no changes have to be made
The issue comes when the player swaps items very quickly: Best case scenario, the player see the item in their hands change a second time when the server authority kicks in. I naively fixed this by adding a small cooldown to item switching, which most of the time work.
But with high enough latency, or with unfortunate packet loss, things get really bad, and even if the server is working correctly, the client can end up in messed up states, such as having 2 items in his hands at the same time
My theory is that the OnRep_ function kicks in in the middle of the local replication (the switching consists of the item in your hands going back to your hand, then another item going into your hands), leading to inconsistent states
Is there any reliable way to implement client prediction, and ensure the applied server states are consistent on client?
or is my whole setup backwards and need to rebuild it from the ground up?
In my PlayerController, I have an InputAction that allows the player to click-to-move their selected Character, but this character is NOT possessed by them, it has an AI controller. Like an RTS. Obviously this works on the host, but not the client. If I want to make this work for clients, does my move in the PC need to be a server RPC to a function on the GameMode that actually moves that Character? Can a PlayerController even RPC to the GameMode since the GameMode doesn't even exist on the client?
It just needs to be an RPC to the server in the playercontroller
Does that RPC to go to GameMode or can i put it also in the PC?
Ah I think I see what you're saying.
Nice, i got it to work. Thanks!
Now the only issue is that there's a noticeable lag between clicking and moving but only for the client. Maybe I didn't set it up right?
When does the ItemInHands ref get set for the opening client?
the RotateItemDown are called from MouseWheelDownEvent
i run the same logic locally then run it from the server
No i mean for a client, when in the equip time does that ref change happen?
at what time does MyCurrentHeldWeapon change, the instant the input happens?
IDK what you have in BP but in C++ you can get the pre-replicated value, there you could check if it's the same as current and not do the animation
I think I will have to rework how the inventory works right
when I switch weapons, I move the current weapon in the player's hands to the slot where that weapon is stored, then set the hands slot free, then set the item in the hands with the new weapon, then set the inventory slot for the weapon as empty
which is too complicated for what it should actually be doing
gonna change it so the item slots in the inventory wont change unless an item is picked or dropped, then simply change the item in the player's hands
what does this mean exactly ?`
Warning LogNetPlayerMovement ServerMove: TimeStamp expired: 14.165473, CurrentTimeStamp: 15.198007, Character: BP_NEWTHIRDPERSONCHARACTER_C_0`
i get that warning while testing and i have a significant latency added for when testing but yea not sure exactly what that message means , if anyone knows
Is there a mesh location correction kind of a thing for character mesh? I'm attaching it to another mesh in the world and playing a montage in multicast. For simulated proxies, it sometimes returns back to it's default relative location while still being attached to the other mesh. What might be causing this or how can I debug this?
Why does my UserWidget have the wrong owner? When the first player appears, the UserWidget has the first and only player as owner, but when the second player appears, the owner is the same as the first player, even though it should be the second player. The name of the owner is displayed, both players have the name is the first player. The game is run in As Client mode, i.e. both players are clients. Thus, the second player controls the code for all players
Just trying to make sure I'm not missing an easier way to do this. I want to call "craftItem" on a crafting station actor. However in order to do this, I need to first call a proxy "craftItem" on my playercontroller, passing in a reference to the actor I want to really call "craftItem" on, and then relay the call to it.
I can't directly call "craftItem" on the station actor because my player doesn't own it, and it seems like when you have a bunch of players, calling set owner first and then calling "craftItem" on the station doesn't seem right either and has race conditions, and then we're constantly swapping the owner as players use the station, which feels weird also.
Is there a better way to do this kind of general thing and avoid having to proxy through playercontroller? Or is this kind of the standard way to do it?
This makes no sense, other clients don't have other client's player controllers
And usually the local player controller will be the owner of a widget
Is the player's controller at level 1 only?
Well, is there anything that can be done so that each player controls only their own User Widget, and not others'?
That is the case? But this is weird, you'll never create health bars for other players. Not sure why you do it this way though
Managing a HUD through the HUD class or something similar rather than managing UI directly through the character class is certainly more typical
The local player controller will own the HUD, you would need a secondary property for whatever actor you want to track from within the widget
Though I guess this is from following a tutorial?
This is a standard way to do it AFAIK. We have something we call ServerRPCComponent on the player controller where we stuff all these utility functions.
Thanks!
hi. to anybody who sees this and is good with replication and blueprints i have city sample vehicles - optimized and it has enter and exit animations with destruction but I'm trying to get it replicated so i can use it for this game I'm working on if you are interested in helping dm me ill give you the project and you can keep it and do what ever with it just dm please i need help ๐ .
what's the best way to notify my PlayerController when a value on my PlayerState has changed? I've tried RepNotify and I've tried an event dispatcher, but neither have worked for the client, only the host.
So about the server manager matchmaking thingy we talked about yesterday. Gave it a go today and got a server manager working. I can now initiate instances in ec2, receives matchmaking requests, matche clients with server and send information back to the client to connect ๐
Easier than i thought.... Damn, talk about overthinking. Ofc it was just a POC and i will be adressing security in comming weeks. Will prob use some kind of jwt oauth2 setup together with steam authentication.
Is there a well-accepted pattern for handling the situation "if you're the server, do this operation, but if you're the client, call this server RPC instead, which will do that original operation for you" while minimizing code duplication?
I could in theory have both paths call the server RPC, with (I'm hoping, not sure) the server side automatically figuring out that it is itself the server so it can just execute that call locally, or is that actually an antipattern and I should instead just branch on Has Authority ?
nothin wrong with a server calling a server RPC
or a client rpc with a local PC owner
You might be over thinking it. Branch has authority is normally the way to go
If it's not the server, call server rpc, if it is the server, do stuff
I do like this where if the client calls the function it checks for authority if is client then call server RPC and return early, the server RPC just runs the same function again
That's pretty much how it's done
Interesting, I noticed that my Multicast event doesn't ever make it to the client if not set to Reliable. I wonder if that's somehow indicating that I have completely saturated the network? There really isn't that much happening in the game to make me think so, but I might be wrong.
That's usually a good indicator, you got some RPCs going off on tick or something?
A good rule of thumb is if it's a replicated event and it's only expected to be called once, make it reliable. If it's something that is expected to be called continuously and it won't be a problem if it's skipped once or twice then make it unreliable
anyone here good at on rep notifies? I am having a serious block with a boat and replicating it to client and server.
im in a similar situation, perhaps you want to collab?
Would like to have your typical interaction widget that's 'local' to each player & only shown to them when in radius. Currently I'm using a simple overlap setup with a timeline, anyone have any ideas how I could do this?
Attached an image of the issue I'm encountering where one player is in range and it shows them the widget, but the other player also can see it. ( I don't want this )
Fill free to directly reply to my messages, I don't mind the ping
Could turn the timeline part into a material effect, the overlap event is fine though and saves you ticking
You can "reset" the timer just using a dynamic material param, so basically something like a float that represents time as a param and when you activate you update the time and in the material fade in with a ParameterTime - TimeNodeInMaterials / HowManySecondsItTakes and then one minus and normalize
(its how I did "hit flash" like effects in the enemy material in my game)
Its a lot cheaper than a whole timeline node which is a whole extra ticking component
btw UI also supports animations so a middle ground for convenience would be to use that and just fade in
Sorry I thought you were asking how to improve it. Let me re read.
Oh I appretiate it none the less, but my biggest concern right now is the only local part
You would simply just not trigger if the overlap was a non locally controlled player
Can you give me an example of how I'd get that information? Cause I tried the is local controller thing and it didn't budge
so just check the overlapped actor if you can cast it to a pawn and then from there just check if IsLocallyControlled
Alright that's working, but if you can help me with this
now I've run into another issue where one client works and the other doesn't
I've had this previously
and it's usually always client 2
nevermind
lol
We all have those moments lol

(consider widget animations for a fade in though over a timeline pls for my soul, doesnt even need to be material based, just the widget anim editor)
Thank you for helping me with the other thing, appretiate it
I would but if you keep going in and out of the sphere
the animation has to start at the 0 keyframe
so it would be either 0 or 1 opacity
and jump to that
no, you can resume forwards and backwards lol go into the bp graph for the widget rn and type play animation or whatever

nah a different better node
oh?
oh ye I found it
play animation reverse
plays the animation relative to its current time but in reverse
could also definitely do it with the time param way I described above but its more effort and caching values like the last start time, only works for simple curves like linear, exp, etc. Probably more effort than its worth unless you know you need it for lots of UI.
Anyway, glad you sorted it. Enjoy
Hi, where can I get the local controller of a machine?
APlayerController* FirstLocalPlayerController = GetGameInstance()->GetFirstLocalPlayerController();
Wonder why it's not exposed to bp
GetPlayerController0 is just that tbh
no instance where player controller 0 is not the local controller?
I can see that FirstLocalPlayerController just iterates through all the controller and return the one that is LocallyControlled
"Local" is a relative term
If called on a client, it will give you the first local PC
On a server I would guess it does the same
ListenServer that is
Awesome, thanks
It's always going to be a local player controller on a client, only gets a bit more challenging if you have split screen.
Though I don't understand why that's relied on so much, widgets have player controller owners, so do pawns
I know the client only have their own controller ,its more like I need to be wary of what the listen server grab.
I never see the issue at hand but if I am not mistaken, get player controller with index is frowned because the order isn't guaranteed.
For example if client load faster than server, in the server the controller 0 is no longer the listen server.
Could be wrong on this but it is why I'm trying to avoid get player controller with index
imo there's almost always a better way to get a controller than those static library type ones that just return the first index, can you describe your use case. (btw worst came to worst why couldnt you just iterate the controller array checking for IsLocallyControlled? shouldnt be an issue unles split screen is involved like sswires said)
That's what getfirstplayercontroller does
And what I'm using atm
I just want to get the controller that guaranteed to belong to the listen server
well it will if you check for locally controlled (which is what you said it does, in blender rn so idk) then you are fine, you just need to change it if you have splitscreen local
// Use the consistent local players order if possible
if (World == nullptr || World == GetWorld())
{
for (ULocalPlayer* Player : LocalPlayers)
{
// Returns the first non-null UPlayer::PlayerController without filtering by UWorld.
if (Player && Player->PlayerController)
{
// return first non-null entry
return Player->PlayerController;
}
}
}
else
{
// Only return a local PlayerController from the given World.
for (FConstPlayerControllerIterator Iterator = World->GetPlayerControllerIterator(); Iterator; ++Iterator)
{
APlayerController* PC = Iterator->Get();
if (PC && PC->IsLocalController())
{
return PC;
}
}
}
Actually it does return the first PC ๐ , it only iterates when World is not valid
GetPlayerController(0) will be the listen server host if you actually check the netmode
Also, the order for the PlayerController iterator is not consistent across map transfer so we donโt want to use that index. 99% of the time people pass in index 0 and want the primary local PlayerController, while sometimes in a listen-server environment for example, the client connects fast enough (through seamless travel) that it ends up as index 0 on the listen-server, so you end up with an undesired PlayerController, while expecting the listen-serverโs PlayerController. Instead, using UGameInstance::GetFirstLocalPlayerController() will safely retrieve you the desired primary local PlayerController. Sadly, itโs not exposed to Blueprint, but you can keep reading below for the exposed nodes.
@modest crater @lost inlet
https://wizardcell.com/unreal/multiplayer-tips-and-tricks/ where I read it from
// Only return a local PlayerController from the given World.
for (FConstPlayerControllerIterator Iterator = World->GetPlayerControllerIterator(); Iterator; ++Iterator)
{
APlayerController* PC = Iterator->Get();
if (PC && PC->IsLocalController())
{
return PC;
}
}
I think I will just do the above ๐
Sounds like a bit of a "trust me bro" but yeah that should also have the desired effect
Though I'm still curious about the use case
I actually forgot what I was doing
oh, I got my network clock in a player controller. So for listen server, I want to grab the correct controller.
How would that be to do with implementing a network clock?
nothing to do with implementing, I just want to grab controller -> Get Network time
the implementation is done, just need to access the controller to read the variable
what I end up doing
rounded because it will be used as a seed stream
just trying to do random Idle animations, no issue soo far but hopefully no edge cases that I need to address later
So just reinventing the game state one?
The game state one isn't as accurate as what Alvarez done
he used different approach
basically calculating the difference and averaging them
you can adjust its update frequency
That's a bit of a myth
its done usng a world timer loop callback isnt it
last I checked
I have no idea, just a beginner
you just increase reduce the time between calls
Yeah still a myth really. The update rate by default is way more frequent, the update routine is also virtual so I added a ForceNetUpdate call to it back in the day
Myth or outdated info.. I know at one time awhile ago the network clock was inaccurate but im pretty sure it's good now
yeah probably, not trying to fight any advice here
but I already done copying and it kinda works
I always thought compensating for half RTT was kinda pointless too
You mean with timers or in general?
I use it for animation stuff and it works better than without on high pings
Any of you use Steam? Do you guys manage to get pings for sessions?
the context is Server Browser not in game
Used it for 2 things, lag comp and UI timers
The game state implementation does a rolling average of the clock drift to smooth it iirc
And since the default send rate is way higher now it works pretty well
Also that's all virtual so you can even implement your own smoothing algo if you want
Hi!
If I want to publish a multiplayer game, do I need a public server to allow online multiplayer?
Thanks!
Depends. Where are you publishing it? What kind of servers are you using? Listenserver or Dedicated, or both?
I'm think to develop a multiplayer game, and I haven't started yet. While thinking on the game, I've thought about how online multiplayer works and if it is always needed to have an online server. Thanks.
You're way too early in the thought process to care about that, IMO. But in general the main thing about needing your own hosted dedicated servers is cheat prevention.
If you're making a friendly coop or something then listenservers are just fine usually.
If you're making competitive games, or games where the server needs to dictate progress, you need dedicated servers that you host.
And dedicated servers can also be player hosted, if you're making a game where you want to allow players to upkeep their own communities in persistent world games.
All in all though, I would just focus on making the game. You're at minimum six months from needing to answer that question if you haven't even started yet.
@kindred widget Thanks a lot.
sure
hello, does anybody know why this is happening?
both the server and the client are looking down from their own perspetives, but from the client's, it looks like the server (and any other client) is just looking straight forward. yaw works, but not pitch
Any reason why client need to know what other people is looking at?
im doing some traces from each camera for a building ghost
alternatively i could just replicate the hit position
just wanted to know if there was a quick way to just get the pitch to work
i've made a blocking system which is literally just having a sheild equipped and setting a variable to true (is blocking)... is this.... to simple ? lmao it works but im not sure if there are cooler ways to do this
Only server trace should matter then? Each client would produce different result depending on latency, which one would you pick as the correct data?
sure but that'd make it really laggy on clients
Depending on the objective you can address them accordingly. Not sure what building ghost is tho
Anyway the camera transform is not replicated afaik
One of the axis might looks like it's working but it probably just follow the pawn rotation
i see
You can replicate it but not sure if that's the route you want to take
nah, i'll try doing what you said and considering only server trace
it sounds like the better option anyways
I mean you can always favour the local client, it really depend on context
If you want to place a building for example, you can just check locally your own character trace
That way lag isn't issue
But ofc server check and have the last say
If the building placement isn't valid, roll back
yeah, thats what i was trying to do
minus the roll back cause i have no idea how to do that
Thing is what server sees and what you see isn't neccessrily the same cuz of lag, so you do want client to predict this sort of stuff imo
prediction really isnt easy though
Where should I save a client variable to retrieve for the server to use? Client selects character type in main menu, then when client loads into server want to spawn a character of the same type that was selected in the main menu. PC, PS and GS are not the same in the menu as in the game.
Well the idea is you just do something on client first, while at the same time informing the server that you are doing that action
Imagine attack animation, you don't want to tell the server first and wait for server to replicate the function to play the animation.
If you have 2 seconds delay, you would end up attacking 2 seconds after you hit the action key.
makes sense
but then i need to tell server to not replicate it to the client that fired it in the first place right?
otherwise animation would start twice after a short delay
Yup
alright
For playing montage, I would use GAS, it's already handled there.
For variables you can get away with skip owner for the rep condition
Any presistence data. Either Game instance, game instance sub system or save game object.
If the savegame object is local only but can be retrieved when the client joins the server then that'd be ideal.
Everything is local after all you are selecting in main menu not after you join a session.
So when you join a server
You just send data via server rpc
Your own data from your save game object
Then server spawn w.e you pass
Easily abused with cheating tho but that's not an issue for co op game
I was planning on using a validator before spawning the character to stop cheating. i.e. before spawn; does this client have the specified loadout unlocked?
Don't want them to access characters/style templates they haven't unlocked yet.
Can you elaborate on this validator
If your model is listen server and you don't have a backend service there's nothing you can do imo
You can't really do that successfully without storing all of the data on a server that isn't the client.
Like, you can make it more annoying. You cannot stop it.
Had an idea once to encrypt the save file
Or ties it with steam ID etc
Gave up and just let cheaters cheat
Easiest way to prevent cheating is just to have dedicated server
Plan was to save the unlocks on the Steam server somehow. It's a Steam game only, then right before spawn request from Steam if the ClientID has character unlocked.
Nothing you can do as long as the data you going to pass is stored locally
It can always be manipulated
Easy for some
How can that possibly be eliminated if it's the server spawning the character?
What server tho
The client can request whatever it wants, the dedicated server on AWS needs to validate it before spawning.
Well that's fine, like I said the easiest way is to have dedicated server
Yeah everything is on dedicated server for now, maybe will do local host after release/profitable. Very similar game architecture to Fall Guys.
I was strictly speaking of listen server since I don't know what you are doing
But then the player needs to connect to your backend or dedicated server
When they are selecting character
Then if you must join other server, that server need to retrieve the data stored by the other dedicated server somehow.
Maybe have a data base
Not necessarily, all they would be able to do is unlock everything locally but not use it in game.
I figured/assumed Steam had a db for each game that could store player stats. Achievements get stored on Steam, I'd like to just store the unlocks on Steam as well and skip having a third server with all the unlock data.
There's an inventory in Steam if memory serves. Have never personally used it.
That would be perfect, I'll look into it thanks.
I'm playing around with epic's StateTree for the first time to manage game state. I want it on the server to be the authority, but I want the side effects on the client.
- Replicating the tree seems like the easiest, but StateTree doesn't replicate.
- I could have the tree on both and keep them in sync, which feels a bit gross but maybe that work is small and finite.
- I could RPC transitions, but then I'm recreating much of what the FSM does automatically. Or maybe not.
- Also considering using HFSM2 which is all in C++ because I can probably replicate that easily.
I'd love to hear what others have done for this.
hello again, i'm having issues showing some Widget Components, any idea why this wouldnt work?
everything is firing, but the widgets just arent showing
well, thing is it works if i call the Fade from here
(this is fired on beginplay)
so my UMG is working by itself
wait.
what's this "Wait for player state" thing? Did you write that?
yeah, i did
i figured out the issue lmao
I'd love to see what that does.
should get the widget from the player instead of the local one
oh its actually just really dumb
ah
You could consider putting a delegate on your player state that's called when it's ready and things that want to wait on it, can register for that callback.
yeah, good idea
I did that for the first time on my new hobby project and I'm pretty pleased with it. Seems like by the time PlayerState has been replicated, all the stuff I need for UI should be there.
and callbacks are great
You can use delay till next tick instead waiting for 0.2 second. That's what lyra did
alright
Player name can just be a string variable in the character class that is replicated.
Widget should just read those data. You should never use multicast for anything that needs to be in sync. What ever you are doing will not work for late joiners or players outside relevancy because the function doesn't get called on them.
"as you can notice i got some free time and reading some convos about npp ๐
"
it's less bandwidth this way too, to check for correction you need the entire state , so if client sends the end state to server , server no longer needs to send state to him. so same data goes from out to in. but you don't need server to send ack RPC anymore. so slightly less.
are you hitting bandwidth limits trying to make something with npp?
whats NPP?
i would argue NPP sends only few bits on its own and doesn't have that big of a cost at all because it uses 1 rpc and really smart usage of replicated properties, everything else is user data.
Network Prediction Plugin
is BeginPlay() of an actor only called on the server (and clients) if the actor is spawned, or also on a client if the client joins later after beginplay on spawn has been called?
Tried to do something in PostInitializeComponents but Gamestate is not always replicated yet, so i'm thinking about using BeginPlay
ah nvm i can register on GameStateSetEvent of UWorld incase it's not replicated yet
Beginplay will be called for all clients, even if the player joins later
ah good to know, thanks!
Its also called each time its loaded
So if you unload it (because you are using wolrd partition or level instances) and load it again, it will be called
If you see a potential race condition, please be cautious and be sure all scenarios lead to a successful end
would it be best to have equipping of weapons/armor be visually replicated via repnotifys vs multicasting?
Stop using multicast on a state?
Do other player need to see the armor you are wearing? Yes? Then take out multicast from your dictionary
love it. ty
My armor is just a replicated skeletal mesh variable
On rep notify set skel mesh on the target comp
yea i have most of the replicating actually happening as an int and it chooses sprite animation flipbooks
but making that int repnotify would be the ticket
it's currently just set to replicated
and that translates to the main sprite anim bp
it does work
but
Yea cuz the anim bp would update on tick
If you need to do something when a variable gets replicated use rep notify
yea im assuming the repnotify would be slightly less memory useage as well
Not sure about that I think even replicated variable only replicate when the value changes? I'm not sure
It's just some variable don't need repnotify
Mostly things that you update every frame
Imo anyway
hmm well then maybe i don't need to change the int variable to repnotify? but i do see what you mean, by if it's only replicating when it changes then that would be an issue
It will always be in sync eventually, you don't need to worry about that part
Use repnotify when you need to do X when a variable gets updated
I mean take a look at crouching, replicating transform etc. You don't need any function to call
You can just on tick, set my transform to the replicated variable
I feel like I'm not good at explaining tho but tldr, you use repnotify if you want to do something when a variable gets updated
i get what you're saying for sure. ironcially tho i think the current method does actually suit it. as when armor gets equppped it changes the animation index which is in the anim bp. so it changes the visual of the armor and replicates properly but was consdiering changin that to repnotify
Hello,
I'm trying to get my head around how the Listen-Server net mode works. I get that Player 2 - the Client joining in - would (for example) only have access to one player controller. It's own.
Player 1 - The host - Is both the client and the server. Does this mean that Player 1 has access to both Player Controllers?
Or during play, does Player 1 behave the same like Player 2, but there's another instance of the game happening behind the scenes on the same computer as Player 1?
The host - Is both the client and the server. This is incorrect
The Host is not a Client
It is a Server
Only a Server (with a renderer and input)
Does this mean that Player 1 has access to both Player Controllers?
This is correct
The Host (being the Server) has access to all PlayerControllers.
The Server is the Authority.
"client" in the sense that they see the game world and are playing in it might be what they meant I suppose but yeah client/server in this context is mutually exclusive
I know what they meant by it. I think its important to correct the distinction because of the potential confusion its usage as such might cause.
If new users treated the Host as a Server from the beginning, they would have an easier time understanding the rules around it.
I agree
it's important to not mix stuff up in conversations here for sure
The role vs net mode thing was confusing for a long time
I have to check for NM_DedicatedServer a lot
FApp::CanEverRender is there too I suppose (but more for rendering alone, don't use this for netcode lol)
Yeah, using these types of functions are for advanced users though
A part of me wishes the terminology was slightly different in some places but overall I think unreal is somewhat consistent here
I made a PR years ago exposing NetMode to Blueprint, citing that it would be an easier tool for newer users to understand context. They shot it down saying that Role was enough. It was annoying to see that they exposed it themselves in some other project, Fortnite i think.
They do have IsServer in there at least :/
and maybe Is dedicated server
I think those two just about cover it to me, but it is still a bit lame to hide that
Yeah I saw no sense in not having NetMode exposed
Thanks for the replies!
I guess this confirms some behaviours I was seeing in my own tests and wanted to confirm. If I try to make a game using this net-mode I have to account for the fact that the host is always the server. It's that it can be a little confusing to think of the design of the game like this.
So it's safe to say that Player 1 has direct access to the Game Mode but Player 2 doesn't (directly that is), right?
So it's safe to say that Player 1 has direct access to the Game Mode but Player 2 doesn't (directly that is), right? Its not just safe, its a certainty. Only the Server has access to the GameMode
yes, assuming you mean player 1 is the server
Yep - Cool. Thanks!
Seeing this as Player 1 is the Server with a renderer and input defintiely helps!
Finally (which is the final thing I'm struggling to get my head around with) - this simple scenario I just put together.
The first graph is from the GameMode. When each player starts (in Listen-Server via the editor) it stores the custom player controller to an array. Once both log in (length == 2), the server iterates throught the array and sets a CustomInt variable (which is replicated and defaults to zero). Then sends an event to the Player Controller to print it's CustomInt value.
If the PrintCustomInt event is a default event - Then the server correctly prints:
Server: 2```
However, if I set the event to run on Owning Client, we get:
```Server: 1
Client: 0```
This part confuses me as I thought the change of the Int would be replicated to the client, and if I ran that print, I would expect it to locally be 2 too after being set by the server. The server still sees the second Player controller's custom int as 2, but the Client based event still prints as 0 (the default).
I did think that maybe I should be running this test in another actor that isn't player controller as it may be doing other things under the hood, but I thought I'd check anyway because this part is a little confusing to me and would be keen to understand this behaviour better.
Thanks again for all the help!
Property Replication is dictated by the NetFrequency of the Actor.
RPCs are sent immediately.
The RPC is arriving before the change to the property is being Replicated.
matt are you experienced with steamworks, online subsystem?
How do I know which player controller is notifying the server. Say I send an RPC to a blueprint on the server. How do I print out which player controller called it
Is anyone?
Ask your question anyway.
RPCs are sent through an Actor Channel. Actor Channels are setup for the same Actor. So an RPC being called from a Client to the Server, will execute on the same Actor that called it.
Its just in a different network context.
If you call an RPC in PlayerController_2, then PlayerController_2 on the server will receive the RPC.
RPCs are all oriented around being targetted at one replicated object
the server can RPC to the clients on any replicated object, but client to server (call on client, runs on server) must be from an object that client owns (generally the possessed pawn and player controller)
Ownership in the networking context is a unique thing and is one thing I dislike about unreals nomenclature
yeah Its a pain in the ass
I hate how I have to use math to find out what server controller is notifying the server
Huh?
A server RPC can only be called by the owning player or the server itself.
So the answer is the owning player. Not sure what "math" you're referring to.
There is pretty much no situation in conventional unreal stuff where the client->server rpc isn't in something directly related to a given player
if you need an rpc to be from client->server that is intended to do something about some other player (Player A attacks Player B sent from Player A) you can include an object as a field on the rpc
or even their player index just do the pointer to save yourself the headache
Not the index. That is not kept consistent.
the playerstate index? I need to find it
It is not consistent across instances.
FUniqueNetId I guess
Just send the pointer to the player state...
yeah, that's the simple thing
Please dont @ me for direct questions. Just ask the question and anyone that is able to answer will answer it.
Please read our #rules
Ooh! This explains what was going on!
I just did a test adding another print on tick and did see the variable change after a few ticks.
Thanks for the response, very helpful and I better understand the flow
If I use a RepNotify instead to print the value it works as expected so I can see how RepNotifies would be better to avoid problems with Lag.
However, it does seem like in this case, RepNotifies triggers 3 times. One for P1 in server, one for P2 in server, and then P2 in Client.
Based on your response earlier I guess it makes sense because the Host, being the server, has both Player Controllers so it triggers on both cases. I guess that's where we'd want to filter based on ownership to avoid problems
Depends entirely on what you are trying to achieve as to what you do inside of a RepNotify.
You have some control in Blueprint over who a Replicated Property is replicated to.
Via the RepCondition.
The server is attaching and welding the character to my boat, but on the client the weld is not happening and the character sits above the boat in the correct position and direction, this causes janky physics for the character when i start moving. Any suggestions on what to do? i was reading about disabling collision for the character while its in the boat.
Anytime you want to attach the Character to something else that ends up moving it. You want to consider adjusting the collision profile for the Character.
Typically you will also want to halt any movement modes as well
Nice - Yeah. I was exploring that now.
I think I'm having a good grasp of how the Listen-Server net mode will pan out.
For my game that is good enough (turn based game) so not too worried about latency issues.
However, when going through the documentation and guides online that talk about Game Mode and RPCs to make the server a safe place to avoid cheating... I can't stop but wonder if the Host is more capable of cheating in a Listen-Server mode?
The Host is the Server, they have full authority over the state of the game, you have no ability to stop them from cheating if they absolutely want to.
If you want to seriously limit cheating, use Dedicated Servers.
Otherwise you have limited options to combat it.
Fair enough.
Thanks a lot for your help! Much appreciated!
Disabling collision got me into the boat and disable movement made me able to paddle around, however, it seems now that the players direction is not updating with the server position. So when the boat turns the character remains facing the original direction on entry.
You probably need to update the Control Rotation
This also sounds like the Boat is not a separate Pawn that you are possessing?
I would suggest you consider making the Boat its own Pawn, and basically you unpossess the Character and start possessing the Boat
Then when you exit the Boat you repossess the Character
it is an actor that i jump onto then attach to
hmm I originally considered this, but dont remember why i went this route
Oh, it will be 2 people controlling the same boat
If the Boat is controllable by the Player, it should be a Pawn.
Thats fine, you might need to make the separate inputs their own pawns as well.
For example.
Say I had a Tank.
Only the Driver gets to move the tank.
The Gunner gets to swivel and shoot the turret
The Tank and the Turret can be separate Pawns
Which get possessed respectively by each Player
The Turret can be Attached to the Tank
in the case of a canoe, that both players have the same paddle options forward and back on both sides, then this could also be 2 of the same pawn?
The makeup of both, is the totallity of the Tank
In your case there it might be a little more complicated
my reasoning was, when attached to the boat, their paddle would give force on that boat(actor)
so 1-4 people could control the same boat
In that case you might be better off having it be its own Actor
You could however have each "seat" be a Pawn.
Then you attach 4 seats to the Boat
The Seats would pass desired input into the Boat Actor
do you think this would cause me less replication issues like the character direction?
The direction of the Character doesnt really have much to do with replication.
But utilizing Pawns would help
Since you can adjust how they react to certain inputs
It allows you to encapsulate all of the desired behavior for what the Player can do as that Pawn.
ill have to look into pawns, im fairly new to unreal still and never really used beyond the initial character
You have a lot to learn.
Multiplayer is a rough place to start.
Much better off making something in SP first.
To get the hang of things.
I do have a background as a software engineer, but yes this is a whole new world. Things work much faster and easier in SP, but ive always been a MP fan. I'd rather make a simpler game in MP, than a complex one in SP.
There is no such thing as a simple MP game.
coming to realize that
also i had been doing the large majority of my MP testing as the host, not the joining client. that was a rude awakening.
MP is one of the hardest things you can do in Game Dev.
i had a nice trick going, rep on server calling a multicast. but then i had multiple instances of a paddle and toggle logic doesnt play well on multicast.
Also my characters movement is all motion matching lol
A Toggle is a state
I believe motion matching is just dynamic Anim selection. Doesnt really have anything to do with multiplayer or replication
so if enter boat toggled InBoat boolean, then when i multicast, it would then retoggle it. so server thinks im in the boat, client thinks im not. then one character is standing from chooser table and other is sitting to paddle.
no motion matching is just its own layer of difficulty on top of multiiplayer
Motion Matching in Unreal Engine is a query-based animation pose selection system.
So basically what I said.
yeah yeah, im just saying, that i chose to do a MP game AND use motion matching on my first go round.
so its been a lot
i have to bite the bullet eventually
Try and consider what your choosing to do in multiple contexts before going ahead with it.
"How will this look for someone else"
Going back to your earlier issue, there is a clear line of separation of responsibilities that might help you think more critically about how to approach an issue.
The Character isnt responsible for directing the Boat
The Boat manages itself, taking in direction from the Player.
it updates position on paddle but ends up misaligned by the end of the paddle. Im not sure how that is even happening.
Im talking more conceptually here.
So you might understand the reasons why using a separate Pawn would be useful.
yes im following, so im trying to think how the boats input from the player driving the player direction
im going to see if i can replicate what i have with pawns
If i was doing this, Id have the "seats" in the Boat be Pawns.
The Boat be its own Actor.
The Boat receives an Input for desired direction from all of the Seats
And then calculates out a force from those inputs
Applying that force to itself
So if Seat 1 and 2 are both providing a forward input, since they are on opposing sides, it would result in a forward force.
If 1 of those seats changes its input, it would cause the boat to turn in that direction.
By how much, depends on the input magnitude.
Since this is multiplayer, you will probably need to send the desired inputs to the Server via RPC from the Clients and have the Server apply the force.
You probably cant predict any application of force on the Clients
Since all players are indirectly controlling the same Boat
So you will run into latency issues
Lots to consider...
i had envisioned that a forward paddle on the right side, would move the boat forward to the left. any player can paddle any direction and side, and it would push the boat in that corresponding direction. So a bit simpler than having to calcualte the net force with i think the same result? I dont mind it not being as perfect.
But right now the paddle input is multicasted which i dont exactly think is right. There is a much deeper issue where upon exiting the boat, the paddle forces are seemingly re applied. It's like they are being stored somewhere for a while, then run on boat exit and that one is truly beyond me atm. I have disabled it by not running paddle forces if i am not in boat, but i know there is something brewing.
You dont want the Players applying the forces
You only really want the Players telling the Boat "hey I desire you to apply force in this direction".
i can feel this is wrong
Then the Boat decides if it can apply that force
Thats half right i guess.
You want the Server to know which direction the Player desires the Boat to go in
But then Multicasting that back down is wrong
i tried to cut out the multicast and it wasnt working but i havent tested it at my current state of both client and server paddling working.
ah yes, the paddle only occurs on the server if i dont mutlicast
perhaps i run force on server, then mutlicast the animation
It might not seem obvious, in your mind, you need to separate the idea that whats visually happening has anything to do with cause and effect.
There are a lot more smoke and mirrors in games.
Infact games are built on smoke and mirrors
Just because the Player might be visually paddling with an oar, doesnt mean thats actually resulting in movement.
The rendering of an action has nothing to do with some effect later.
i have noticed this, when my characcetr was not seated properly it wasnt that it wasn't attached to the socket, its the the collision didnt let it be "inside" the boat. it is tough to diagnose these issues.
You need to forget about the visuals.
Inputs drive events
Not visuals
Player says "I want this to happen"
Then some logic later decides to act on that desire by the Player
Visuals are typically reactive.
This happened, so I need to play this animation
Etc etc
i do need to learn some better debugging tools like some console commands rather than jsut seeing what happens on screen.
i had a whole saga with pontoons on the boat
Player 1 Input + Player 2 Input = Boat Movement Direction
Thats all you should focus on
How do you get 2 Players Inputs to result in the Boat applying Force
cant I just have each player apply their own force?
No
why
In Unreal, the Server is the "Authority"
Only 1 simulation rules the state of the game
Thats the Server
sorry, i mean that can't both players send their input to the server. one sayd move Fwd Left, then the other Fwd Right.
Yes but thats not the same thing
Sending their desired inputs is not the same as applying a force
my lingo is bad, but i get what you are saying. the server is the ultimate authority and should dictate the movement of the boat
Correct
The Server can receive hints from Players about what they want it to do for them
But its ultimately the Server that decides the outcome
Otherwise you end up with desync and all sorts of trouble
For example
What do you do in the case where Player 1 desides to go right and Player 2 desides to go left?
If both are applying a force
And there is no central authority to decide how to reconcile that
the way i see it, is player 1 says go fwdright, then player 2 says go fwdleft. the server recieves both of these and goes 2x fwd, then 1 left and 1 right, thus just going straight.
but yes without the server
could be janky
Thats correct if the server is the authority.
But im talking about no central authority
Its all over the place
so with that, its important to understand that Players are only providing their desires
The Server maintains control
That way, everyone ends up with the same result
I am trying to get into the habit of thinking this way. Server to all clients. and back to the SP point, i read going from SP to MP is really tough
trying to refactor a SP into MP*
Yeah you just dont do that.
You start making a SP game or an MP game.
You dont ever make a SP and then convert to MP
Its not worth the trouble, you are better off just starting from scratch
Imagine you made a SP game, with all the lovely systems you ever desired, and then you needed to have the same conversation we just had about every single one of them x 1000
You may as well have just started it as a MP game to begin with.
well thats the "boat" im in right now lol. Why redo everything instead of just doing the MP slowly and figuring it out
I guess it depends on time and your ability to persist through adversity.
Your capability to think abstractly is also a major factor
Some people just dont get it
They can make SP games just fine, but adding an extra player...
A lot changes when you do that
Pretty much everything changes
luckily my job isnt that demanding right now so i have quite a bit of time to work on it. I am actually a technical product manager rather than a SWE these days, so you would think I would be good at cutting out whats unnecessary, but i still find myself overcomplicating my game.
Its a skill being able to NOT overcomplicate things.
So dont feel like you are alone in that.
Unfortunately though, complex problems do require complex solutions.
paddle changing hands was one where i said fk it, no way im diving into custom animations. the paddle can just teleport to another socket for now.
But complexity can also be subjective
As you get better, you will come to think things you faced in the past were not as complex as they initially seemed.
ah yes, my first time trying to get an animation to play lol
Doing those types of things is totally normal throughout development.
You can always come back to that
I'm away from computer so I figured I'd ask here. If you check HasAuthority() on a not replicated pawn (in this case an ASpectatorPawn), will it just always return true?
If a Client spawned an Actor NOT through Replication, then yes, it will have Authority over that Actor.
So in this case do you know how the spectator Pawn is spawned? I assume the ClientGoToState/something in that client RPC does it but I wasn't completely sure
Spectators are spawned client-side
Be aware this code is extremely old at this point so if it doesn't work for you, it's not frowned upon to do something bespoke
hello, i'm trying to make a building system in a multiplayer game. this is for spawning the building ghost/preview
this works fine, and doesnt present delay on client side when trying to start building. however, if somebody started building, and somebody else join late, they won't see the building ghost, or the placed building.
i noticed that by enabling the Replicate flag on the Ghost and Building Actors, Unreal takes care of this and replicates them even to late joiners. The problem with that is, I can't spawn an Actor on Client and Replicate it then right? I can have the client tell the server to Spawn it, but then the client experiences delay...
If i spawn the actor on client and then tell server to do the same, that client will end up with two actors
what's the solution here?
Hi,
How do I replicate a PlayerState attribute only to team members (same TeamId)?
Thx
I'm using C++
Using IsNetRelevantFor?
But then what if I have 2 attributes with different conditions?
You can't have per-property relevancy like that
Have a separate secrets actor that does implement IsNetRelevantFor or use a subobject (eg. a component) using replication groups
ok. seems a little clumsy for what should be a common replication use-case (many games have teams)
yes but I don't make the rules
haha .... thanks @lost inlet
Maybe I can just restrict my COND_CUSTOM to this team case
That's kinda not how that works. custom is just setting if a property is actively replicating at runtime
COND_NetGroup is the new thing
but that's only for subobjects
oh. guess I will try COND_CUSTOM and see
again, that's not how it works
BTW I tried Iris today but it just gave errors
you can't set a property as active per-connection
it's almost like I can't trust chatgpt
well yeah. that's been known for a long time
it's only 10% bum steers actually ... still useful
yeah but so is a search engine
omg no chatgpt is 100 times better 90% of the time and about the same for those tricky no-answer Q
that's when I come here lol
How do you think most teams handle this use case? Just filter on the client side?
https://archive.org/details/GDC2015Fiedler
Someone pins this .. it was a gold resource for me to start understanding how to do networking optimization
Game physics engines are used to create games like Portal, Titanfall, Smash Hit, and Diablo 3. Games would be far less compelling without the realistic physics...
they have a TeamInfoActor ...
which only exists to that team
like we have TeamInfo_Private and TeamInfo_Public
(Private only replicates to people in the same team, public replicates to all everyone)
OK thx ,and that's the correct usage for IsNetRelevantFor? i.e. per actor, not per property
either that or graph
In my case I guess I would need a PlayerStateTeam actor, for player attributes only relevant to team
bump...
Just don't use multicast at all for the moment
it's 99% used for the wrong reason by people who started multiplayer
yeah, im now just doing this
Late joiners and players outside relevancy will not execute the function
which works, but theres a lot of delay on the client
from when the input is fired to when the actor even appears at all on the client
Realistically there's no way around this in BP only. The two easy solutions require C++.
and X ammount of time for the server to replicate the actors to clients
What you can do for the client that spawn the building tho
you can create a proxy Mesh or a temporary object so to speak
when the one from server comes, you can destroy the proxy object
so that will give illusion that you place the building without delay
how do i know when the server one starts existing? theres no onrep for actors (that i know of)
if its not too advanced i can give it a shot
i mean you make a property that is repnotify
when this property replicates back you can replace
will the property and actor replicate at the exact same time?
if not, id get the proxy mesh overlapping with the actual actor or the proxy mesh disappearing before the actor is replicated
The best ways require C++.
You can then either simply always spawn this preview actor with the character that needs it and only bother replacing the meshes in it based on what the player has picked to place. This requires C++ to gather all of the meshes from the default class of the building so that you can emulate it. I did this with my own building system and it works great.
The other way is just to override the spawning name and name it stably for that player. Then the player can name it when they spawn it predictively, and the server can name it the same thing. This allows replication to non owning clients and predictive spawning for the owning client. This requires C++ to override the name when spawning.
IMO I'm partial to the first.
Or the replacing of the other when it comes in from server. Not as elegant though. But no BP only solution ever really is. :/
wait, sorry, i dont exactly understand the second method
what's naming got to do with it?
if i name the actor a specific name and make sure the server names it the same thing, it wont replicate back to the client that spawned it predictively?
No. It will. But when it arrives on the client as a replication, the actor already exists so it simply replicates to it. This is how replication works.
This would be very useful for me, is there methods that I can look at to apply this?
For example. If the Client 2 is building and it spawns Client2BuildingActorDisplayHelper. It tells the server it's doing this and the server spawns the same named actor as Client2BuildingActorDisplayHelper.
There are three players on a dedicate server. Client1, Client2, and Client3.
Client2 has already spawned Client2BuildingActorDisplayHelper locally and sent an RPC to server.
Server receives RPC and spawns Client2BuildingActorDisplayHelper.
Client 1 and 3 will receive this replication and create a new actor. They had no Client2BuildingActorDisplayHelper. So they spawn a new one because there is no Client2BuildingActorDisplayHelper in their world.
Client2 on the other hand has a Client2BuildingActorDisplayHelper. So it simply overwrites the properties it already has that it was told to replicate, and skips the spawning part.
thats insanely useful
are this done simply just by overriding the name?
Look at the name parameter settings on the SpawnActorParameters. There's I think an Enum and an FName. Enum determines how it should try to spawn it if there are name conflicts. FName is the name you want to use.
awesome, nice info
so i can just make a C++ blueprint node that spawns an actor with a specific name and use that??
In theory, yeah. You'd lose all the expose on spawn stuff unless you make a custom node. But those aren't always necessary.
Memory also says there are overrides in AActor related to this, but I don't remember if they're needed for this?
basically no idea what that even means lol
yeah thats fine. i'll try it
Hey
Few days ago weird Widget multiplayer problem came and stays with me.
Only for client window(view) the screen is stretched and fill the monitor weird way, it looks like there is no pawn control.
Nothing extra changed.
This only happens when I create widget and add to viewport in my PlayerController.
Before it was okay, but now something happend (Unreal 5.4)
(I also tried Owning Player add get player controller "0")
Everythign works fine if i use Standalone mode.
Any idea what could happen here?
How to properlyin gamemode get even when all characters possessed? Basically i'm doing rn InitNewPlayer and check amount of player needed and then start the game, but player controller doesn't have possessed character yet and i need them to perform some actions, how to property wait for that event?
finally managed to do this, but i cant find the Enum you were talking about. the only one i can find is related to collision handling
it seems that the actor from the server is replicating back with a "0" at the end of it
and if i try to spawn another one on the client, unreal crashes with this error: Cannot generate unique name for 'PlayerGhostDisplay' in level 'Level /Game/Maps/UEDPIE_1_Testing.Testing:PersistentLevel'.
theres this one but not sure how to set it
update: i got it
why could be the cause of getting a null when trying to access a reference of an object from a created pawn
I expose the variable on creation, on the client I get null on server it works.
I tried using owner, same result
is the variable replicated?
yes
but the weird part is, I only get null once (Im spawning units from a barracks style actor)
does the object referenced exist on both?
odd
should I not use on begin play?
and wait for another event
will try adding a delay
no idea, im new to replication
and see what happens
if it works with a delay youre on some sort of race condition
seems like its still spawning it just with a different name
FActorSpawnParameters SpawnInfo;
SpawnInfo.Name = Name;
SpawnInfo.NameMode = FActorSpawnParameters::ESpawnActorNameMode::Required_ReturnNull;
return WorldContextObject->GetWorld()->SpawnActor<AActor>(ActorClass, Location, Rotation, SpawnInfo);
i also can't respawn the actor once its destroyed since it will either spawn with a different name or it returns null as i set it to do
Very very rarely should you give UObjects a specific name
well yeah but the solution they mentioned included doing that
Not sure what the context is here but giving objects the same name won't magically connect them for replication purposes
thats what they said would work
That won't work
what can i do then?
my issue is i want to be able to spawn the actor on client predictively and also spawn it on the server with the Replicate flag so late joiners and stuff still get the actor
if i just do it, the actor spawns twice on client, once predictively, and then from the server replication
You need to generate the object name client-side and send it to the Server so it can use it for spawning, and make sure both think it's stably named. However you can't replicate it to remote clients if you do that.
However you also need to be careful generating object names client side, since globally within a game instance object names must be unique. If the Server already has an object with that name, things will go bad quickly.
make sure both think it's stably named
how can i do that?
this is what im doing right now, just spawning them both with the exact same name on both client and server
You can't in Blueprint
But in C++ the simplest way is to just set bMapStartupActor to true.
Not sure what you're doing, but surely the ghost actor only matters to the client?
it's for a building system preview
i still want players to see what the other players are doing
so thats why im trying to replicate the ghost
if its too impossible ill just, not replicate the ghost, thats fine too i guess
as long as the actual actor spawning works fine it shouldnt be an issue
Not impossible AFAIK but very difficult, and I don't think you can have an actor that is stably named replicate dynamically
i understand
are there other ways to create actors on client predictively and replicate them from server then?
because otherwise i can still see delay happening when actually placing the buildings
spawn a fake one locally and replace the fake with the "real" one when it replicates would probably be what I would do
Actually, honestly, I wouldn't bother doing either unless the lag is actally a problem
Prediction is messy and you need to make sure you cleanup when it fails
shouldnt be a huge issue, no
the player with lag will just see the building placed later but thats it
wait.
can't i do something with OwnerNoSee?
so that the client still spawns its thing locally and the server spawns it too, but even if its replicated back to the client its invisible
Wouldnt you just spawn the real one with a ghost material and no collision?
Hello,
There was a heavy drop every 5 seconds in our game, we removed UDP and the problem was solved. It has been 1 year since then, and while we still have no problem, some people reported that they had this problem.
We think the problem is still related to UDP because there is no drop when they play with no connection to Steam/net off.
Oddly enough, the UDP plugin is turned off. I wonder if there is a remnant of UDP somewhere? Or is it TCP or something else?
My game is all about physics-based movement in a side-scrolling environment (meshes are 3d though) .. with bullets that knockback players.
I'm wondering which of those options would be appropriate to give me physics determinism for my game:
- Physics substepping
- Tick Physics Async
Question for y'all, when does it make sense to use IsServer instead of HasAuthority?
My impression is that HasAuthority covers more cases where the local process might have authority over the actor, e.g. the actor only exists on the client and therefore the client can do whatever it wants to that actor, regardless of whether that's on the server or not. HasAuthority ends up being less about which side of the network you're on, and more about your permissions to act on the actor, which is probably what you want most of the time?
Yes, HasAuthority is what you want in 90% of cases.
Checking whether you're the server is usually in cases where you want to avoid doing something that'd be purely visual on a dedicated server (which would be a waste of resources, since you don't have visuals on a dedicated server).
Or very rarely for some more complex prediction operations. It's the kind of situation where you'll probably know when HasAuthority isn't good enough if you're working in the space.
I'm sort of stuck in a catch 22 here. I need to execute a loop on the server that gets replicated to the client but I need the proper player controller first because in that loop I need to know which player controller is executing the loop "The number is important"
I would have done compare loops with the player net id but that still doesn't fix the situation at hand because I need to have the player controller ID
ehh I was able to figure it out with get controlled pawn
but still its such a weird way to do it
i'm currently using AsyncPhysicsTickActor and from my understanding, this function requires both the physics thread and the game thread to lock so depending how many actors, this could be an issue. getting your physics registered on the physics thread is something i tried but couldn't wrap my head around, but smarter people than me have done this. i wish they'd write some articles but here we are lol. substepping i haven't actually done yet but from what i understand it's as simple as diving your variable game tick into multiple fixed ticks and keeping an accumulator for the remainder. both options get you closer to determinism
I am trying to make a top-down game and I was wondering what the most optimal way to replicate a character facing the cursor would be.
Currently, I am updating it on the client then sending that rotation to the server for it to update but I'm getting some weird bugs and I think it could be done better. Any help would be appreciated
In order to calculate the direction the character is facing from a 2d mouse position it requires knowing the screen dimensions and the camera location/frustum. Instead, the client could just do all of that calculation and network a single value representing the intended yaw of the character as its input. -
Then you can update your character authoratively given the sent value. (Intended yaw)
Hi, I've been reading a lot about the discussions on replicating a montage, especially because I understand that multicasting should be avoided. Most people recommend using GAS because of the correction and prediction system it has. I'm making a combat system and I have several questions. Do you recommend using gas? I'm currently replaying montages with onrep, but it seems slow to me when it comes to making combos and so on... thank you very much.
You don't want to wait for the on rep to come from the server to play the montage.
You should predict actions like that.
GAS already done that part,
If your game have attributes and abilities, I think using GAS is no brainer
should GAS be used for something like (non competitive, pve) shooter games too? or should i just look at lyra lol
Lyra use GAS
At least for shooting and changing camera mode
interesting, ill have a look at both then
but from what i read online GAS needs to be set up in C++
how hard is that and how much is this setup exactly?
Relative I guess, it hasn't clicked yet for me soo far so can't say it's easy for me.
But you do need to setup the boiler plate in c++
If you are doing shooting mp game, competitive or not you can look at Stephen tutorial.
It covers a great deal of important concept for multiplayer.
Lag compensation, client prediction, server rewinding, etc.
Are you allowed to share a link to the channel here?
Why you ask me ๐คฃ? If not self promotion then you are allowed afaik as long as the content doesn't break the rules
With no other 3rd party plugins, all attributes need to be set up in C++, custom execution classes for effects usually need to be done in C++ for best effect, a lot of useful functions of the ASC and Abilities aren't natively exposed to blueprints and many of the structures used by GAS cannot be read/manipulated in blueprints, again, usually due to a lack of functions being exposed.
Apart from these kinds of things, adding an ASC to an actor and setting up a few attributes in C++ is fairly easy, and getting a few effects and abilities working is too.
No I'm asking you for a link to the channel ๐คฃ Been trying to watch as many solid series with different concepts. Never heard of the one you mentioned, the stuff you said he covers got my interest lol.
Tried looking it up, but just going off the name stephen wasn't really bearing any fruit
@teal frost @snow trail
https://www.udemy.com/course/unreal-engine-5-cpp-multiplayer-shooter/
Thank you
if i have pickup items that have the same trace channel as enemy/player hitboxes, it currently will "block" the attacks if the pick item overlap is in the way of an enemy, is there a way to prioritize the enemy hitbox vs it getting "blocked" by the pickup item's hitbox?
i guess i could do a multisphere overlap but it kind of does strange things when i do that, so would rather just keep the single sphere overlap for attacks, but yea if anyone knows if you can prioritize a hitbox
hey if possible could anyone help me with something. im adding multiplayer to my game but once the multiplayer was implemented i realised that my custom first person character controls and bluerprints didn't affect the second player in the lobby. (1st player gets double jump and sprint) ( second play isn't able to get those abilities and would like to fix that) thank you to anyone who replys :)
I'm assuming you're referring to co-op?
LAN
no, online multiplayer
The simplest way would be to first define who get's to be the character can jump, and who doesn't.
Example: The host is by default always considered the first player, so they get it. If that were the case then you'd just need to first check if the player trying to jump is the server, and if so then jump
so when you say "first player" do you just mean the first player that joins?
oh
soz if i didnt make sense
you want them to do the same thing, but currently they don't
okay I see
what's your jump code looking like
Jump is a function that get's replicated, launch character is not
you need to ask the server to launch the character
through a Server RPC
how do i do that
sec
That will allow you to double jump in a multiplayer settings regardless of server or client
ok do i put this in the first person bluerpint?
yes, if that's where your jump code is
and i replace the old jump code with this
on landed, you should reset current jump back to 0
yeah if you want
The answer is to not have the same trace channel as attacking, and interacting
I can't think of any reason why you'd want to do that
they seem totally unrelated
soz for asking this but how did you get this?
If you go to
- Top left of editor and click Edit
- Project Settings...
- Under Engine click Collision
Here you can create as many collision channels as you like
one for attacking, and one for interacting
nooo!, the server double jump didnt work
did you mark the event as run on server?
I don't think you know the weight of the problem yet just saying
now i've got to manipulate this new found knowledge into fixing the sprinting feature and wall ride feature yay
If it takes 1 second before a player can start moving , for many they will uninstall the game
Yea I did know i could do this and was thinking it could be the solution but isnโt there a limit to how many you can use? I have a decent amount in there already for a building system
Only decent solution for sprinting if you are using character movement component is in c++.
damn
You have to work with their frame work
Any other attempt is just fighting it and ppl just failed unsurprisingly
nah go nuts, I've personally never heard of this being an issue, it'd be really weird if it were
alternate option: just disable corrections in network settings if it's a co-op game
Nice, will def go nuts with this now
just be wary that the more channels you add, the more complex your collision handling becomes. So go nuts but like not literally
yea for sure, just going to add an interactable trace haha
this is what i was mentioning before, but 18 is a lot so would be a bit strange if you needed all 18. tho, i am using quite a lot because of certain logic in my building system but perhaps would be better to switch to tags for that but would be process
Oh nice, I stand corrected. 18 extra channels is alot, maybe that's why the issue has never come up in my years working in UE.
Side note: I bet it is related to what I was saying earlier about it making collision handling more complex for the engine. Too many channels to check against can have an impact on performance
yea that would make sense, and yea def not ideal to have that many custom channels if that's the case. will probably move things to tags, assuming that's much lighter to check against
Just keep in mind it's just as detrimental to over optimize as it is to under optimize
I think UE had a reason for capping it at 18, most likely something like this wouldn't effect your CPU budget unless you're carelessly handling collision, like unecessary overlap checks, moving hundreds of actors all the time, etc
yea true thanks
will trust their limit until i see a major issue with it, but yea nothing too crazy going on , and not using all 18 as of now s
I see, thx a lot !
You know. I never realized I could use get controlled pawn after a "run on server" event to execute data I need from the server to the correct player controller without mathematical voodoo. Why does UE do this
Surely they should have made it easier.
I failed to understand the issue and what maths got to do in grabbing the controller of the pawn.
Well the age old issue. "Which player controller id is who" from other clients perspectives
Where do you learn multiplayer stuff? The pinned material in this channel address that in the first page.
Just use get controller in server machine to get the controller of the pawn
Oh I know these methods it's just my use case was unique
I ran a playerid check on the server and was able to reliably figure out who was who and passed the data as I see fit
Client only know their own controller anyway, asking the controller of a pawn they don't control will just return null
Yeah I meant the id from playerstate
Found a pretty reliable and lightweight way to do a compare on the server for data passing to clients using that unique net id
And the cool part is I run all the math on the server so I kind of took the ability to cheat away from almost all the things I coded. Sure it's still cheatable but I can detect allot of it now. I had just wished it was a small bit easier. Learning this was very vague in the beginning.
How can we ping sessions in Steam?
Guys, do you know what the UDP Messaging settings should be?
UDP was disable, TCP was enable, some PCs were receiving drops every 5 seconds.
We activated UDP, deactivated TCP, the drops decreased but still continue.
Since we do not experience this problem, we cannot test it, we have it tested on another PC on request. So we don't have much chance to do some trial and error. What do you think will happen if we turn off both Plugins? (btw it's a game released on steam)
what do you use UDP messaging for?
It's a CO-OP Listen server game. It is important to use one of the TCP/UDP protocols.
wut? that's not what this is
the game socket will be UDP regardless and has no dependency on these messaging plugins
Yes, that's exactly what I was wondering. Even though we use UDP by default, do we have to activate the plugin
no?
Okay
Warning LogNetPlayerMovement ServerMove: TimeStamp expired: 1.712689, CurrentTimeStamp: 2.863481, Character: BP_NEWTHIRDPERSONCHARACTER_C_0
what does this mean? i get this as a warning in my ide while testing w latency
What could be the reason for the in-game drop, even though TCP and UDP plugins are disabled? No drop when steam is off or internet is off.
We know that UDP triggers this, we had this problem before when UDP was on. Now UDP is off, but the same problem happens on other PCs.
UDP Messaging has NOTHING to do with the game connection
I'm not sure you're hosting games? If it's listen servers, you're really at the mercy of the host's connection quality
Unfortunately, we are at their mercy.
May I gift you the key to the game so you can test it?
Some PCs have no problems at all. I hope you have problems
Just turn it off
Not resolved, unfortunately.
Well having it off is not going to be a detriment unless you're actually using it (again, not game connection related)
And you will have to have some latency/packet loss resiliency hosting from listen servers
@woven bramble if you can't reproduce it using the built in latency emulation in PIE, then you could try it on a package using a tool like 'clumsy' to simulate latency.
Hello.
I work remotely and I need to test our game's ability to handle network disconnection.
What would be the best way to terminate internet connection from the game ?
I have tried Clumsy, and it hampers the connection between my work computer and my PC. So I can't use it without locking myself out of my work computer.
Hello, can someone tell me whats the best way to locally predict this animation that gets triggered from a different blueprint? The problem is the "run on owning client" only works if its triggered by the server obviously, so it doesnt work since its not triggered by the server.
If you're testing standalone server and client on the same machine, just kill the server to test disconnection for client, and vice versa.
Client Prediction means that you're having the client run it first before the client requests the server to both ok and have the server execute it. If the execution up to this point was running on the client already due to an input event, then you shoudln't need to call a "Run on Client" RPC.
This is my execution so far, its only running on the server, i have absolutely no clue on how to rewrite it so the client runs the same
No, its connected to a dedicated server.
If you want the client to predict it first, then you have to let the client input start running whatever you want the client to predictively execute before sending the RPC to the server.
You also don't want to have a bunch of "Run On Server" events in series like this.... Marking events "Run On Server" is like opening a door that allows clients to make requests to the server to execute whatever follows next, and someone with a little knowhow can make their client send those requests at any time regardless of the logic you have built.
Thanj you for your anwser, i guess i should make a empty project and get the first sentence in my head first with a much simpler setup for trial and error
So i made this very very simple example, how should it be set up to be client authoriative with server checks?
client predicted*
Input > Client Does Thing > Client Sends RPC to Server Requesting to Do thing > Server Validates
IF Server doesn't want to allow > RPC Back to executing client to rewind
IF Server wants to allow > Proceed with server execution
My find sessions button cant find any of the 2 sessions I created at a few second different times, until a few tries, then it finds and shows both of them in server list. What can be the problem?
Greetings
Any tip how to deal with character collision during crouch in multiplayer?
To prevent floor-clipping, I'm changing mesh location too, but that looks clunky even with Timeline
Relatively sure the CMC already handles that for you.
Crouching is instant after all
At least in terms of code
I feel like I'm going crazy. My gamemode has a struct that records the playerstates and their possessed pawns to facilitate repossession. The pawns persist, but this struct is empty on the other side of seamless travel.
What am I doing wrong?
This is in the gamemode, so it should persist, according to the official documentation and reading the original GetSeamlessTravelActorList code
If I'm not mistaken the game mode is reloaded when a level is loaded even by seamless. Which means that variable gets reset at the start of every game as well.
That certainly seems to be the case. Weirdly enough, though, the pawns do not
Where is that documented?
The GameMode actor (server only)
Any actors further added via AGameModeBase::GetSeamlessTravelActorList```
An overview of how travelling works in multiplayer.
Not sure. Just what I've noticed through playing around on my project
Thanks. Is there another gotcha like that with Playerstates?
I believe so. The project I'm playing with is using listen servers so idk if this will work for you, I just save the data like that to the game instance of the host. then reload it from their game instance when they connect.
Probably a better way, but maybe a possibility for now at least for you?
No, I think you're right. That was going to be my next approach
Same here, listen servers
I was either going to try storing a reference to the previously owned pawn in the playerstate or recording in a map in the instance
Sounds like you got it working with the latter?
To a degree, I haven't really worked on it much as other things were taking priority at the time I was messing with it.
One thing I didn't mess with much that may be an option would be gamestate, but that may reset on reload as well. not sure.
In the GetSeamlessTravelActorList code, it stores both Gamemode and Gamestate in there, so I'm worried about the same issue
Forgot to ask, where are you setting the struct data?
Here's the declaration:
UPROPERTY(BlueprintReadWrite, Category = "Travel")
TMap<FUniqueNetIdRepl, APawn*> PlayerPawnMap;
// Function to add a mapping
UFUNCTION(BlueprintCallable, Category = "Travel")
void RegisterPlayerPawn(const FUniqueNetIdRepl& PlayerId, APawn* Pawn);
// Function to find a pawn for a given player
UFUNCTION(BlueprintCallable, Category = "Travel")
APawn* GetPawnForPlayer(const FUniqueNetIdRepl& PlayerId) const;```
Calling it during runtime in a blueprint from a player controller UI element, why do you ask?
That may be where your problem lies on the data not loading. For the data to load I believe it needs to be set on the server. Which means you would need to pass the data to an entity capable of speaking to the server to set it there. Ui is incapable of accessing the server.
If I'm understanding your situation right that is... Sorry.
I kind of hand waved it, but yeah I used the blueprint debugger and ensured the data was being set in the server, which is the only place for the gamemode as I understand.
In reality, I have this silly spaghetti
Which is all in the player controller
And calls these custom RPCs in the game state

