#multiplayer

1 messages ยท Page 204 of 1

tranquil beacon
#

Does loading/unloading streamed levels work in multiplayer where players could control which of those levels are loaded for themselves only? Obviously the persistent base level would stay, but I'm curious if clients have control over the streamed levels and how that would impact what other players see

sour dragon
#

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?

sinful tree
sour dragon
#

Yes

sinful tree
#

It has a built in predicted crouch.

sour dragon
#

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

compact flame
#

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

sonic obsidian
sonic obsidian
# sour dragon Its smooth when i get rid of the timeline and just set it with a one time task i...
{
        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
peak wadi
fossil spoke
#

Can you provide examples of what you mean?

fossil spoke
#

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

tidal temple
fossil spoke
#

Location is predicted by the Client (at least in the case of CMC).

#

But it is not managed in the same way as ControlRotation

tidal temple
boreal bison
#

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?

boreal bison
#

which makes me think the character movement walk speed is desynced, but it should be correct on the client and server

#

so, no clue

tranquil beacon
rigid steeple
#

Does the character's weapon need to be replicated, or is it enough to replicate only the character?

thin stratus
#

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.
thin stratus
rigid steeple
# thin stratus Well, I don't just want to spoonfeed you here, cause I think that question could...

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

thin stratus
#

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.

rigid steeple
#

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

thin stratus
#

They can be simply PickUp Actors with an Item Definition that then gets added to the Inventory.

rigid steeple
#

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

thin stratus
rigid steeple
#

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

compact flame
#

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

modest crater
kindred widget
modest crater
rocky night
#

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?

thin stratus
#

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?

rocky night
#

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?

modest crater
thin stratus
#

Cause that will be false on the Server for a Client Player.

rocky night
#

ahh ok cool i try that

meager spade
#

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

velvet current
#

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

latent heart
#

Also see where it says tags? Click that. Find the tag for the build you want. Check out that tag.

velvet current
amber merlin
#

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.

latent heart
amber merlin
#

I asked because i wanted to have as a talking session.

latent heart
#

You're far more likely to get an answer if you just type it.

amber merlin
#

Also not wanting to hire rather have a small consult session.

latent heart
#

99.99% of this server never enters the voice chat. Probably can add an extra 9 on to that.

amber merlin
#

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?

latent heart
#

You hit the nail on the head at the end there. Why would you do this inside unreal?

amber merlin
#

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

latent heart
#

There are some server providers who provide matchmaking "in house" as well. You should check out how they work.

amber merlin
#

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

latent heart
#

I just mean what type of infrastructure they use. ๐Ÿ™‚

amber merlin
#

oh i see

unborn vortex
#

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:

  1. Item system is ItemTemplate(DataAsset) + ItemInstance(UObject) with a softptr to template and array of structs representing item state.
  2. When map is loaded, client inventory component is restored from save game. I am not sending whole inventory to the server via RPC.
  3. 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? ๐Ÿ™‚

slim jay
#

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?

grave lynx
#

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]

kindred widget
grave lynx
meager spade
#

Ttuple can't be exposed

amber merlin
latent heart
#

Nice. ๐Ÿ™‚

tidal temple
#

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

boreal bison
blazing bear
#

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?

boreal bison
blazing bear
boreal bison
blazing bear
#

Aah you're right, thank you

blazing bear
boreal bison
visual cedar
#

have a question about Playfab SDK and their multiplayer servers if anyone knows where I should ask that, thanks!

thin stratus
#

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

thin stratus
twin juniper
#

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.

fair crypt
#

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.

crisp shard
#

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 ?

fair crypt
#

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.

crisp shard
compact flame
sonic obsidian
#

You should call the multicast from the server rpc

#

But attachment is replicated so just call a server RPC

#

@compact flame

compact flame
#

So just make a custom event that runs on server and do it through there?

leaden bone
#

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

kindred widget
leaden bone
#

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

