#multiplayer

1 messages ยท Page 37 of 1

bitter oriole
#

How many player starts are there with which tags, too

#

Whether the loop exits, what the result is...

bleak raft
#

When a server sends a multicast, it's called right away on the server side right ?

twin juniper
twin juniper
#

4 times

bitter oriole
twin juniper
#

ok just a sec

#

have a look

bitter oriole
#

You can copypaste the code here, using triple ` quotes around it

#

And the easiest way to debug your issue is simply to use the debugger - chances are either of the pawn is nullptr

twin juniper
#

not iam getting different type of errors i didnt changed any code i reopened the project and when i build iam getting this errors

#

i dont know whats this exatly

bitter oriole
#

Classic C++ error of missing a forward-declaration or include

#

Just read the error log, it's quite clear

twin juniper
#

where

#

and what i need to add?

bitter oriole
#

Read the full error text very carefully, it spells out what is missing and where the offending code is in your project

#

Make sure to forward-declare your pointer types

twin juniper
#

ok its saying for acharacter but i declare it as class?

#

wait i will send u code

#

ignore the error we will fix that later for now i will add header

#

'#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameFramework/GameMode.h"
#include "MainGameMode.generated.h"

/**
*
*/
UCLASS()
class MYPROJECT_API AMainGameMode : public AGameMode
{
GENERATED_BODY()

public:
int playerListNum;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
    TSubclassOf<class ACharacter> firstPawn;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
    TSubclassOf<class ACharacter> secondPawn;

void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const;

protected:

UPROPERTY(Replicated)
    TSubclassOf<class ACharacter> currentPawnToAssign;

UClass* GetDefaultPawnClassForController_Implementation(AController* InController);

};
'

bitter oriole
#

Need three ` around the code

twin juniper
#

what?

bitter oriole
#

And like I said, use the debugger to inspect your variables

twin juniper
#

'''#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameFramework/GameMode.h"
#include "MainGameMode.generated.h"

/**
*
*/
UCLASS()
class MYPROJECT_API AMainGameMode : public AGameMode
{
GENERATED_BODY()

public:
int playerListNum;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
    TSubclassOf<class ACharacter> firstPawn;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
    TSubclassOf<class ACharacter> secondPawn;

void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const;

protected:

UPROPERTY(Replicated)
    TSubclassOf<class ACharacter> currentPawnToAssign;

UClass* GetDefaultPawnClassForController_Implementation(AController* InController);

};
'''

bitter oriole
#

Three `

twin juniper
#

okok

#

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameFramework/GameMode.h"
#include "MainGameMode.generated.h"

/**
 * 
 */
UCLASS()
class MYPROJECT_API AMainGameMode : public AGameMode
{
    GENERATED_BODY()
    
public:
    int playerListNum;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
        TSubclassOf<class ACharacter> firstPawn;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyGame")
        TSubclassOf<class ACharacter> secondPawn;
    
    void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const;

protected:

    UPROPERTY(Replicated)
        TSubclassOf<class ACharacter> currentPawnToAssign;

    UClass* GetDefaultPawnClassForController_Implementation(AController* InController);


};
#

this is for header

#
#include "MainGameMode.h"
//#include "Engine/Private/GameplayStatics.cpp"
#include "Kismet/KismetMathLibrary.h"
#include "GameFramework/PlayerStart.h"
#include "Net/UnrealNetwork.h"
#include "Kismet/GameplayStatics.h"



void AMainGameMode::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    DOREPLIFETIME(AMainGameMode, currentPawnToAssign);
}

UClass* AMainGameMode::GetDefaultPawnClassForController_Implementation(AController* InController)
{

    TArray<AActor*> playerSpawnsList;
    UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerStart::StaticClass(), playerSpawnsList);
    float randomNum = UKismetMathLibrary::RandomFloatInRange(1, playerSpawnsList.Num());

    if (currentPawnToAssign == nullptr)
    {

        for (playerListNum = 0; playerListNum < playerSpawnsList.Num(); playerListNum++)
        {
            GEngine->AddOnScreenDebugMessage(0, 5, FColor::Green, TEXT("Started"));
            UE_LOG(LogTemp, Warning, TEXT("STARTED"));

            if (firstPawn != nullptr && secondPawn != nullptr && playerSpawnsList[randomNum]->ActorHasTag("Asura"))
            {
                currentPawnToAssign = firstPawn;
                GEngine->AddOnScreenDebugMessage(0, 5, FColor::Green, TEXT("Asura"));
                UE_LOG(LogTemp, Warning, TEXT("Asura"));
            }

            if (firstPawn != nullptr && secondPawn != nullptr && playerSpawnsList[randomNum]->ActorHasTag("Dev"))
            {
                UE_LOG(LogTemp, Warning, TEXT("Dev"));
                currentPawnToAssign = secondPawn;
                GEngine->AddOnScreenDebugMessage(0, 5, FColor::Green, TEXT("Dev"));
            }
        }
    }
    return currentPawnToAssign;
}```
#

cpp

bitter oriole
#

Now use the debugger to inspect the variables within the loop and you'll have the error spelled out very quickly

#

Likely firstPawn or secondPawn nullptr, or the tag check is wrong

#

By the way the random number is probably wrong too, will never pick 0 and should never be a float

twin juniper
#

ok

#

want me to change random thing?

#

see this is what out put iam getting

twin juniper
twin juniper
#

but still same result

thin stratus
#

Was attaching a Replicated Actor automatically replicated?

#

I think so iirc. Can that be turned off somehow?

chrome bay
#

attachment replication right?

thin stratus
#

Yeah

#

I'm a bit confused

#

I know the AttachParent in SceneComponents is replicated

#

But the SceneComponent (Root of a Weapon) is not

#

Only the WeaponActor is

#

Why is this replicating the attachment

chrome bay
#

Yeah you can disable it, attach rep is like replicated movement

thin stratus
#

Cause I need it to attach to 1P and 3P Mesh and noticed it's behaving strange

#

So there should be an override?

#

But the whole attachment is driven by the SceneComp or not?

chrome bay
#

Nah by the actor

thin stratus
#

Ah found it

chrome bay
#
{
    // Empty
}

