#multiplayer

1 messages Β· Page 648 of 1

torn bane
#

I know im frustrated now im sorry

fading birch
#

I didn't take offense

#

it's all part of the troubleshooting process

#

what could be happening, and happens to me is your ISP could be blocking the ports

#

or theirs is

torn bane
#

I had to ask that i need to open some ports

twin juniper
#

The best action right now is to take a break. Sometimes, fresh air can relax your mind, to a point you start to see whats wrong with your code

fading birch
#

i don't think their code is the issue

#

if it works locally 100%

#

on 2 pcs

#

with 2 steam accounts

#

the code is fine

twin juniper
#

I would say NAT, but he's seeing the session

#

hummm

torn bane
#

Yea that"s wierd

twin juniper
#

Are you specifying any ports? Are the ports open?

fading birch
#

that's run entirely through the Steam OSS

#

Can you do a mobile hot spot?

#

and test from your phone wifi

#

to yourself

twin juniper
# fading birch that's run entirely through the Steam OSS

It was a quickly idea that I had, I know its used to redirect the connection request to the correct device inside a network XD. Also, I was thinking about connectivity issues he could have based on the NAT type, if is open or strict... If the NAT of the network where the hosting machine is located is strict, his friend could have connectivity issues, more lag, etc... I don't know how the Steam OSS deals with it

torn bane
#

I havent changed anything, i mean idk API of adbbanced steam sessions, maybe i can search for ports informations in thier site

#

Thanks a lot guys I will write when I find the solution

sharp hornet
#

If it's a NAT problem make sure to try the SteamSockets plugin, it's not on by default

#

Although I don't know how SteamSockets works in LAN mode, I've never had to use it as I would just use the normal public networking unless you're seriously bandwidth limited. If you're doing LAN for real you probably need to turn off steam networking entirely and fall back to the manual ip/port joining which bypasses sessions entirely

wise bridge
#

Like that? But it don't get the same effect at all, it's shown on the player screen not above the player

#

I don't know the right way to create / destroy an widget on an object

karmic sparrow
#

Wait. I made a mistake. Use an actor with a widget, not a widget component. That way the client has to spawn the actor, then attach the actor to the target.

#

It depends on what you're going for really. Having the client spawn the actor with the widget, then attaching it to the target will allow the widget to be shown in either screen space or world space on that object. Since the client is the one who spawned the actor, that actor and its widget will be visible to the client.

#

With that method, the widget does not need to be added to the viewport since it's part of the actor you attached to the target. If that makes sense.

wise bridge
#

The actor can't spawn the object

karmic sparrow
#

Have it spawn from the player controller.

wise bridge
#

When you tell me to use widget instead of widget component, it's the same thing no? When I type widget I got that, and when I pass my cursor on it after it say widget component

wise bridge
karmic sparrow
#

Yeah do that. Just make an actor with a widget as a component, vs using widgetcomponent bp. That's the distinction I was trying to make between the two.

#

So the widget elements need to be visible at spawn, or just when the player looks/interacts?

wise bridge
#

Only when the player looks interacts

#

And it's a multiplayer game, and the server see what the client is looking

karmic sparrow
#

The client can still spawn actors and attach them to objects that were spawned by the game mode. The actors that the client spawned and attached would be owned by the client.

wise bridge
#

But that mean that each time a player look for something, I should hide the object only from his eyes, spawn a new one at the exact same location with an UI?

karmic sparrow
#

Hmm

#

If the player is looking straight at something or interacts with it, that would be a good time to spawn + attach the actor that displays the widget, then when the interaction is done, the actor with the widget destroys itself.

#

At least that's how I would approach it.

wise bridge
#

Oh I guess I got it

wise bridge
#

Ok so it almost work, I got this warning and for one frame a new item state can be shown to the server sometimes, or it cancel the shown one of the server if the client is looking it @karmic sparrow

karmic sparrow
#

Client interacts with target actor --> Client spawns new actor with widget --> Client attaches actor with widget to target actor.

#

This should work from the player controller

wise bridge
#

I didn't spawned a new actor, might be why, gonna try this tommorow

summer spade
#

I spawn a replicated projectile from a client then it spawns on all the clients and the server but it is spawned twice in the client which spawned it first so what should I do so that the original client not have two projectile

hollow eagle
#

@summer spade to answer your question in the correct channel...
You can spawn a "fake" projectile on the client, then when the client receives the real one from the server interpolate it to the position of the server's and then delete it.

#

so you'd really have two projectiles - the fake one the client spawns, and the real one replicated from the server. The client's only exists until a bit after the server's does.

#

this is the basics of how network prediction works... which isn't a simple task to get right, but this is the gist of what you need to do.

hoary lark
#

is that a "real" solution? that doesn't seem like it would work at all

hollow eagle
#

sure it is

#

why wouldn't it work?

hoary lark
#

i mean i guess it would work for like a bowling ball

#

it wouldn't work at all for a "real world" shooter

hollow eagle
#

for a projectile based one it would

#

which is the point

#

if the time the projectile takes is longer than the roundtrip latency then you just immediately delete the server's projectile when it gets received on the client.

#

ostensibly the client's fake projectile would have already played out the same effect

hoary lark
#

the projectile would warp way back and play out something completely different

hollow eagle
#

right, which is why you wouldn't immediately delete the fake projectile on the client, nor would you immediately make the real one visible. To do everything correctly you'd interpolate the fake projectile's movement (but also have to account for server -> client latency, so there will be some extrapolation too).

hoary lark
#

why bother then though?

hollow eagle
#

because if you don't spawn a fake projectile you end up with laggy shooting. And if the projectile isn't fast enough to beat the round-trip time then you still need to correct for errors.

hoary lark
#

just let the predicted projectile play out.

hollow eagle
#

Sure, if it matches what the server sees. That's why CMC's prediction system has a range in which it won't correct.

#

If the projectile is too fast to notice anyway then yeah this is somewhat pointless - just spawn a fake projectile and ignore the server's replicated one.

#

But if it's not super fast (a grenade would be an important use-case for this since it has a long lifetime) then you'd need to go through all of this for things to look correct.

hoary lark
#

yeah, I can buy that. I doubt there is any decent game in existence that would do this for e.g. a sniper bullet

hollow eagle
#

Battlefield or arma with very large maps maybe

#

an RPG in something like that would also probably need this, since if the client is sufficiently off on a large map the explosion of the hit would be in a completely different spot

hoary lark
#

yeah, it's the old "pick your poison"

dull lance
#

Battlefield doesn't really do that [resyncing] [at least not before Bf1]

hoary lark
#

explosives are such high value events in those games (and usually slower) so it's worth correcting, but bullets, it'd be worse

hollow eagle
#

Yeah I agree that bullets are unlikely

hoary lark
#

so the TLDR is I should have said "what kind of projectile are you actually dealing with @summer spade " edboy

summer spade
#

It is like a spell

dull lance
#

so a slow speed projectile?

summer spade
#

Yeah

hollow eagle
#

If it's slow, then you probably need to go through all the stuff I said. Though I'd start with just spawning a fake projectile on the client and not resyncing it with the server yet - get that to work first.

summer spade
#

Ok

hollow eagle
#

So spawn a projectile on the client, also spawn one on the server, and come up with a way to ignore the server's projectile (/delete it) on the client that fired the projectile.

#

see if that's good enough for now. If it isn't, then you get into the complex interpolation stuff.

hoary lark
#

I think the simplest (and least robust) solution is something like 1) spawn it locally on the client "shooting", 2) spawn a non-replicated one on the server, 3) broadcast an RPC from the server to spawn local ones on all other clients, but ignore it on or don't broadcast to the shooting client. let each client just play their own FX, usually they will match what the server does by luck. damage can either be applied by the server instance or RPC'd up by the shooting client if cheating isn't a concern. if this simple solution doesn't play out well enough due to your game's dynamics then I'd probably immediately switch into doing everything else siliex described

sand crown
#

Hey I'm using Advanced sessions etc, And trying to make a simple Players list, to show the current players in the online session. I'm trying to call them through an Array PlayerStates / GameState etc, I have done this in the widget for the current online players, But It seems to be just calling the same client name etc for both. It seems to be getting that there is 2 clients connected, but in the list it is listing the same client name twice for both clients. And only shows the Clients name who is looking at the player list, shows 2 of the clients name.. can anyone think of what might be causing this ? ? Any hints be great. Thanks.

twin juniper
#

Can we make RPC inside dataasset ?

thin stratus
#

No

#

@sand crown need your code to be able to see what's wrong

sand crown
#

here's my open player list widget

#

the Online Player Widget

#

what else you need ?

thin stratus
#

The second image is pretty cursed

#

Replicated variable inside of widgets are redudant

#

And you are getting PlayerController 0

#

Which is the local player

#

So no wonder you see the same player twice

#

You arr already calling set player name

#

Why the code in thr online player widget?

#

@sand crown

#

Also your code will break once the delay in your first image is not long enough

sand crown
#

idk followed some stupid tutorial once, was the only thing i could find at the time on making a simple player list, it worked for him, but not for me and now can't even find the tutorial or any other

fading birch
#

you already have the player state

thin stratus
#

I only know about epics tutorial which is garbage

fading birch
#

you can get the name from either the session info

#

and set it in the player state

thin stratus
#

SessionInfo in bps?!

#

It's enough to just set it when creating the widget

sand crown
#

can you by any chance put an example together with a few images ?

thin stratus
#

I'm not on my pc, so sadly not

#

Remove the code that is in your second image

#

That should already improved things

#

In your first image you are setting the player name

#

That should be enough

sand crown
#

then the create widget won't be calling anything in the first image yeah ?

thin stratus
#

First image can stay

fading birch
thin stratus
#

Second image breaks it

sand crown
#

@fading birch are you saying to call it in the playerState Event graph ?

thin stratus
#

Don't get confused

sand crown
#

im always confused lol

thin stratus
#

Just remove the code from the second image

#

And try again

sand crown
#

what do i do with the create widget in the first image tho ?

#

just leasve it

#

?

thin stratus
#

Yeah leave it. You are creating the widget, settung the PlayerName and then adding it to the list, so that's fine

sand crown
#

ok will try

thin stratus
#