compact flame
meager spade
#

it will cause the updates to not work

#

if client is modifying stuff, this should be in a temp scope

leaden bone
meager spade
#

wihout knowing what your doing, ๐Ÿคท

leaden bone
#

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

tidal temple
hallow dagger
#

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?

clear copper
#

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?

bitter robin
#

It just needs to be an RPC to the server in the playercontroller

clear copper
#

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?

dark edge
hallow dagger
#

i run the same logic locally then run it from the server

dark edge
#

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

hallow dagger
#

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

crisp shard
#

what does this mean exactly ?`

Warning LogNetPlayerMovement ServerMove: TimeStamp expired: 14.165473, CurrentTimeStamp: 15.198007, Character: BP_NEWTHIRDPERSONCHARACTER_C_0`

crisp shard
#

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

upbeat basin
#

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?

rigid steeple
#

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

limber turret
#

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?

lost inlet
#

And usually the local player controller will be the owner of a widget

rigid steeple
#

Is the player's controller at level 1 only?

lost inlet
#

What

#

Player controllers only exist on the server and owning client

rigid steeple
#

Well, is there anything that can be done so that each player controls only their own User Widget, and not others'?

lost inlet
#

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?

silent valley
abstract stream
#

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 ๐Ÿ˜ .

clear copper
#

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.

amber merlin
# latent heart Nice. ๐Ÿ™‚

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.

vapid gazelle
#

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 ?

tardy fossil
#

nothin wrong with a server calling a server RPC

#

or a client rpc with a local PC owner

short arrow
#

If it's not the server, call server rpc, if it is the server, do stuff

proven pagoda
short arrow
#

That's pretty much how it's done

vapid gazelle
#

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.

short arrow
#

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

tropic beacon
#

anyone here good at on rep notifies? I am having a serious block with a boat and replicating it to client and server.

tropic beacon
slow meteor
#

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

modest crater
#

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

slow meteor
#

How would any of that make the widget local?

#

lmao

modest crater
#

Sorry I thought you were asking how to improve it. Let me re read.

slow meteor
#

Oh I appretiate it none the less, but my biggest concern right now is the only local part

modest crater
#

You would simply just not trigger if the overlap was a non locally controlled player

slow meteor
#

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

modest crater
#

so just check the overlapped actor if you can cast it to a pawn and then from there just check if IsLocallyControlled

slow meteor
#

oh locally controled

#

ok ok I'll try

slow meteor
#

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

modest crater
#

lol

slow meteor
#

I'm stupid

#

he just wasn't in the collision sphere

#

HAH

#

man

modest crater
#

We all have those moments lol

slow meteor
modest crater
#

(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)

slow meteor
slow meteor
#

the animation has to start at the 0 keyframe

#

so it would be either 0 or 1 opacity

#

and jump to that

modest crater
#

no, you can resume forwards and backwards lol go into the bp graph for the widget rn and type play animation or whatever

slow meteor
modest crater
#

I do it for UI hovering effects, it fades over time

#

forwards and backwards

slow meteor
#

alright thank you, again

modest crater
#

nah a different better node

slow meteor
#

oh?

#

oh ye I found it

#

play animation reverse

#

plays the animation relative to its current time but in reverse

modest crater
#

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

dark parcel
#

Hi, where can I get the local controller of a machine?

nova wasp
dark parcel
#

Wonder why it's not exposed to bp

thin stratus
dark parcel
#

I can see that FirstLocalPlayerController just iterates through all the controller and return the one that is LocallyControlled

thin stratus
#

"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

dark parcel
#

Awesome, thanks

lost inlet
dark parcel
# lost inlet It's always going to be *a* local player controller on a client, only gets a bit...

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

modest crater
dark parcel
#

And what I'm using atm

#

I just want to get the controller that guaranteed to belong to the listen server

modest crater
#

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

dark parcel
#
// 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

lost inlet
#