void AShooterCharacter::GatherCurrentMovement()
{
#if USE_ATTACHMENT_REPLICATION
    Super::GatherCurrentMovement();
#else
    if (IsReplicatingMovement())
    {
        FRepMovement RepMovement = GetReplicatedMovement();

        RepMovement.Location = RootComponent->GetComponentLocation(); // FRepMovement::RebaseOntoZeroOrigin(, this);
        RepMovement.Rotation = RootComponent->GetComponentRotation();
        RepMovement.LinearVelocity = GetVelocity();
        RepMovement.AngularVelocity = FVector::ZeroVector;

        SetReplicatedMovement( RepMovement );
    }
#endif
}```
#

We disable it in HLL for vehicle seats to avoid race issues between the seat actors and the character

thin stratus
#

Don't you need to disable it for attaching weapons too?

chrome bay
#

weaps don't rep movement at all for us

#

attaching is done during equipping

thin stratus
#

They don't for us either

#

It doesn't need to

#

The original if checks || AttachParent

#

Our Equipment process has an OnRep_CurrentWeapon

#

To attach to the Owner

chrome bay
#

yeah, similar here

thin stratus
#

(inside a WeaponComponent fwiw). All variables are valid

#

But the Server replicates the Attachment

chrome bay
#

Hmm that's not happening for me. The weap components aren't replicated are they?

#

Or maybe weapon has replicate movement on?

thin stratus
#

The WeaponComponent is an ActorComp on the Character. Basically the Weapon Manager.
It's replicated with an OnRep_CurrentWeapon

#

The WEapon is also replicated.

#

The Code does CurrentWeapon->AttachToComponent(CharacterOwner->GetMesh()....);

#

That works fine but is apparently replicating

#

I tested it with limiting it to auth and the Client gets the attachment replicated

#

Which is not ideal cause it needs to attach to 1P Mesh when LocallyControlled

#

:D still confused

#

I'm sure you'd also need to do that in your weapons

#

@chrome bay Ended up just overriding OnRep_AttachmentReplication for the Weapon and removing the Super call. leaving it empty

#

Seems to fix it. I could swear I never had to do that in the past x years.

chrome bay
#

It sounds to me like the weapon has replicated movement on

thin stratus
#

It doesn't

#

I double checked

bitter oriole
# twin juniper

Looks an awful lot like your random value is simply always 0-1 (or 2-3, or whatever indices your "asura" starts are at in the array)

thin stratus
#

It doesn't need to

#

As soon as the AttachParent is valid it starts gathering the data

#
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
            if (RootComponent->GetAttachParent() != nullptr)
            {
#

The function is just super confusing to read

chrome bay
#

Well thats fucking stupid

thin stratus
#

So in the middle of the function it selectively does stuff based on the AttachParent

#

Which I guess makes sense, but still..

#

Ah well, always great to learn something basic 6+ years in I guess

chrome bay
#

My favourite dumb API decision is actors not replicating when hidden..

#

Or when hidden and collision disabled, that was it

#

I mean.. why

thin stratus
#

There are a lot of those assumptions made by Epic's coders

#

Widgets not ticking when invisible.
Widgets not ticking if there is no Tick Node in the BP version.

#

Things like these

chrome bay
#

I get the widget thing, as they need to be painted first

#

I remember having that convo with Nick

thin stratus
#

The C++ Version not ticking cause the BP version not having an empty Tick Node in it is however bullshit

#

At least something like that was the case

#

Can't recall

chrome bay
#

ah haven't seen that one

thin stratus
#

There are also still functions that silently fail if called before BeginPlay

#

Which can happen with OnReps

chrome bay
#

This attachment thing is eternally stupid though. No idea how I've missed that for so long

thin stratus
#

Yeah me neither. I must have only attached non replicated actors

chrome bay
#

Fortunately doesn't affect me that much but, so stupid.

thin stratus
#

I mean

#

Tbh, it only shows up if you want to attach to different components on client and server

#

You wouldn't notice otherwise

chrome bay
#

yeah

#

Ah well, something I can micro-optimise away ๐Ÿ˜„

timid moat
#

Hi!

#

Do you have an idea why I can't find a session that I created and started? I'm using the Cedric tutorial's code.

#

Thanks!

dim trail
#

a server RPC in cpp that calls a non server method should still exist on the server in execution?

#

i have a replicated variabled set to true in the non server method but it is called from the server, but it looks like its not updating in the client...

#

for example if this doesnt make sense..

void ServerMethod_Implementation()
{
  NonServerMethod();
}

void NonServerMethod()
{
  bReplicatedVar = true;
}

the replicatedvar is false on the client

opal fox
#

Do we know the exact answer to what it means when it says SIMULATING like this? when debugging in a blueprint?

bitter oriole
#

Make sure the var is correctly replicated

#

And the actor is client-owned

dim trail
#

would it matter if it is being cast?

#
for (int i = 0; i <= SkillLevel; i++)
            {
                switch (i)
                {
                case (0):
                    Src->bCanSit = true;
                    Src->BasicSkills.bCanSit = true;
                }
            }

in the non server method

#

and the server method

    APlayerCharacterGASWithAbilities* Player = Cast<APlayerCharacterGASWithAbilities>(Src);

    switch (SkillID)
    {
    case (ESkills::WA_BASIC):
        if (IsValid(Player))
        {
            Status->GrantBasicAbilities(Player, SkillID, SkillLevel);
        }
        break;
bitter oriole
#

Anything called from an RPC executes in the RPC's context

dim trail
#

oh shit, its not being replicated in dorep ๐Ÿคฆ

#

ty anyway ๐Ÿ™‚

lavish dagger
#

Hello all, is there to send a API request that I can send to a dedicated server? Iโ€™m trying to integrate with AWS and I want to remotely kick a player out of the dedicated server

bitter oriole
#

No, need to implement that yourself

bitter oriole
cerulean seal
lavish dagger
bitter oriole
#

Yes

lavish dagger
# bitter oriole Yes

Could you elaborate more? Iโ€™m using a third party service, cognito, to sign in users, so how I can ensure no one signs in twice and using the same player login. Unfortunately cognito is stateless when it comes to user sessions

bitter oriole
lavish dagger
bitter oriole
#

Basically you just need some Websocket service running on the server to take your calls

true spade
#

Hi, I have a question with the grabbing in the multiplayer, how to accomplish that? Since I tried now on trigger press run the RPC for run on server. (like on the image) and it's not working, the client is not able to grab anything, server can. Any suggestions?

queen frigate
#

Hey guys how can i reproduce this for the server ? so every other client gets these effects ? I'm still new to this I hope i wrote in the right channel

#

I just need it to work in the editor since its for my final exam

pastel fiber
#

Can a UE game built as a dedicated server be run as a listen server only by passing arguments like TestMap?Listen -game?

sinful tree
pastel fiber
glad escarp
#

Hello again. Anyone here with experience setting up FPS multiplayer characters? I get the over all concept of having a third person mesh that other players see and a first person mesh that only the player sees. That's simple enough to set up. What I'm struggling to understand is how to sync the locations of the player's arms/hands/weapons between those two meshes. If I were only doing line traces for projectiles it wouldn't matter but I have some weapons that have physical projectiles that have to originate from the barrel of the gun. Do you normally try to sync this up between the two models or is the client projectile origin in one place and the server multicasts the visuals to all other players regardless of where the projectile is supposed to go? I feel like I'm overthinking this and someone with more experience can simplify this.

sinful tree
# pastel fiber I was just wondering. I have not learnt multiplayer part yet. Does it mean that...

Effectively yes. When you're building your game and are going to be using Unreal's networking, then yes, you're making something that can act as either a listen server or dedicated server, and when building for a dedicated server you get a separate package that is stripped down - there's more configuration for what gets included/execluded within the project settings.

There is a caveat though - if you're trying to have both listen servers and dedicated servers available for your application, there's a little bit more thought needed for some of the programming logic flows - usually building for just dedicated is a bit more straightforward, but listen servers you have to take into consideration that the "Authority" can be a player too.

pastel fiber
#

Thank you very much. Very informative. ๐Ÿ™‚

#

As a beginner with low budget, I think we usually start learning by building listen server. I have no hosting server to test.

sinful tree
#

That's not really what dedicated vs listen sort of means.

latent heart
#

The easiest way to determine all this is by checking the World's NetMode.

sinful tree
#

Do you want players to be able to host their own dedicated servers for example?

chrome bay
#

The parallax is usually only significant at short distances so it rarely matters.

sinful tree
#

And you can "test" running a dedicated server by changing the play mode in the editor to "Play As Client" - that spawns a server process that your editor connects to as a client.

chrome bay
#

As for syncing positions of the two meshes, also not done AFAIK. Some games do try to do this, but it's much easier said than done and imposes restrictions on animations etc.

pastel fiber
glad escarp
glad escarp
chrome bay
#

For particles/visuals you just draw it from the mesh sure

sinful tree
# pastel fiber I am not sure because most players have no knowledge to host server. ๐Ÿ™‚ And both...

That's not really what it's about though. It's about what you intend to make as a game and what you want to allow. Don't think about whether it is easy for players or not - people with knowhow will figure it out and do it if it is made available for them to do.

So it boils down to one of these choices:
A) You have a single player game.
B) You have a multiplayer game where a player acts as a listen server host of the game and other players can join them.
C) You have a multiplayer game where a dedicated server process is running somewhere (either run by players, or by some hosting service) and other players join those servers. Players could still have the option of acting as a listen server host if you allow it.
D) You have a multiplayer game where only you host the dedicated servers and you do not release the server executable to the public, meaning no one else can run a server for your game. This is the choice if you intend to have cross-server persistence for your players. (ie. they can join any server at any time and still have all their stats or what have you)

latent heart
#

Cross-server persistence can be fine with C too, if you really don't care about cheating.

sinful tree
#

Yeah but you also run into the problem that malicious players could basically destroy anyone else's account.

latent heart
#

You can do a mix of both, for sure. Randoms joining your server could go wrong, but there's no reason to restrict friends-only servers in that way.

#

And it depends on where your player's stats/whatever are stored.

#

You could offer the server for people to host on, but connect to a central hub for per-player data.

sinful tree
#

And how does said data get updated?

latent heart
#

Again, if you don't care too much about cheating. ๐Ÿ™‚

#

But Call of Duty has done that method, for instance, and that worked quite well.

#

(as far as I know)

sinful tree
#

I think a lot of games have done that with online leaderboards and such.

latent heart
#

Online leaderboards are gonna get hacked to shit no matter what you do lol

#

You should try to make it harder, of course. ๐Ÿ™‚

sinful tree
#

And that's the same problem with any kind of player stats when you allow external entities to update the data. Someone'll likely figure it out and can ruin stuff ๐Ÿ˜ฆ

latent heart
#

All depends on your type of game, tbh.

#

And what type of stats.

sinful tree
#

Had that happen to me in a P2P game some time ago. The player data (level, items, money) was stored online, but since it's a P2P game it relied on the game clients themselves making the calls to update the data. Someone figures out what your ID is, uploads some crappy data to your ID, and effectively erases all your progress.

latent heart
#

Heh

#

It must be doable in some way, though.

sinful tree
#

Person only did it too because I was kicking their ass and they sucked >_>

latent heart
#

As I mentioned, CoD had p2p servers in a previous release. I've no idea if that got hacked.

sinful tree
#

Vast majority isn't going to muck about.

#

It's those one or two bad actors that could really bugger things up.

pastel fiber
latent heart
#

The way around that is just to back stuff up and let people complain. Then fix it when they do.

#

You don't "choose" to be a listen server in that way. You determine that before you start playing. You say, "I will host a game"

#

Instead of "I will join a game"

pastel fiber
latent heart
#

Some games, when you choose to host, also give you the option of starting a dedicated server. This usually closes the game and starts up a new instance of your game.

#

That new instance is just a dos box (usually) with no ability to "play" the game from it.

sinful tree
latent heart
#

I think it depends on how easy it is to do and how many of your userbase will do it compared to the ones that won't.

pastel fiber
latent heart
#

If you have a million customers and 100 of them are dicks, it's not so bad, that million other people will fund you fixing the hacks.

sinful tree
#

You can't be a player and a dedicated server at the same time.

#

You can have a copy of the game and be a player, and have a dedicated server running on the same machine.

latent heart
#

If you have 1000 customers and your stats are easy to hack and you have even 1 person doing bad stuff, it'll be a massive headache.

latent heart
sinful tree
#

(shhh)

pastel fiber
latent heart
#

That's the dedicated part.

sinful tree
#

Yep

latent heart
#

Also other implications about game logic and replication, but I don't think that's relevant here.

timid moat
#

Hi!

sinful tree
#

And yes, any time that you allow players to be a host, whether they are a listen server or running a dedicated server, they then have the means of potentially cheating as they are in control of those processes.

latent heart
timid moat
#

If I'm runing standalone, and I set Player's name in PlayerState, and I join a Session. How can I pass the Player's name to the server? I'm testing the Online Subsystem Null because it is the first time I do this.

#

Thanks!

latent heart
#

Depends on the session. If it's a steam session, for instance, the srever can get your name from your session data.

#

I think.

timid moat
#

I'm testing the Online Subsystem Null because it is the first time I do this.

pastel fiber
#

Ok Thank you. Very informative. It is time to continue learning. ๐Ÿ™‚

glad escarp
dark edge
glad escarp
dark edge
#

If it's 3rd person it's super important to get your camera aim -> character aim direction system working well

#

It gets very tricky the further the camera is from the character

glad escarp
pastel fiber
#

It is possible to run a dedicate server on a mobile phone?

obtuse pendant
#
 OwningController = OwningController == nullptr ? GetOwningPlayer() : OwningController;
   
    if(ChatTextBlockClass && OwningController)
    {
        BlasterPlayerState = BlasterPlayerState == nullptr ? OwningController->GetPlayerState<ABlasterPlayerState>() : BlasterPlayerState;
        if(BlasterPlayerState)
        {
            int32 LastIndex = ChatTextBlocks.Num();
            UChatTextBlock* ChatTextBlock = CreateWidget<UChatTextBlock>(GetOwningPlayer(), ChatTextBlockClass);
            if(ChatTextBlock && ChatTextBlock->ChatTextSlot)
            {
                const FString TextToDisplay = FString::Printf(TEXT("%s: %s"), *PlayerName, *Text.ToString());
                ChatTextBlock->ChatTextSlot->SetText(FText::FromString(TextToDisplay));
                ChatTextBlocks.Add(ChatTextBlock);
                ChatTextBox->AddChild(ChatTextBlock);
            }
        }
    }
    ChatInput->SetText(FText::FromString(""));




#

thats my code for adding the chat box

#

but when i enter a msg and hit enter

#

it says an error

#

Only Local Player Controllers can be assigned to widgets. BP_PC_C_1 is not a Local Player Controller.

dark edge
#

That's the decision you need to make

dark edge
#

Basically if you have to ask, no.

glad escarp
pastel fiber
#

I am wondering why UE staffs decided to complicate the process for building and packaging dedicated server by having us to build UE editor from source code first.

It means that the prebuilt UE editor cannot be used to build and pack dedicated servers.

Any idea behind this decision?

If it can be made complicated why it is made simpler. ๐Ÿ™‚

elder sable
#

Hi, where can i found how FFastArraySerializer works ? It seems to replicate only changed indexes, it should be used everytime an array can change ?

dark edge
#

The CounterStrike model has the bullet fire from the camera on server but people see it come from the gun. Although it doesn't really use projectiles so that's sort of a moot point

glad escarp
# dark edge The CounterStrike model has the bullet fire from the camera on server but people...

Ok so maybe the server fires it (in my case) from the muzzle or the weapon, using a line trace from the player camera or weapon sight camera to find it's destination (depending on whether the player is hip firing or in ADS).

Then the multicast to other players shows it firing from the muzzle of the third person weapon and traveling toward the correct impact point from the server? To try to relay some visual accuracy.

Something like that?

pallid mesa
elder sable
#

Where can i find it ?

pallid mesa
elder sable
#

Thanks !

timid moat
#

Hi!

#

If I'm in a standalone client, and I join a session, which GameInstance will I have? mine or the one that already exists on the server? I'm asking this because I want to store my playerstate on my GameInstance before I join the session, and after that restore the playerstate in the server.

#

Thanks.

graceful flame
#

Each machine running the game has its own GameInstance regardless of them being a client or server.

timid moat
graceful flame
#

"The PlayerState is also replicated to everyone and can be used to retrieve and display data on other Clients. An easy way to access all PlayerStates, that are currently in the Game, is the PlayerArray inside of the GameState Class."

fathom aspen
#

I know of a persistent data compendium pinned in this channel, might find it useful

quasi tide
#

I don't.

#

Care to share?

timid moat
fathom aspen
#

client RPC that is on PostLogin, retrieve the client GameInstance, server RPC back with the data while validating it

#

I feel I could have given that as an example there, so I will note it for myself to add it

quasi tide
#

Will that be what pushes it past the 60 minute mark? ๐Ÿค”

timid moat
thin stratus
#

Best is to learn C++ and persist data properly

#
  • Some Random Dude
fathom aspen
quasi tide
fathom aspen
#

That is used to validate data

thin stratus
#

Yeah but, if you use C++ anyway, then why persisting in the GameInstance like some BP noob? :D

fathom aspen
#

If you are doing stuff in BP then you will have to make your own version

fathom aspen
thin stratus
#

Or, you know, persisting AInfo Actors for example

fathom aspen
#

But they are hard traveling aPES_Sob

thin stratus
#

They are lost

#

I'm out

fathom aspen
#

Why hard travel when you can alter the engine so you always seamless travel?

thin stratus
#

I mean, connecting is hardtravel, so I can give you that

#

But even then, there are ways that at least don't need the initial ServerRPC from PostLogin

fathom aspen
#

The one I can think of would be to talk to your backend and retrieve data

#

Which I will do anyways when I validate

thin stratus
#

No I mean, the Client, in C++, should def have a point where they can send data via an RPC

#

Without needing the RPC from the Server first

#

We send SaveGame Data in a Coop game that way

#

+- cutting it into multiple RPCs due to size

#

But that's a different story

fathom aspen
#

Ah right, that could prolly be ServerNotifyLoadedWorld?

#

But well... it's not virtual iirc

#

rip

pallid mesa
#

hey buds besides 7777 which other (default) port shall I open in the host computer to connect to my server through my vpn?

quasi tide
#

36745

fathom aspen
#

But yeah my dead brain can't think of what that would be, but good point @thin stratus

pallid mesa
thin stratus
#

7777 should be enough

quasi tide
pallid mesa
#

!!

#

don't troll me ๐Ÿคฃ

fathom aspen
#

4664? That opens Laura port

graceful flame
#

1337

quasi tide
# pallid mesa don't troll me ๐Ÿคฃ

It's a joke but also not a joke at the same time. In general, I stay away from ports below 10k. I think the guideline is even lower than that, but I give myself some buffer room.

#

That's the number.

#

Couldn't remember it

thin stratus
#

Despite 3389. That thing scares me.

pallid mesa
#

bingo

#

no one really made the joke?

fresh cloud
#

hey, i had a quick question about the functionality of listen vs dedicated? so for listen, i know that there is a local player running, but for example, if i have a set of players and each of them is in a pawn on a different streaming level sublevel

#

the server would need to have each occupied level loaded and most likely visible, but i want each player to ONLY have their own occupied sublevel loaded and visible

thin stratus
#

That is not looking to be a quick one

fresh cloud
#

is that even possible with listen?

#

would the listen client HAVE to have them all open and visible to the user? like a mastermind user?

thin stratus
#

Theoretically not for the Server, unless you allow Client Auth Movement I guess?

quasi tide
#

This is a problem that Epic is still trying to solve with World Partition ๐Ÿ˜…

thin stratus
#

I mean, it really depends on the scope, but yeah

fresh cloud
#

darn, i guess i would have to default to a dedicated setup? the dedicate server could have multiple maps loaded and visible/ticking, then sending data to each client that only has their room open and active

thin stratus
#

You do have to realize that some network setups are just not suited for the default server architecture of UE

#

After all this is an Unreal Tournament Engine, so the whole DedicatedServer and ListenServer stuff is really stuck in the past

quasi tide
#

Ehhh - it's still quite pervasive today in non-UE engines as well though.

thin stratus
#

Yeah sure, but we are talking about UE

#

You can use RepGraph, or even just IsNetRelevant to sort Players

#

But in terms of putting them into some sort of "instances", it's lacking

#

Quite a while ago I was wondering if one could make a sort of pokemon game, where the fights would be instanced rooms. But even that is annoying to set up in normal servers

#

Would probably have generated a GUID and assign that to the Fight and everyone involved and used IsNetRelevant to filter it all

#

Luckily no collision in that example

visual urchin
#

Question, I'm currently making a blueprint that functions as a checkpoint. This blueprint calls a custom event on the server in order to save the transform in a variable in the playercharacter. In server it works, but not in client. Is there a chance blueprints that aren't controlled by a player can't call online events?

quasi tide
#

Server RPCs must be called by networked owned actors

pastel fiber
#

GetNetConnection() invoked from within a listen server is always nullptr?

quasi tide
#

If it is a positional checkpoint, I'd say just have a collision box that just saves the transform on the server (can even have it only be loaded on server) @visual urchin

#

If the client must know about the position for w/e reason, make it a replicated variable.

fathom aspen
sinful tree
amber saffron
#

hi, i need some more help, im spawning actors on the server and then attaching them to each other via attach actor to component node. the spawned items show up on both client and server, but when i run the attach node it only attaches properly on the server, on client it just attaches to 0,0,0 location

weak linden
amber saffron
#

oh just re-read you post this is not on my character bp it is a separate bp actor that spawns the items and attaches them to each other in the map

weak linden
plush lagoon
#

what would be the best cpu/ram for a dedicated UE Service?

graceful flame
plush lagoon
#

@.@ obviously not cost effect.

#

got any base limitations?

graceful flame
#

but the reality is that cloud hosting is the best option if you want to scale

plush lagoon
#

I should follow?

amber saffron
plush lagoon
#

yes I know need to know the cpu/memory i need more or less @graceful flame so I can pick the correct vm instance type

#

trying not to spend too much, but also don't want to make it too limited @.@

graceful flame
#

it varies depending on your game

weak linden
plush lagoon
#

survival game server 24/7 uptime

#

more or less @weak linden

#

40-50 players max

weak linden
#

Is this just for development?

plush lagoon
#

production testing

#

trying to see the cost of use for a single month

#

and such

#

since i'm blowing 250usd a month for my current server but thats development I don't think i need that... <.<

#

so trying to get a more focused on the base min. I should look at

#

and maybe go 1 node size up or just add more ram

#

any ideas, would be much appreciated
โค๏ธ

graceful flame
#

There's no clear number to answer this because it all depends on a lot of variables here

plush lagoon
#

ballpark :p

#

very base. min. etc then i can work up from there

graceful flame
#

Just use the calculators cloud providers have on their websites

#

and plugin how much your cpu uses when running as a server

plush lagoon
#

that doesn't tell me the base requirements for a UE Dedicated Service. And if it should have gpu, etc etc.

#

I know how to calculate costs. ๐Ÿ˜› I'm trying to find some mins. for hosting of the service. Googling online isn't giving me alot of info just the editor base

weak linden
#

Okay, so I'm not sure about the performance implications of running in a VM instance, but regarding bare metal, I'd usually suggest a 3.5-4GHz quad core, 8-16GB of RAM and you'll probably only need like 50-100GB of storage if it's just for hosting a single server

plush lagoon
#

and editor != compiled game server in terms of resource cost thus why i've been asking

graceful flame
#

well you probably don't want some onsite database engineer playing your game so I doubt a gpu is required. UE runs headless

plush lagoon
#

perfect

#

Thank you @weak linden โค๏ธ

#

i'll use that as a baseline to go off

graceful flame
#

How many game instances will you have per server?

plush lagoon
#

if the performance is not good i'll just slowly scale it up

#

1

#

just 1

graceful flame
#

it might be more cost effective to have a few large servers with more instances or maybe its cheaper to have many tiny servers with 1 instance

#

depends on your game

#

or better yet just give out the server build and let the community host it themselves

plush lagoon
#

I will be doing that but for pre-alpha testing and such trying to keep us hosting 2-3 instances

#

so we can test all of the game and grid features

amber saffron
#

and build it for linux and not windows they are generally cheaper to run as well

plush lagoon
#

yes it is built for linux

#

thumbs up

weak linden
#

I'd personally suggest the same as lawlster, just get a cheap bare metal box from SoYouStart, for example, 40 euro gets you a box that can run at least 3-4 servers and you can do whatever you like with it LUL

hollow eagle
#

Those values aren't really a good baseline because it depends too much on the game itself.
Not needing a GPU is true... unless you write a game that needs one.
If you already have something you can test with, just spin up a few VMs of various spec and see how they perform.

plush lagoon
#

hmm good idea @hollow eagle i'll use @weak linden as a baseline thoughg and i'll spin up a few instances that are larger/more resources to see how things go

#

but it is just a single service

amber saffron
#

are you using steam or anything like that just pure dedicated server

hollow eagle
#

that's not relevant to server spec

plush lagoon
#

and I don't want to run more then 1 service per server for stability reasons at least until we can see performance, etc to validate the stability for testing

hollow eagle
#

Right, that's normal enough. Using a small VM per server isn't entirely unusual though it's not as cost effective.

amber saffron
#

if its just dedicated server you can go amazons ec2 arm servers

plush lagoon
#

true

#

I plan to move it over to kubernetes and docker contained deployment after the fact @hollow eagle

#

I have a functional prototype for deployment but I dont have a ci/cd inplace and abuncha other stuff that makes it hard for me to manage it lol properly

#

so starting with stage 1 testing

#

then moving to kubernetes

amber saffron
#

lol

hollow eagle
#

I mean, pick a cloud provider and setup a VM with reasonable specs. Test, then rescale the VM to a new size and test with that.

plush lagoon
#

i'm using GCP

#

yep I agree @hollow eagle and will do that โค๏ธ

#

automating everything sucks @.@

#

its like playing 3 dimensional chess @.@ mental exhaustion is real

amber saffron
#

on server it attaches everything correctly, but on client it only appears that the static mesh actors can attach appropriately, the skeletal meshes (which hold the static meshes) are not attaching to the main skeletal mesh actor, any idea why this might be happening?

distant vault
#

Hello, I'm having some issues with displaying the ready status of my players. The event goes like this, On click, run on server (not is ready = is ready). after that I get the game mode and call Update ready status, Which loops through all the player controller and get is ready and calls Update Player list. the player list is then generated again with the updated information. THE PROBLEM is that on one client it changes all the players ready status and on the other player it does nothing. hopefully you understand it.

sinful tree
#

You shouldn't need to be storing player data in the game mode. Use the player state. Anything that you need to be replicated you can set as a replicated variable. If you need something that should trigger an event, you set the variable to be a "RepNotify" variable so an OnRep function gets generated.

So then what happens:
Client Presses ready Button > RPC to Server to Indicate Ready > Server gets playerstate of the actor readying up > Server sets replicated boolean "Ready" > (Seperate process: OnRep of the "Ready" boolean can then set client UI)

Any other data that you want to have clients know about a specific player, you should use replicated variables on the playerstate (or at least, a replicated variable of your structure). Not an array of a structure stored on the game mode.

At any time you need to get player information on clients, they can get the player array from game state or the PlayerState from their controlled pawn. If you need to have a UI built up around a specific player, then you use their playerstate as a reference to their specific UI element.

distant vault
distant vault
sinful tree
distant vault
#

the event does get called now

#

This is what I have now but it doesn't run

sinful tree
#

Game Mode doesn't exist on clients, so that would only ever trigger on the server.
You shouldn't need to make an RPC to the server on the UpdateReadyStatus interface if you're in the game mode (as game mode only exists on server). Still also questionable why you need to do this at all - you shouldn't need to send the data to each player controller - they can get the replicated "Ready" boolean from the playerstate already (in theplayerstate), and any clients needing to update UI can do so also with the OnRep. Mind if I DM you a set up I've built so you can see how I've done it? It's several images.

rotund onyx
#

if the server creates a component (with replication checked) on a player, does that player automatically replicate the component? I am seeing a very large delay in UI when players attempt to interact with their component's variables

winged badger
#

as long as the player is replicated, yes

#

replication is not instantaneous, so it will replicate when the player actor replicates

#

you can ForceNetUpdate to get it ontop of the queue

candid gale
#

Question, where and how can I run server side stuff for the level. eg: I want to spawn some replicated actors before any player joins?

#

Real motive is to have like a world manager for a loot system and such

weak linden
candid gale
#

Thank you so much

latent heart
#

Did someone say subsystem?!

candid gale
#

The constructor doesn't seem to be a good option

weak linden
#

I would probably just say BeginPlay

candid gale
#

oh, can I just call that on a GameModeBase class?

weak linden
#

It'll automatically be called by the engine so just hook your functionality onto it either in BP or C++ and it'll work just like that

candid gale
#

Really cool and straightforward, appreciate it

weak linden
#

Happy to help ๐Ÿ™‚

visual flint
#

hello! Im building a multiplayer game in UE5 with world partition and I want a player to go from a big open world with a directional light to a cave with no directional light. Im using data layers with all actors in either world in their own data layer. When a player goes through a teleporter Im activating the target data layer. Do you know if I can load and unload data layers for a specific player controller? Like I want "player A" to teleport to the cave and later player B can teleport there as well independently. Also is there a way to know the state of a loading data layer? I want to display a loading screen while the layer loads. I cant find much online for this specifically. Would love some insight

fluid hull
#

what's the idea with UObjects that follow outer chain to get UWorld not being able to spawn actors in blueprints? Am i setting up time bomb for myself by circumventing that?

Are there gonna be issues with replicating/saving/something else if you don't spawn actor from other actor/level bp/game state/other things that are officially allowed to do so?

timid moat
#

Hi!

#

If I have two players and one of them is running as a Listen Server, how can I make it run his code as a client?

#

Thanks!

chrome bay
#

Well you can't really, it's the server

#

Not sure exactly what you're asking though - the idea of a listen server is for a players machine to act as both server and player at the same time

timid moat
timid moat
#

Is there something similar to void OnRep_PlayerName() for PlayerState in Blueprints?

#

Thanks

latent heart
#

Override begin play on your custom player state

#

It triggers on the client as well after replication.

rose egret
#

how PS->UniqueId is generated in OnlineSubsystemNull ?
Im looking for a way to save state of characters

#

I know in OSSSteam its the same every time player join with the same steam account, but what about OSSN ?

chrome bay
#

It's random

#

OSSN doesn't have any service or login info to assign unique IDs' to players

blazing spruce
#

Hi, im having an issue giving the client player input on an actor, im trying to do a security camera system where the player can run up to the control panel actor, press the interact key, then it should disable their input so they cant move while using it and then enable input on the control panel actor itself which is where the input events are to cycle next/prev through the cameras.. ive tried having the EnableInput in RPC calls but i cant get it working so i must not being doing it right or in the right place, any ideas how i can get this working?

#

Control Panel Actor

#

Interaction

dim trail
#

do I need to RPC DisableMovement or any changes to the movement mode?

winged badger
#

so Client RPC wont' work

#

you can call SetOwner on it from both client as it starts interacting and on server when ServerRPC arrives, to the Player's Pawn or Controller

#

that is assuming your Server RPC for interact is routed properly, ofc

blazing spruce
#

So where does SetOwner get called? on the input action or on the control panel actor?

winged badger
#

you should always screen blueprints so one can see what blueprint it is, scope matters

#

but yes

#

it is generally better to send a pointer to the interaction target through the RPCs to avoid any potential ambiguity

#

like having 2 interactables in the overlap range, client can decide on one, server on the other one

timid moat
#

Hi!

#

Using GameInstance to save data and retrieve it after player travels (with OpenLevel) doesn't work for one player when that player is a Listen Server. Any advice?

#

Thanks

young spoke
#

sup guys... which would be better for sharing state among many clients?

  1. let the replication system manage deltas for UPROPERTY(Replicated) TMap<int32, SomeComplexStruct> MapChangingOften shared on clients
  2. manage deltas yourself with multicast RPCs?
#

oh wait, is TMap even replicated properly

eternal canyon
young spoke
pastel fiber
#

Do actors with bReplicates=true always get spawned in servers? In other words, we don't need to check whether the running code is in a server, right?

true spade
#

I have question, how it's possible to get recent player that have played the game/match?

magic furnace
#

What do you mean by that?

true spade
#

For instance, you've played a multiplayer match with 10 other players that you don't have in the friends list, and I'd like to display "Recent Players" in the main menu so you can add them as friends later if you'd like. So is it possible to fetch list later?

quasi tide
#

You can track that with a backend service. Or just locally.

#

So every match, just locally log who you're playing against and then when they go to that menu, just read from the file or the backend service.

magic furnace
#

yup

true spade
#

Aha, great. Thanks for that. I think for now I'll do it locally.

#

And for adding friends is that has to be done on the backend or it's possible through the subsystem?

sinful tree
real ridge
#

guys where I can find what does this variables mean? I need set up some things for my multiplayer game but I cant find these things in documentation or anywhere else

[/Script/OnlineSubsystemEOS.NetDriverEOS]
bIsUsingP2PSockets=true
P2PConnectionTimeout=6000
ConnectionTimeout=6000.0
InitialConnectTimeout=6000.0
MaxClientRate=100000
MaxInternetClientRate=100000

[/Script/OnlineSubsystemUtils.IpNetDriver]
ConnectionTimeout=10.0
rose egret
#

is there any option for URL to change the PlayerName of PlayerState when connecting to server ?

#

or maybe changing UniqueNetID ?

sinful tree
#

The below image was taken from docs. Has to do with Epic Online Services P2P connections.

Connection timeouts are definitions of when responses aren't received in milliseconds. So basically everything is set at 6 seconds with no response == the engine will assume connection was lost.

MaxClientRate / MaxInternetClient rate is the maximum number of bytes per second the server/client will attempt to utilize per connection, either for a client on a LAN connection or a client over the internet.

elder sable
#

Hi, if i have a RPC with a struct as parameter, how could i use another struct inheriting from this one ? I could use actors replications but i wonder how to do it with RPCs

real ridge
#

link?

#

we are joined on dedicated server

#

to session there

#

tried to inscrease this to be not kicked from session but after 10sec my character dissapeared for other players anyway

pastel fiber
sinful tree
elder sable
#
// from AOnlineBeaconHostObject::OnClientConnected
Cast<ANVLobbyBeacon>(NewClientActor)->Test(Lobby); // Lobby is valid
//
    UFUNCTION(Client, Reliable)
    void Test(ANVLobby* Lobby);
// Lobby has bReplicates to true

Is this supposed to work with this setup ? Lobby is null on the client RPC

glad escarp
#

Hey guys. I have a strange issue with my game. It's listen server and the host loads in correctly, has the right pawn/controller etc. But subsequent players who join seem to be switching to the default engine pawn for some reason. Anyone know why this would happen? BTW: In my game mode, I am using Event Handle Starting New Player to spawn their character and possess it.

elder sable
#

Did you remove auto possess ?

glad escarp
#

Yes. Auto-possess is disabled on the player character.

elder sable
#

Maybe FinishRestartPlayer possess it before you set the pawn

#

Breakpoint on OnPossess and check who possess your pawn

glad escarp
slim mist
#

I have a vehicle actor that is spawning a weapon actor on AActor::PreInitializeComponents. How should I handle the spawning of this weapon actor from a replication perspective? Should I do a check if the environment is the server?

elder sable
glad escarp
elder sable
#

Well check the possess events to have more informations

pastel fiber
#

You must be using a source build of Unreal Engine, which you can download from the Epic Games Github.
If your project is using a binary build from the Epic Games Launcher, you will need to migrate it to a Github source build.

Why can't we use the prebuilt binary to package game for dedicated servers?

hallow sand
#

If I get spammed with these, how bad is that? Is there a simple place I should be checking for issues?

[2022.11.29-21.16.17:403][858]LogNetPlayerMovement: Warning: ServerMove: TimeStamp expired: 185.007645, CurrentTimeStamp: 186.049927, Character: Char
[2022.11.29-21.16.17:403][858]LogNetPlayerMovement: Warning: ServerMove: TimeStamp expired: 185.007645, CurrentTimeStamp: 186.049927, Character: Char
[2022.11.29-21.16.17:403][858]LogNetPlayerMovement: Warning: ServerMove: TimeStamp expired: 185.007645, CurrentTimeStamp: 186.049927, Character: Char```
woeful lantern
#

