#multiplayer

1 messages · Page 141 of 1

dark edge
#

Probably pretty hard to do

south skiff
#

Sorry, I'll ask there too, though someone here might have done that for multiplayer already

#

I couldn't find a way to do that, I see that SkinnedMeshComponent feeds it delta time, but it never "seeks" the time. I'll try to dig further into it, maybe there is a way

dark edge
#

Yeah it probably accumulates time from whenever it "starts" playing

#

might even pause when not used at all, like how audio pauses when silent

#

not sure

#

If you can figure out a way to feed an actual time value to an animation, which it'd sample by Time%AnimLength, then you'll be on track

south skiff
#

I should try feeding it negative delta time lol 🤔

cinder goblet
#

I need help figuring out why my component will highlight for player 1 but not player 2. It had been working for a while, but now the client never calls the part of the code (shown below) where it sets up the mouse over events. The actor itself is spawned after both players have entered the game from the game mode, but having it placed in the world produces the same results. BP_Tile and SM_stone_02 (the component I highlight) both replicate.

https://prnt.sc/AGkE390ewHTU

Lightshot

Captured with Lightshot

inner reef
#

Just looking for some general advice from people who have experience with Netcode in shipped games:

  1. Where do most indies make critical mistakes when coding multiplayer FPS games? I'm trying to tidy up my netcode and would love an external opinion about what to optimize first
  2. What are the most important config variables for a networked game? Are there any values or settings that aren't initially obvious and need focus for optimum performance?
  3. How much does the 'Waste' factor in the Network Profiler actually affect net performance? And how does it affect net performance?
  4. Any other thoughts anybody wants to throw in? Please do!
thorn turtle
inner reef
#

Just a side note on this - Epic recommends avoiding Reliable Multicasts at all costs. They actually almost removed that functionality from the engine all together because it can destroy network performance for everybody if it gets abused.

dark edge
#

The highlight is local right? I don't see anything if YOU hover an object, right?

spiral crystal
#

nvm i'm dumb 😄

cinder goblet
#

@dark edge I’ll go try that now, but the highlight is ONLY local, when I highlight my opponent does not see it so I don’t believe that should be replicated.

dark edge
#

I mean do you intend for it to be local or not?

#

if it's meant to be local then multiplayer has nothing to do with it

cinder goblet
#

Well, the object itself is replicated, and the client isn’t running the code that enables it.

dark edge
#

you're telling me the client isn't running Begin Play?

cinder goblet
#

I was debugging, and never saw the client go through it.

dark edge
#

That'd be a but sus to me

cinder goblet
#

How would you recommend going about resolving this type of issue?

dark edge
#

I'd start by trying to figure out where it's breaking

cinder goblet
#

I just need the actor to highlight when the client mouses over it.

#

Well, and the server. Both players should see their own highlight and not the other players to be clear.

dark edge
#

Print the net mode on begin play

#

make sure begin play is running everywhere, then make sure the mouse hover events are running everywhere

#

My money is on the mouse hover events not being triggered

glacial zealot
#

Does anyone know how to make a torch replicated? Because I added a spotlight and sent on server wheter to set it to visible or not with rep notify and that works but cant find a way to set the Y-axis rotation to replicate...

cinder goblet
#

Okay, I’ll focus on that. Thank you.

dark edge
#

I'm guessing this is a torch held by some character right?

glacial zealot
#

yeah actually I just set it up as spotlight directly in the character

#

as component

dark edge
glacial zealot
#

Guess I found out to do this and set the spotlight to component replicates:

#

seems to work fine, hopefully no hidden issues

dark edge
#

You shouldn't have to replicate the spot light

#

but it depends on what else you're doing with it

glacial zealot
#

i tried without and somehow the spotlight was backwards

dark edge
#

I mean it's just inheriting the rotation of the capsule right?

#

or whatever it's attached to

glacial zealot
#

yeah

dark edge
#

are you doing anything to it on begin play or is this literally the only time its transform gets changed?

glacial zealot
#

that's the only one

#

but since it works isnt that ok?

#

shouldnt be big of a deal

dark edge
#

sure go for it

sweet sage
#

Is the 100 players limit a myth?

#

for dedicated server

#

I tried 11 players and it was using 1% of my server cpu

dark edge
#

Could probably handle 1,000 playing Chess, and 3 playing Factorio

#

all depends on how the demand scales per player

sweet sage
dark edge
#

if you gotta ask, probably not

sweet sage
#

For a game like fortnite is 100 players the limit?

#

I`m using full c++ optimized and not playing animations/bones on server

#

it should handle even 200, right?

dark edge
#

Better optimized than Epic can do?

#

I mean sure, test it

sweet sage
#

Still using CMC

#

and gameplay abilities

#

i will try but 11 players using (CMC) and gameplay abilities was barely hitting my server, it was at 1% (a weak server)

dark edge
#

You gotta remember it scales worse than that, depending on the density

#

11 players in 1 place is much worse than 11 all spread outside of relevency range of each other

sweet sage
#

11 players fighting each other at same place

#

All on same replication graph grid

dark edge
#

No way to know but testing

sweet sage
#

Looks like the CPU hog is TickBones and TickAnimation not the CMC by itself

hollow eagle
#

There is no single answer to this question.

#

CMC is not particularly fast. 100 is not an upper bound, just the most anyone has reasonably done.

#

You can do more, you might be stuck doing less. It depends entirely on the game, how much time and effort you have to spend on optimization, and how much money you're willing to throw at server costs.

thorn turtle
#

I have flashlights as a separate actor in my game because of my pickup system. because of this I'm running into some issues. When one player picks up a flashlight it works fine, turns on and off fine, but once the second person picks up another flashlight the first one stops being able to be turned off, or sometimes player 2 can turn off the flashlight player 1 is holding. I'm guessing I'm missing something to iterate them but I'm not sure what atm

spiral crystal
hollow eagle
#

it is

#

actors run begin play when they are spawned in the world, on all game instances that know about them, regardless of whether you are a late-joining client or not.

#

it'll even get called multiple times on a client if an actor goes in and out of relevancy over and over again (because as far as that client is concerned the actor is being deleted/created again)

#

though in that case the client is seeing them as separate actors, so it's not like beginplay is called multiple times on the exact same object on that client.

sweet sage
#

On unreal can we have components that are client side only? visual things that don`t need to get created on dedicated server?

hollow eagle
#

yes

sweet sage
#

What do i change for it to work

hollow eagle
#

If it's a component created at runtime, just don't create it in situations you don't want it.
If it's a custom actor component, override NeedsLoadForClient/NeedsLoadForServer
If it's a primitive component (any kind of geometry, mesh, etc) set AlwaysLoadOnServer to false and disable collision on the server.

sweet sage
#

AlwaysLoadOnServer is what i need, ty

#

I will check that

sweet sage
#

It does not exists

#

Should it work for SkeletalMeshes?

hollow eagle
#

it cannot be set in blueprint

sweet sage
#

I see

hollow eagle
#

also note that this only affects packaging, not runtime.

#

packaging for a dedicated server will remove the component entirely from content. It does not affect code otherwise creating a component or object, and if you want to avoid creating something in a dedicated server config you will have to change your code to do that.

sweet sage
#

Ty, this is exactly what i need

stone marlin
#

Hi guys I have an issue where when I package my MP project as a development build it works fine and connects over steam using my steam online subsystems plugin but the joypad doesn't work.

So I looked up the issue and people said the joypad will only work if I package the game as a shipping build. So I tried this and the joypad does now work fine but I can no longer connect over steam.

I looked up this issue and it said I must add a file in the binaries folder of my packaged project to remedy this. But it didn't work for me and the directions were a little vague for this fix. Has anyone else encountered this issue and if so could you explain how you fixed it or where you found the fix please?

twin juniper
#

Hey i have a question. Say if i have a = 0 in my player controller by default, then i set a = 1 on client side, would a = 1 on the same controller but server side?

plucky prawn
#

Client is not replicated to the server, you will need an rpc to do this

coral locust
#

Sorry fell asleep. If you are familiar with it and know how to do this I would be willing to pay for your help. Let me know. Feel free to dm.

coral locust
#

^ This goes for anyone that would be familiar with how to do this and willing to help out and build a system to handle it. I would be willing to hire and pay for your assistance.

modern cipher
#

It would still be inefficient even if every client saved the game state. Which client would recreate the session? And what if that client left the game or wants to join another session?
Maybe it's better to use a dedicated server instead, or use the unity engine for this I believe it supports host migration because among us is using that

gritty valley
#

I have a replicated Int array (ressources the players is gathering) with a length of aprox 200. Changes to it I want to be reflected in the clients UI asap. Changes to it may happen once every other minute or every 0.3 seconds. What would be a reliable efficient way in BP to tell the client to update their UI with the most recent value?

I was thinking instead of replicating the Array, reliable RPCing the changed Index and Value, and adding a delay of ~1.5sec for any following change of the same index. Or just running the whole "gathering" logic on Client and server, but i'm afraid of the values jumping back and forth then.

thin stratus
#

That way you get per element callbacks and overall a more performant setup

#

If you only have BPs available, you can probably just use the Array as RepNotify and use the OnRep to update your UI

gritty valley
thin stratus
#

I don't think you have a lot of options

#

Reliable RPCs aren't really the way here

#

If you aren't using C++, you will have to live with whatever BP offers

#

Multiplayer without C++ is a bad idea. Probably wrote this 100+ times in this channel already to others :P

gritty valley
#

alright, thanks 😉

modern cipher
thin stratus
#

That still requires to loop the whole array

#

Only FastArraySerializer would do a delta comparison and do what Maeloth wants

dark parcel
#

I need to wrap my head around combat in Network scenario. How to find compromise for smooth experience.
The issue that come to my mind is that the Attack by A.I is already initiated before the information can reach the player. So essentially the "real" (Authorative) attack have come ahead before the A.I in client machine visually launch an attack.
For like 100 ms, won't this posses a problem? How can I for instance apply a parry mechanic given the situation?

coral locust
#

what all does the client need to be a host?

glacial zealot
# dark edge sure go for it

In the end it doesnt work... it was kinda working but the aim offset was way faster than the camera, so basically when watching up and down it was going too up, not following the camera

thin stratus
#

You need an improved net clock, which there is an article pinned about

#

And then you really just need to work with Timestamps and giving the player some slack

#