GetPlayerController(0) will be the listen server host if you actually check the netmode

dark parcel
#
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

#
// 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 ๐Ÿ˜„

lost inlet
#

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

dark parcel
#

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.

lost inlet
#

How would that be to do with implementing a network clock?

dark parcel
#

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

lost inlet
#

So just reinventing the game state one?

dark parcel
#

The game state one isn't as accurate as what Alvarez done

#

he used different approach

#

basically calculating the difference and averaging them

modest crater
lost inlet
#

That's a bit of a myth

dark parcel
#

but he done the test

#

and the margin is way smaller with his method

modest crater
#

last I checked

dark parcel
#

I have no idea, just a beginner

modest crater
#

you just increase reduce the time between calls

lost inlet
#

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

dark parcel
tardy fossil
#

Myth or outdated info.. I know at one time awhile ago the network clock was inaccurate but im pretty sure it's good now

dark parcel
#

yeah probably, not trying to fight any advice here

#

but I already done copying and it kinda works

lost inlet
#

I always thought compensating for half RTT was kinda pointless too

modest crater
#

You mean with timers or in general?

#

I use it for animation stuff and it works better than without on high pings

dark parcel
#

Any of you use Steam? Do you guys manage to get pings for sessions?

#

the context is Server Browser not in game

lost inlet
#

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

timid moat
#

Hi!

#

If I want to publish a multiplayer game, do I need a public server to allow online multiplayer?

#

Thanks!

kindred widget
timid moat
kindred widget
#

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.

timid moat
#

@kindred widget Thanks a lot.

snow trail
#

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

dark parcel
#

Any reason why client need to know what other people is looking at?

snow trail
#

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

crisp shard
#

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

dark parcel
#

Only server trace should matter then? Each client would produce different result depending on latency, which one would you pick as the correct data?

snow trail
dark parcel
#

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

snow trail
#

i see

dark parcel
#

You can replicate it but not sure if that's the route you want to take

snow trail
#

nah, i'll try doing what you said and considering only server trace

#

it sounds like the better option anyways

dark parcel
#

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

snow trail
#

yeah, thats what i was trying to do
minus the roll back cause i have no idea how to do that

dark parcel
#

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

snow trail
#

prediction really isnt easy though

quaint tendon
#

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.

dark parcel
#

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.

snow trail
#

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

dark parcel
#

Yup

snow trail
#

alright

dark parcel
#

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

dark parcel
quaint tendon
#

If the savegame object is local only but can be retrieved when the client joins the server then that'd be ideal.

dark parcel
#

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

quaint tendon
#

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.

dark parcel
#

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

kindred widget
#

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.

dark parcel
#

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

quaint tendon
#

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.

dark parcel
#

Nothing you can do as long as the data you going to pass is stored locally

#

It can always be manipulated

#

Easy for some

quaint tendon
#

How can that possibly be eliminated if it's the server spawning the character?

dark parcel
#

What server tho

quaint tendon
#

The client can request whatever it wants, the dedicated server on AWS needs to validate it before spawning.

dark parcel
#

Well that's fine, like I said the easiest way is to have dedicated server

quaint tendon
#

Yeah everything is on dedicated server for now, maybe will do local host after release/profitable. Very similar game architecture to Fall Guys.

dark parcel
#

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

quaint tendon
#

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.

kindred widget
#

There's an inventory in Steam if memory serves. Have never personally used it.

quaint tendon
#

That would be perfect, I'll look into it thanks.

sterile plaza
#

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.

snow trail
#

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

sterile plaza
#

doesn't look overly multiplayer related

snow trail
#

wait.

sterile plaza
#

what's this "Wait for player state" thing? Did you write that?

snow trail
#

i figured out the issue lmao

sterile plaza
#

I'd love to see what that does.

snow trail
#

should get the widget from the player instead of the local one

sterile plaza
#

ah, nice!

#

glad I could help :D