Hello, I'm trying to make the multiplayer work in my game, but when I join a session I get this. Can somebody help me resolve it?

bitter oriole
#

Dedicated servers are for an advanced audience

#

Those will use a fork of the engine anyway

pastel fiber
bitter oriole
pastel fiber
bitter oriole
#

If it takes more than one hour to rebuild the week's version your team needs better hardware

#

You don't even need to work with dedi anyway

#

You just need to test it regularly and ship it

#

So you can integrate that in your CI process

plucky prawn
viscid tapir
#

There is no problem using "Run on server" in the game state right (Calling the events whenever it is the server instance) ? But using "Run on server" in the gamemode is useless ?

sinful tree
#

Game Mode is only on the server, so yes, using Run On Server events on Game Mode won't trigger if executed from clients (they can't even reference the game mode itself to try and do so)

latent heart
#

I think he misunderstands what "Run on server" means.

#

He think it limits it to only be run when there is authority.

#

That is not what it does.

dark edge
rotund onyx
#

hi everyone,
In my game players press a lot of buttons to interact with replicated objects and change their variables. Sadly for me there seems to be a second or so of delay between pressing the button and seeing the number change and it makes the ui feel very sluggish.
I'm wondering what's the intended way to operate a ui like this in a multiplayer environment. I need a synced ui because accuracy is very important, but I dont want it to feel so sluggish either.