If the AI attacks at Timestamp 1000(ms) and the attack takes 100ms to reach the client, and the client then sees it and presses parry, then the Parry event will reach the Server in Timestamp 1200. You will have to basically open up the parry window by adding the ping/rtt to it.

#

You'd let the player parry based on its local information, then send the timestamp they parried in to the Server.
If the Server agrees, then that's all fine, if not, then the Client will be corrected by getting damage.

dark parcel
#

@thin stratus 🗒️
This make perfect sense, thank you!

sharp vigil
#

so.. you cant send maps using an RPC? Just got this error in my CPP code when trying to compile 😦

Error: Maps are not supported in an RPC.

blissful totem
#

Is it granted

twin juniper
blazing spruce
#

Hi, how can i replicate Set View Target with Blend properly? essentially what i want is for any spectating players to also update their view target when the player they're spectating interacts with the draw, ive tried putting the set view target into a multicast event but that didnt work for the spectator either

rapid vigil
#

aren't widgets supposed to not replicate? if I run 2 clients testing by play in editor, it shows up on both

#

i've tried both a branch that checks player pawn index and created a custom client event. still shows up on both

dark parcel
#

not sure what player pawn index is

willow bobcat
#

How do I set up 2 local players playing on the same keyboard with their own controllers and pawns? I'm setting them both up like this in my gamemode

    if (ACustomController* Player1Controller = Cast<ACustomController>(UGameplayStatics::GetPlayerController(GetWorld(), 0)))
    {
        UE_LOG(LogTemp, Warning, TEXT("Player 1 controller found"));
        AMyPawn* Player1Pawn = GetWorld()->SpawnActor<AMyPawn>(PlayerClass, FVector(-80.0f, 60.0f, 21.0f), Rotation, SpawnInfo);
        Player1Controller->InitializePlayer(0);
        Player1Controller->Possess(Player1Pawn);
    }
    
    if (ACustomController* Player2Controller = Cast<ACustomController>(UGameplayStatics::CreatePlayer(this, 1)))
    {
        UE_LOG(LogTemp, Warning, TEXT("Player 2 controller created"));
        AMyPawn* Player2Pawn = GetWorld()->SpawnActor<AMyPawn>(PlayerClass, FVector(-80.0f, -60.0f, 21.0f), Rotation, SpawnInfo);
        Player2Controller->InitializePlayer(1);
        Player2Controller->Possess(Player2Pawn);
    }
#

and they use 2 different mapping contexts

modern cipher
#

lol tf is that? you should not use the same function for ReplicatedUsing
and you need to remove Replicated if you want to use OnReps

lost tinsel
#

afaik the only parameter passed in to the OnRep function is the last value known, right before the replication

#

if that can help

#

if you have a OnRep_Notify(var) the var is the last value before being changed by the replication, and you don't pass it.

dark parcel
lost tinsel
#

then my knowledge ends here

dark parcel
#

same 😔

lost tinsel
#

anyway, there should be caveats for "replicating" the struct, I actually don't know if that can be replicated

#

for example, in my case, I have a TMap, that can't be replicated, so I use aux variables in order to simulate a replication

#

yes that's what I told you earlier, you can try that

dark parcel
#

Yeah I guess you can check if the Old struct is different with the new struct

#

sound kind of like a pain tho

#

well maybe because I am clueless

lost tinsel
#

easy then

#

go try it

dark parcel
#

Ahh ok, that should do then

#

Sorry don't understand the term

#

my cpp is beginner level

#

I know operator overload but not sure what you mean with reckless abandon

#

I'm more confused than before 😄

lost tinsel
#

lmao

#

ye I told you, with on rep notifies u do this stuff for getting the last known value before getting changed 👌

dark parcel
#

Can I see how you do the delta?

#

Like the system you mention that detects if the struct isn't the same

#

do you just do if SomeStruct.Member1 != NewSomeStruct.Member1 ?

#

sorry if it doesn't make much sense, really new at this

#

ty

stone marlin
#

Hi guys I have an issue where when I package my MP project as a development build it works fine and connects over steam using my steam online subsystems plugin but the joypad doesn't work.

So I looked up the issue and people said the joypad will only work if I package the game as a shipping build. So I tried this and the joypad does now work fine but I can no longer connect over steam.

I looked up this issue and it said I must add a file in the binaries folder of my packaged project to remedy this. But it didn't work for me and the directions were a little vague for this fix. Has anyone else encountered this issue and if so could you explain how you fixed it or where you found the fix please?

I posted this yesterday but it was late would love to know if anyone else has experienced this

umbral patio
#

Does anyone know how lyra replicates player's camera pitch?

thin stratus
#

Yeah wasn't sure if you took that advice or not

#

Also the param in the OnRep should be const&

#

In case it's not yet

#

But since it's working, I assume it doesn't matter too much

#

A client possessed pawn/character is automatically autonomous proxy

#

Everything else is usually simulated

thin stratus
#

You can't change it anyway :D

#

it's not like you magically change the old value

thin stratus
umbral patio
thin stratus
#

The dlls are somewhere in the ThirdParty folder

#

C:\Program Files\Epic Games\UE_5.3\Engine\Binaries\ThirdParty\Steamworks\Steamv153\Win64

#

Something like this

#

Should be enough to move them to the packaged Binaries folder of your game

#

Not sure if needed

#

The Steam app Id file should theoretically be added when downloading from steam

#

if you aren't doing that, you'd need to manually add it

#

I'm really not sure why you ask so much about this. Are you controlling that one Character/Pawn directly or are these many pawns that are controlled RTS wise?

#

If you are controlling the Pawn/Character directly, then you shouldn't have to worry about this.

thin stratus
#

So is that Character possessed by your PlayerController or not?

#

Then it's more like an RTS Character

#

And then it's more or less what Kaos already told you

#

You'd need to do quite some changes to get that to be an Autonomous Proxy

willow bobcat
#

Yea I've been trying forever but I can't get more than one controller to work with my keyboard. I'm sure it's the tiniest little mistake somewhere that makes it not work, cus I've searched everywhere but haven't found anything that helps

thin stratus
#

Depends on if you can live with the delay the player will feel when doing literally anything

#

The only pro and con is that the Player will either have direct response or will have the ping as a delay to see their actions

sharp vigil
#

I really hate that tmaps dont replicate 😦 just screaming out to the void right now.

fossil spoke
sharp vigil
#

Because maps are tidy. I'd rather not have to create a struct with an identifier for every property that could be grouped together in a map

latent basin
#

What channel is best to ask people if they want to join in for a playtest?

fossil spoke
sharp vigil
#

Wouldnt I have to have struct1 struct2 etc.. for each key:value?

fossil spoke
#

Uhh no?

sharp vigil
#

Maybe Im smoking crack then haha.

fossil spoke
#
struct FMyStruct
{
    int32 MyStructId
    
    SomeType MyStructData    
}

TArray<FMyStruct>
#

MyStructId would be used to identify the element in the TArray.

#

You would use that as if it was the "key" in a TMap

sharp vigil
#

I think Im just sleep deprived. I get what you mean. But you still have to loop through an array and check if the struct is the one you want though, right?

Right now I have my gamestate using a struct with int32 to represent resource amounts/store team ID's/store all that in a TArray. Then on the client side I store that info on a map on the gamestate <Resource enum, int32> to be represented in the UI/used for other things. I think my point is that its annoying to workaround when I could just have a map

fossil spoke
#

The fact remains that TMaps are not replicated (they dont need to be).

#

And thus you need to find alternatives.

#

I was only providing you an alternative.

sharp vigil
#

Yeah I gotcha. Thanks

fossil spoke
#

What do you mean? In relation to what exactly?

#

Prediction is a mechanism you apply to individual things in an attempt to mask the effects of latency.

#

You as the developer choose what to predict, so your question is extremely broad and difficult to understand exactly what youre looking for in an answer.

#

My guess is @whole grove's answer isnt what you were hoping for.

#

AFAIK Overwatch doesnt predict their Grenades. That might be a good example.

hollow eagle
#

Neither does halo reach, but they hide it with a predicted animation.

#

Which I'd assume overwatch does too

fossil spoke
#

We dont either, we predict the anim yes, but not the projectile.

#

Its not worth the trouble as Clients dont even notice the difference.

hollow eagle
#

the always relevant video about prediction and the complications thereof https://youtu.be/h47zZrqjgLc

GDC

In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.

Register for GDC: http://ubm.io/2gk5KTU

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover a range of developmental topics including game des...

▶ Play video
#

You're not going to find any

#

not without turning off prediction entirely (for games that allow it)

#

which would be... very few. Maybe source-based games.

fossil spoke
#

Arent we all

hollow eagle
#

If a lack of prediction feels bad then a game isn't going to ship with it. You're not going to find any games that have shipped that both feel good and avoid using prediction when they should have.

#

I see little to no code in UBehaviorTreeComponent that requires it be used with an AI controller

#

I'm not sure it needs to be on a controller at all

quasi tide
hollow eagle
#

I was about to mention that some tasks may need updating

#

but that's not really a big deal

#

MoveTo isn't hard to copy and fix

#

most tasks should be fine - luckily a lot of AI stuff deals with components on the controller rather than assuming the type of the controller.

quasi tide
#

UBrainComponent has the GetAIOwner method, which, maybe that could be a template instead; to use it to return t instead.

hollow eagle
#

You don't need to use that function

#

that function is just a utility to create a BT component and run it

#

You can create one yourself.

hollow eagle
#

worst part about the MoveTo task is it doesn't even need to be grabbing an ai controller specifically :/

#

looks like there's exactly one very minor thing specialized for AI controllers

quasi tide
hollow eagle
#

it is

#

by... creating a component

#

UBehaviorTreeComponent

quasi tide
#

Create the BT component. Set it to use a certain blackboard. Add to w/e class you want.

hollow eagle
#

or just look at the source to RunBehaviorTree and copy what it does

#

it may be defined on AIController but it doesn't do anything that wouldn't work on a player controller.

#

Aside from already having a BrainComponent property to store the BT component in, but you can make that yourself.

quasi tide
hollow eagle
#

ye it's dumb, there's very little functionality specific to AIController

#

lots of things would be simpler and better if they weren't specialized and accepted any kind of AController

grand kestrel
unkempt tiger
#