snow trail
sterile plaza
#

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.

snow trail
#

yeah, good idea

sterile plaza
#

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

dark parcel
snow trail
#

alright

dark parcel
#

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.

hollow gate
#

"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?

snow trail
#

whats NPP?

hollow gate
#

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.

hollow gate
spiral crystal
#

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

lament flax
spiral crystal
#

ah good to know, thanks!

lament flax
#

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

lament flax
crisp shard
#

would it be best to have equipping of weapons/armor be visually replicated via repnotifys vs multicasting?

dark parcel
#

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

dark parcel
#

My armor is just a replicated skeletal mesh variable

#

On rep notify set skel mesh on the target comp

crisp shard
#

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

dark parcel
#

Yea cuz the anim bp would update on tick

#

If you need to do something when a variable gets replicated use rep notify

crisp shard
#

yea im assuming the repnotify would be slightly less memory useage as well

dark parcel
#

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

crisp shard
#

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

dark parcel
#

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

crisp shard
#

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

weak bison
#

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?

fossil spoke
#

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.

nova wasp
#

"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

fossil spoke
#

If new users treated the Host as a Server from the beginning, they would have an easier time understanding the rules around it.

nova wasp
#

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)

fossil spoke
nova wasp
#

A part of me wishes the terminology was slightly different in some places but overall I think unreal is somewhat consistent here

fossil spoke
#

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.

nova wasp
#

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

fossil spoke
#

Yeah I saw no sense in not having NetMode exposed

weak bison
#

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?

fossil spoke
#

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

nova wasp
#

yes, assuming you mean player 1 is the server

weak bison
#

Yep - Cool. Thanks!
Seeing this as Player 1 is the Server with a renderer and input defintiely helps!

weak bison
#

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!
fossil spoke
#

RPCs are sent immediately.

#

The RPC is arriving before the change to the property is being Replicated.

lime dome
sour cradle
#

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

fossil spoke
fossil spoke
#

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.

nova wasp
#

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

sour cradle
#

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

hollow eagle
#

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.

nova wasp
#

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

hollow eagle
#

Not the index. That is not kept consistent.

nova wasp
#

the playerstate index? I need to find it

hollow eagle
#

It is not consistent across instances.

nova wasp
#

FUniqueNetId I guess

hollow eagle
#

Just send the pointer to the player state...

nova wasp
#

yeah, that's the simple thing

fossil spoke
#

Please dont @ me for direct questions. Just ask the question and anyone that is able to answer will answer it.

weak bison
#

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

fossil spoke
#

You have some control in Blueprint over who a Replicated Property is replicated to.

#

Via the RepCondition.

tropic beacon
#

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.

fossil spoke
#

Typically you will also want to halt any movement modes as well

weak bison
# fossil spoke You have some control in Blueprint over who a Replicated Property is replicated ...

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?

fossil spoke
#

If you want to seriously limit cheating, use Dedicated Servers.

#

Otherwise you have limited options to combat it.

weak bison
tropic beacon
#

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.

fossil spoke
#

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

tropic beacon
#

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

fossil spoke
#

If the Boat is controllable by the Player, it should be a Pawn.

fossil spoke
#

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

tropic beacon
#

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?

fossil spoke
#

The makeup of both, is the totallity of the Tank

#

In your case there it might be a little more complicated

tropic beacon
#

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

fossil spoke
#

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

tropic beacon
#

do you think this would cause me less replication issues like the character direction?

fossil spoke
#

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.

tropic beacon
#

ill have to look into pawns, im fairly new to unreal still and never really used beyond the initial character

fossil spoke
#

Multiplayer is a rough place to start.

#

Much better off making something in SP first.

#

To get the hang of things.

tropic beacon
#

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.

fossil spoke
#

There is no such thing as a simple MP game.

tropic beacon
#

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.

fossil spoke
#

MP is one of the hardest things you can do in Game Dev.