Only thing that i don't know is is how that set playername function is looking like

#

Cause you didn't post that

fading birch
#

that's what I meant by setting it in the player state

#

not sure if you can do that via BP tho

thin stratus
#

Not sure what you mean

#

The Playerstate already has a PlayerName

#

They already use it in their first image

#

That's all fine

sand crown
#

removing first image code not work,, now just says player name twice.. not getting the separate desktop client info or steam names now.

fading birch
thin stratus
#

It is

#

It's set in every OS usually

thin stratus
#

Not first

#

Also what does SetPlayerName look like?

sand crown
#

sorry yeah was the second image

fading birch
#

@sand crown I just realized I have the exact BP setup you're looking for

#

so. This is my lobby list widget

#

it's responsible for creating the actually lobby list, and creates a widget for each player by looping through the player state array from the game state

#

When the widget is constructed, I bind a delegate, which is called after a player joins my lobby

#

that then calls this function, which creates a lobby player widget, which contains info about the player:

#

open the original for it to be readable ^

#

here's what it looks like in action:

#

In code I am setting the player name: c if(IOnlineSubsystem* Subsystem = Online::GetSubsystem(this->GetWorld())) { if(IOnlineUserPtr UserPtr = Subsystem->GetUserInterface()) { NewPlayer->PlayerState->SetPlayerName(UserPtr->GetUserInfo(0, *UniqueNetId)->GetDisplayName()); } }

#

@thin stratus i looked through the engine, and I don't think that the OSS sets that at all. You have to get it from the online subsystem

#

which I don't think you can do in BP at all

sand crown
#

ah well will see what i can do. if not I'll have to scrap it

thin stratus
#

It's not true

#

The PlayerName is set by the engine

#

You don't need the oss

#

You don't need cpp either

#

My lobby kit on the Marketplace is BP only

#

@sand crown are you even using that name variable?

#

I only see you setting it

#

Is it used in a binding?

#

If not either bind it or additionally call SetText on the PlayerName text

#
FString ULocalPlayer::GetNickname() const
{
    UWorld* World = GetWorld();
    if (World != NULL)
    {
        // Try to get platform identity first
        FString PlatformNickname;
        if (UOnlineEngineInterface::Get()->GetPlayerPlatformNickname(World, ControllerId, PlatformNickname))
        {
            return PlatformNickname;
        }

        auto UniqueId = GetPreferredUniqueNetId();
        if (UniqueId.IsValid())
        {
            return UOnlineEngineInterface::Get()->GetPlayerNickname(World, *UniqueId);
        }
    }

    return TEXT("");
}
#

@fading birch

fading birch
#

ah ty

#

I was looking for that

#

learned how the engine handles from ack handshake -> spawning player though

#

xD

#

went down a rabbit hole

thin stratus
#
// Send the player nickname if available
FString OverrideName = LocalPlayer->GetNickname();
if (OverrideName.Len() > 0)
{
    PartialURL.AddOption(*FString::Printf(TEXT("Name=%s"), *OverrideName));
}
fading birch
#

yeah, the options get parsed by the game mode

#

among other classes/functions

thin stratus
#
FString UOnlineEngineInterfaceImpl::GetPlayerNickname(UWorld* World, const FUniqueNetId& UniqueId)
{
    IOnlineIdentityPtr IdentityInt = Online::GetIdentityInterface(World, UniqueId.GetType());
    if (IdentityInt.IsValid())
    {    
        return IdentityInt->GetPlayerNickname(UniqueId);
    }

    static FString InvalidName(TEXT("InvalidOSSUser"));
    return InvalidName;
}
fading birch
#

I don't generally use listen servers, so i'm a bit lost on how to accomplish this. I want to change the value of an uint8 in my player state. The value is stored as an on rep. I have 2 sets of functions. 1 is a normal function, the other is a server function updates the variable and calls the onrep for it. Nothing appears to happen though.

thin stratus
#

ListenServer and DedicatedServer are no different in terms of Replication

#

I would breakpoint and check if your code even calls

fading birch
#

relevant code:
.h

    UFUNCTION(BlueprintCallable)
    void SetTeamColor(ESquishyColour NewTeamColor);

    UFUNCTION(Server, WithValidation, Reliable)
    void ServerSetTeamColor(const ESquishyColour& NewTeamColor);

    UFUNCTION()
    virtual void OnRep_TeamColor();

    UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_TeamColor)
    ESquishyColour TeamColor;```

.cpp
```c

void ASquishyPlayerState::SetTeamColor(ESquishyColour NewTeamColor)
{
    ServerSetTeamColor_Implementation(NewTeamColor);
}

void ASquishyPlayerState::ServerSetTeamColor_Implementation(const ESquishyColour& NewTeamColor)
{
    TeamColor = NewTeamColor;
    OnRep_TeamColor();
    ForceNetUpdate();
}

bool ASquishyPlayerState::ServerSetTeamColor_Validate(const ESquishyColour& NewTeamColor)
{
    return true;
}

void ASquishyPlayerState::OnRep_TeamColor()
{
    if(ASquishyCharacter* SquishyCharacter = Cast<ASquishyCharacter>(GetPawn()))
    {
        SquishyCharacter->SetEnumSquishyColor(TeamColor);
    }
}```
#

that was my plan, then I got side tracked digging through the engine lol

thin stratus
#

Please Review the RPC

#

Or rather

#

The normal call

#

And what you do in it

#

@fading birch

fading birch
#

oh

#

duh

thin stratus
#

Also

#

You might run into a classic race condition with this

#

Unless your Character also queries the Color

#

If you have no character on the client at that point, it would never get the color

fading birch
#

oh don't worry about that

#

that's for later handling

#

we have a bunch of NPCs that follow the player around and change their color to match the player that controls them

thin stratus
#

Just saying

#

I had to implement my fair share of customization systems

#

And it's easy to forget

fading birch
#

Ah I see

#

I'll likely just grab it from the begin play or post init components

thin stratus
#

In the Character?

fading birch
#

yes

thin stratus
#

In the Player Character or follower?

fading birch
#

both inherit from the same base

thin stratus
#

Well

#

Player Character has no PlayerState until possessed

fading birch
#

ah

thin stratus
#

So beginPlay and Post Init both won't work

#

You need to use OnRep_PlayerState

fading birch
#

that's a very good point

#

yes

thin stratus
#

And your Follower won't have that

fading birch
#

no it won't

thin stratus
#

So that needs a custom OwnerPlayerState

fading birch
#

but it has the owner

#

yeah, i've already set that up actually

thin stratus
#

Yeah but Owner is Controller or Character

#

Doesn't mean the PlayerState replicated yet

#

Best and cleanest would be an OnRep PlayerState variable of the "owner"

fading birch
#

the player can't control the minions until they walk up to them

#

so at that point the PS will be valid

#

or at least should be

thin stratus
#

Fair enough

fading birch
#

also they're absolutely adorable

thin stratus
#

What about other clients that join

#

And the Followers already exist

#

But the new Client has the PlayerState not yet replicated of the other player

#

(i hate multiplayer as much as I love it)

fading birch
#

so the NPCs are actually spawned by each player

#

by spending goo (blue stuff on the UI there)

#

and can only be done on at their base

#

or a base they take over

thin stratus
#

Alright, well just making sure you think about all of this. It's annoying to figure out when suddenly a player sees the wrong color

fading birch
#

oh believe me

#

that's what started this whole damn mess

#

xD

thin stratus
fading birch
#

mmhmm

woeful ferry
#

Hi,

We're making a survival co-op experience. When saving multiplayer sessions, would it be easier for the local player to save its characters content (inventory et.c.) and tell that to the server what the player had when joining the session with matching ID, or let the server save all the characters content?

manic terrace
#

I am using the GameState and trying to use the PlayerArray at the start of the game. But it is null. I guess it hasn't yet been set by unreal. I tried at BeginPlay() and at PostInitializeComponents() but it's an empty array. What function can I override so that the PlayerArray is set? I want to some set some stuff at the start of the game in the GameState.

woeful ferry
#

@manic terrace Cheating is not a huge issue in this case, since it would just ruin for your friends experience. It's a co-op experience, but I get what you mean πŸ˜„

#

Thank you for the input

stoic ore
woeful ferry
#

@stoic ore No, it's co-op or singleplayer and no couch co-op.

Anyways, I'll elaborate more this afternoon. It's lunchtime for us at the studio.

meager fable
#

Hi, I want to stream levels independently for server and clients this works unless a listen server walks into the trigger, then it loads the level for everyone

cobalt apex
#

hi, I haven't been able to connect the plugin to the server side for a week, please tell me how to do this? the "Water"plugin. when I start the server, it requires me to install it, but I do not know what I need to write ((((I really ask you!

foggy wave
#

hi guys , after many builds and testing of my game suddenly the client that joins the host lags very much when he moves like a tremble and when he pick up an item the item doesnt get destroyed, he keeps adding the item

cobalt apex
foggy wave
#

maybe a loop causing that lag

cobalt apex
foggy wave
cobalt apex
#

a very strange event

foggy wave
#

and it didnt always happen

cobalt apex
#

maybe there are problems with the Internet?

foggy wave
#

nah i dont think so

#

i tried to connect localy on the built version , it doesnt lag that much but the bug with the items still happening

sand crown
#

@fading birch @thin stratus I had no luck with players list, just keeps calling 2 of the same name.. thanks anyways.

manic terrace
#

bIsDead = true; if(bIsDead) { UKismetSystemLibrary::PrintString(GetWorld(), "1", true); } else { UKismetSystemLibrary::PrintString(GetWorld(), "2", true); }

#

I execute this on the server and the 1 gets printed

#

then I am getting that replicated variable in the animation blueprint

#

and it should be going to the dead state and play animation.

#

yea just wanted to test if it was happening because I am getting something weird. The animation doesn't play on the server but it does on the client

#

and when it plays on the client it does play one the server

#

I have no idea what's happening I have a listen server and a client. When the server it to be killed the animation plays on the client and not on the server. And when is supposed to die it dies normally both on the server and the client.

boreal geyser
#

Hey guys so recently I've ran into a strange occurrence. So I changed the scale of my player, but after this, some clients would stop spawning. Their user interface widgets wouldn't even show on screen. However, after I moved my 'player start' objects farther from the ground, all clients finally spawned and had a user interface widget. What do you think happened here?

fading birch
#

it's likely that they weren't able to find a good spawn area since you're player starts weren't in good locations with the new size.

boreal geyser
#

ah that makes sense. Thanks!

fading birch
#

double checked

#

pawns by default have SpawnCollisionHandlingMethod = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding; set

#

which the engine falls back to if you don't override the game mode functions for spawning players

#

or if you don't specify it in your pawn

#

actors however will always spawn regardless by default

#

character's use the same default behavior as pawns

dull lance
heavy marlin
#

Does anyone know if you can conditionally
a) Exclude a component from an actor based on Target (ie. Server), and
b) Choose a different implementation of a component based on Target?

grim rain
#

Hey guys im trying to make a function work in multiplayer but it doesnt work when playing on client, works standalone though. the equip function is a c++ function and i tried to make it run on servcer and multicast but that didnt work, or i probably did it wrong idk. could anyone give me some pointers? any help appreciated πŸ˜„

fossil spoke
#

@hot sage Do not post the same message across multiple channels, read the #rules.

nimble parcelBOT
#

:triangular_flag_on_post: KuShaan_BroSL#0012 received strike 1. As a result, they were muted for 10 minutes.

grizzled flicker
#

functions only run on the server

#

you need to pass through your client-only event to the server by creating a reliable server event

#

then lastly a multi-cast event

#

but you have so much going on there im not rly sure exactly how to help, and thats waat makes multiplayer real fun to code! lol

twin juniper
#

Guys, doesn't own an APawn the PlayerController that have already possessed it? RPCs from the client to a server requires that the client owns the actor where the RPC is being called, and I'm calling my RPC inside the APawn, but the client isn't sending the RPC. EDIT: yes, it does, when the APawn::PossessedBy(AController*) is called, server-side. Since the PlayerController already owns the Pawn, after possessing it, I still don't get it why the RPC sent by the client isn't working, should I do a Multicast, inside the Server RPC scope? ```// Called every frame
void APongGameplayPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