anyone have an idea why as soon as i set up steam integration my demonetdriver stopped getting loaded by the engine :((

#

theres some sketchy stuff going on inside BaseWebSocketNetDriver.ini? which I assume some steam type extends, so maybe that's why the definition is getting cleared?

#

I tried to-add it inside DefaultEngine.ini, by copy pasting a line that's already very much in BaseEngine.ini
surprisingly this worked once - right after I packaged it, but after that, it stopped working :(

torpid whale
#

Hi, One question, I am destroying an actor, but when I test it on the client side, I get an error when I want to destroy it, I think I know the reason and it is because it is destroyed 1 time on the client and 1 time on the server, how do I do that? be destroyed on the server? with a has autorithy?

unkempt tiger
#

if (Actor->HasAuthority()) Actor->Destroy();

torpid whale
fossil spoke
#

@torpid whale Destroying a networked Actor on the Server will automatically destroy it on Clients

#

So when your call to Destroy happens on the Client, the Actor might have already been destroyed automatically.

#

Thus leading to an access none error (assuming thats whats happening, since you didnt actually specify the error).

#

If you want the Client to keep the Actor around, but have it destroyed on the Server. Call TearOff first on the Server, then Destroy.

#

Tear off will cause the Actor channel to be removed without destroying the Clients version of the Actor.

dull tinsel
#

Does anyone know how to make local multiplayer work? Apparently it's been broken for a while because of something to do with the enhanced local sub-system. Tried all the common forum suggestions and no dice

grand kestrel
#

Thx, I animated it in photoshop (kind of a mistake, it has no curve interp)

torpid whale
dull tinsel
#

I'm trying to get local multiplayer working. I've tried manually setting local controller numbers without success, and I've tried adding my own game viewport class but it doesn't seem want to work. Here is the code. Anyone have any ideas?

#pragma once

#include "CoreMinimal.h"
#include "Engine/GameViewportClient.h"
#include "MyGameViewportClient.generated.h"

DECLARE_MULTICAST_DELEGATE_OneParam(FOnInputKeySignature, const FInputKeyEventArgs& /*EventArgs*/);

DECLARE_DELEGATE_RetVal_FourParams(bool, FOverrideInputAxisHandler, FInputKeyEventArgs& /*EventArgs*/, float& /*Delta*/, float& /*DeltaTime*/, int32& /*NumSamples*/);
UCLASS()
class MYPROJECT3_API UMyGameViewportClient : public UGameViewportClient
{
    GENERATED_BODY()
    
    public:
        virtual bool InputKey(const FInputKeyEventArgs& EventArgs) override;
        virtual void RemapControllerInput(FInputKeyEventArgs& InOutKeyEvent) override;

        virtual bool InputAxis(FViewport* InViewport, FInputDeviceId InputDevice, FKey Key, float Delta, float DeltaTime, int32 NumSamples = 1, bool bGamepad = false) override;

    private:
        ULocalPlayer* GetLocalPlayerFromControllerId(int32 ControllerId) const;
        /** A broadcast delegate broadcasting from UGameViewportClient::InputKey */
        FOnInputKeySignature OnInputKeyEvent;

        /** Delegate for overriding input key behavior */
        FOverrideInputKeyHandler OnOverrideInputKeyEvent;

        /** A broadcast delegate broadcasting from UGameViewportClient::InputAxis */
        FOnInputAxisSignature OnInputAxisEvent;

        /** Delegate for overriding input axis behavior */
        FOverrideInputAxisHandler OnOverrideInputAxisEvent;

#if WITH_EDITOR
        /** Delegate called when game viewport client received input key */
        FOnGameViewportInputKey GameViewportInputKeyDelegate;
#endif
};
#
#include "MyGameViewportClient.h"

#include "GameMapsSettings.h"
#include "Engine/Console.h"
#include "Framework/Application/SlateApplication.h"
#include "GameMapsSettings.h"



bool UMyGameViewportClient::InputKey(const FInputKeyEventArgs& InEventArgs)
{
    FInputKeyEventArgs EventArgs = InEventArgs;

    if (TryToggleFullscreenOnInputKey(EventArgs.Key, EventArgs.Event))
    {
        UE_LOG(LogTemp, Warning, TEXT("Try toggle full screen on input key success!"));
        return true;
    }

    if (EventArgs.Key == EKeys::LeftMouseButton && EventArgs.Event == EInputEvent::IE_Pressed)
    {
        UE_LOG(LogTemp, Warning, TEXT("Flash Indicator Success"));
        GEngine->SetFlashIndicatorLatencyMarker(GFrameCounter);
    }

    //if turn on skip setting and using gamepad, increment controllerId
    RemapControllerInput(EventArgs);

    if (IgnoreInput())
    {
        UE_LOG(LogTemp, Warning, TEXT("Ignore input"));
        return ViewportConsole ? ViewportConsole->InputKey(EventArgs.InputDevice, EventArgs.Key, EventArgs.Event, EventArgs.AmountDepressed, EventArgs.IsGamepad()) : false;
    }

    OnInputKeyEvent.Broadcast(EventArgs);

#if WITH_EDITOR
    // Give debugger commands a chance to process key binding
    if (GameViewportInputKeyDelegate.IsBound())
    {
        if (GameViewportInputKeyDelegate.Execute(EventArgs.Key, FSlateApplication::Get().GetModifierKeys(), EventArgs.Event))
        {
            UE_LOG(LogTemp, Warning, TEXT("Set up key Debugger"));
            return true;
        }
    }
#endif
#
    // route to subsystems that care
    bool bResult = (ViewportConsole ? ViewportConsole->InputKey(EventArgs.InputDevice, EventArgs.Key, EventArgs.Event, EventArgs.AmountDepressed, EventArgs.IsGamepad()) : false);
    // Try the override callback, this may modify event args
    if (!bResult && OnOverrideInputKeyEvent.IsBound())
    {
        UE_LOG(LogTemp, Warning, TEXT("Sub-system notified!"));
        bResult = OnOverrideInputKeyEvent.Execute(EventArgs);
    }

    if (!bResult)
    {

        ULocalPlayer* TargetLocalPlayer = GetLocalPlayerFromControllerId(EventArgs.ControllerId);
        if (TargetLocalPlayer && TargetLocalPlayer->PlayerController)
        {
            bResult = TargetLocalPlayer->PlayerController->InputKey(FInputKeyParams(EventArgs.Key, EventArgs.Event, static_cast<double>(EventArgs.AmountDepressed), EventArgs.IsGamepad(), EventArgs.InputDevice));
        }

        // A gameviewport is always considered to have responded to a mouse buttons to avoid throttling
        if (!bResult && EventArgs.Key.IsMouseButton())
        {
            bResult = true;
        }
    }


    return bResult;
}
#
void UMyGameViewportClient::RemapControllerInput(FInputKeyEventArgs& InOutEventArgs)
{
    const int32 NumLocalPlayers = World ? World->GetGameInstance()->GetNumLocalPlayers() : 0;

    if (NumLocalPlayers > 1 && InOutEventArgs.Key.IsGamepadKey() && GetDefault<UGameMapsSettings>()->bOffsetPlayerGamepadIds)
    {
        InOutEventArgs.ControllerId++;
    }
    else if (InOutEventArgs.Viewport->IsPlayInEditorViewport() && InOutEventArgs.Key.IsGamepadKey())
    {
        GEngine->RemapGamepadControllerIdForPIE(this, InOutEventArgs.ControllerId);
    }
}



ULocalPlayer* UMyGameViewportClient::GetLocalPlayerFromControllerId(int32 ControllerId) const
{
    if (UGameInstance* MyGameInstance = GetWorld()->GetGameInstance())
    {
        const TArray<ULocalPlayer*>& MyLocalPlayerArray = MyGameInstance->GetLocalPlayers();
        for (ULocalPlayer* const MyLocalPlayer : MyLocalPlayerArray)
        {
            if (MyLocalPlayer && MyLocalPlayer->GetControllerId() == ControllerId)
            {
                return MyLocalPlayer;
            }
        }
    }
    return nullptr;
}
#

I threw in some print strings to see if this is even running because I'm not getting any errors and it's set to use this in the project settings but it doesn't seem to wanna work for me.
Please @heavy gorge If you have any ideas

meager stratus
#

Should I try to be selective about what I do in the OnRep_MyProperty handler, such that it only performs cosmetic things (vfx, abp, sounds, etc)? For example, in my OnRep_CurrentWeapon, I could choose to call weapon->SetInstigator(x) on it, however technically that might only be necessary on the server/owning client? If that makes sense

fossil spoke
#

You can do whatever you like in an OnRep.

meager stratus
#

Just wondering what is a good separation of concerns. It would be convenient to lump it all in one place

fossil spoke
#

Its a function like any other.

#

Can you be more specific about what concerns you with OnRep?

meager stratus
#

I'm trying to get my head around what should happen on the server vs what should be replicated to clients where this actor is purely simulated. Since those clients don't have authority over the actor, I don't think I strictly need to initialise backend variables like "ownercharacter" which would only be used within an HasAuthority check

#

Though the OnRep function seems like a handy place to kick off all of those backend variable initialisations

#

So I can just do it in OnRep and at worst it'd waste a couple of CPU cycles on clients that don't have authority, but it would make my code cleaner?

fossil spoke
#

There isnt really a general rule of thumb when it comes to these things to guide you, since a lot of multiplayer networking scenarios are surrounded by huge amounts of differing context that affects the path you might need/want to take.

dark parcel
fossil spoke
#

You should be less concerned with bandwidth (within reason) and more concerned with CPU overhead when it comes to the network.

#

At least from the perspective of the Server.

dark parcel
meager stratus
#

Right that makes sense. Ok so I will just aim to just keep my code readable. At least things are replicating is the goal!

fossil spoke
#

@dark parcel Fast Arrays are very useful if you want per element notification.

fossil spoke
#

Each iteration of a system should be faster and more network efficient.

#

As you gain hindsight from the lessons you learned building the previous iteration.

dark parcel
#

You run the command on the client side, so on the server the character remain stationary.
You get rubber band because the server keep correcting the location (which is where it stands on the server)

#

So you are running the command on both server and client, this might seem to work in Pie with no lag but when you add a lag I don't think you will get your desired result (gonna get rubber band again imo)

#

The CMC sends movement data which will simulate the movement on the server. The server then will check if the move are valid and correct the client if necessary.
I don't know anything about simple move to, maybe it doesn't send the needed FMove data?

#

It will given the correct function. Like Add movement input should be okay

#

but yea don't know a lot about this subject maybe someone with experience can give you answer with doing top down movement

twin juniper
#

If i want a RPC from a client to the server and all other client, i would have to call 2 RPCs, one "Server" from the client to the server and one "Multicast" from the server right?

dark parcel
#

especially for replicating a variable

#

You just send a Server RPC from client that update the server variable and that's it.
The server will replicate the variable to all client on the next netupdate

twin juniper
#

That only happen if you mark the variable as replicated right?

dark parcel
#

The variable needs to be marked as replicated for it to replicate to clients

twin juniper
#

It's like an auto multicast, i get it now

dark parcel
#

don't know if that's how it should be viewed 😄

#

Lets say you have a replicated var called myHealth(float).
If you are the server you just change the value

#

that's it, it will be replicated to client eventually (How long it reach the client will depend on ping)

#

Since replication only work from Server to Client,
If you are the client. You will need to run a Server RPC to tell the server, Hey Change myHealth variable

#

So Player 2 (client) -> send a server RPC -> Server Change My Health
-> All clients will update their MyHealth when the information arrived from server

past flicker
#

I'm trying to design some networked melee combos. State machines make sense in my mind to represent flowing sets of moves, but the available plugins do not have client side prediction. So I've been trying to make my own state machine and it occurs to me that this may be misguided task. Making a generically predictive state machine is probably on the same order of difficulty as that abandoned Network Prediction plugin because prediction is not something easily solved generically. Every predictive task requires its own unique implementation, which explains why nobody has been able to put out a plugin yet. It's just too hard. Am I on the right logical path here?

dark parcel
#

Nice 👍

keen thorn
#

Hi guys, anyone have experience with implementing 150-300 roaming NPCs in a multiplayer game open world map where they can be visible from afar? Our game kinda require this but im not sure which is the best approach

#

Kinda looking for battle tested methods, so any reference to GDC or similar talks are much appreciated

whole iron
#

Anyone know how to make it so players dont cause physics interactions with each other [my suspected culprit]? My characters can crouch and end up "launching" each other just by walking into someone standing.

sharp vigil
#

Is the level blueprint executed first before all character blueprints?

blazing spruce
#

However, as far as im aware you shouldn't be using the level BP for multiplayer anyways

sharp vigil
#

Im trying to initialize teams on my gamestate and I keep getting this. I'm calling an RPC on my character to initialize the team but keep getting this. Any advice with regards to this?

Originally I did this in my level blueprint but tried switching it to my character.

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor WeatherReportGameStateBase_0. Function InitializeTeams will not be processed.

blazing spruce
# sharp vigil Why is that?

I cant remember the exact reasons off the top of my head, some of the other smarter people in here will be able to give you a better answer but any logic you're trying to run in there is prolly better suited to be done from a different class

blazing spruce
sharp vigil
#

I'm calling an RPC to initialize resources and teams on the gamestate.

#

I think I fixed it. I just had to check the authority on the gamestate and now it runs smoothly

timid fox
sharp vigil
#

hah ive looked through his blog before but I missed that

#

thank you

twin juniper
#

would that work?

#

for multiplayer?

plucky prawn
#

what are you trying to do?

timid fox
#

It would "work" but probably not as you intended it. You can't be sure that player index 0 is the one you expect it to be.

twin juniper
#

it only print 1 person

#

well, it is working because everytime someone enter, that trigger

#

but it will only print the same thing

#

what should i put in the get player character?

sharp vigil
#

you could get the class and if its another player character then do it

#

instead of getting it from the index

twin juniper
#

true

#

then it would work on all of them

sharp vigil
#

You just want to print the name if you collide with another player character?

twin juniper
#

what would i do for the player?

sharp vigil
#

I dont know what you're trying to accomplish

#

Are you trying to print the display name out of player characters you collide with?

twin juniper
#

to do the action only if its a certain player...

sharp vigil
#

Do you have some sort of identifier for that player? Like a team ID or a name?

twin juniper
#

yea later, I'll add that

sharp vigil
#

You could check if you collided with a player then use that identifier to determine if its that certain player.

twin juniper
#

what node i would use to get the players

sharp vigil
#

You're already doing it. That "other actor" is the one you collided with then you have a reference to it

twin juniper
#

like that?

sharp vigil
#

use the function under utilities called GetClass then select your class on the bottom node which would be your player character class

twin juniper
#

utilities?

sharp vigil
#

Sorry doing multiple things at once rn. You're using the right get class node just delete that stuff on the bottom, get player character and get class

#

Keep the == and the other get class you have at the top

twin juniper
#

ok ty

sharp vigil
#

You're welcome. I think you can figure out the rest from here

twin juniper
#

yea

glacial zealot
#

Guys Im spawning a replicated actor from server and with a repNotify I get its ID and set it up, the thing is that my actual actor has a widget to show interaction info which is presetted to a specific widget (image1), when I try to cast to that on client it return empty... but still when I go near there it shows it but can't cast and call a function on it to modify its info, why is that?

sharp vigil
#

So you have a RPC you called and then you're using repnotify on the client to get the values you want and set up your actor? And when you try to access the values on that actor after this has occurred you're unable to?

glacial zealot
#

Basically what I do is gamemode spawns items at start game, those items have ID integer variable set to RepNotify, based on that ID i get the info on datatable and set it up (only 1 item to manage all pickups, easier and faster), the thing is that the widget which is already setted to that on the actor seems to be null on client

sharp vigil
#

Hmm Im not sure then. Do you have an event when that rep notify hits the client so you know all that stuff is populated?

meager spade
#

GameMode does not exist on client (?)

#

are the properties on gamemode?

timid fox
#

Yes, GameMode is server only and that includes all it's properties.

dark edge
#

Is it just not being created?

fierce adder
#

What is max players count and how to change it in ue5 ?

blazing spruce
glacial zealot
glacial zealot
glacial zealot
fathom aspen
#

Another way to "change it" while in PIE is via the console command net.MaxPlayersOverride 10 (but this is not a perma change, but just for testing)

glacial zealot
fathom aspen
#

How did you set up a session for 4 players?

#

If it's via the NumPublicConnections whatever then, it means that the session won't be advertised anymore, but the server can still perceive players, so if a client was able to find that server somehow then yeah they might be able to potentially join

#

It's always good to stay consistent

grizzled stirrup
#

How can you increase the value of RELIABLE_BUFFER to prevent disconnects when many RPCs happen in a single frame? Do you need to change it via source or is there a .ini somewhere that changes it? I'd like to never disconnect if possible and would rather drop packets than auto disconnect clients

chrome bay
#

You can't drop reliable packets

#

Otherwise you can't garauntee a permanent desync

grizzled stirrup
#

Oh ok thanks, in that case any way to just increase the reliable buffer limit past 256?

#

So that clients don't just fully disconnect

chrome bay
#

Guess you could just modify it and rebuild the engine in NetConnection.h

grizzled stirrup
#

Thanks, was hoping it'd be an .ini but looks like a source build is needed. Will look into it now 🙂

fathom aspen
grizzled stirrup
#

Is it as trivial as simply putting this enum { RELIABLE_BUFFER = 256 }; // Power of 2 >= 1. up to like 4096 ?

#

In NetConnection.h

#

Or are there data size limits that would prevent this?

grizzled stirrup
fathom aspen
#

I can't vouch for increasing it, never done that 😛

#

You can always try and enlighten us xD

grizzled stirrup
#

Ok thanks. From a general C++ point of view, could enum support values greater than 256?

#

Will report back if it works

grizzled stirrup
meager spade
#

@grizzled stirrup i have to question, WHY

#

i have never had reliable buffer overflow

grizzled stirrup
#

Rare case in PvE game with a lot going on (no limit on player power), would prefer no client disconnects if possible instead of people randomly dropping out

meager spade
#

seems like your abusing Reliable

#

we have tons of rpc's every frame

#

and never overflowed the reliable buffer

#

it seems like you have reliable rpc's on tick

#

which you should never do

grizzled stirrup
#

I don't, it's more one off events where players might spawn 1000 bombs in a single frame

#

And each one has a single reliable RPC

#

normally this never happens

glacial zealot
grizzled stirrup
#

but players can push things to extremes after hours of play

meager spade
#

this is a design issue not an engine limitation

#

if its spawning 1000 bombs in a single frame

#

then you have underlying game issue

grizzled stirrup
#

It's more for the 1% cases that manage to push the game that far, if I can simply increase the buffer without any consequences then that's great

#

Most people don't spawn more than say 10 bombs in a frame

meager spade
#

have you overflowed the buffer?

fathom aspen
meager spade
#

if they are going to spawn 10 bombs in the same frame (which i highly doubt a player can click 10 times in a frame)

#

then batch it to a single RPC

#

instead of 10.

#

like i said

#

this is your GAME CODE issue

#

not an engine issue

grizzled stirrup
#

I can definitely look into batching but it's a lot of work for an edge case, if increasing the buffer limit would solve it and not have any other negatives (as it seems more of a sensibile limit) then I'm more inclined to fix it that way

meager spade
#

increasing the buffer is a scapegoat for bad game design

grizzled stirrup
#

This bug happens very rarely I'd just like it to be covered

meager spade
#

like i said

#

i have never in 5+ years

#

overflowed the reliable buffer

#

and we have a ton of stuff happening in Red Solstice 2

sweet sage
#

Is there any callback when a AActor is tracked by a network connection? Start/end

meager spade
#

what you mean "tracked"

sweet sage
#

It started to get replicated to that connection

meager spade
#

question is, what are you doing (and why do you need it)

#

cause there maybe another soloution

grizzled stirrup
# meager spade i have never in 5+ years

Most games wouldn't run into it as they have sensible limits to things. For my game, it doesn't limit your power so you can spawn absolutely insane amounts of things with enough loot (bomb that then spawns 3 bombs on exploding that then spawn more things on them exploding etc.) and that's part of the fun. It'd need a rewrite on how things are spawned / designed just for this rare edge case that doesn't affect most players when a single int could be changed instead, must prioritize

sweet sage
#

It is so sleep actors when no one can see it

grizzled stirrup
#

It seems most players have the bandwidth but are running into the RPC limit more often than actually disconnecting for connection reasons

meager spade
solar stirrup
#

Keep in mind if you have to increase the buffer you're probably gonna run into other issues

meager spade
#

fix your underlying issue before modifying the engine

#

don't be lazy 😛

solar stirrup
#

Players with less than perfect networking conditions are not gonna have fun

grizzled stirrup
#

Any to look out for in particular? Fine with increased latency rather than complete disconnects

meager spade
solar stirrup
#

You're in unexplored territory hah

#

I don't think anyone else here has increased the buffer

sweet sage
solar stirrup
#

Generally you optimize your netcode to stop it from overflowing

meager spade
#

EndPlay will be called on client if an actor goes out of relevancy

grizzled stirrup
meager spade
#

they dont exist if not relevant

#

so why do you need to know about the connection?

sweet sage
meager spade
#

yes but what is this to do with networking

grizzled stirrup
sweet sage
meager spade
#

sorry not fully understanding the issue here

solar stirrup
#

Hmmm what exactly are you doing with the RPCs that causes an overflow?

meager spade
#

you want to turn stuff off if the actor is not replicating to anyone?

solar stirrup
#

Sensible limit because at a certain point you're basically gonna DDoS players, the server or both

solar stirrup
#

Especially on lower end hardware or bad network conditions

#

It's akin to playing a game with someone in your household downloading something when you have pretty bad internet

meager spade
#

i am not really sure there is such a callback or something for that

solar stirrup
#

There isn't, been looking for something like that.

#

You have to implement your own logic for that

grizzled stirrup
# solar stirrup Hmmm what exactly are you doing with the RPCs that causes an overflow?

Just in a simple case, bomb explodes and an RPC is sent with data about the explosion (I could do this via a RepNotify var but it needs to be timely and is gameplay relevant so must be reliable but I do need to investigate a ForceNetUpdate approach instead and it may be optimized enough). Now a player picks up an upgrade that spawns 3 more bombs on explosion and another upgrade that allows their bombs to break off into smaller bombs mid air, and then another upgrade that throws 5 bombs at once. So now the RPC cost is exponentially higher. Now say 5 players all have these upgrades and all happen to throw them at the same instant, this leads to a situation where they all disconnect

#

I may be able to move back to onrep here though

#

On closer inspection

#

If it's reactive enough

solar stirrup
#

ForceNetUpdate is a trap

meager spade
#

the reliable buffer is PER connection

#

not globally

solar stirrup
#

It resets the replication interval so the engine considers the actor for replication asap - but the engine may still push it back

#

If you force net update a lot of actors you're basically doing nothing

grizzled stirrup
#

Ah ok good to know. Well in that case, there's an edge case that allows players to stack so many bombs on one frame that it'll overflow

solar stirrup
#

The engine will consider a lot of actors and decide it's too much at a time and defer some

grizzled stirrup
#

But I'll see if OnReps without ForceNet is enough to do it

meager spade
#

again, this is a design issue

grizzled stirrup
#

And then can skip the RPC entirely

meager spade
#

if you have so many bombs in one frame

#

then you have bigger issues than just replication

solar stirrup
#

Yeah if it's in a single frame you should pack everything as much as possible

grizzled stirrup
solar stirrup
#

If it's only cosmetic info consider making it unreliable

#

Raising the limit is a risk

grizzled stirrup
solar stirrup
#

Opens to malicious actors spamming huge RPCs with the engine accepting them because they fit in the buffer

grizzled stirrup
#

That's fine in this case, PvE game, they can cheat or spam or whatever

#

I'd prefer to just not have people disconnect

solar stirrup
grizzled stirrup
meager spade
#

like i said, we did this with batching, you dont need to send a single rpc for every bomb

solar stirrup
#

And if they do, there's a ton to do before increasing the buffer is the solution

meager spade
#

even if they explode, you dont send a multicast out the same frame

#

for every bomb

#

player cant perceieve one frame

#

split stuff over multiple frames

solar stirrup
#

Yeah batching sounds like your solution here

grizzled stirrup
#

Is there a way to query the current buffer and then split the RPCs over different frames?

#

I can definitely look into that, does sound cleaner

meager spade
#

no

solar stirrup
#

Easier to do it yourself

#

Before calling RPCs

meager spade
#

for example, we have a damage gameplay cue

grizzled stirrup
#

So I'd need some kind of manager for all stuff that can call RPCs for a connection and then limit them if it breaches a limit?

meager spade
#

which is a multicast from Damage Gameplay Effects

#

we batch all of these (if they match) to the same RPC

solar stirrup
meager spade
#

so for like weapon firing, where we fire 5 RPC's, i only fire 1

#

and i didnt change anything

#

except put a special FKaosDamageCueScopeBatcher before doing the stuff

grizzled stirrup
#

See, the only issue I have here is that if simply increasing that int in NetConnection.h would solve this, it takes 5 mins and works. I can completely rewrite my system for this very edge case but it does seem like a lot of work for something that provides very little tangible value if that makes sense

#

I do like doing things the right way but also time is very valuable

#

And you have to pick the right battles in terms of what you are working on

meager spade
#

but 1000 bombs in a single frame? that is a recpie for disaster

#

i bet your frametime jumps also

grizzled stirrup
#

For 1 in 10000 players on one occasoin where they decided to go for the limits

#

Frame rate does jump

solar stirrup
#

Even with the buffer increase you're gonna have players drop

grizzled stirrup
#

It's part of the fun

#

To break the game

solar stirrup
#

Not because the engine kicks them but because their pc or router kicks the bucket temporarily

grizzled stirrup
solar stirrup
#

Executing RPCs also takes time

#

A small amount of RPCs is probably fine but they do have overhead before you even reach your RPC implementation function

grizzled stirrup
#

I'd say increasing to 1024 would solve it in pretty much every case

#

Just have to weigh the work / time for the end result as part of the equation

solar stirrup
#

Up to you in the end, we just give our opinions ^^

grizzled stirrup
#

I do greatly appreciate it

#

And thank you for taking the time

#

Was interesting to learn about it

sweet sage
#

@meager spade do you think OnSerializeNewActor is good for that?

Edit: I have tried and it works great for me

meager spade
#

yes but thats only when it seralizes

#

you wanted both ways

sweet sage
#

It is called only first time it serializes (i tried)

#

But yeah, i need the other way

#

I will check virtual void OnNetCleanup(class UNetConnection* Connection) {};

#

Do u have jump,e tc?

#

Or only walking?

#

Are u colliding with physics objects?

#

Are u simulating packet loss? how much?

daring cosmos
#

Hello Guys, i am making a multiplayer game with EOS, my game right now works as p2p, so somebody host the game, and others joins, is a team deathmatch game, and i have a separate backend http api in other language, so when the match finishes the host (the server authoritive) sends a request /match/finished with the stats to the api, basically which users won the match, the backend can update the stats like exp earn, etc, all this is fine, but my concern is, since this is ran from the client side, i dont know if is there a way to doble check this info from the backend, like check if the session is running, who is the host etc, from an api call, or any way to communicate with EOS to get this info, the only way i can think of , of make this more secure, is by just hosting dedicated servers, but i would like the players just host their matches,

any ideas? any experience of working with multiplayer with a separate backend?

sweet sage
#

Do it works with something like 30ms latency?

#

Looks like u have wrong movement cod

#

How do you move your character?

#

I don`t think it is locally predicted

#

You need to move on server only

#

for click to move

#

Try this

dusty river
#

In blueprints. I'm spawning an actor on the server and passing the playerstate of the client that spawned it. The variable is set to replicate. If my client connects after the actor is spawned, the actor shows up on the client side but the variable isn't replicated, and after a delay it still doesn't replicate. The client should have an actor with the server's playerstate.

Everything works fine if the client connects before actors are spawned.

dusty river
#

Okay. The playerstate isn't initialized until after the actor is spawned. Solved-ish.

dark edge
dusty river
#

I'm still debugging but I'll let you know. Thank you.

sharp vigil
#

Im confused about when the gamestate is replicates to the client. I assume it would be extremely often? I have an onrep method for changing variables on the gamestate.
Would it be redundant to have an event called in the onrep when the gamestate is updated?

round yew
#

Hello @latent heart I discovered Nakama recently and read you are using it. I was wondering do you use it for dedicated servers? and if yes do you use heroiclabs cloud solution or another provider like aws

fierce adder
#

I have 2 problems with this blueprint. 1. The input doesn't activate on the client; it only activates on the host and doesn't deactivate. 2. Casting to PlayerController returns Cast Failed.

icy jetty
fierce adder
icy jetty
#

Idk, but I helped you cut your problem in half so I am content 🙃 (smarter people might know the answer)

icy jetty
#

Could it be that the player controller is not yet assigned on overlap?

#

Like is this just after spawning or something

#

Or rather it’s not possessed by a PC yet

dusty river
#

Plug the controller into your cast failed print string.

fierce adder
#

you mean that?

fierce adder
upbeat basin
#

Is there any point to use UFUNCTION specifiers BlueprintCosmetic or BlueprintAuthorityOnly if function isn't exposed to blueprints? I believe it's still letting cpp calls to work without issues even if the conditions aren't met, right?

dark edge
#

The player won't own the door anyway so it can't call RPCs through it.

#

Your whole setup is borked

fierce adder
#

I'm just starting to learn, and that's what I did, but I'll try to modify it.

prisma snow
#

Is GameMode guaranteed to exists on the server when a level is loaded and placed actors are loaded?

meager spade
#

yes

#

GameMode is one of the first things to be loaded

grizzled stirrup
#

How can you calculate the size of a struct to make sure it can be sent in a single RPC? (seems to be 64KB limit in NetMaxConstructedPartialBunchSizeBytes which I think I'm well under, but would like to see how much the current struct actually takes up)

prisma snow
latent heart
quasi tide
#

It was advertised as a backend to use for Godot users. Because open source and all

#

They were even a sponsor for Godot for some time (don't know if they still are)

fathom aspen
prisma snow
limber minnow
#

hey guys Im trying to create a multiplayer game on unreal engine, net mode play as Client, so it will have a dedicated server. It works good if I open the level and I can see the other players, but if I need to load a new level, for example going inside a portal or clicking a button, the other players dissapear, lets say each players should belong to each level, and when traveling shouldnt travel all players but only this which triggered it. Okay after this I tried to use command servertravel without success, and set up travel map with gamemode seamless travel without success, I've tried many tutorials

fathom aspen
# prisma snow I see, is there any special consideration when dealing with such actor initialis...

Most of the gotchas I'm seeing these days are coming from net startup actors (replicated placed in level actors). Don't rely on BeginPlay being the function where your PODs will be replicated and ready. Usually they will replicate much much after BeginPlay was called. Also if you are using level streaming, then you might come upon a very rare issue where these net startup actors get destroyed on clients if you stream out and in levels real quick.

prisma snow
quasi tide
#

Wh...why did you reply to the same comment with the same reply Max? 🤣

limber minnow
#

hey guys regarding to my question before, I have 2 levels on my project, when I try to open a new level, or come back to previous level, its like I lost the connection with the server, cant see the players anymore, it seems it creates a new instance of the level and thats not what I want to achieve

fossil spoke
limber minnow
#

No, I dont get disconnected neither the clients, they are still connected, the problem is I cant reach the same level the other player is connected, it seems the unreal creates a new instance of the level

prisma snow
fossil spoke
fossil spoke
round yew
limber minnow
#

Well, better to understand the result I want to achieve > having a level which a player can connect, and will be able to see everybody who is already there connected, so this level will be always running on the server. Then when the player travels to different level or come back to previous, is possible to see who is in the previous or next level

prisma snow
#

No intention to span whatsoever

fossil spoke
#

Its not

fossil spoke
limber minnow
#

yes but not all players just the player who triggered

quasi tide
#

I think Max's discord is actin' all funky

prisma snow
latent heart
quasi tide
#

Maybe he just wanted to be really sure that WizardCell read his reply 🤣

prisma snow
#

I cannot see the duplicated messages, so didn't realize. Feel free to delete one of them if necessary

fossil spoke
limber minnow
#

Is it possible to hard travel in the editor standalone playing mode ?

#

or I have to be packing and cooking stuff ?

fossil spoke
#

Depends on what version of the Engine you are on, as I think UE5 supports Seamless Travel in PIE now.

round yew
fossil spoke
#

But generally speaking you shouldnt be using the Editor to connect to Servers in PIE.

round yew
limber minnow
#

yes Im trying to achieve a seamless or hard travel at least, but without any success

#

with console node or open level nothing works

round yew
#

check that netdriver are configured correctly in DefaultEngine.ini

round yew
limber minnow
#

yes I just created a new project

#

having the same issue

#

Im doing something wrong still didnt figure what

round yew
#

OpenLevel should work perfectly fine when yo play in editor

lost tinsel
#

related to column client

is this saying to me that if the instance (say a character) is the server, then the code is executed on the server, but if the instance is the client, the code is executed on client side of that particular instance?

round yew
#

so a settings maybe

round yew
lost tinsel
#

yea im focusing on the client column

#

I should have pointed it out better lol

round yew
lost tinsel
#

it says if the actor is owned by the server, the code is ran on the server

round yew
#

eg: if clientA is the owner of a specific character, the RPC logic will only run for that client

#

yes because the RPC RunOnOwningClient needs the actor to actually have an owning client, if it dont it will simply run like a normal event

#

its used when you want to target a specific client only from the server

lost tinsel
#

so if the owning actor has the authority ( server ) the code is executed on the server, but if the owning actor is just a simple client (doesn't have authority) the code is executed on client-end ?

round yew
#

imagine the clientA just make a kill, you want to show the UI that shows who you killed, server send the RPC with the killed player with his username as argument, so you can display "You killed XXX"

lost tinsel
#

the doubt came in my mind when I realised that this client RPC (invoked from the server) is also executed on the server

#

that's why I went to the docs and checked it out

round yew
#

should only fire on the owning client, unless it has no owner or server is owner

lost tinsel
#

but the doc says if "server owned actor" -> runs on server

#

so if I invoke a Client RPC server side, I get that code executed aswell on my server side

#

I mean, that's correct as intended

round yew
#

then it runs on server

#

like a normal event

lost tinsel
#

"UNLESS it has no owner or server is owner"

I'm not understanding this, can you elaborate further if you dont mind

round yew
#

this should be the expected behavior, because this is the reason why you call that RPC

lost tinsel
#

are we talking about a specific actor?

round yew
#

yes

#

because you run your logic in actors

lost tinsel
round yew
#

imagine a replicated actor, it has a synchronized copy on:
Server
Every other client

one of the clients is the owner, the local client from that client's perspective

#

so it will run only for that specific targeted client

limber minnow
lost tinsel
#

it's all clear, only needed to talk about it in depth

#

thank you mate

round yew
#

sure no worry

#

its a matter of time before it becomes obvious

#

just need to get use to think in terms of server, clients, local client and how code should run differently in all those cases

#

i learnt RPCs using blueprint, it's very visual it helped a lot

lost tinsel
lost tinsel
round yew
#

you can be less overwhelmed when you have many new concepts to learn

lost tinsel
#

will keep it in mind

limber minnow
#

@round yew is not necessary to join or create session maybe that is the problem ?

grizzled stirrup
#

Generally it's at runtime

#

And there are arrays so the size varies wildly

blissful totem
#

Well someone just deleted a question but I’m guessing the answer is that input is not replicated, only effect

short arrow
#

if you were to like get the controller and try to receive any type of inputs it wouldn't be replicated anyway

blissful totem
#

I think they meant the movement input on the character movement controller. Like not the controller stuff but the cached store of movement input

#

But I think the answer is the same

short arrow
#

oh, yeah it is. the cmc does it's own replication stuff if you have replicates movement to true. but otherwise the answer is the same

sweet sage
#

how IsLocallyControlled() works for AI?

#

will it ever return true?

rare cloud
fossil spoke
#

There is also a function IsPlayerControlled which should help you identify the difference as well.

sweet sage
#

I have this AI mob spawned on game map and i`m using ReplicationGraph Grid system.

The grid is working for my Players but nor for this AI (never removing it from Map).

I think it is spawned by default on client also somehow. Is there a way to spawn only on server and make replication graph also work for him?

#

This is what is happening

#

Both pawns are using same class but has a different Controller (one of them is using AIController)

#

Is using a Respawn and instantiaing it only on server the best way?

gilded thorn
#

Ive been reading old posts about Splines not replicating, is this still the case?

Is the best way around still arrays of points?

twin juniper
#

How does ABP worked in replication? Does it worked just like PlayerPawn, where there is a different version on the client and on the server? What if i store a = 1 on the client, and then change a = 2, what would it be like in the server?

vagrant grail
#

Guys, how did you learn how to do multiplayer in unreal ?

twin juniper
#

Idk about u, but i don't :))

#

This stuff is so undocumented i'm just shooting in the dark

thin stratus
#

After that you are on your own more or less

thin stratus
twin juniper
thin stratus
#

No

#

Anim Blueprints are per SkeletalMeshComponnet (if the Component is set to use ABP instead of single Assets).

#

But those AnimBluperints have no replication, they are just instanced locally

vagrant grail
thin stratus
#

Replicated Variables are synced when someone joins late.

#

If you need a callback for the data reaching the Client, you can mark them as RepNotify in addition to the Replicated part.

#

Then you get an OnRep_VariableName that calls with the newest value

#

What doesn't "sync" are RPCs, cause they only call in the moment, Someone who joins later won't receive older, already fired RPCs.

vagrant grail
thin stratus
#

RepNotifies are for STATE
RPCs are for ONE TIME ACTIONS

vagrant grail
#

yeah I know but I can't think of One Time Actions (examples) 😄

thin stratus
#

If you want to tell the Client to do something, then an RPC is used.
If the color of a Character changes, RepNotify is used.

#

Hm, an exmaple could be an exploding barrel, if assumed to be fully server authoritative .

vagrant grail
twin juniper
thin stratus
#

Its Health could change the material over time, this is a State, needing a RepNotify.
When it explodes, you might want to set a bExploded boolean with a RepNotify so that you can change the Mesh and turn a little Fire on inside of it.

But the explosion itself only happens once and only for the people around it, so here you could use an RPC to trigger the explosion.

thin stratus
vagrant grail
thin stratus
#

RPC and RepNotify have nothing to do with FX

#

Like, that's not the thing you use to decide which of the two to use

vagrant grail
thin stratus
#

The point is State vs non-State

vagrant grail
#

Yeah

thin stratus
#

State is persistent. New players or people who come late should still see that the state changed

#

The Barrel being broken with fire on it is a State

#

The Explosion is not

#

So the first goes via OnRep, the second via RPC

vagrant grail
#

Oh yeah I see

thin stratus
#

That's a simplified example of course.

vagrant grail
#

makes sense

#

yup thanks.

#

I think you should do a video tutorial about that could help alot of people, because alot of youtube tutorials usually use RPC for states thing too

thin stratus
#

Most tutorials really suck

#

Like really really suck

vagrant grail
#

and they don't think about people joining later

thin stratus
#

And I can't blame them

#

They think they know what they do cause it works for them

#

And then they take the time to share it

#

And that's noble

#

But also spreads the false info like sh*t

vagrant grail
thin stratus
#

Even Epic Games own Lobby Tutorial is the biggest crap out there

vagrant grail
thin stratus
#

And that's the same (minus the company stuff) for a lot of people

#

The people who get good have a lot of work to do and not the freedome to just write some articles anymore

#

I wouldn't have the time to write the compendium again today

thin stratus
vagrant grail
#

mhhh, what if you get hired / paid by Epic Games to do good tutorials / blogs / documentation for it, would you accept ?

thin stratus
#

But that exists/existed already

vagrant grail
# thin stratus As a contractor, if the payment is right, maybe.

Ouuhh maybe you can ask them, or open a donation paypal / tipee, etc... and when a certain amount is reached to help you cover all your financial needs (let's say for months), you can start that to help thousands of people learing multiplayer properly ? 👀

thin stratus
thin stratus
#

Not sure if all of those are still there after epic yeeted so many employees

vagrant grail
vagrant grail
thin stratus
twin juniper
#

I wish there is some millionaire just donate to BRY rn 😂

thin stratus
#

Either way, that's going pretty off-topic by now. Let's keep room for peeps that need help with #multiplayer

vagrant grail
vagrant grail
twin juniper
vagrant grail
#

Damn we can't create threads in this channel 😦

thin stratus
#

Not sure I would agree with either, cause neither of you have actual numbers on that

#

There are a lot of companies that internally do multiplayer, that learn from my compendium

#

Which you will never hear of

vagrant grail
vagrant grail
round yew
#

try to see if you don't have any errors in the console when you try to use the node

#

can you show a screenshot of how use the node as well?

lost tinsel
#

so I was figuring out some concepts, in my case I have 1 client and 1 server (2 characters total), I put a simple print on screen in the begin play, and I get

Client: BeginPlay
Client: BeginPlay
Server: BeginPlay
Server: BeginPlay

so this means that for every viewport (client/window, whatever) I print twice, since in each viewport I have 2 actor instances, now, in the begin play I tried to send a Server RPC, in the Server RPC I simply print based on authority, if has auth print server otherwise print client. All I get is 3 logs, I don't understand why 3 and not 4, the RPC is supposed to be fired from every actor instance no?

chrome bay
#

Because the Clients don't have authority to call an RPC on something they don't own, so it's not sent. If it does manage to get sent, the server will ignore it

lost tinsel
#

ok nvm, I connected the points, it's 3 because it's for the 2 instances on the server (one owned by server and the other owned by client) and 1 from the client (owned by invoking client)

chrome bay
#

Yeah, the 'Owning' client can call the RPC on it's character, but not any other character

lost tinsel
earnest ocean
#

Hey ya all 🙂

I have my ThirdPersonCharacter thats shooting at another player and invoking:

            {
                HitCharacter->TakeDamage(WeaponInstance->Damage, FDamageEvent(), GetController(), Cast<AActor>(WeaponInstance));
            }```

So far, so good, - that works. 

Now when my TakeDamage realises, that the player died it invokes a method on my GameMode `GetWorld()->GetAuthGameMode<ADefaultGameMode>()->PlayerKill(GetController(), EventInstigator, DamageCauser);`

This than invokes a method on the GameState, setting all the kills in a struct: 
```if (GetLocalRole() == ROLE_Authority)
    {
        FPlayerKill PlayerKill;
        PlayerKill.Victim = Victim;
        PlayerKill.Killer = Enemy;
        PlayerKill.Weapon = Weapon;

        PlayersKilled.Add(PlayerKill);

        OnRep_PlayersKilledUpdated();
    }```

Now, after replicating the Killfeed variable, my Killer entry on that struct is somehow empty.  It works on the player that kills the other player, but the killed one does not get the killer.

I think it has something todo with me using GetController() to reference the killer - but I have no clue whats really going on there as any steps before have the Killer filled as predicted
solar stirrup
#

Players will not have access to the controllers of other players but themselves

#

In this scenario, you probably wanna reference the player state of the killer

#

same for the victim

earnest ocean
solar stirrup
#

Nope - player states are available to every player

earnest ocean
#

Ah ok, I thought I read somewhere that the GameState is available for everyone but the player just for that one player

solar stirrup
#

Nah

#

GameState and PlayerState exist for everyone

#

GameMode on the server only, and PlayerController on the server & owning client only

earnest ocean
solar stirrup
twin juniper
#

How do i use console command when play using "New Editor Window"?

#

I want to use slomo.

solar stirrup
#

Tilde

#

~ or `

#

based on your keyboard

#

should whip up the in-game console

twin juniper
#

that only work for mode "Selected Viewport"

#

i'm talking about the poped up window

lost tinsel
#

I wrote "slomo 0.1" and works for all windows

twin juniper
#

thanks

rich cairn
upbeat basin
lost tinsel
earnest ocean
#

Does anyone else have that strange behavior, that when you fresh start the UE Editor and imidiatly start with 2 players it just freezes with no output whatsoever? Even when I'm debugging in Rider I get nothing at all

twin juniper
#

Does server and client have a delay when testing on the same machine?

#

If there is, how long is it approximately? Like 0.1s, 0.2s?

thin stratus
thin stratus
#

.2 would be 200ms. Which is across the ocean

twin juniper
#

Ok guys i actually figure it out after 5 mins posting here (worked on it for like 5 hours straight). Damn posting here is like a mass buff of luck or something.

#

Turned out the attack animation is the only one with Root motion enable so it worked, the other don't. I still don't understand but it is what it is.

lost tinsel
glacial zealot
#

Any idea why on my animation it doesnt update the variables on client? I set them to replicate since the server only have the controller of the ai... the is following is a basic one on AIController and works on server

lost tinsel
#

I'm using a transition map and I set it inside the Project Settings and also made sure that bUseSeamlessTravel is set to true, but if I try to load a level, it doesn't actually use that map (with ServerTravel), but all I get is a freeze for 2/3 seconds and then the loaded map

mystic estuary
lost tinsel
#

fixed, I forgot I switched the GameMode in the world settings to the default one

dark edge
heady copper
#

hello c++ developer here

#

making an enquiry on best practice to implement a voice chat...am using a plugin and can seem to get it working ,it stated if seamless travel is used ll controllers should be gotteen and each voice chat actor should be spawn for each controller did that anf notihing

#

any one with experience on this plugin?

lucid badger
#

I'm getting a nullptr from

UGameplayStatics::GetPlayerController(this, 0);

Does the client potentially start receiving actors before it even has a playercontroller? Thinkge

inner reef
#

@lucid badger I've experienced problems in the past with Pawns not having all their controller info initialized on the first frame. Most people seem to get around this by putting all their player-controller logic behind a timer with a small delay, which gives everything a chance to initialize before getting/setting player controller data.

#

Your player controller should always exist on the client whenever a game begins, but the possession of pawns happens on the server, and that takes time to replicate over to clients.

lucid badger
#

For some reason the 1-frame-delay strategy gives me the heebie jeebies. But I can just have the two parts check for the presence of the other, so that whichever one arrives last executes the init code

flat night
#

hey guys, I have an issue I cannot seem to resolve
My game uses a single topdown camera, like Overcooked, so I want when players join to use that camera. Initially when I tried that, the Server was working fine (the camera is set to Auto Activate for Player 0), but all the other actors would spawn a camera (I think?) inside the Character (like the image).
So I found out this function in GameMode: HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer), that I used then to do:
if (SharedCameraActor) { NewPlayer->SetViewTarget(SharedCameraActor); }
with SharedCameraActor being the only camera that I get in the level during InitGameState() and that made the rest of the players use the camera(I also do this on each controller bAutoManageActiveCameraTarget = false;). The issue is that right now, when the game starts and a Client joins, at first they spawn at 0,0,0 location without a character or anything, and then they start using that camera. And I do not know when this actually happens. I made a long delay of 10 seconds in the GameMode, so that each Client has time to start using the camera, but I would like a more controlled approach, so that either they immediately use that camera, or there's a way to let me know when they start using that camera, so I can start the game then(rather than an arbitrary timer). I don't know if anyone has experience with that type of game.

crisp shard
#

when activating/ deactiviing say a niagara particle FX component* in multiplayer, would you need to activate and deactive on the server? this would only be for visual effects but not sure if it would work doing a multicast or anything like that to show/hide it w a activate/deactive

spiral crystal
crisp shard
#

in short, do components need to be activated on server? and then visibility can be set to visible or sometihng?

flat night
spiral crystal
# flat night Sorry, can you explain a bit more?

This is how i'm doing it
So you could make a call newPlayer->SetViewport(YourSharedCamera) after possesing the pawn

However, this will probably not fix your issue of the static screen, especially in debug. But this should be fine in test / shipping.

#

I have the same issue of this limbo camera view when joining while being in debug, but it's fine in test and shipping

#

Not saying its the correct way though, but this works for me 😂

flat night
jolly delta
#

Hello I'm facing a weird behaviour is someone can help me ?

I'm using a gamemode that inherit from gamemodebase --> my field begin played are rightly fired on both clients and server
but if i am using gamemode parent class, this event is only fired on server. Any idea of why ?

torpid lantern
#

Any recommendations for an in-game chat SDK on a dedicated server? Or does Unreal have something out of the box that would scale well with user count?

spiral crystal
flat night
#

That still might not solve the actual issue. The thing is that I am wondering if there's a way to get a callback when a new player has possessed a camera.
I am wondering if using an Interface with the Camera in the game would help with something like that. So that when the player possesses the camera, I get a notification

dark edge
jolly delta
dark edge
#

What's that got to do with the game mode then? What is the actual problem?

#

One thing to note tho, you need to match your game mode and game state

#

Both need to be base or not. Can't mix gamemodebase and GameState or gamemode and gamestatebase

jolly delta
fair latch
#

Using delay is not really a fix imo

sweet sage
#

Do bAllowPhysicsRotationDuringAnimRootMotion works on multiplayer games? can it breaks simulated proxies movement?

#

How is the rotation computed for simulated proxies? during root motion

#
Replication Consistency:
Enabling physics rotation during root motion can introduce subtle variations in character rotation across clients due to physics calculations not being fully deterministic.
This might lead to visual inconsistencies, especially with fast movements or complex animations.

Is that true?

#

Simulated proxies are rubberbanding but not the player itself or server character

#

bAllowPhysicsRotationDuringAnimRootMotion is always true

#

Are not rotations replicated directly to simulated proxies at any tick?

#

Or will it compute its own rotation using ComputeOrientToMovementRotation?

flat night
# fair latch I have a loading screen system in place. The loading screen will only be removed...

But do you use Matchstates? Because I guess that's where one of my issues comes from that currently I switch the match state to InProgress when the required players join, and that state spawns all the characters, so it's a bit late.
Or I guess maybe I can try switching the match state to InProgress, the players will spawn, the possession will happen and then the actual match can begin 🤔

jolly delta
#

Okey i found why, when using game mode you should use player state and not base one

fair latch
#

You can call your set view target with blend there too i suppose?

#

The match can begin when all players connect and ready

sweet sage
#
if (GetMesh()->GetAnimInstance() && GetLocalRole() == ROLE_SimulatedProxy)
    {
        GetMesh()->GetAnimInstance()->SetRootMotionMode(ERootMotionMode::Type::IgnoreRootMotion);
    }

This fixes my issues

sweet sage
#
    if (GetMesh()->GetAnimInstance() && GetLocalRole() == ROLE_SimulatedProxy)
    {
        GetMesh()->GetAnimInstance()->SetRootMotionMode(ERootMotionMode::Type::IgnoreRootMotion);
    }
    else
    { 
        GetMesh()->GetAnimInstance()->SetRootMotionMode(ERootMotionMode::Type::RootMotionFromMontagesOnly);
    }

Final fix is this is weird why it is not the default behaviour

spice gorge
#

What's the concept behind Absolute when in the Open Level call? I see in the code it mentions whether it selects TRAVEL_Absolute or TRAVEL_Relative based url.
In a video by Epic the host mentioned that you should always set it to true, though didn't give much of a reason why outside of efficiency.
However in my experience it breaks seamless travel in a multiplayer game.
Is seamless travel a time when you shouldn't be using this?

wanton bear
#

does anyone have any advice for this

#

currently have it set up to sync based on the time between the first client and second clients shooting time

flat night
# fair latch I didnt touch match states and just simply keep the loading screen on the viewpo...

yeah, but having a valid pawn happens during InProgress is what I am saying I guess. Because currently I have MatchWaitingToStart and when players reach 2 numbers, it goes to InProgress, the pawns spawn and the game runs. So it does need to go to InProgress, I just need to delay the actual players being able to start playing when the pawns spawn and are a valid. So I will try what you suggested with Aplayercontroller::acknowledgepossesion and see if that works
Thanks!

fluid summit
#

Hi!

Does anyone know if it's possible to turn on/off replication of some properties?

I have some properties that are only used on server side for stat calculation, but when the player opens some UI, i want him to be able to see those properties at their updated value, and when they close the UI stop replicating to save bandwith

sweet sage
fluid summit
#

thanks!

final holly
#

how can i send rpc to server from ui

#

i know widgets only exist on the client

#

But do I always have to create all the RPCs that I want to run on the server within the player class? How do I proceed when I want to make changes to an actor belonging to the server via the UI?

spice gorge
final holly
#

because my interaction RPC works fine this way.

#

I have an actor called Generator, by interacting with this actor I affect another actor on the server. Example: Turn on the lights, but I cannot do this through the generator's UI. Is it right to write RPC in the Player class for a function belonging to the generator?

#

Or I want to increase the value of an actor on the server side via the UI, do I have to make this dependent on the player class?

#

I wrote too much sorry about that

spice gorge
final holly
#

Actually, if I have to explain what I want simply: I open a widget with the client player, I click a button on this widget, and the value in an actor on the server side increases.

#

Do I need to send all RPCs from the player class? I want to understand the logic of this?

mystic estuary
final holly
mystic estuary
final holly
#

Wouldn't all actors depend on the player class?

mystic estuary
#

What do you mean? Do you mean 500 different instances of a certain actor or 500 totally different actors? Also do you mean "character" or "pawn"? If so, as long as you're using the same player controller for your character it's going to be the very same RPC

final holly
#

500 totally different actors

mystic estuary
#

All right. Is it just an actor that is unrelated to the player? Like a wall or anything really

final holly
# mystic estuary All right. Is it just an actor that is unrelated to the player? Like a wall or a...

For example, we have a generator class, that is, it is an actor, that is, it inherits from the actor class and is physically present at the level map. and I created a special widget for this generator actor and I run the functions in the generator class through this widget.Let's say I have another phone actor and I have a special phone widget for it, and I run a function within the phone actor with this phone widget.In order to run these functions within each actor's widget, do I need to define an RPC in the Player class and then call these RPCs from the widgets?

mystic estuary
#

If you need to do anything server related with the generator or the phone then yeah, you do need to create a server RPC that you'd call by pressing the button. Maybe I'm getting you a bit wrong, but as I understand the generator and the phone are totally different actors, and they do not share any common functionality

mystic estuary
#

Yeah, you would need to create an RPC for OpenLight, OpenDoor, CallSomeone, PhoneLight (?) separately. One thing that I forgot to mention is that the RPC has to take the object you're interacting with.

Depending on the design you might bring all these objects under one single interface called Interactable or something, which under the hood would do a specific action -- OpenLight, OpenDoor etc. In that case you would need one single RPC instead of N, where N is the amount of available interactions.

There are different approach to that, and you might want to go one way or another depending on your particular project.

final holly
ashen plume
#

setting net mode to "play as client" and moving a replicated actor in the editor moves it on the other client too, shouldnt this not happen since neither are the server?

#

net mode stuff is so janky to me

thorn turtle
#

I have flashlights as separate actors in my game, they turn on and off when the player left clicks however the issue I'm having it responds to ANY player left clicking even if they aren't holding anything or they are holding a different flashlight, can somebody please help

mystic estuary
mystic estuary
mystic estuary
neat prism
#

Hey everyone, I have a bit of a common issue and I'm looking for some best practices:

I have a multiplayer game where my clients are using AddForce or AddImpulse to fight gravity and hover like a helicopter / jetpack. I'm getting some awkward server-client correction jitters that I just can't seem to smooth out.

I have a server RPC (that works) which is making the jetpack "thruster" fire an addforce (or addimpulse depending on what I am testing). I figured if the server is the one handling the RPC call, the client should just assume the position through replication.. but the jitter says otherwise. The force being applied is calculated correctly neutral hover

Any recommendations would be helpful. Hope I explained my issue well.

twin juniper
#

wtf happened?

stoic lake
neat prism
#

Just checked it out, looks promising

stoic lake
magic helm
#

Hello, is there a secret UE function I can call for reliable/unreliable RPC's from Server to Simulated Proxy? Before somebody suggests just doing multicast and then adding a gate for sim proxies only, I'm not asking for design help. Mainly asking for this one specific thing if anybody knows of it

fossil spoke
#

Do you mean you only want to send an RPC to a specific connection?

magic helm
fossil spoke
#

That doesnt make sense, all Actors (except NetOwningConnection Actors) will be Simulated Proxies

magic helm
#

What part doesn't make sense? There's a multicast that includes the owning client connection... why shouldn't there be an option to just not send it to that connection?

#

Unless Im missing something and need to dig into the net driver stuff more?

fossil spoke
#

Your usage of the Term Simulated Proxies in this context isnt making sense from what you are asking to achieve.

#

If you want an RPC only to a single connection, you must send it via the PlayerController.

#

The PlayerController embodies the actual connection to a single Client

#

So if you want an RPC to all other Clients, except one, you need to send an RPC to each PlayerController except the one you dont want.

magic helm
#

Yes Im aware of that, and I would be calling this on an actor that has an owning client connection that is connected to the player controller

magic helm
fossil spoke
#

Well out of the box thats your only option.

magic helm
#

think3d gonna keep investigating... because there's no way I cant just push my own packet across to the remote machine's and do it the same way that normal multicast does it while skipping the owning client connection...

#

Like I totally understand if its requiring more lower level engine calls and stuff that would scare most people but still...

fossil spoke
#

@magic helm Look into UNetDriver::ProcessRemoteFunction

#

The unfortunate reality is that an Actor making an RPC must have a NetOwningConnection owner.

magic helm
neat prism
#

worth every penny and more

#

I see it is causing a bit of goofiness in my other replicated pieces but I'll dig my way out of those holes

lucid badger
#

I have actors to represent items that have been dropped on the ground. I've got everything working in MP except this last quirk:

ItemActors that are loaded with the map are not replicating position even though they are replicating properties Thinkge

#

Meanwhile ItemActors that are spawned later replicate both Hmmge

#

Is there something unique you have to do for actors that load with the map to sync movement correctly? Thinkge

#

Spawned later meaning, if you drop an item from your inventory, the actor that is spawned by code replicates properly

#

Yeah hmm, if I put them in the air a bit, server loads, items fall to ground, then client loads in and items start in the air still Thinkge

fossil spoke
#

@lucid badger Are those items set to Replicate at all?

lucid badger
#

Yea

#

And movement

#

And always relevant

fossil spoke
#

Is bNetLoadOnClient set to true?

lucid badger
#

The ones that spawn after map loads all sync fully

#

Probably not what's that 🙂

#

Will try heh

fossil spoke
#

It should be enabled by default

#

So unless you specifically disabled it its probably fine

lucid badger
#

Yeah it's true

#

So if I load in and drop an item before the client joins, THAT actor will also sync correctly

#

It seems to be specifically that the map-loaded ones are desyncing movement somehow Thinkge

fossil spoke
#

Desyncing in that they dont do anything on the Client?

#

But the Server sees them working fine?

lucid badger
#

Positions don't match

#

All other behavior is normal

#

They carry a Guid value that replicates, and that is working even when movement isn't

#

ONLY position is desyncing Thinkge

fossil spoke
#

Do they start out at the correct position?

lucid badger
#

No, they start in their 'original' positions as defined in the map

fossil spoke
#

Thats what I mean

lucid badger
#

Err, what I mean is, I have 4 items all spawn on top of each other midair so they scatter a bit with collision. When server loads, they fall to the ground, and when client loads, they are in teh air again and fall differently

fossil spoke
#

Oh

#

So they do move on the Client

#

They are just not in sync with the Server

lucid badger
#

Yes but desynced

#

Yea

fossil spoke
#

Yeah well thats just because Physics in UE is not deterministic

lucid badger
#

And I can pick them up and tehn if I drop again (which spawns a new actor) that will be working perfectly

dire cradle
#

Is the item "mesh" the root component?

fossil spoke
#

Meaning you will get different results from Physics interactions on Client and Server for the same Actor

lucid badger
fossil spoke
#

How high is your NetUpdateFrequency?

lucid badger
#

Okay so that's why I was getting confused. It APPEARED that the ones dropped after were syncing but they just aren't being subjected to something as random as spawning 1:1 with other colliders and pushing out

#

NONE are syncing position

#

On the ITemActor it's just default

fossil spoke
lucid badger
#

Thinkge but it seems like it never snaps to the correct spot

fossil spoke
#

If you are using Physics to move the Actor, then the Client can still change inbetween updates

lucid badger
#

Okay lemme crank frequ

dire cradle
#

On item's begin play, check for authority and if client turn off physics on the mesh. You need to simulate physics only on the server, then update transform on clients via multicast

lucid badger
fossil spoke
#

You shouldnt need a multicast at all

#

Rep Movement should be fine

dire cradle
#

Replicate movement should work if the simulate physics is turned off on clients

lucid badger
#

Ahh

#

Okay let's see

fossil spoke
#

Assuming your NetUpdateFrequency is high enough

lucid badger
#

Even without turning off phys on client?

fossil spoke
#

But you want to be careful with that

lucid badger
#

It's at default 100

fossil spoke
#

Default should be enough

dire cradle
fossil spoke
#

So something else must be going on.

lucid badger
#

Yeah I don't need it to correct that frequently I just don't want items getting crazy far from each other

#

Root component is a "DefaultSceneRoot"

#

Should I put the mesh there instead? Thinkge

dire cradle
#

Yes.

fossil spoke
#

You need the Mesh to be root

lucid badger
#

Ok that alone fixed it

#

Frequency unchanged, client physics unchanged, when client joins now they are just on the floor already

fossil spoke
#

You probably would want to disable physics on the Client if the Server is managing it