tropic beacon
#

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.

fossil spoke
#

Stateful vs Stateless

#

RPCs are stateless

tropic beacon
#

Also my characters movement is all motion matching lol

fossil spoke
#

A Toggle is a state

#

I believe motion matching is just dynamic Anim selection. Doesnt really have anything to do with multiplayer or replication

tropic beacon
#

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

fossil spoke
#

Motion Matching in Unreal Engine is a query-based animation pose selection system.

#

So basically what I said.

tropic beacon
#

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

fossil spoke
#

Right

#

Yeah

#

As I said, better to start with SP to get the hang of things

tropic beacon
#

i have to bite the bullet eventually

fossil spoke
#

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.

tropic beacon
#

it updates position on paddle but ends up misaligned by the end of the paddle. Im not sure how that is even happening.

fossil spoke
#

Im talking more conceptually here.

#

So you might understand the reasons why using a separate Pawn would be useful.

tropic beacon
#

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

fossil spoke
#

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...

tropic beacon
#

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.

fossil spoke
#

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".

tropic beacon
#

i can feel this is wrong

fossil spoke
#

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

tropic beacon
#

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

fossil spoke
#

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.

tropic beacon
#

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.

fossil spoke
#

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

tropic beacon
#

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

fossil spoke
#

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

tropic beacon
#

cant I just have each player apply their own force?

fossil spoke
#

No

tropic beacon
#

why

fossil spoke
#

In Unreal, the Server is the "Authority"

#

Only 1 simulation rules the state of the game

#

Thats the Server

tropic beacon
#

sorry, i mean that can't both players send their input to the server. one sayd move Fwd Left, then the other Fwd Right.

fossil spoke
#

Yes but thats not the same thing

#

Sending their desired inputs is not the same as applying a force

tropic beacon
#

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

fossil spoke
#

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

tropic beacon
#

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

fossil spoke
#

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

tropic beacon
#

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*

fossil spoke
#

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.

tropic beacon
#

well thats the "boat" im in right now lol. Why redo everything instead of just doing the MP slowly and figuring it out

fossil spoke
#

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

tropic beacon
#

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.

fossil spoke
#

So dont feel like you are alone in that.

#

Unfortunately though, complex problems do require complex solutions.

tropic beacon
#

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.

fossil spoke
#

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.

tropic beacon
#

ah yes, my first time trying to get an animation to play lol

fossil spoke
#

You can always come back to that

glad robin
#

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?

fossil spoke
glad robin
#

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

chrome bay
#

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

snow trail
#

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?

chilly haven
#

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?

lost inlet
#

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

chilly haven
#

ok. seems a little clumsy for what should be a common replication use-case (many games have teams)

lost inlet
#

yes but I don't make the rules

chilly haven
#

haha .... thanks @lost inlet

#

Maybe I can just restrict my COND_CUSTOM to this team case

lost inlet
#

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

chilly haven
#

oh. guess I will try COND_CUSTOM and see

lost inlet
#

again, that's not how it works

chilly haven
#

BTW I tried Iris today but it just gave errors

lost inlet
#

you can't set a property as active per-connection

chilly haven
#

it's almost like I can't trust chatgpt

lost inlet
#

well yeah. that's been known for a long time

chilly haven
#

it's only 10% bum steers actually ... still useful

lost inlet
#

yeah but so is a search engine

chilly haven
#

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?

honest bloom
meager spade
#

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)

chilly haven
#

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

meager spade
#

yes

#

we control it through ReplicationGraph

#

but IsNetRelevantFor works

dark parcel
#

it's 99% used for the wrong reason by people who started multiplayer

snow trail
#

yeah, im now just doing this

dark parcel
#

Late joiners and players outside relevancy will not execute the function

snow trail
#

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

dark parcel
#

Sure, you can't avoid delay

#

it takes X ammount of time to reach the server

kindred widget
#