if(!MovementDirection.IsZero())
{
    const FVector NewLocation = GetActorLocation() + MovementDirection * Speed * DeltaTime;

    if(GetNetMode() >= NM_Client)
    {
        GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("ServerRPC called."));
                    
        ServerRPCMoveActor(NewLocation);        
    }
    else
    {
        SetActorLocation(NewLocation);
    }
}

}

bool APongGameplayPawn::ServerRPCMoveActor_Validate(const FVector& Location)
{
return true;

}

void APongGameplayPawn::ServerRPCMoveActor_Implementation(const FVector& Location)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("ServerRPC executed."));

SetActorLocation(Location);

//MULTICAST CALLED HERE?

}```

foggy idol
marsh pine
#

Hello.. I am working with pixelstreaming and I realized that the pixelstreamerinput component is destroyed as soon as the client loads the server's map. Pixelstreaming keeps working, but I cannot connect to it through the (now destroyed) component. Does anyone knows how can I avoid it, so I can use pixelstreaming in a client-server setup ?.. Thanks !!!..

stiff ledge
#

hello guys i am a new unreal dev and i want to practice in multiplayer vr apps. is there any good tutorials that you could recommend to me?

#

i prefer blueprints because i am not good c++ programmer

red lark
#

hi everyone

#

how could I make matchmaking in my game

smoky plinth
stiff ledge
#

???

#

yeah i can see some videos. do you recommend any of those specific? its all the same for vr app?

twin juniper
#

Hello everyone.I gave my player five choices for a character to choose from.Based on his choice i will change skeletal mesh in that way.When i am changing the skeletal mesh i am doing a multicast then it will change across all clients.But if my player joins late then that player character is not updating it's mesh at all.I also tried setting replication for mesh component but it is not working.Plz help me.Thank you.

#

I mean if my player joins late then already existing players are not changing their mesh.

winged badger
#

put a USkeletalMesh* with OnRep

#

and set it from OnRep on clients

#

multicasts are no good if you need to keep state

woeful ferry
#

Hi,

I'm kinda lost on how to solve this problem. We're making a co-op survival experience and when a player joins, they should have had their character variables saved, which is solved.

However, how do I detect which player is who? I've looked into UniqueID in player state, but it seems to change for every session.

steep terrace
#

Hello, everyone~ I have a problem of multiplayer. How can I send Render image to server from client ? Even I use the "Run on server" and "Run on multicast" , the texture of server is empty but client is exist。

bitter oriole
#

You'd need to send the image as a compressed archive

#

Compress to png, send it, decompress and upload to the GPU

split siren
#

Agree with @bitter oriole , but try to minimise that as uploading pngs can be very bandwidth draining.

bitter oriole
#

Yeah obviously this would be for like a player avatar at login

split siren
#

But @steep terrace wants to send it from client via RPC to server and I assume server would then re-distribute it to other clients. Just be aware of the costs associated with those actions.

steep terrace
#

My game is a player(using ipad) drawing in the panel, and the his drawing will upload to the computer.

#

The variable type of Render image is texture. The log said that it is not support when client send to server.

#

it sound like a good idea ! I will try it! Thx a lot ~ πŸ˜†

naive elm
#

about RPC with validation, is the (call)_validate executed on both server and client or just the client?

#

what do you mean just the client not the server? unreal works with server-client model which means the server always knows what happen on each client

#

if you are starting to learn about multiplayer there are some useful links pinned on top right corner in this channel, about your question, you have to check replication boxes on blueprints

#

the one who have to destroy the object have to be the server

thin stratus
#

never ever used it haha. I always returned true

#

There was never a need for it

#

I did however hear that you would actively kick the client if you return false

#

Which I'm not sure if that's true, but if it is, then I don't see a lot of things you can place into that

#

A simple disagree on some ammo value, if the ammo is already replicated, shouldn't kick someone

twin juniper
#

Guys, my second player/client movement is laggy as hell.To make him see the changes made in the server, through a server RPC, I just called a multicast. But the client movement is laggy. Isn't this snippet the way you normally do? I read in another thread that one solution would be call a ForceNetUpdate inside the Tick, but it didn't solve it ```void APongGameplayPawn::MulticastRPCMoveActor_Implementation(const FVector& Location)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("MulticastRPC executed."));

SetActorLocation(Location);

}

// Called every frame
void APongGameplayPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

if(!MovementDirection.IsZero())
{
    const FVector NewLocation = GetActorLocation() + MovementDirection * Speed * DeltaTime;

    if(GetNetMode() >= NM_Client)
    {
        GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("ServerRPC called."));
                    
        ServerRPCMoveActor(NewLocation);        
    }
    else
    {
        SetActorLocation(NewLocation);
    }
}

}

bool APongGameplayPawn::ServerRPCMoveActor_Validate(const FVector& Location)
{
return true;

}

void APongGameplayPawn::ServerRPCMoveActor_Implementation(const FVector& Location)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("ServerRPC executed."));

SetActorLocation(Location);

MulticastRPCMoveActor(Location);

}```

thin stratus
#

Well

#

It's kinda the way

#

But you are lacking all of the movement replication principals

twin juniper
#

Hello Cedric! Could you clarify this point, please?

thin stratus
#

I'm searching for a website to showcase it

#

gimme a few min

twin juniper
#

kk thanks

thin stratus
#

You will see two dots

#

This is a 2D example

#

but doesn't matter

#

It's a Server and 2 Clients

#

You can see the update time on the server (middle)

#

and 3 settings, as well as lag on each client

#

If you have none of the checkboxes turned on, you'll notice how laggy it is

#

That's basically what you have

#

Now there are 3 things

#

Prediction: Means that the Client performs the Action while also telling the Server.
You do that so the Client doesn't have to wait on the Position to be replicated to them again.

#

If you enable that, you'll see that the circle moves faster, but now gets weird corrections

#

That's where Reconciliation comes in.
This makes sure that the client and server communicate which move they are currently handling.
That means when the Client tells the Server to move, it sends a timestamp along

#

As well as the result of the move, so the Server can move and compare, and either accept or correct the movement

#

The correction is what you see if you only enable Prediction

#

Specially when changing directions

#

That's because the replicated location from the movement comes back to the client when they are already miles away

#

Overriding whatever they were doing

#

Reconciliation makes sure that the client knows what update comes in, and then replays all the moves that are older than that update.
So the correction is if at all minimal and the player keeps moving smoothly

#

The Interpolation part is only for the other side, so if you see another client you only get the location update, so you want to interpolate between the last and the location

#

The CharacterMovemnetComponent does all of this for you

#

If you use a Pawn, you'll have to recode this all

#

If the text above is hard to understand, start at the beginning of the website I posted you and read through it

#

This helps a lot to understand what is going on

twin juniper
#

Thanks! πŸ™‚ i need to use the website and read the notes. People in #multiplayer told me, some days ago, to use an ACharacter instead an APawn, but I discovered that I can't change the capsule collision shape without breaking CMC (that would require me to write a custom CMC using a Box component instead, and a capsule collider doesn't fit on a pong paddle), and yesterday they told me to use APawn again. So, I'm cornered: or I rewrite the entire CMC, using a Box component collider, or I code the movement behavior for a Pawn. I'm fucked

fading birch
#

@thin stratus there's a good GDC talk on how overwatch handles their networking that covers what you typed as well. Let me see if I can find it

#

they use a bit of ECS for their networking, which is why the game runs so damn smooth

thin stratus
#

I always try to use the Character

fading birch
#

you can sort of cheat it

#

and have your pong ball react to a certain collision channel

#

change the collision channels on your capsule comp to ignore that

#

and then have a box collision on your paddle that blocks it

#

may be worth a shot @twin juniper

twin juniper
fading birch
#

no i'm saying on your paddle

#

just use a custom collision channel

#

which you can set via your project's properties

manic terrace
#

Is the free steam app id normally that laggy. Or is my code just bad?

fading birch
#

steam has no bearing on latency really

#

outside of creating/finding a session

twin juniper
# fading birch

it worth it a try, but in the case of using an ACharacter, right?

fading birch
#

once you're in game, it's on you

twin juniper
#

thanks

fading birch
#

so you don't need to rewrite the CMC

twin juniper
#

let me think how I would do that, and I will post here later

fading birch
#

give the pins a solid read/watch.

#

Replication is a very basic term for working with multiplayer

manic terrace
fading birch
#

If you're playing locally and you're having lag it's your code. If you're playing online and have lag it could be code and/or your internet.

twin juniper
# thin stratus https://www.gabrielgambetta.com/client-side-prediction-live-demo.html

I guess I will, for learning purpose, to try to code it, since I have found this thread https://forums.unrealengine.com/t/client-prediction-and-server-reconciliation-for-pawn/46658/4, where a guy explained how movement prediction and correction works (in the CMC, I think) in network games using UE:```/*
Here’s how player movement prediction, replication and correction works in network games:

Every tick, the TickComponent() function is called. It figures out the acceleration and rotation change for the frame,
and then calls PerformMovement() (for locally controlled Characters), or ReplicateMoveToServer() (if it’s a network client).

ReplicateMoveToServer() saves the move (in the PendingMove list), calls PerformMovement(), and then replicates the move
to the server by calling the replicated function ServerMove() - passing the movement parameters, the client’s
resultant position, and a timestamp.

ServerMove() is executed on the server. It decodes the movement parameters and causes the appropriate movement
to occur. It then looks at the resulting position and if enough time has passed since the last response, or the
position error is significant enough, the server calls ClientAdjustPosition(), a replicated function.

ClientAdjustPosition() is executed on the client. The client sets its position to the servers version of position,
and sets the bUpdatePosition flag to true.

When TickComponent() is called on the client again, if bUpdatePosition is true, the client will call
ClientUpdatePosition() before calling PerformMovement(). ClientUpdatePosition() replays all the moves in the pending
move list which occurred after the timestamp of the move the server was adjusting.
*/```

#

I will try the @fading birch approach, if something goes wrong. But I guess I can "use/copy/override" the functions above, and try to use them on my custom Pawn?

twin juniper
#

And I was thinking, if I want to follow a movement prediction approach like the one presented in Cedric's link, I should assume that the first step to correct the code I posted above is to ```// Called every frame
void APongGameplayPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