dark edge
#

Is the delay what you'd expect given the ping you're testing with or much more than that?

#

if it's much more than you'd expect with the ping settings, then look into the replication update rate of the actors. Maybe it's super low

rotund onyx
#

its more than I expected but I don't have anything to really compare against. I imagine most of the games I play have decent netcode so I probably dont actually know what "real" ping looks like

#

I'm a little surprised unreal wont do prediction of at least variables automatically
or maybe it does, I dont know lol

#

how do I even get started with that

latent heart
#

Things will update quicker if you don't reply on replication, but force the issue with an RPC.

#

Regular replication is not always instant.

#

Depends on what variables you want to update, of course.

rotund onyx
latent heart
#

You haven't actually said what variables you want to change.

#

There is no "prediction" at all unless you implement it, except for things like positional changes with hte character movement component.

rotund onyx
#

I mean its just things like clicking a button and an int goes up

latent heart
#

How is the engine meant to predict you pressing a button? ๐Ÿ™‚

#

Prediction works on extrapolating current deltas to estimate future values.

#

I'm far too anal about my wordage.

rotund onyx
#

I definitely am familiar with the concept

#

Just have no clue how implementing it works

latent heart
#

I take it you are sending an rpc to the server when you hit the button and then relying on regular replication to notify everyone about the change?