Realistically there's no way around this in BP only. The two easy solutions require C++.

dark parcel
#

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

snow trail
#

how do i know when the server one starts existing? theres no onrep for actors (that i know of)

snow trail
meager spade
#

i mean you make a property that is repnotify

#

when this property replicates back you can replace

snow trail
#

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

kindred widget
#

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. :/

snow trail
#

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?

kindred widget
dark parcel
kindred widget
#

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.

snow trail
#

thats insanely useful

dark parcel
#

are this done simply just by overriding the name?

kindred widget
dark parcel
#

awesome, nice info

snow trail
#

so i can just make a C++ blueprint node that spawns an actor with a specific name and use that??

kindred widget
#

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?

snow trail
sonic frigate
#

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?

grave notch
#

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?

snow trail
#

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

true stream
#

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

snow trail
#

is the variable replicated?

true stream
#

yes

#

but the weird part is, I only get null once (Im spawning units from a barracks style actor)

snow trail
#

does the object referenced exist on both?

true stream
#

yeh

#

I only get null once, then works

snow trail
#

odd

true stream
#

should I not use on begin play?

#

and wait for another event

#

will try adding a delay

snow trail
#

no idea, im new to replication

true stream
#

and see what happens

snow trail
#

if it works with a delay youre on some sort of race condition

snow trail
#
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

chrome bay
#

Very very rarely should you give UObjects a specific name

snow trail
#

well yeah but the solution they mentioned included doing that

chrome bay
#

Not sure what the context is here but giving objects the same name won't magically connect them for replication purposes

snow trail
#

thats what they said would work

chrome bay
#

That won't work

snow trail
#

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

chrome bay
#

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.

snow trail
#

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

chrome bay
#

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?

snow trail
#

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

chrome bay
#

Not impossible AFAIK but very difficult, and I don't think you can have an actor that is stably named replicate dynamically

snow trail
#

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

chrome bay
#

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

snow trail
#

the player with lag will just see the building placed later but thats it

snow trail
#

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

hoary spear
#

Wouldnt you just spawn the real one with a ghost material and no collision?

woven bramble
#

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?

honest bloom
#

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
vapid gazelle
#

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?

hollow eagle
#

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.

sour cradle
#

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

sour cradle
#

ehh I was able to figure it out with get controlled pawn

#

but still its such a weird way to do it

lusty aspen
# honest bloom My game is all about physics-based movement in a side-scrolling environment (mes...

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

delicate zinc
#

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

pallid mesa
#

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)

outer sphinx
#

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.

dark parcel
#

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

snow trail
dark parcel
#

At least for shooting and changing camera mode

snow trail
#

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?

dark parcel
#

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.

teal frost
dark parcel
#

Why you ask me ๐Ÿคฃ? If not self promotion then you are allowed afaik as long as the content doesn't break the rules

sinful tree
# snow trail but from what i read online GAS needs to be set up in C++ how hard is that and h...

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.

teal frost
#

Tried looking it up, but just going off the name stephen wasn't really bearing any fruit

dark parcel
crisp shard
#

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

torn basin
#

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 :)

short arrow
#

LAN

torn basin
#

no, online multiplayer

short arrow
#

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?

torn basin
#

i want both players to have the same abilities but i cant get it to work

short arrow
#

oh

torn basin
#

soz if i didnt make sense

short arrow
#

you want them to do the same thing, but currently they don't

#

okay I see

#

what's your jump code looking like

torn basin
short arrow
#

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

torn basin
#

how do i do that

short arrow
#

sec

short arrow
#

That will allow you to double jump in a multiplayer settings regardless of server or client

torn basin
#

ok do i put this in the first person bluerpint?

short arrow
#

yes, if that's where your jump code is

torn basin
#

and i replace the old jump code with this

short arrow
#

on landed, you should reset current jump back to 0

torn basin
#

ok cool

#

tysm

short arrow
torn basin
#