if(!MovementDirection.IsZero())
{
    const FVector NewLocation = GetActorLocation() + MovementDirection * Speed * DeltaTime;

    if(GetNetMode() >= NM_Client)
    {
        GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Orange, TEXT("ServerRPC called."));
                    
        ServerRPCMoveActor(NewLocation);        
    }
    
    //Predicts the movemwent that will be validated in the server
    SetActorLocation(NewLocation);      
}

}```and then I should use GetWorld()->GetDeltaSeconds() value as a Timestamp, to verify and correct the position... To resume it, I must repeat what is in Cedri'cs link and what that guy said (the same thing). How prone to error I would be? XD

thin stratus
#

The Server RPC should have the NewLocation but also the data to actually perform the move

#

And then perform the move and compare what the client said should be correct

twin juniper
#

Thanks for the tip, I will make it work, slowly, but I will: I was reading the Valve article, which was referenced in the link you have posted

#

Also, in the same article, Now, at t = 250, the server says β€œbased on what I’ve seen up to your request #1, your position is x = 11”. Because the server is authoritative, it sets the character position at x = 11. Now let’s assume the client keeps a copy of the requests it sends to the server. Based on the new game state, it knows the server has already processed request #1, so it can discard that copy. But it also knows the server still has to send back the result of processing request #2. So applying client-side prediction again, the client can calculate the β€œpresent” state of the game based on the last authoritative state sent by the server, plus the inputs the server hasn’t processed yet.is the reason behind the CMC PendingMove list usage, I got it. I guess you guys, Unreal Slackers moderators, are saints, tolerating a bunch of guys/gals coming out of nowhere asking things XD

twin juniper
thin stratus
#

For example

agile lotus
#
[2021.07.01-18.37.19:300][646]LogNet: Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Your connection to the host has been lost.
[2021.07.01-18.37.19:300][646]LogNet: NetworkFailure: PendingConnectionFailure, Error: 'Your connection to the host has been lost.'
[2021.07.01-18.37.19:300][646]LogNet: DestroyNamedNetDriver SteamSocketsNetDriver_0 [PendingNetDriver]```
#

Using steam sockets I can't get a client to travel to a listen server map

#

if I use steam subsystem it works fine

agile lotus
#

It appears my client is trying to connect to the wrong map

#

Browse: steam.109775240936920135/Game/Maps/MAP_Startup
but it should say

Browse: steam.109775240936920135/Game/Maps/MAP_MainMenu

twin juniper
kind ember
#

Is there a way to make HTTPS request from PlayFab cloud script?
Seems like it can only do HTTP.

frozen nexus
#

I have a anim montage replication problem. The montage is playing in the wrong direction for clients (its always facing down towards the ground). The base animation sequence used in the montage is using Additive settings (local space) to get the correct direction (in the direciton of character forward vector, works for the server). I am calling PlayAnimMontage() in a OnRep_Method() to tell the clients to play the anim montage. Any ideas to what I am missing here? Thanks!

split siren
#

Just checking, RPCs should not go through if actor is set to Dormant All, am I right?

split siren
#

That sounds more like a legal issue rather than technical one

#

I have no idea, I was just wondering if you are asking a technical or legal question. From technical standpoint, it should be doable. But I guess the safest way would be peer-to-server-to-peer

#

I don't think this is the right channel to ask for legal advice. I believe it is more programming oriented.

#

AWS has very limited free options, none suitable for game server if you are asking that. "Is it good"? Yes? It's a cloud server of spec you pay for..

#

Dunno

woven sinew
#

anyone got problems with session current player count not being updated too ?

warped hearth
#

What is the equivalent of this node in Unreal Engine 5?

shy hill
#

When using the steam online sub system to connect to a listen server, is it normal that by default, the basic character movement replication is not smooth ?

split siren
split siren
# shy hill client viewing moving client

I believe there is a default client side mesh prediction which should be smooth enough.. I tried it just now and looked fine on my end. Can you send a video of it happening?

split siren
#

Paper2D Does not support client-side movement prediction. That feature is only for meshes.

shy hill
#

my character has 'replicate movements' on and this is my movement node

#

argh really ? good to know

split siren
#

I tried to write my own couple months ago with some success..

#

But definitely buggy

dark edge
split siren
#

Yeah, because it needs to handle animations and other stuff

dark edge
#

Wouldn't those just be driven by the capsule movement and end up the same either way? Seems like an ass backwards way to do things.

shy hill
#

so theoretically, if I replace my sprite with a cube... would that work ?

dark edge
#

@shy hill are you based on ACharacter

shy hill
#

yes

dark edge
#

Does it go Capsule -> Skelmesh -> Sprite?

shy hill
dark edge
#

Try attach sprite to mesh

shy hill
#

but right, I don't use the mesh

dark edge
#

Its still there tho just empty

#

If that's the component being predictably moved then attached components should follow. Try it.

#

Although common sense goes out the window when dealing with the CMC

shy hill
#

thanks a lot, that already help a lot, I spent many hours trying to figure it out :d. My concept relies on pretending to be an NPC, so ideally there shouldnt be any lag at all, if you have any tips to improve it further, I'd be happy to here them (I tried 'smooth sync' but it came with other issues I couldnt solve )

plucky prairie
#

what is the Proper setup for Dedicated server testing? When I use the editor and run 'clients' they behave differently to when I package a dedicated server build and the run it. It's a pain to have to have to package client/server every time I make a small change, what is the best way to go about this?

thin stratus
#

You can run servers standalone too

#

Might still be slightly different to how packaged behaves though

#

But removes the need to package

#

Most studios set up buildmachines with jenkins and p4 though to automize stuff like that

plucky prairie
#

so if I make a small change to a blueprint how do i run the server standalone?

#

you mean i jsut dont package?

fading birch
#

you can make a shortcut like this:

"EngineLocation/UE4Editor.exe" "ProjectFolder/ProjectName.Uproject" -server -log```
plucky prairie
#

ah ok cool

#

then is there a way to run a client like that too

#

instead on in editor?

fading birch
#

yes. replace -server with -game

plucky prairie
#

excellent, thanks so much

timid moss
#

Hey. I also found this post from searching for "turn in place jitter". Did you ever figure this out? I'm having the same problem

lucid vault
#

Yes, iirc it had to do with the order in my animBP for tip and spine rotation

summer tide
#

If I randomize materials and pass it to SetMaterial to my Mesh in BeginPlay, do I have to replicate this?

oblique bay
#

Does anyone know or have any pointers on how to implement spectating teammates like in CSGO or Valorant where you basically see your teammate's POV

calm bison
#

Having issues with a flying vehicles location being incorrect if it collides with something

#

anyone have any suggestions?

#

they're just completely off lol

peak star
#

@oblique bay I dont know those two games but I think the easiest way would be to setviestargetwithblend on the teammate's pawn.

If you want it as part of the HUD instead of changing the entire viewport over, you can do that with a scenecapture2d on the the team mates pawn and a render target as your texture on the hud widget.

But if you want the exact view the other player has as a picture in picture in your HUD including THEIR hud, then I am not sure how to do that.

#

I think for most use cases you wouldnt need any network code to do it though

thin stratus
merry harness
#

Hiho, what exactly is better to have a fixed game mode and to regulate everything via a game mode or a parent game mode and some child game modes?

Master Game Mode (Main Game)
MenuGamemode (Login Menu)
ThirdPerson Gamemode (everything about the player / character)

or

MasterGamemode (for everything)

merry harness
#

Someone have any ideas? ^^

split siren
#

Maybe a bit too specific question, but does anyone know why actors gathered by UReplicationGraphNode_DormancyNode are not network culled based on distance later on?

merry harness
#

That's probably true, I also think that it serves as an overview, there are also aspects such as widgets that should run on the client in the third-person game mode (widget = client) and other things such as the status values, strength of the opponents, etc. server-based so that nobody can cheat ^^

thin stratus
#

I would always tend to having proper Hierarchy

#

I would never want my GameMode for the MainMenu to have Gameplay Code

#

Neither would I want MainMenu and Gameplay Modes to have code for Lobby etc.

winged badger
#

someone can always cheat

#

and until you have a functional game you shouldn't even try to account for that

merry harness
#

I agree with you, but client-based data is always easy to change, while data on the server is always freshly accessed and cannot be influenced by changes to the client.

#

I have a little problem and hope someone can explain how to fix my problem.
I know that widgets work at the client level and not work at the server level.

What exactly is the difference between a widget and a UI?

How can I fix this error that when I press "i" to open the inventory, the inventory also opens?

Before the switch to "Play as Client" everything worked ^^

meager spade
#

Widget is a UI layer

#

UI is local only and has no business being inside GameMode.

merry harness
#

Do you mean this should not be in the ThirdPerson gamemode??

meager spade
#

correct.

#

GameMode should not create or do anything with widgets

merry harness
#

ah ok

meager spade
#

Check the pinned compendium

#

GameMode is server only. Clients would never get a widget

merry harness
#

but my errors are not in gamemodes

#

Do you mean the PDF? i have read 2 times

meager spade
#

If you are trying to access GameMode from your GI on clients, that would not be allowed either

#

tho i cant tell what those errors are doing

merry harness
#

i can tell you

#

pls give me a second ^^

#

wow

#

Ok i have deleted the Create Main Widget from the ThirdPerson Gamemode (no Error) and copied the code into the ThirdPersonCharacter (now i have Errors) xD

#

@meager spade Ok can you explain why i get this error Code?

#

this is in the ThirdPerson Character

#

I didn't get any errors when the same code was still in gamemode.

#

The same Error Code in the game Instance...

dull lance
#

just dropped by: @merry harness dedicated server?

merry harness
#

Yes Play as Client

dull lance
#

iirc, dedicated servers cannot create widgets. So if your code is ALSO running on the dedicated server itself, that could be why

merry harness
#

The main Menu isnt replicated

dull lance
#

that's not what I meant

#

Widgets cannot be replicated anyways

merry harness
#

And the Main widgted Event /to create) ist only run as client

#

So that's exactly why I have all the stuff in the MasterPlayerController. I told every event there that it could only be carried out on Cliets ...

#

should i have the shortcuts also into the MasterPC?

#

These are in the ThirdPersonCharacter

merry harness
#

someone have any idea?

vague fractal
#

What would be the best way to set the rotation of an non-gameplay relevant thing for each player ?

As in, Object 1(Which exists for every player) should always look at the "local" player

#

Might make more sense if i explain the situation.
My enemies are having a UWidgetComponent which will show a widget with his health and similar above his head.
And i want this widget to always look to the player on his client

dull lance
#

On Beginplay, find the local player... then on tick, Interp to Local player find look at rotation? ^

vague fractal
#

Finding the local player is kinda my problem here ^^"

#

GetWorld()->GetFirstLocalPlayerFromController() is the best i found, but even there i have no idea how to get the character from ULocalPlayer

#

Oh, seems like it has a PlayerController variable

thin stratus
#

Just putting it on ScreenSpace isn't enough?

vague fractal
#

I feel like there is a way to avoid the NetMulticast here, but i'm not sure how.

This here is my TakeDamage method

void AEnemyBase::TakeDamage(const FWeaponDamage& DamageAmount, APlayerCharacter *Causer)
{
  if(M_AttributeComponent->GetIsDeath()) return;

//Damage calculation...
  if(M_AttributeComponent->GetIsDeath())
  {
    Server_HandleDeath();
  }
}

Server_HandleDeath Is basically just this here

void AEnemyBase::Server_HandleDeath_Implementation()
{
  HandleDeath();
}
void AEnemyBase::HandleDeath()
{
  GetMesh()->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
  GetMesh()->SetSimulatePhysics(true);
}

But this whole logic doesn't seem to work on the client

thin stratus
#

Client should never call that

#

Neither should there be a serverrpc in that

#

Server rpc should happen waaaaayyy earlier when your client performs their input

#

Unless this is a Multicast

vague fractal
#

I'm sadly still a bloody beginner when it comes to networking πŸ˜“

thin stratus
#

Then you mislabel it quite hard haha

#

You should always remember that state changes should be done via onrep variables

#

Not multicasts

#

Being dead is a state change

#

Make it an OnRep Boolean

vague fractal
thin stratus
#

It will fire automatically clientside

#

If you also need it on the server then you need to call the Onrep by hand when you change the variable

vague fractal
# thin stratus It will fire automatically clientside

I've tried it with a debug message, but it was never called.
Can it be that it's cuz M_AttributeComponent is a more complex type than a simple struct ? (It's UCharacterAttributeComponent : public UActorComponent)

thin stratus
#

I don't follow. If you have such states in a component then thr component itself in additon to the actor has to be marked as replicated

#

And then you would have the Onrep boolean in that component

#

The pointer to the component doesn't need to be marked as replicated. Component is spawned in construction on clientside anyway

#

Phone is dying soon. So might stop answering

vague fractal
#

Oh, so i should basically get the OnRep notify within the UCharacterAttributeComponent class and in case IsDeath will be changed to true i'll call the HandleDeath method from the AttributeComponent ?

#

Argh, wish my brain would be quicker when it comes to networking

fading birch
#

@vague fractal is there a reason you're not using virtual float TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser); ?

vague fractal
merry harness
#

Ok noone knows..

fading birch
vague fractal
fading birch
#

Without seeing how your inventory component toggle works, we can't help you

#

you should probably ask in #umg as this isn't a multiplayer related question

fading birch
vague fractal
merry harness
hollow eagle
#

The damage stuff is de facto deprecated even if it isn't marked as such. It's a bit odd that they're not deprecating before removing, but UE5 is as good a chance as they're going to have to make breaking changes so meh. It's likely something coming with the full release at this point (or maybe a future EA). I haven't checked if the main branch has removed it yet.

#

Damage stuff still exists in ue5-main for now. So they haven't removed it yet. Or the migration guide is entirely wrong and they changed their minds on removing it.

gleaming viper
#

hey guys, how would I go about replicating flashlight's pitch? I got something like this, but the spot light pivot is kinda screwed up and it doesn't rotate properly, could you help me out?

fading birch
hollow eagle
#

You also think they would have proofread the migration guide.

#

Obviously something is wrong there, for now I'd assume it's going away.

waxen breach
#

I posted this in #virtual-reality but I really need some help doing Oculus VR multiplayer

#

anyone able to do this?

#

Well here's the main issue

#

I have only ever made singleplayer games

#

but, that being said

#

there is zero documentation about VR replication

#

Well, there's tutorials showcasing them turning the first person and third person tutorials into Networked apps

#

I'm just looking for something that has to do with VR replication because the motion controllers are apparently different

#

Well again that's the issue

#

I'm going off what I've read here

#

I'm just not even sure where to start, because there's nothing to follow rn regarding this

#

I think i found some lead

#

but i'll have to see how it goes

fading birch
#

speaking of VR, is there a good way to test two VR players by yourself?

severe tendon
hollow eagle
#

I'd almost recommend making a non-VR mode just for testing game features.

#

it's a bunch of extra work but... it doesn't need to be polished and you might make that time back with improved iteration speed on anything that isn't directly tied to motion controls.

fading birch
#

ugh, damn

severe tendon
#

Anyone know what would cause this error in a packet?
We're using BP over C++ for simplicity

mossy lantern
#

Hey all, when trying to build a dedicated server to test out my project that I have been working on in Unreal with multiple people, the build time for all of the files has taken significantly longer (about 10 hrs) than what the github page estimated for it to complete. So, I was just curious as to if this could be because of my hardware specs and not being connected to ethernet or if it could be because of an ulterior reason.

severe tendon
fading birch
#

@mossy lantern were you building the engine from scratch for the first time?

#

A normal first build time for a dedicated server can take anywhere from 10m for an empty project to 2+ hours for a larger project

#

our Build machine takes ~30m to build an updated version of our dedicated server and that build machine is bonkers fast

#

in addition to what @severe tendon linked, you can also do this:
make a shortcut like this:

"EngineLocation/UE4Editor.exe" "ProjectFolder/ProjectName.Uproject" -server -log```
I usually create a shortcut off the `.uproject` file and then construct that in notepad and paste it in. `-log` is especially useful beyond seeing a log because if you close it, the server also closes. If you don't have `-log` you'll need to close it via task manager
tidal venture
#

Does someone have a solution for the choppiness when two character colide while moving with latency?

severe tendon
#

Lerping/smoothing?

#

There is a smooth move plugin iirc

tidal venture
#

So I should expect my character to teleport when someone move into them? I know the plugin, I use it when I need to use physic.

#

It work very nicely when I disable the network simulation

severe tendon
#

Movement and colliding is physics
The reason its so choppy is because of the server and client positions not being exact, Client thinks the server object is at Pos 1 when its at Pos 2, so smoothing should fix that as far as Im aware

tidal venture
#

I'm going to give it a try, I was more hoping about something simple to setup in the CMC networking panel

#

Sadly it's true, smooth sync just resolve it. I didn't wanted to use it, but that just seem impossible without it

#

Thank you for your output

mossy lantern
fading birch
#

building the engine from scratch is expected to take a 30m - 4+ hours.

#

depends on your CPU

dull lance
#

quick question: at which point does an actor class has their network role established? Ctor? OnConstruction? PostInitialize? BeginPlay?

fading birch
#
AActor::AActor(const FObjectInitializer& ObjectInitializer)
{
    // Forward to default constructor (we don't use ObjectInitializer for anything, this is for compatibility with inherited classes that call Super( ObjectInitializer )
    InitializeDefaults();
}