sinful tree
#

Press Button -> Increase Int to new value on client -> RPC to server that you've pressed the button -> Server increments the int and replicates to everyone.
Now you just need to deal with rollback

latent heart
#

If the server says no, it should revert the change.

#

And you shouldn't make major changes until the server has acknowledged it.

rotund onyx
latent heart
#

E.g. you might start to spawn a projectile for a gun, but you'd never kill somebody until the server acknowledged you actually pressed the trigger.

#

It depends what your variables do to how you deal with this.

#

So far all we know is, "it's an int"

latent heart
#

You should also use regular replication as well so that late joiners know the value.

rotund onyx
#

i mean its no more complicated than "press button to make int go up"
I just dont want my ui to feel sluggish while it waits to the new value

latent heart
#

So use the above outlined method!

rotund onyx
#

so is ForceNetUpdate fine for "less important" scenarios

quasi tide
latent heart
#

You should also probably block further changes to your int in between notifying the server and receiving an acknowledgemnt.

rotund onyx
#

I assume I wouldnt want to use it on something that relies heavily on reflexes?

latent heart
#

Shrug

#

QTEs need to die, so yeah.

rotund onyx
#

(what is QTE?)

quasi tide
#

At least three quarters of The Last of Us

latent heart
#

Quick Time Event.

rotund onyx
#

oh right

#

when would I want prediction versus just doing ForceNetUpdate?

dark edge
#

I would not try doing prediction if you can make it work good enough otherwise

latent heart
#

Nothing you have said would involve any prediction whatsoever.

rotund onyx
#

I know, but now I'm curious

latent heart
#

Things which update frequently and constantly should probably use prediction.

#

E.g. movement and camera angles.

latent heart
#

It's just not quick

prisma snow
#

The thing is that I don't know the context of the game

rotund onyx
#

how would such a thing be set up? Is it like two variables, where the client updates theirs and then gets a repnotify of the "real" value?

prisma snow
#

But if it's UI stuff and 99% of the time the client is going to be "right", just go ahead and change the value in the client straight away

latent heart
#

Basically.

#

You assume positive result and act accordingly, but don't do anything hard to undo until the srever acknowledges.

rotund onyx
prisma snow
#

What I would do:

  • On button click, update value client side + RPC the event/new value.
    -Server performs the logic and replicates the value
  • OnRep, the client recieves the new server value and overwrites the client-side that we "predicted"
rotund onyx
#

interesting

prisma snow
#

unless UI has changed much since I did it, you need to manually update widgets anyway when the underlying value changes (unless you are using bindings)

rotund onyx
#

what's the best way to set up the OnRep for the UI? Should I be using event dispatchers or something? Can I somehow listen for OnRep?

prisma snow
rotund onyx
prisma snow
#

And the replicated values should belong to whatever class the do, the OnRep will fire automatically and you can write your logic there

prisma snow
rotund onyx
#

going from OnRep back to the UI is where I'm not sure

prisma snow
#

But tbh don't worry about performance yet, I doubt UI is that heavy

quasi tide
#

UMG MVVM should not be used by beginners imo. Stick with the tried & true event-based approach

prisma snow
woven basin
quasi tide
#

In BP - you just make it a an onrep variable

quasi tide
#

Needs to be notify

prisma snow
latent heart
#

It's bindings without poling.

prisma snow
quasi tide
# latent heart Is it all that different?

Well, 1 - it is in beta, 2 - it almost didn't even make this release, 3 - no one has really dug into it.

Having someone, whom is a beginner, should stick with the stuff that is for sure to work.

rotund onyx
#

sounds cool

#

I will stick to your advice and ignore it then

latent heart
#

I assume it ties into ufunction setters or something

quasi tide
#

For BP onrep, you just need to change your variable to this. Then it'll create a function for you in the left side (OnRep_{VarName}). Double-click on that and the code you put in that function will run whenever the value of the variable changes.

#

If you're in C++, you have to call the OnRep function manually.

prisma snow
#

You tied the macro to the name of the ufunction that was triggered

quasi tide
prisma snow
#

Been a while since I setup rep

#

I use mostly RPCs lately

rotund onyx
rotund onyx
prisma snow
prisma snow
#

Unreal's system is quite good and using it as it was intended will yield the best results almost always

rotund onyx
#

cool, thanks for sharing

#

always interesting to see everyones' different approaches

quasi tide
#

I create an AHUD class that manages ALL of my widgets.

rotund onyx
#

I really need to get into using a HUD

quasi tide
#

Then I have my PlayerController just talk to that to bind to stuff or call methods directly

rotund onyx
#

right now I do everything in the PC but compartmentalizing all UI things into a hud might be nice for my sanity

frosty dune
#

Hey Guys, I'm trying to determine how I'm going to approach building interiors in my multiplayer project. Would it be more performant to instance the interiors and have players load a separate map of sorts. Or should the interiors be modeled right into the building itself so no loading would need to be done?

Edit:
Player counts will be roughly 50. Dedicated servers

bitter swift
#

I have a question regarding competitive multiplayer gaming.

I assume peer to peer or player hosting is out of the question. One issue is that 1 player will have server authority and can effectively cheat. The other issue is that if the player host crashes then the whole game session crashes and nobody can reconnect.

With a dedicated server you solve both of those problems. However how exactly would it work with creating those dedicated servers? Keep in mind, these dedicated servers should not be launched by any player.

I suppose it's ok for a player to host a lobby that other players can join. When they are ready, what happens then? Can they communicate to a 24/7 server somewhere that will create a dedicated server for them? If yes, is there a guide on how to setup in Unreal Engine?

I sincerely appreciate the help on this topicโœจ๏ธ

rapid bronze
# bitter swift I have a question regarding competitive multiplayer gaming. I assume peer to p...

Sounds like you're looking for on request deployers
Following this you would probably have a master server that handles the deployment and keeps track of everything that's needed, basically the player would connect to this lobby / master server, send a request to deploy an instance somewhere on another server (Start match) then handle all the connections and such (Connecting to match)

Don't take my word for it tho, never done it personally, look how competitive games deploy instances, lots of the times they have public explanations for how the server infrastructure is setup

#

It generally requires a lot of work tho unless you use some sort of service that does it for you, but usually it'll be expensive from what I've seen

bitter swift
rapid bronze
#

For an example guess you can look at PlayFab

#

All the subsystems they have implemented and the services they provide

#

You could honestly even just rely on an already existing platform, let players create Dedicated Servers but only consider progress, achievements and all that stuff on official servers, think like counter strike

It really just depends for what exactly you want to go for

bitter swift
visual flint
#

Is there a way to toggle data layer visibility for an specific player controller?

normal vault
#

Question.. Is GI best place to store a client's player token for transfer across two dedicated servers?

My thought is storing it from GS to GI in the beginning of the transfer logic, doing the transfer, and then retrieving it from GI back into GS on connect. From there, it calls the API and retrieves the data to shoot down to the PS, and reassigning the player vars in the pawn. It sounds right in my head, but I wanted to see if anyone has any better advice.

timid moat
#

Hi!

#