wait where do i find server jump?

#

oh wait nvm

short arrow
#

I can't think of any reason why you'd want to do that

#

they seem totally unrelated

torn basin
#

soz for asking this but how did you get this?

short arrow
#

one for attacking, and one for interacting

torn basin
#

nooo!, the server double jump didnt work

short arrow
#

did you mark the event as run on server?

torn basin
#

oh wait bruh

#

text is so small lol

#

thank you so much

#

it works!!!!!!

dark parcel
#

You will have input delay tho

#

For the second jump

torn basin
#

eh thats fine

#

as long as it works

dark parcel
#

I don't think you know the weight of the problem yet just saying

torn basin
#

now i've got to manipulate this new found knowledge into fixing the sprinting feature and wall ride feature yay

dark parcel
#

If it takes 1 second before a player can start moving , for many they will uninstall the game

crisp shard
dark parcel
#

Only decent solution for sprinting if you are using character movement component is in c++.

torn basin
#

damn

dark parcel
#

You have to work with their frame work

#

Any other attempt is just fighting it and ppl just failed unsurprisingly

short arrow
nova wasp
#

alternate option: just disable corrections in network settings if it's a co-op game

crisp shard
short arrow
crisp shard
crisp shard
short arrow
#

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

crisp shard
short arrow
#

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

crisp shard
#

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

sour cradle
#

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.

dark parcel
sour cradle
#

Well the age old issue. "Which player controller id is who" from other clients perspectives

dark parcel
#

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

sour cradle
#

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

dark parcel
#

Client only know their own controller anyway, asking the controller of a pawn they don't control will just return null

sour cradle
#

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.

dark parcel
#

How can we ping sessions in Steam?

woven bramble
#

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)

lost inlet
#

what do you use UDP messaging for?

woven bramble
lost inlet
#

wut? that's not what this is

#

the game socket will be UDP regardless and has no dependency on these messaging plugins

woven bramble
#

Yes, that's exactly what I was wondering. Even though we use UDP by default, do we have to activate the plugin

lost inlet
#

no?

woven bramble
#

Okay

crisp shard
#

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

woven bramble
# lost inlet no?

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.

lost inlet
#

I don't know anything about your game

#

Or what the nature of the drops are

woven bramble
#

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.

lost inlet
#

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

woven bramble
#

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

chrome bay
#

Just turn it off

woven bramble
lost inlet
#

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

silent valley
#

@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.

loud heart
#

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.

sour dragon
#

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.

silent valley
sinful tree
sour dragon
loud heart
sinful tree
# sour dragon This is my execution so far, its only running on the server, i have absolutely n...

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.

sour dragon
#

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

sour dragon
#

So i made this very very simple example, how should it be set up to be client authoriative with server checks?

#

client predicted*

sinful tree
#

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

sour dragon
#

Is this the correct approach?

noble sentinel
#

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?

storm zealot
#

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

thin stratus
#

Crouching is instant after all

#

At least in terms of code

silk nexus
#

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

teal frost
silk nexus
#

That certainly seems to be the case. Weirdly enough, though, the pawns do not

#

Where is that documented?

teal frost
#

Not sure. Just what I've noticed through playing around on my project

silk nexus
#

Thanks. Is there another gotcha like that with Playerstates?

teal frost
#

Probably a better way, but maybe a possibility for now at least for you?

silk nexus
#

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?

teal frost
# silk nexus 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.

silk nexus
#

In the GetSeamlessTravelActorList code, it stores both Gamemode and Gamestate in there, so I'm worried about the same issue

teal frost
silk nexus
#

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?

teal frost
#

If I'm understanding your situation right that is... Sorry.

silk nexus
#

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

gray sparrow
#

a game for example 3vs3 or 5vs5 multiplayer... i can only write in blueprints and the game will work on steam?

#

they will find session join or leave and can play?

#

only with blueprints written game?

#

possible or not?