void AActor::InitializeDefaults()
{
    PrimaryActorTick.TickGroup = TG_PrePhysics;
    // Default to no tick function, but if we set 'never ticks' to false (so there is a tick function) it is enabled by default
    PrimaryActorTick.bCanEverTick = false;
    PrimaryActorTick.bStartWithTickEnabled = true;
    PrimaryActorTick.SetTickFunctionEnable(false); 

    CustomTimeDilation = 1.0f;

    SetRole(ROLE_Authority);
    RemoteRole = ROLE_None;```
dull lance
#

I did check that but that doesn't seem to account for networking specifics.

fading birch
#

what do you mean?

dull lance
#

Well, this seems to be before say things like simulated copies get their roles assigned

meager spade
#

Anyone know why a client leaving a game would not tell the host they have left?

#
    {
        if (UOnlineSession* const LocalOnlineSession = GetOnlineSession())
        {
            LocalOnlineSession->HandleDisconnect(World, World->GetNetDriver());
        }
        else
        {
            GetEngine()->HandleDisconnect(World, World->GetNetDriver());
        }
    }```
#

this is what i call when a client clicks the quit button, but they end up not actually leaving, but the server will time them out

severe tendon
odd sundial
#

I have this weird issue.

I have some UI set up where players can choose their loadout. When they save what loadout they want, that information is stored in the player's Player State (it's just an array of "gadgets").

The first player spawns. No worries- the gadgets he chose are there, and he can use them.

However subsequent players that choose their loadouts will spawn with their gadget choices in addition to the choices made by the previous player.

For example, if the first player chose a smoke grenade and a flashbang...

And then the second player chose camoflauge and extra ammo, the second player will end up with all four gadgets.

What... what could be going on here? It's like they share a common PlayerState

thin stratus
#

No idea without seeing your code.

odd sundial
# thin stratus No idea without seeing your code.
void ASpy::InitializeEquipmentBasedOnLoadout()
{
    if (SpyPlayerState)
    {
        if (SpyPlayerState->GadgetArray.Num() > 0)
        {
            for (int i = 0; i < SpyPlayerState->GadgetArray.Num(); i++)
            {
                TSubclassOf<AGadget> Gadgetclass = SpyPlayerState->GadgetArray[i];
                FString GadgetName = Gadgetclass->GetDefaultObject<AGadget>()->GetGadgetName().ToString();

                UE_LOG(LogTemp, Error, TEXT("You have selected: %s"), *GadgetName);

                if (InventoryComp)
                {
                    InventoryComp->AddGadgetToInventory(Gadgetclass, 1);
                    if (bShowDebugs) { UKismetSystemLibrary::PrintString(GetWorld(), TEXT("Spy.cpp - InitializeEquipmentBasedOnLoadout() called.")); }
                }
            }
        }
    }
}```
#

From the PlayerState BP

#

The UI that adds the gadget array to the playerstate

#

Might any of that help explain what the heck is going on here?

#

As i said, the loadout works great, but it's like they're.... sharing a player state

#

This is called from the character to take the gadgets from the player state and equip the player with them

thin stratus
#

First image

#

Is your issue

#

GetPlayerController0

odd sundial
#

Yeah???

thin stratus
#

You can't use that node in Multiplayer like this

#

If you call this on the Server, which you are

#

Then it's the Server's PlayerController

#

And thus the Server's PlayerState

odd sundial
#

..... and that would make perfect sense

thin stratus
#

Locally you can use GetPlayerController0 if you have no local coop stuff

#

So e.g. in the Widget

#

But not if you start communicating between players

#

Where is that Server RPC in?

#

In the PlayerState

odd sundial
#

That server RPC is in the PlayerState BP

thin stratus
#

Why do you get the PlayerState again from the PC?

#

You are already in it

#

It might even be the correct one

odd sundial
#

... good point

thin stratus
#

The SecondImage is fine-ish

#

But even here you should probably use "GetOwningPlayer"

#

And make sure you pass the PlayerController into the CreateWidget Node

odd sundial
#

Okay amazing I'm going to try and implement this right now

thin stratus
#

The third image looks bad too

#

In the Character you can do "GetController"

#

Or even "GetPlayerState"

#

Not sure why you use GetPlayerController0 here

#

That's again the Server's

#

The PlayerController creates the PlayerState, so in your Character you can just use the OnPossessed event or whatever it's called, and do "GetPlayerState" and get the Data

#

Taht event calls Server side only

#

I assume you want to spawn gadgets server-side only anyway

#

Something like that

odd sundial
#

Thank you! I'm going to try and get all this in and see how she works

odd sundial
# thin stratus

Re this image.... this BP code is from the Character's BP, not the player controller. I can't seem to access the Event OnPossessed from the character, even if I try to from the controller node

thin stratus
#

That event is part of teh Character

#

@odd sundial Might just be called Possessed

odd sundial
#

Hmmm yeah the loadout system doesn't work for servers or clients at all anymore

thin stratus
#

Yeah not sure how the rest of your code works

#

But given what you posted this should be enough

#

I assume the Loadout selection and the Spawning of the Character happens after each other and on the same map

odd sundial
#

Yes, spectator pawn is possessed, player chooses their gadgets (held in the player state) then clicks spawn - player spawns with their gadgets loaded in from the player state

#

PlayerState (new)

#

from the Widget blueprint when they save which gadgets they've chosen

#

Called by the character's BP

odd sundial
thin stratus
#

Where you Create the widget

odd sundial
#

So this is from the controller BP..

Everything else I think seems to be working, but when I try to add my UI, it causes a hard crash. I'm guessing there's a conflict between the 'Possess' event on the player character and this 'On Possess' event? Perhaps? If I disconnect the UI from being created/added to the viewport, it doesn't crash

odd sundial
thin stratus
#

You can't use pins like this

#

Only because the EventGraph allows it doesn't mean you can pull wires as you please

#

If you need a Callback to add UI that depends on the Pawn

#

Then you should use C++

#

There you have the OnRep_Pawn function you can override

#

The ClientRPC obviously would work in terms of calling, but you can't bes ure that the Pawn is available on the client yet

#

And if you want the pawn, just use GetControlledPawn

#

Don't use the PossessedPawn pin like this

#

You are moving between Networks, the Client has no idea what the value of that pin is

#

@odd sundial

odd sundial
#

@thin stratus Appreciate all your hard work here!

#

Yeah I can't get.... around these hard crashes because of the UI. Ughhh I'm so tired. I give up for now... thanks for your help

thorny jay
#

we have a real time multiplayer online racing game ...
our dedicated server has 16 core cpu and 16gb of ram ...
how many players can this server support simultaneously?

thin stratus
#

Yeah nothing we can answer. You'll have to profile it yourself and then judge.

manic terrace
#

I was wondering why the default Net Update Frequency which is a 100 is that high. Isn't that just too much? I have mine to a value of 5 and from what I have seen so far it is working fine. I changed it on my character and haven't seen any dramatic changes. Should I have it higher?

sweet pier
#

For multiplayer is it better to make a single player game, then convert it to multiplayer or to make it with a multiplayer framework to begin with

#

Thanks

azure hollow
#

At the end of my race I need to send a ghost structure to the server. The weight of the struct is 244kb, in your experience is this a high number or is it ok? my first time with server stuff πŸ™‚

azure hollow
#

after serialization

chrome bay
#

Quite large for a one-off packet, but might go through ok

#

If not you'll have to spool up a socket

azure hollow
chrome bay
#

IIRC the default "saturation" limit in 4.26 and above is 100kb, but that's for a full seconds worth of data

#

UE's networking is designed for very small packets at high rates

azure hollow
#

ok thanks a lot

chrome bay
#

Epics recommendation BTW is to use sockets if you have to do this

azure hollow
#

got anything that I can read about this?

dry cipher
#

Hi @ all
I trying to replicate a physics actor. Can someone explain to me why this is not possible with my settings? I spawn the balls on the server but on the clients it have different positions

thin stratus
#

The Actor also needs to replicate movement

#

But be aware that this is not smoothed at all

#

And that Replicated Physics shouldn't be used for Gameplay, as physics aren't deterministic etc.

dry cipher
#

@thin stratus
How would you do such gameplay in principle? Are the physics in games like rocket league or fallguys fake?

thin stratus
#

Rocket League has done a lot of additional work to get this working

#

There is a youtube video about it, obviously not detailed enough to easily copy it

#

Fall Guys is not UE4, or?

#

relatively sure that's unity and also kinda sure that they had to do a lot of groundwork to get this working

fading birch
dry cipher
#

@thin stratus
I am a programmer, but no C++ so far πŸ˜…. If this means a lot of work, I'll have to rethink my gameplay. My plan was to have small races with mini-games in between, but it looks like I will have to cancel the mini-games. It's just a hobby project πŸ˜„
@fallguys: oops i always thought that was the Ue4 but Djriff is right it is unity

thin stratus
#

Yeah it might be a lot of extra work

#

At least if you want the players to have a good experience

fading birch
#

I was pretty surprised it was made with Unity

#

Unity is a fine engine, but the marketplace makes me run away as far as possible

#

it's a sad state

green spoke
thin stratus
#

Glad it helps (:

dry cipher
#

@green spoke
@thin stratus
Yes, the best guide for repication! thanks alot

fading birch
#

i'm not familiar with that

fading birch
#

ah

vague fractal
#

Is it a bad sign that the physic body's aren't 100% sync ?
I'm kinda afraid that it could break my interaction system since you have to look at the dead enemy to loot him

meager spade
#

replicating physics is a nightmare

#

hence why you don't care where a dead body is (if might be slightly different place/position on eveyr client)

#

but why does that matter?

vague fractal
meager spade
#

client can just tell the server hey i wantr to loot this

vague fractal
#

Alright, i'll try to ignore it then ^^
Currently it's anyways already like 95% sync (Likely wont last for long xD)

twilit radish
#

Until it all falls apart with high latency D:

#

Also, are there any VR devs in here? I was wondering how people deal with room scale and multiplayer, it seems like an insecure and weird mess to me πŸ€”

#

Especially when for example already dealing with the Character Movement Component. I have for example been trying to support room scale for a test, but my clients keep desyncing because I try to move the actor to the camera, which obviously the CMC doesn't like. But even that is still a very insecure way and not something you can correct if it goes wrong on the client (a desync). I really wonder how games like Pavlov deal with this.

twilit radish
#

Room scale refers in this case to the person in VR physically walking inside their own real life room, so if I walk 1 metre in the real world my camera will also move 1 metre relative to the actor. Why I move the actor towards the camera is to make sure the collision of the character (the root capsule component) stays relevant for.. Well collision. This makes sure people can't literally walk through for example walls in the game. But at the same time like I said this solution is really not cheat proof and to my knowledge also not a good way that can be corrected by the server if the client does desync from the server.

The cheating aspect would obviously be, who says a client doesn't make speed / teleport hacks out of this? They could say the camera is suddenly 20 metres in front of them, you could only really do checks with this such as "Isn't the camera maybe 20 metres away from the original centre of the room?" or "Isn't it moving literally metres per frame?" etc.

#

I'm not too worried about hacks though, but I would prefer a client not having really weird issues if they for example maybe lost track of the headset and the headset suddenly teleports all over the place or goes to a 0,0,0 relative location πŸ™‚

#

It's weird a feeling correct, but there are many games that don't allow this by pulling back the player camera (which is what I described). Which isn't an ideal solution, but better than walking through a wall and possibly getting in the most weird places if you would ask me. But fading to a black screen is also a solution yeah.

vague fractal
#

Is there maybe any good guideline for when to use what(As in when should i use OnRep, when should i use a Server RPC, how do i call it ect..) ?
I feel like i'm doing everything wrong while it still somehow works.

vague fractal
meager spade
#

i think it may also have that one for free.

kind ember
#

Since when did they added this?
And does it work well? Are there any additional steps?

rocky stag
#

Hello everybody
I have a multiplayer game that I load sub-class of my game’s character from a data asset when a player connects.
I want a recommended way to spawn this character and possess that on the controller. Currently, I’m using On posses but I think there is a better place to do this.

kind ember
#

Wow Epic! Lol why did they put that in there.
I heard UE5 gonna support 64 bit world coordinate, what do you think?

modest rune
#

hopefully simple question (my google-fu seems to be failing me on this one, im probably searching for the wrong term) but in the context of something like a multiplayer shooter (and in the context that i'm a hobbyist noob and still dont know the nuances between some of these items), should input be handled on the character or should I make a playercontroller? Should I make my character from the unreal character class or the pawn? Any recommended resources for learning more about why I should do one or the other or how to properly implement a player controller?

kind ember
#

Oh great!

muted perch
#

How would I avoid using multicast in places? what are some conditions where I wouldn't need to use multicast? (I don't need like a 100% rundown, just like general rules would be the most helpful)

modest rune
#

Ok I guess my confusion is, I created a character and bound input axis and actions. But I did not create a controller, is it creating a default controller that I should edit? Is that where those input bindings should actually live?

kindred widget
#

@modest rune Your GameMode has the default classes for those things. The Engine will use the UE4 default controller class for possession if you have not specified your own in GameMode. As far as input bindings, you should put them where they're meant to go. This heavily depends on your game and personal design, but a good example might be something as simple as a tab button to open up a typical shooter's game stats page with KDA stuff, game time, etc. This should probably live on the controller, since you'll likely want players to see this when their pawn is dead, or even before it's spawned. Movement should most likely go on the Pawn itself because you can't guarantee you won't create different pawn types. Classic example is human versus car/horse. Car/Horse will have majorly different controls than a human pawn, and having to route that through ifs and branches in logic is a headache that can easily be avoided by keeping the input in the pawn that uses it and possessing them correctly.

kind ember
#

Does anyone know if GTA V use deterministic physic or semi like default Unreal?

twin juniper
#

Guys, I'm passing a USTRUCT as a reference in a server RPC, but, for some reason (probably is something I'm missing), the reference isn't working. If I discard the struct and use its member as the RPC parameters, directly, everything works fine. Here are the snippets:

#

USTRUCT()
struct PONGONLINE_API FMovementPredictionData
{
    GENERATED_USTRUCT_BODY()    
        
private:
    friend class APongGameplayPawn;
    
    float Timestamp;

    FVector Location;

};

(...)

UFUNCTION(NetMulticast, Reliable)    
void MulticastRPCMoveActor(const FMovementPredictionData& PredictionData);

UFUNCTION(Server, WithValidation, Reliable)    
void ServerRPCMoveActor(const FMovementPredictionData& PredictionData);```
#