I have added a TextRenderComponent to the blueprint third person character. I set it a text, create and start a new session as a Listen Server. The problem is that when the other players join the session, they don't see that text updated on their client window.

#

Any idea about what it is happening?

#

Thanks!

pallid mesa
#

the player name is stateful therefore it should be replicated or sent on-join to the other peeps

pallid mesa
#

you are using the playername from the playerstate?

timid moat
#

Thanks. I'm new with this and I can't find anything similar to what I'm doing. Or maybe, I'm not searching it with the right words.

pallid mesa
#

how are you setting the text?

timid moat
#

This is the problem:

timid moat
pallid mesa
#

yes, non stateful code causing issues, that's a typical beginner problem, don't worry ๐Ÿ˜„

#

but where, how

timid moat
pallid mesa
#

you'll learn about when to use multicasts, when to not use them

#

once you do, we can come back here and continue with the explanation ๐Ÿ˜„

timid moat
pallid mesa
#

multiplayer is tought, we gotta go step by step Elric, I'm sure that if you are determined to learn you'll be able to tackle every time more and more complex problems

#

but let's start from the very beginning, otherwise it'll be harder

#

also don't be afraid to ask if you don't understand something that's written in the article, this is necessary

timid moat
#

@pallid mesa I don't understand this paragraph: "Since we want new connections to see the new mesh of our Pawn, we are going to employ a state for that. In this case I decided to use an OnRep boolean, which defines whether a player has the new Mesh set or not". I don't know how you use the OnRep boolean to know if I a (new?) player has the Mesh set or not.

pallid mesa
#

I simply set the bool in the server

#

when the new player joins... since it's a replicated property, he'll receive it and execute the onrep on his machine

#

when a player joins a game, they receive all the replicated properties from all the actors that are relevant to him

#

some of these replicated properties can execute some behaviour when they "change" in the client

#

that's what onrep does... if the new value is different than the old one

#

onrep will fire

timid moat
#

Thanks. I have my custom PlayerState blueprint class, but I haven't been able to find the OnRep for the PlayerName.

timid moat
pallid mesa
#

correct imagine u join a game

#

and the game has a property initialised to 7 in the details panel, which happens to be replicated

#

if u join to that game and the server happened to have changed that property before... you will receive the new one (for example 5)

#

and since what you have stored in the client doesn't match what just came to you, you will execute the onrep locally

pallid mesa
#

I don't think you can override it in blueprints, you should be able to override it in C++ since its virtual...

#

because of this same reason, we have to do little tricks in Blueprints to achieve the desired result

timid moat
pallid mesa
#

yes the behaviour inside the onrep can do that

#

like.. imagine that every time the player changes his name, u want to make something else

#

ie: grow his head

#

this would be the place to do it

#

so imagine the more characters the name has, the bigger the head

timid moat
#

and, if there isn't no OnRep in Blueprints, what can I do?

pallid mesa
#

right since we are unlucky and there's no onrep on blueprints

#

we have to explore the options we got with this

#

let me check

timid moat
#

I'm think it could be easier if I use a variable for the Player's name instead of using the PlayerState.

pallid mesa
#

yes you can do that for instance

#

but if you are using the playerstate

#

what you can do is to have a playername variable in the character aswell

#

and every time there's a possession you send the playerstate playername to the character through the server

#

and let the blueprint character playername replicate

#

for example...

timid moat
#

OK. Thanks a lot! You've helped me a lot.

#

I have to go now, when I come back I'm going to try this.

#

Thanks again.

pallid mesa
#

another option you have on blueprints is "on beginplay of your character" wait for the playerstate to be around, and once it is around set the text

#

because remember beginplay executes in client and server

#

when a connection becomes relevant to you, the client side begin play will execute for you

#

why am I saying to "wait for the playerstate to be around"?

timid moat
#

Yes, I don't understand that.

pallid mesa
#
  • because the playerstate is another actor and it might not exist by the time the character is created iirc -
#

because... actors replicate independently

#

and character might have replicated for you before playerstate

timid moat
#

How can I wait for the playerstate? Is there an event triggered when the character receives it?

#

I know in C++ exists.

pallid mesa
#

not in blueprints... you'd have to imply the controller i believe

#

in fact I don't quite remember what's exposed and whatnot in blueprints... sometimes I forget things

#

but this is what Jambax and co say...

#

Blueprints multiplayer is a demo for the whole thing

#

what you can do is to do a wait loop

timid moat
#

A lot of things to learn.

pallid mesa
#

indeed! I'm learning every day aswell!

#

So a wait loop

#

in which you check for the playerstate

#
1: if (IsValid(playerstate)) DoThings() 
2: else goto 1
#

you can do that with a timer, or with a delay

#

it sucks... but it does its job lol

timid moat
#

Thanks a lot @vori. I have to go now.

#

Bye.

rose egret
#

how destroys the pawn when GM::Logout happens ?

#

Damn UE5 had 50GB of PDB and I did not download do cant use debugger for engine codes

timid moat
#

Hi!

#

Do you know if there is documentation or a book that tells about what happens under the hood? For example, what happens when a player join a session on a server? Does the server sent to the player all the replicated data? Which methods run and where they run?

#

Thanks!

glad escarp
timid moat
#

Hi!

#

When a player joins a server's session his PlayerController's Begin Play run first on the server, and after that on the client, isn't it?

pallid mesa
#

yes

#

gm creates pc, dispatches beginplay, postnetinit happens on the client and begplay beginplay is dispatched - iirc

#

hahaha

woven basin
#

I've read WizardCell's peristing data link. I was wondering if there is an (easy) way to make it that nothing persists between levels? i.e. playerstates + playercontrollers are fully reset to initial spawn status. At the moment they are apparently persisted on the server by default?

(this is for some automated editor specific stuff, where I want/need 'stateless' so that they are fully reset)

#

...yeah - maybe its literally as simple as that and I'm over thinking it - let me go try it out now. Thanks.

#

yeah thanks - not sure why I was overcomplicating it. And then I can use a custom GameInstance for the 1-2 very specific things I explicity want to carry forward. Thanks

pastel fiber
#

Which version should I follow when splitting code based on ROLE?

Version A

void AProjectile::BeginPlay()
{
    /*....*/
    if (GetLocalRole() == ROLE_Authority)
    {
        SphereComp->OnComponentHit.AddDynamic(this, &ThisClass::OnImpact);
    }
}
void AProjectile::OnImpact(/*....*/)
{
    if (OtherActor)
    {
        UGameplayStatics::ApplyPointDamage(/*....*/);
    }

    /*....*/
}

Version B

void AProjectile::BeginPlay()
{
    /*....*/
    SphereComp->OnComponentHit.AddDynamic(this, &ThisClass::OnImpact);    
}
void AProjectile::OnImpact(/*....*/)
{
    if (OtherActor)
    {
        if (GetLocalRole() == ROLE_Authority)
        {
            UGameplayStatics::ApplyPointDamage(/*....*/);
        }
    }

    /*....*/
}
pallid mesa
#

they both will provide the same end functionality... but I'd say that if you use the former, be explicit with your naming on the OnImpact function and make clear that it runs only on authority

#

the later consumes a bit more resources, but its negligible

#

can be handy if u ever need non authorative reactions

pastel fiber
#

In Version A, we need to trace all executing paths to know that ApplyPointDamage() will never be invoked in clients.

In Version B, the intent can instantly be understood. No need to trace the calling history.

pallid mesa
#

mhm, that's why I mentioned that if you use the former, you might want to provide a better naming conv

timid moat
pallid mesa
#

what I can recommend you is to check Cedric's eXi Network Compendium for starters

pastel fiber
timid moat
pastel fiber
timid moat
thin stratus
# timid moat Thanks. This?

What happens when you start up your Unreal Engine game? This video is a guided tour of the Engine's initialization process: along the way, we'll glimpse the high-level structure of the Engine (modules, game instances, local players, and viewports) and we'll see how all the different parts of the Game Framework (game modes, game states, player co...

โ–ถ Play video
#

You can have a look at this

#

But it's not directly for Multiplayer

#

But probably good for everyone to have a look at at least once

#

An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.

Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe

00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...

โ–ถ Play video
#

He does have a Multiplayer video, but I don't think that has the lifecycle in it

twilit radish
timid moat
glad escarp
#

Hey guys. I have two questions. One is a follow up from yesterday and the other is a general question in preparation for creating my equipment system:

  1. I have a strange issue now where players who join my session will be unable to move, almost like the player character isn't registering any input. Any ideas on why that might be?

  2. If I want to use data tables to create databases for my equipable items/weapons and plan to have items that are locked until the player meets certain achievement criteria, since you can't modify a data table at runtime, the entire set of items would be in these data tables. So to unlock them, would I have arrays saved in the player's player state (or somewhere else) that load in from cloud stored variables on my target platform? (steam in my case)

Thanks in advance.

timid moat
frail coral
#

Hello there how do I replicate subobjects purely on blueprint? I managed to do it on c++ but whenever I try to replicate them purely on bp they just replicate as null

frosty bison
#

Hello guys. I have some problem with creating widget in multiplayer project (c++) for 2 players. How can I create some widget for every player (but not for copies of clients)? I tried to do client function (UFUNCTION(Client, ...)) where I am creating widget by Cast<ControllerCreatedByMe>(GetController()) and my UserWidget class and then I am adding it to viewport. I put this function into BeginPlay and it gave me an exception. I fixed this by adding validation in BeginPlay (IsLocallyControlled()). But now it looks like finally 2 widgets were spawned by the 1 PlayerPawn (I checked it by the breakpoint and also in the elsewhere in my code I see that widget variable for another player is NULL). It is doing unreal further work with that widget. How can I fix it?

clear island
#

how much overhead is there sending in an RPC like:
MyServerRPC(AGameCharacter* Character) vs
MyServerRPC(int32 CharacterID) ?

#

basically, sending a Pointer to an existing Actor vs sending a simple int32, whats faster?

#

from the CharacterID I can get the corresponding actor which is why I'm wondering if it might be better to just send the CharacterID vs the pointer

sinful tree
clear island
#

or is it a string

sinful tree
clear island
#

ah I see

#

so basically, there's no point in sending a int32 directly, its already optimized enough to send an int32 reference

#

cool

hoary lark
frosty bison
#

It seems to be a normal multiplayer

#

I chose โ€œas clientโ€

#

No I did not turn off that option

hoary lark
#

Turn it off

frosty bison
#

Where should I turn it off?

#

Run under one process

#

Is it?

frosty bison
hoary lark
#

Should be in the drop-down beside the play button

#

Not sure if they've moved it I'm in ue4 still

frosty bison
#

I am using ue4 too

#