What is wrong? Should I use the UPROPERTY(Replicated) in every USTRUCT member, even if the struct itself isn't a replicated property and is passed in a RPC?

hollow eagle
#

anything you want replicated in a struct needs to be UPROPERTY() (not Replicated)

twin juniper
#

Thanks, @hollow eagle ! The compiler just told me right now: ``LogCompile: Error: Struct members cannot be replicated```

hollow eagle
#

read what I said again

twin juniper
#

? Should I only mark struct members as UPROPERTY, and not as UPROPERTY(Replicated). Did i misunderstand it?

hollow eagle
#

correct

#

struct properties are replicated together, they aren't opt-in like a UCLASS property.

twin juniper
#

Thanks, let me test this, because I don't now if the lack of UPROPERTY in the struct members was the cause of my issue

#

Yeah, it was πŸ™‚ Thanks @hollow eagle

fading birch
#

you can opt out certain variables from replicating if you want in a struct

thin stratus
#

Has anyone ever extended the CMC ServerMove RPC Functions?
I tried that a quite some time ago (probably 2 years ago or so), because I needed more info from Server to Client than there was available. But I think it wasn't really working.
If someone did that, are there any "here is how it should be done" posts?

Because the Wiki entry that explains how to use SavedMoves does it wrong. They just RPC the extra data in a second RPC, which is of course not synced to the ServerMove one.

#

Base ideas would be adding custom ServerMove functions, adding either the specific parameter or a struct that properly net serializes to them and using those instead of the default ones. +- copy pasting a shit ton of code because the CMC has too big functions with no options to easily place code in between

#

I'm aware though that 99.99% of the time, the Server most likely has all the data it needs to perform a move, so the flags for "I want to do XYZ" are enough.

fading birch
#

I've always just modified the CMC code

#

it irks me that stuff isn't marked as virtual

#

forcing you to use source

thin stratus
#

you mean in a custom engine

fading birch
#

yup

thin stratus
#

Yeah not having that option in this project

#

But it comes down to the same

fading birch
#

you can technically get around it

#

with a few redirectors

#

and just copy the entirety of the CMC

#

I briefly toyed with that today

#

as i'm doing an engine upgrade, and had to copy over our CMC changes

thin stratus
#

Yeah that's also all fine. The "How to make it work" is not what I'm interested in

#

I know I can make it work. I would love to know what the best way is in terms of implementation of the additional parameters

#

E.g. by default this is the server move signature:

ServerMove(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);
#

The CompressedMoveFlags is the only info we can additionally send along

#

e.g. "User pressed key"

#

Like Jump or Crouch

#

but what if I want to say "User pressed Key, and wants to perform this action with these values."

#

"these values" have no place

#

And if the value is only known in the frame that the user performs the action, then the Server could not be in sync

#

An easy example would be if you want to jump with a different strength

#

I can edit JumpZ runtime, but not without an additional rpc

#

I mean, it goes against the design to let the client specify those values, but if cheating is not a concern then who cares :D

#

I also don#t have enough custom flags to even specify multiple different actions -_-

fading birch
#

and why we had to modify CMC

#

I'm sorry I don't have any answers for you, i'm still neck deep in this engine upgrade otherwise i'd look into it. If you do find out, please share as i'm interested in that.

thin stratus
#

It's not urgent. It's just a thing that comes up every now and then and I was curious if others solved it

fading birch
#

If I get some time, i'll look into it this week

#

but my plate is pretty full both on and off the clock unfortuantely

#

I have next week off though

#

πŸ˜„

thin stratus
#

Buddy, that's your free time. Enjoy life. Don't look into this sh't for me :P

fading birch
#

hey, i want to know too xD

#

i'm like a sponge accumulating semi useless knowledge that serves me no purpose, except to pass onto others

thin stratus
#

You'd be surprised how much it's worth to know a lot of stuff, even if not very in-depth

fading birch
#

it's saved my ass a few times actually

#

surface knowledge is like gold

#

especially in this industry

thin stratus
#
enum CompressedFlags
{
    FLAG_JumpPressed    = 0x01,    // Jump pressed
    FLAG_WantsToCrouch    = 0x02,    // Wants to crouch
    FLAG_Reserved_1        = 0x04,    // Reserved for future use
    FLAG_Reserved_2        = 0x08,    // Reserved for future use

Those have been reserved for ages. At this point they could just make them custom too

#

Whatever they are going to add is doesn't even need to be of any value to me

#

E.g. like what if my character doesn't freaking crouch

fading birch
#

:/ c // Bit masks used by GetCompressedFlags() to encode movement information. enum CompressedFlags { FLAG_JumpPressed = 0x01, // Jump pressed FLAG_WantsToCrouch = 0x02, // Wants to crouch FLAG_Reserved_1 = 0x04, // Reserved for future use FLAG_Reserved_2 = 0x08, // Reserved for future use // Remaining bit masks are available for custom flags. FLAG_WantsToSprint = 0x10, // Wants to sprint FLAG_WantsToSlowWalk = 0x20, // Wants to walk slowly FLAG_SlidePressed = 0x40, // Slide press FLAG_Custom_3 = 0x80, };

#

we didn't touch them

fading birch
#

Β―_(ツ)_/Β―

#

we were worried about the future

#

cause you know

#

these have changed in the past 10+ engine versions

azure hollow
#

Since it's my first time with server/multiplayer stuff, what is the best way to compress ghost data (struct of rotation and location)? I'm doing the serialization to json but I don't know if it's the best

abstract pond
#

hey was wondering if anyone could help with this im using the advanced vehicle system demo project and im trying to set the visibilty of the 3rd person character to hidden when they enter the car

#

and its meant to be for multiplayer - but whats happening instead is that on the client both players are invisible as is meant to be, but on the server the server player is hidden and the client player is visible

pallid mesa
#

so... from the server u see the simulated proxy visible?

abstract pond
pallid mesa
#

hahaha

#

let me check if I can find any resource explaning what that is

#

its essential to understand multiplayer

#

hold on a second

#

take a look on the roles section

abstract pond
#

the quick review of roles?

pallid mesa
#

mhm, but I think its explained a bit too complicated

#

boouf yeah it's explained a bit complicated everywhere

abstract pond
#

yeah im not getting it from reading that tbh

#

but i do know that i tried to do the hidden in game through a custom event on the server and through a multicast

pallid mesa
#

so ill make it simple

abstract pond
#

and it had the opposite results

pallid mesa
#

a simulated proxy is the players u see on your screen except for you

#

got it?

abstract pond
#

yeah

pallid mesa
#

that's a simulated proxy

#

now authority is wether you are on the server or not

#

and autonomous is your own client version of self

#

there is a bit more into it and its a bit unaccurate but I think it can get you to start grasping concepts

#

so if you are playing with your friend

#

and you want to make him invisible just for you

#

you need to grab this simulated proxy and make it invisible

#

got it?

abstract pond
#

yeah

pallid mesa
#

nice so what is happening then?

#

explain me your problem using this terminology

#

so lets see if we can figure out together

#

ur simulated proxies are visible?

abstract pond
pallid mesa
#

okay but you would like to set also the autonomous and authority versions to invisible

abstract pond
#

it works on both the client version for itself and the server version for itself - in the client version the server player is also invisible however in the server players perspective the client player stays visible

pallid mesa
#

so from authority

#

your simulated proxy is visible

#

where did you set this hidden value?

#

server or client?

abstract pond
#

server

pallid mesa
#

okay so if you want everyone to acknowledge that visibility

#

you'd need to multicast it

#

assuming that visibility isn't replicated (I guess it isnt)

abstract pond
pallid mesa
#

no haha what I mean is that some variables on the character are replicated underneat (that you cant see)

#

so rn I dont know if visibility is or not, because if it is replicated it might work just setting it on the server

#

but since I guess it isn't

#

you should multicast it

abstract pond
#

so this is multicast

vague fractal
pallid mesa
# abstract pond

thats a multicast yeah. It will execute everywhere, including where is launched

abstract pond
#

and this is the result - the smaller window is the server player and the bigger window is the client player

#

the client player is behaving correctly the way i want it - both players invisible in the car

#

but you can see the client player there in the car on the server side

pallid mesa
#

so this is launched from the server?

#

just call hidden on the server aswell

vague fractal
#

From what i've learned so far it should be a case for the OnRep method

abstract pond
pallid mesa
#

he doesn't need a variable for this

#

no

#

just add the sethidden

#

right after the multicast

#

so you do the multicast and the call on the server

abstract pond
pallid mesa
#

no

pallid mesa
#

put the set hidden

#

haha

vague fractal
pallid mesa
#

irs essentially the same however a variable onrep adds the overhead of having a variable

#

:)

vague fractal
#

And the multicast might not even fire for clients where it isn't relevant

pallid mesa
#

well in terms of late joiners and netculling

#

yes an onrep would do better

abstract pond
#

so doing this

pallid mesa
#

yeah

abstract pond
#

same result

#

the client player is visible for the server side player

#

but both are invisible for the client player

pallid mesa
#

are you sure this is all execd from the server?

abstract pond
#

for the player

pallid mesa
#

yeah thats not the server

#

haha

abstract pond
#

is that literally why... klsjadjksadls

pallid mesa
#

yeah hahehhaha

#

XD

abstract pond
#

...

pallid mesa
#

its okay you are learning

#

so you need to carry this action to the server using an rpc

#

and then once you are on the server you can multicast

#

although from authority that will essentially be the server

#

although. Listening yo @vague fractal lets follow good practices and I'll explain you next relevancy

#

because that's another networking concept you need to understand

#

relevancy means wether an actor should care about another actor over the network

#

the less actors an actor has to care about

#

the less traffic

#

got it?

abstract pond
#

yeah

#

makes sense

pallid mesa
#

sooo

#

one of the techniques we can employ

#

is turn on relevancy based on distance

#

if an actor is so far from you

#

why would you care about it?

#

thats what network distance culling is

#

once they are in range you start to care about them

#

so what happens is...

#

if some property of your actor has changed while it wasn't relevant for another actor

#

once it becomes relevant your other actor has to see this property changed

#

if we use multicasts that wont do the trick

#

:(

#

we need to use onreps!!

#

so as Yinsei pointed out in a smarty pants move

#

is that "what about relevancy?" well, he was right

#

if we want this visibility to change when we have relevancy changes we better create a flag variable that will be in charge on performing an action every time it changes

#

this type of variables are called onrep

#

so once you have carried your action to the server

#

you can have a visibility onrep variable on which you execute the sethidden code

#

aand

#

it will work like a multicast (just in blueprints, in C++ is different)

abstract pond
#

gotcha thats just a way of doing it thats less taxing i suppose

pallid mesa
#

not taxing

#

just more appropriate

#

because with multicasts you aren't defining a state

#

with a variable you are

#

therefore

#

multicasts in general are just for visuals

#

non important stuff (please artists dont kill me)

#

an onrep is to define a state

#

that will react accordingly with an action once the state is replicated

abstract pond
#

gotcha

#

its working now that i've changed it to be on server now tho cant believe i didnt realise that lmao thank you for the help and teachings i shall try to put them to good use

pallid mesa
#

:)

slim matrix
#

if i want to do sprinting and not have jitter from server correction will i need to do it in c++

#

because every blueprint implementation of sprinting in multiplayer i see fails miserably when lateancy is involved

vague fractal
#

I think the problem here is that you can only override some CMC related stuff via C++, but i think a simple sprinting should be possible with BP only

slim matrix
#

like ive tried diffrent tutorials for multiplayer sprinting and even tried a project from the market place but they all fail as soon as i introduce a little lag

#

only thing ive got to work was someones c++ project

twilit crag
#

How would you make it work via blueprints? At a guess, I imagine the problem with jittering comes down to the fact that you need client-side prediction and server corrections

#

more specifically the server needs to be willing to accept the client's predicted actions and apply them retroactively

slim matrix
#

yeah only solution ive found is to do it in c++

twilit crag
#

default CMC does that, but any naive blueprint implementation won't have that, so you have the client either lagging and then being corrected forward, or being corrected backwards, because the sprint only begins when the server says it begins, and the server makes no attempt to smooth out the client experience

slim matrix
#

this video explains the problem with sprinting in BP pretty well https://www.youtube.com/watch?v=RtQRMcupJs0

Many of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidschannel
Discord: https://discord.gg/PdvudWx
You asked for it so here it is! This is my Networked Character Movement Tutorial complete with a full download to the pr...

β–Ά Play video
glossy veldt
#

Hey guys, I have the following problem: when i do a line trace on the client then the impact point does not match with that of the server. Any Idea why that is?

twilit crag
#

so, your options are to either roll up a system to predict sprinting client-side and apply those predictions server-side

#

which could technically be done in blueprints

#

or you use C++ and integrate those changes with the CMC, which already does those things. Although I've never actually implemented this kind of behaviour in the CMC myself, so I don't know how hard it is, but I'd imagine it's easier than building an extra system on top using blueprints

slim matrix
#

so could i have the server lerp the clients speed changes to prevent jitter

twilit crag
#

I think so.

#

It's possible that the CMC needs messing with regardless to prevent it from sending bad corrections

#

but you basically just need code on the server to recognize that, after receiving the client's updated sprint status, it has to look back and figure out where the client should be, according to when they hit the button

slim matrix
#

my idea is the clients speed lerps between the changes while the server just applies the speed change so maybe the time it takes to lerp to the sprint speed will compensate for some lag

twilit crag
glossy veldt
twilit crag
# slim matrix my idea is the clients speed lerps between the changes while the server just app...

It might smooth out the experience for some or most players, but it's effectively applying a fixed client-side offset to account for lag, which basically means that the experience will go from being "ideal" at 0ms, to being ideal at some other latency; anyone above or below that will still see some correction jitters, and the behaviour will vary depending on whether they're faster or slower than that

twilit crag
glossy veldt
slim matrix
#

i did find a plugin to solve some of this but to also have it work in ue 5.0.0 ill probably need to recompile it

glossy veldt
#

I was using the C++ function PlayerController->GetPlayerViewPoint with out_Location and out_Rotation. I made a custom BPL to expose it.
And i am using 2 traces. First from the player view point forward and then use that impact point as the end location of the second trace.
Works fine for me now

#

But thanks anyways

twilit crag
#

If you're using the control rotation, I think that control rotation is "low resolution" over the network; to save on bandwidth, only an approximation of the player's control rotation is sent over the network

#

so you'd get slightly different results by default

#

I don't have total confidence in that though, it's just something I bumped into while writing some simple networked FPS code

#

and it was a while ago

azure hollow
#

In order to send a structure over to the server, Serialization to json is the best way to compress the file? I'm trying to reduce the volume of the data

azure hollow
#

honestly I don't know πŸ™‚ works better?

smoky plinth
#

If you want to save it to a file a binary is usually lighter

#

but no human being can read it xd just machines

#

Unreal has FMemoryWriter FMemoryReader and IFileHelper to help you

azure hollow
#

I have to send struct of position and retrieve when next game starts

smoky plinth
#

i think there is no other reason than legibility to use json instead of binary imo

azure hollow
#

great, I didn't knew it!

#

thanks a lot dude, do you know where can I find more about this?

smoky plinth
#

Digging the engine:
FMemoryWriter
FMemoryReader
IFileHelper
Google them also as binary unreal compression or somthing like that

azure hollow
#

thanks dudeπŸ™Œ really appreciate

fading birch
#

Unreal has access to a few different compression libraries. They seem partial to zlib

true stream
#

what service would you recommend for a MP indie game just starting to go online?, so far I've heard amazon works ok.

#

I'm at the prototype phase, so it would be shared with a couple of friend for now.

azure hollow
#

take a look at playfab too

true stream
#

interesting, seems to be free to start

smoky plinth
true stream
#

I was under the impression that it was free

#

or you mean after reaching a certain threshold of users/data?

smoky plinth
#

i think i remember that any long-term server running in aws cost money

true stream
#

for now I only care about being able to test and prototype it with a limited number of users

azure hollow
#

until 100k users playfab should be free

true stream
#

without much hazle

azure hollow
#

I mean, if you leave the game in development mode and don't go live it's actually free

true stream
#

yeah, that's what it seems

azure hollow
#

I am using it and not paying so...give it a try

true stream
#

I wonder if there is like, a way to learn what steps should I take when transitioning from closed prototype to full online

#

in terms of, marketing, visibility, etc.

#

maybe there are companies that specialize in this, no idea.

azure hollow
#

can't tell, maybe make sure the game works and then you see πŸ™‚