Hmmm

sinful tree
#

Go to advanced settings....

frosty bison
#

I turned it off and got one black window

#

I waited and got 2 windows

#

How to debug when one window opened in another process?

latent heart
#

Attach to that process.

frosty bison
#

How I should do this?

latent heart
#

It'll be in the debug menu of your IDE

frosty bison
#

Ok, thanks, guys

#

I will try a lot at day cause time on clocks is 4:25 am

gray orchid
#

does anyone know how to let people join sessions on your game without them having to be in your organization?
for now im just skipping the loggin but if I want to do player level and such I need a way to let them join with an account

glad escarp
#

Man, this is so weird. I still can't figure out why players who join my game session can't move. I spawn their pawn, posses it and set input to game mode only in the OnPostLogin event in the gamemode. It works for the host every time but none of the clients. What gives?

#

I guess I'll try setting the input mode in the Pawn in the OnPossesed event?

prisma pelican
#

is it better to keep scores and rounds won in game mode or player states?

sinful tree
frosty bison
#

Can someone go to discord with me to explain one moment with widgets in multiplayer on c++?

versed dirge
#

Hi there! New to Unreal and C++ so forgive me my sins. Here's a question:

How do you guys catch NetworkError and TravelError events at the C++ level?

In GameInstance.h we have:

    /** Opportunity for blueprints to handle network errors. */
    UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "NetworkError"))
    void HandleNetworkError(ENetworkFailure::Type FailureType, bool bIsServer);

    /** Opportunity for blueprints to handle travel errors. */
    UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "TravelError"))
    void HandleTravelError(ETravelFailure::Type FailureType);

but these are not marked as virtual, so as far as I can tell we can't intercept them with an override defined in our derived GameInstance class. Instead, they go straight to the Blueprint.

thin stratus
#

While Spawning and Possessing is indeed a Server only thing, the InputMode is a local only thing

#

Both PostLogin and OnPossessed are calling only on the Server

#

I highly suggest not setting the InputMode in more than one place.

#

What I usually do is have some logic in my PlayerController that checks several conditions each frame and decides the InputMode based on that.

#

That's also how Epic usually does it.

#

That way you only set the InputMode in one place, that has all the Info about UI being on the Screen or not (giving you only add Menus etc through it) and it's more or less automated.

thin stratus
#

There should be some global delegate to bind to

#

I can't recall the names and I don't have an engine at hand to check

frosty bison
woven basin
versed dirge
#

@thin stratus There's not, unfortunately. They get called directly:

void UEngine::HandleNetworkFailure_NotifyGameInstance(UWorld *World, UNetDriver *NetDriver, ENetworkFailure::Type FailureType)
{
   ...
        World->GetGameInstance()->HandleNetworkError(FailureType, bIsServer);
   ...
}
woven basin
#

Do Clients know if the current server they are connected to is a dedicated or listen server? I know I can easily write that function myself, but just wondering if that logic already exists or not in an existing function?

frosty bison
#

I use listen server, as I know

#

Is something changing when I change it on "run as client"?

thin stratus
#

Spawning a Widget only on the Local Clients is relatively straight forward

frosty bison
thin stratus
#

BeginPlay of your PlayerController with a "IsLocalPlayerController" check should be enough

#

In a Pawn, you can't use BeginPlay for this

#

Because the Pawn is not possessed when it calls BeginPlay

#

So you can't check if it's locally controlled, since it's .. not

frosty bison
#

Should I do it in my controller?

thin stratus
#

Depends on the UI you want to show

#

If it's a generic HUD that is not specific to your Character, then yes

#

If you have multiple Characters that all need different HUDs, then Character might be better

frosty bison
#

It is score widget

#

That should show scores of two players

thin stratus
#

Then PlayerController should be fine

frosty bison
#

Ok

#

Thanks for advice

thin stratus
#

Also no need for making it a Client RPC. Just in case you are still doing that

frosty bison
#

I thought that all actions with that widget I should do with a client RPC

thin stratus
#

Why

frosty bison
#

When I did a similar thing in another project with Blueprints, it worked

#

But now I am working in C++

thin stratus
#

You only need a ClientRPC if you are on the Server and you need to target a specific client

#

BeginPlay, in for example the PlayerController, calls on Server and the owning Client (doesn't exist for other clients), so the only thing you have to do is stop the code from spawning the Widget if you are not the local player. That's why a simple IsLocalPlayerController check is enough

frosty bison
#

Maybe it made my way working

fathom aspen
thin stratus
#

Part of UEngine

#
// Keep an eye on any network or server travel failures
    GEngine->OnTravelFailure().AddUObject(this, &UGameViewportClient::PeekTravelFailureMessages);
    GEngine->OnNetworkFailure().AddUObject(this, &UGameViewportClient::PeekNetworkFailureMessages);
#
    // register the engine with the travel and network failure broadcasts
    // games can override these to provide proper behavior in each error case
    OnTravelFailure().AddUObject(this, &UEngine::HandleTravelFailure);
    OnNetworkFailure().AddUObject(this, &UEngine::HandleNetworkFailure);
#

HandleNetworkFailure calls HandleNetworkFailure_NotifyGameInstance

#

So yes, there are delegates. You just need to dig a bit deeper next time :P

glad escarp
thin stratus
#

You already said that :D

glad escarp
#

Wierd. I sent it once.

#

My phone deleted the first one on my side I looked like.

glad escarp
thin stratus
#

Depends on the game, but the most basic one is if a Menu is open by checking if the UUserWidget pointer is valid and visible.

#

If no menu is open, I set it to GameOnly

#

If a menu is open, I set it to UIOnly

#

+- ShowMouseCursor

#

And making sure it's only set once by having a member variable. Some custom Enum with the 3 options is enough

#

So if (NewInputMode == CurrentInputMode) return; where NewInputMode is the one you figured out by your condition and CurrentInputMode is the member variable.

glad escarp
wheat magnet
#

If I host session using EOS, will I still need to build dedicated server for joining sessions over internet?

woven basin
verbal tendon
#

Usually to serve those you want to have a counter implemented of objets that it UI only input

#

once that counter reaches 0, you go back to game input

wheat magnet
#

@woven basin If I made a simple multiplayer game, and If I try to join session using EOS from another computer, will it works?

woven basin
wheat magnet
#

So this means I don't need to deploy a dedicated server on cloud computer?

woven basin
#

no, you can do either

wheat magnet
#

users can host from anywhere and join

#

using EOS

glad escarp
wheat magnet
#

That's what I am trying to say that If EOS allows us to make/join sessions, then why we need to deploy a dedicated server build on cloud computer?

woven basin
wheat magnet
#

I can deploy dedicated server on amazon etc, and users directly join via ip. why EOS then?

woven basin
#

For the same reason that you can program a game using C++ without Unreal. Sure, you could do that, but your just making it harder.

#

The Online subsystems do alot of work under the hood

#

Just wait till you have to tell users to manually open ports etc.

wheat magnet
#

Deploying dedicated server is difficult than listen server.

#

And it's also cost you for cloud computer

#

So listen server is best option?

#

If user host a game using listen server, then this means that user have opened connection port to join other players?

#

does this also means that user computer will "act" as server?

fringe thistle
#

Hey guys, I'm currently trying to replicate a struct which has a void* variable in it but whenever I parse that struct into a server RPC, the value of the void* is always nullptr while other variables are replicated properly. Does anyone know how to fix it?

fringe thistle
#

Hm ok that explains alot. So is there any alternative for void* in addition to TArray<uint8> ?

#

well my void* is an address to another struct (could be a c++ struct or a blueprint struct). I use void* cause I made a K2 node that has a wildcard input so I could parse in whatever struct I want

thin stratus
glad escarp
fringe thistle
#

what do you mean by that? ๐Ÿ˜…

#

maybe before sending the void*, I could convert it to a UStruct pointer and then send it? ๐Ÿค”

verbal tendon
#

Upon sending MyOtherStruct through the network it will also serialize the instance of FMyStruct

#

void* is not a type of anything, it is a pointer to memory

#

I would suggest brushing up on C++ basics if that doesn't make sense, before learning C++ for Unreal

plucky prawn
#

void* is also begging for problems

verbal tendon
#

The appearance void* in code commits is highly related to subsequent firing of software engineers involved in this practice. #changemymind

fringe thistle
verbal tendon
#

Replacing one bad idea with another bad idea with no further information to the base of your reasoning doesn't help

#

provide an explanation of the problem you are trying tos olve

#

Rather than other guesswork ideas and asking if they might possibly be correct. That way will make it more likely you get satisfactory help

primal pike
#

Given that I already implemented all my RPC and built my Actors with the Replication System in Mind.
What are the requirements to Network Test a game outside of the same LAN. I had some problems in the past.
My Research showed me that it would require me to do NAT Punshing. Is there some alternative Systems, Protocols or Frameworks to make it easier (Like Steam).
Also I want to set it up as a Listen Server where the main Client hosts the match. Just the quickest route to Test multiplayer with my Partner: Select Map > Start Game from CLI > Enter IP Address > Join Session to playtest Mechanics.

plucky prawn
#

nat punching isnt really required unless you want to publish it and want lobbies and shit

#

in which case you would usually just use like EOS or steam

woven basin
#

In WizardCalls guide, he says that console command servertravel is seamless, while travel command is not.

But then it goes on to say that you need to enable AGameModeBase.bUseSeamlessTravel for seamless travel to work.

So when I call servertravel on a map when the gamemode is false for this, is the engine going to force seamless, or will it respect the gamemode?

plucky prawn
woven basin
#

yes - it was more about just trying to understand how it is layered.

plucky prawn
thin stratus
#

ServerTravel is not Seamless by default.

#

It depends on the setting in the current GameMode

#

In case that answers your question

woven basin
#

ok thanks... in that case the wording is vague in the guide. I guess servertravel will try to use seamless if the game mode allows it?

woven basin
fringe thistle
# verbal tendon No it doesn't unless you provide more context

ye sr about that. So currently I'm trying to convert an array of object from a Json file to an array of structs (this part is done locally) and then send those structs data to the server. Here is the example of the JSON:

[
        {
            "Content": {
                "className": " ",
                "corpoTag": " ",
            }
        },
        {
            "Content": {
                "itemDefinition": " ",
                "skin": " "
            }
        }
]

Since each object is a different type from each other, I need a generic struct to hold the data when I convert json object into UStruct using JsonObjectToUStruct (const TSharedRef< FJsonObject > & JsonObject, const UStruct * StructDefinition, void * OutStruct) . So I create a struct called FCustomizationFragment, which has StructType (the type of the struct) and MessageBytes (the data of the struct).

USTRUCT(BlueprintType)
struct FCustomizationFragment
{
    GENERATED_BODY()

    UPROPERTY()
    FGameplayTag FragmentTag = FGameplayTag();

    /*Structure type of the fragment.*/
    UPROPERTY()
    UScriptStruct* StructType = nullptr;

    /*The data of the fragment.*/
    void* MessageBytes = nullptr;
}

The conversion part is done but I cant replicate MessageBytes of the struct atm.

thin stratus
# woven basin ok thanks... in that case the wording is vague in the guide. I guess `servertrav...
bool UWorld::ServerTravel(const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
{
    AGameModeBase* GameMode = GetAuthGameMode();
    
    if (GameMode != nullptr && !GameMode->CanServerTravel(FURL, bAbsolute))
    {
        return false;
    }

    // Set the next travel type to use
    NextTravelType = bAbsolute ? TRAVEL_Absolute : TRAVEL_Relative;

    // if we're not already in a level change, start one now
    // If the bShouldSkipGameNotify is there, then don't worry about seamless travel recursion
    // and accept that we really want to travel
    if (NextURL.IsEmpty() && (!IsInSeamlessTravel() || bShouldSkipGameNotify))
    {
        NextURL = FURL;
        if (GameMode != NULL)
        {
            // Skip notifying clients if requested
            if (!bShouldSkipGameNotify)
            {
                GameMode->ProcessServerTravel(FURL, bAbsolute);
            }
        }
        else
        {
            NextSwitchCountdown = 0;
        }
    }

    return true;
}
#
void AGameModeBase::ProcessServerTravel(const FString& URL, bool bAbsolute)
{
#if WITH_SERVER_CODE
    StartToLeaveMap();

    UE_LOG(LogGameMode, Log, TEXT("ProcessServerTravel: %s"), *URL);
    UWorld* World = GetWorld();
    check(World);
    FWorldContext& WorldContext = GEngine->GetWorldContextFromWorldChecked(World);

    // Force an old style load screen if the server has been up for a long time so that TimeSeconds doesn't overflow and break everything
    bool bSeamless = (bUseSeamlessTravel && GetWorld()->TimeSeconds < 172800.0f); // 172800 seconds == 48 hours

    // Compute the next URL, and pull the map out of it. This handles short->long package name conversion
    FURL NextURL = FURL(&WorldContext.LastURL, *URL, bAbsolute ? TRAVEL_Absolute : TRAVEL_Relative);

    PRAGMA_DISABLE_DEPRECATION_WARNINGS
    FGuid NextMapGuid = UEngine::GetPackageGuid(FName(*NextURL.Map), GetWorld()->IsPlayInEditor());
    PRAGMA_ENABLE_DEPRECATION_WARNINGS

    // Notify clients we're switching level and give them time to receive.
    FString URLMod = NextURL.ToString();
    PRAGMA_DISABLE_DEPRECATION_WARNINGS
    APlayerController* LocalPlayer = ProcessClientTravel(URLMod, NextMapGuid, bSeamless, bAbsolute);
    PRAGMA_ENABLE_DEPRECATION_WARNINGS

    World->NextURL = URLMod;
    ENetMode NetMode = GetNetMode();

    if (bSeamless)
    {
        World->SeamlessTravel(World->NextURL, bAbsolute);
        World->NextURL = TEXT("");
    }
    // Switch immediately if not networking.
    else if (NetMode != NM_DedicatedServer && NetMode != NM_ListenServer)
    {
        World->NextSwitchCountdown = 0.0f;
    }
#endif // WITH_SERVER_CODE
}
#

(also funny that it forces a non-seamlesstravel if the server is on for too long hehe)

plucky prawn
#

that function is virtual right

#

right

thin stratus
#

There are multiple places like that. Unreal Dedi Servers should not run longer than x hours

#

So best to restart them frequently

#

But that has been a thing for years now

woven basin
#
if (GameMode != nullptr && !GameMode->CanServerTravel(FURL, bAbsolute))
{
   return false;
}

So if I'm reading this right - if the game mode does not allow Seamless and you try for server travel, it returns false?

So how is it getting through then? I'll go digging more...

thin stratus
#

Try to not misread the function names

#

It checks if it can SERVER Travel

#

There is nothing speaking about SEAMLESS Travel at that point

woven basin
#

oh right -thank you

#

my dyslexia kicking in

thin stratus
#

The only thing that can stop SeamlessTravel in that functio nis if you play in editor

#

Cause PIE doesn't support Seamless

#
    // NOTE - This is a temp check while we work on a long term fix
    // There are a few issues with seamless travel using single process PIE, so we're disabling that for now while working on a fix
    if (World->WorldType == EWorldType::PIE && bUseSeamlessTravel && !FParse::Param(FCommandLine::Get(), TEXT("MultiprocessOSS")))
    {
        UE_LOG(LogGameMode, Warning, TEXT("CanServerTravel: Seamless travel currently NOT supported in single process PIE."));
        return false;
    }
#

Spoiler: That has been a problem for years and I doubt there is a fix any time soon. So that comment is probably just wishful thinking

woven basin
#

ok - so in that case - the real difference between servertravel and travel is "do I want to bring clients along with me"?

And meanwhile, "do I want seamless" if defined by GameMode (which is irrelevant for travel as no one comes along)

thin stratus
#

I have never used the travel command

#

Didn't even know that's a thing

woven basin
#

I was just trying it then, even with 'seamless' it kicks the clients back to main menu

#

which is what started this whole rabbit hole trip

#

now I get it, makes far more sense

#

Hopefully Wizard can update the guide slightly with the above - it makes more sense that way IMO

thin stratus
#

Hard Travel when using Steam would kick the Client back to the Menu, yes

#

If that is what yo uexperience

#

In general, even without Steam, you want to almost always SEAMLESS ServerTravel

woven basin
#

But you can have travel with seamless, but the only person who continues the data is the server - so they carry forward their data and kick clients.

Not sure you would ever "want" to do it - but you could.

#

So I believe you can have:

servertravel (seamless): keeps clients, keeps data
servertravel (non-seamless): kicks clients (try to reconnect), loses data
travel (seamless): kicks clients (No reconnect), server keeps seamless data across
travel (non-seamless): kicks clients (No reconnect), server also loses data
thin stratus
#

I can't comment on travel

#

Non-Seamless Server Travel also kicks clients

#

The point is that they try to reconnect

#

Which with e.g. Steam will cause issues

woven basin
#

kk - updated

#

all good - I have what I need now - so thank you

thin stratus
#

I would need to know what the travel command actually calls internally

#

Might call ClientTravel

#

That would explain why the clients don't reconnect

#

Might even cause the Server to not be a Server anymore (if ListenServer)

#

cause of the missing listen param

#
bool UEngine::HandleTravelCommand( const TCHAR* Cmd, FOutputDevice& Ar, UWorld* InWorld )
{
    FWorldContext &WorldContext = GetWorldContextFromWorldChecked(InWorld);
    FURL TestURL(&WorldContext.LastURL, Cmd, TRAVEL_Partial);
    if (TestURL.IsLocalInternal())
    {
        // make sure the file exists if we are opening a local file
        bool bMapFound = MakeSureMapNameIsValid(TestURL.Map);
        if (!bMapFound)
        {
            Ar.Logf(TEXT("ERROR: The map '%s' does not exist."), *TestURL.Map);
            return true;
        }
    }

    SetClientTravel( InWorld, Cmd, TRAVEL_Partial );
    return true;
}
#

Yeah so it's just a ClientTravel

#

I would even say that this won't keep any data

#

I don't see how this would be seamless

#

ClientTravels are always hard travels iirc

#

But not entirely sure

#

From the looks of it this will cause the ListenServer to become standalone.
And PlayerController/PlayerState doesn't run through SeamlessTravel code

#

So Travel is just a ClientTravel, an you shouldn't use that for Server Traveling.

woven basin
#

yeah - seems like it drops the listen part to prevent crashing it says

#

So why have it at all? Just use servertravel or if standalone game use openlevel? Why have travel at all?

#

maybe legacy..

thin stratus
#

Travel -> ClientTravel is fine

#

You ClientTravel when connecting for example

meager raptor
#

Hi everyone, I have an issue with server client communication. I have an actor component on my character. I have an event in the component that sends a struct from the server. On that event I call another event on Owning Client still with the struct. The client receive an empty struct (but execute itself). Why would that be ?

kindred widget
#

@glad escarp & @thin stratus & @verbal tendon
You can entirely do away with SetInputMode stuff using CommonUI if you have a little access to C++. It is a much simpler and cleaner implementation than having to track input modes all of the time when you open and close widgets. Basically the leaf most activated widget determines what input mode you're in, and it does it automatically via a simple virtual override. When the widget is activated and it is the leafmost widget, it sets that input mode. So if you have an activated widget for your game screen set to Game, it'll automatically set that when that widget is shown. If you open an inventory where you need the mouse and you return Menu, the moment you open this inventory, it just automatically sets UI only mode. Highly recommend it.

timid moat
#

Hi!

#

This is what I'm doing to set PlayerState->PlayerName in GameMode class:

frosty bison
timid moat
#

How can I know on my custom PlayerState class when the PlayerName has been changed?

#

Thanks!

timid moat
thin stratus
# kindred widget <@741305523311345805> & <@94211915902889984> & <@131239815076118528> You can ent...

Hm, I haven't actually played around with CommonUI much yet. One of my employees did.
It looked like it was mainly doing what we had internally already coded for the years before CommonUI. There are also some stupid limitations, like filtering the Enter key and things like that.

But automatic input mode handling sounds useful. I would probably try it, but I also like the control of handling it like I currently do

timid moat
#

I think this is impossible to do in Blueprint,

thin stratus
kindred widget
#

Game Mode apparently has a callback named OnChangeName when you use ChangeName.

latent heart
thin stratus
#
    /** 
     * Retrieves this player's name/tag from the online subsystem
     * if this function returns a non-empty string, the returned name will replace the "Name" URL parameter
     * passed around in the level loading and connection code, which normally comes from DefaultEngine.ini
     * 
     * @return Name of player if specified (by onlinesubsystem or otherwise), Empty string otherwise
     */
    virtual FString GetNickname() const;
thin stratus
#

fwiw, PlayerState has OnRep_PlayerName

#

For the question about updating the UI when it changes

kindred widget
#

It does. But you need C++ to access it. ๐Ÿ˜ฆ I put a delegate there after super.

meager raptor
thin stratus
frosty bison
#

So also I don't understand, why ScoreWidget is NULL on the bottom of screenshot