#multiplayer

1 messages ยท Page 644 of 1

meager spade
#

interesting

hasty reef
#

Like I'm genuinely super confused

#

I had changed a setting about a day ago but I completely forget what it was, are there any settings you know of that could do this?

kindred widget
#

@hasty reefWhat is this actor's root component?

#

Or what is the component hierarchy

#

Cause only three things will cause that to not call on a client. Relevancy(Like only being a SceneComponent), Not being replicated, and the actor not actually having replicated to the client yet.

hasty reef
#

So the problem isn't just the one actor, I've created new blueprints directly from the actor subclass and those won't multicast either

kindred widget
#

What is the actor's component list?

#

And try turning Always relevant on.

hasty reef
#

@kindred widget is this what you meant by component list?

kindred widget
#

Yeah.

#

Try setting it to AlwaysRelevent. If that lets you multicast, consider changing the Root Component to some form of collidable object.

hasty reef
#

it's already always relevant

#

Found the issue lol, it was running before the clients connected

modern frigate
#

hello everyone! Does anyone have a cpp fps multiplayer tutorial?

winged badger
#

try shooter game

modern frigate
#

@winged badger thank you

winged badger
#

its not a tutorial, but its a working project that was a starting point for quite a few games out there

modern frigate
#

yeah... I'd like much more a tutorial, but truth is a project is better than nothing

snow thorn
snow thorn
#

Fuck valorant

fading birch
#

Ark's exe was named Shooter Game for quite awhile.

gleaming vector
#

it was also the template for Squad

#

there are quite a few big games it was the template for

#

i believe gearbox also used it to prototype borderlands 3

heady python
#

Setting replication at runtime hinders performance since the replication mode has to be changed to be dynamic (Correct me if this is wrong). I want to spawn an actor and have control over whether it spawns in a replicated or not replicated, so is there a better way to do this?

snow thorn
#

It annoys the living fuck out of me how lazy they are

#

I still like the game tho

#

LMAO WHY CAN I OPEN THE GAMES UPROJECT

vivid seal
#

for ark?

nova wasp
#

mod tools etc?

snow thorn
snow thorn
#

but no one rlly goes digging through game files

nova wasp
#

in fairness changing the project name after the fact is no joke

#

I think the actual EXE can be set to whatever though iirc

snow thorn
#

but i mean it just shows how laZy wild card is

nova wasp
#

changing my project EXE to ShooterGame.exe despite not using shootergame just to piss people off

fading birch
gleaming vector
#

i worked on it way back then

#

havent for like 4 years now tho

digital current
#

When I am picking up an item and adding it to my inventory, would you recommend that I do the adding in the item or the player

gleaming vector
#

the player

#

with my inventory system, the player (by way of the inventory component) does all the mechanics

thin stratus
#

You can usually answer this by answering the question what is being modified. Because uuuusually you want the class to modify itself. So if e.g. the InventoryComponent has an array of items, then you want that component to modify the array, not something else.
That's at least how I usually structure my code.

#

If your item needs to react to being addee and removed from the inventory, then you can always forward data via OnAdded and OnRemoved events that you can create in your item class. And these then can modify the item itself.

#

@digital current

digital current
#

@gleaming vector @thin stratus thanks for the advice guys

fading birch
gleaming vector
#

no

#

when i was there, it was basically shootergame

#

i built my own inventory system since, Arc Inventory (it's on the marketplace)

#

it uses GAS

fading birch
#

Oh nice!

#

I built my own as well for a side project using data assets. It's managed via GAS though.

gleaming vector
#

ya, i started with data assets

#

ended up making some weird struct system, gave up on that and did uobjects + a subclass for static data

#

i want to change it to uobjects + data table for static data now that you can easily modify data tables with modular gameplay

thin stratus
#

There are probably a million and 1 ways to make inventory systems in ue4

gleaming vector
#

yeah

thin stratus
#

If a system works and feels good for the purpose it was created then it's probably better than any other solution.

#

With which I want to say: Don't blindly implement and inventory system based on suggestions alone. It needs to fit your project and scale well

nova wasp
#

How about every stored item is a child actor, where item definitions are singleton actors (joke, probably don't do this)

thin stratus
#

E.g. No need for GAS if you don't intend to use that :D

fading birch
#

How about every stored item is a child actor, where item definitions are singleton actors (joke, probably don't do this)
There's a use case for this actually. Especially if you have generic items and you're just using inheritance

#

probably horrendous for performance though

gleaming vector
#

that's basically what shooter game is

#

and fortnite!

fading birch
#

I think FN uses data assets. I vaguely recall a dev blog about it

gleaming vector
#

shootergame doesnt have item definitions (unless you count item classes as a kind of item definition)

#

no, they have an actor per weapon

#

there static data comes from data assets i think

fading birch
#

Ah yeah

#

I think you have to have an actor per weapon

#

trying to make an inventory without that is just insane

gleaming vector
#

the basic idea is you need to figure out what is "static data" and what is "per instance data"

#

that's really the core of inventory

fading birch
#

Yeah

nova wasp
#

I mean ChildActor in the runtime attache sense, sorry

gleaming vector
#

static data being stuff that is shipped as data in your game, and per instance data being what each item needs to replicate/instance

fading birch
#

I've been toying with ideas/methods for creating an inventory that takes multiple spaces in a UI

gleaming vector
#

that works with my system

fading birch
#

I've seen several tutorials for 1 slot items inventories

#

but none on those

eternal canyon
fading birch
eternal canyon
#

oh yea I have seen some stuff on that

twin juniper
#

is there any way to see cpu usage , ram usage, disk usage, bandwidth usage on a dedicated server?

sweet marsh
#

hey guys any idea why calling SetIgnoreMoveInput(IgnoreMovement); from the game mode on a Playercontroller is failing to disable movement on clients?

dim barn
sweet marsh
#

that's a built in player controller function... so when the game mode spawns a character (server side as it only exists on the server) it also tells the player controller to do this (stops the spawned character moving) seems to work fine for listen server but not for the clients

dim barn
sweet marsh
#

yeah i've tried that```void AIGCPlayerController::DisableMovement(bool IgnoreMovement)
{
if (!IsLocalController())
{
ClientDisableMovement(IgnoreMovement);
}
else
{
if (IgnoreMovement)
{
SetIgnoreMoveInput(IgnoreMovement);
}
else
{
ResetIgnoreMoveInput();
}
}

}```

#

thats the function the game mode calls... so tells the client to disable it's movement.. but the client can still move around

#

no probs knowledge sharing seems to be a good way to learn this engine ๐Ÿ˜‰

dim barn
#

You're calling ClientDisableMovement(). What is called inside of it?

sweet marsh
#

DisableMovement(IgnoreMovement);

#

so basically calls that function on the client again

dim barn
#

Makes sense. Then IsLocalController returns true and it should SetIgnoreMoveInput.

#

Did you debug and confirm that SetIgnoreMoveInput(true) is being called on client side?

sweet marsh
#

just trying once more

#

yeah this is weird.. it hits the message correctly, the ClientDisableMovement() is called

#

the value passed is true

#

but the client can still move around

dim barn
#

Is it possible somewhere else it's quickly being overwritten with SetIgnoreMoveInput(false) on the client?

sweet marsh
#

yeah i'm wondering that

#

let me breakpoint on that call in the engine code

#

ok looks like there is actually a call ClientIgnoreMoveInput built into the engine playercontroller.. although it's not called anywhere from that cpp file for playercontroller.. going to try a direct call to that

dim barn
sweet marsh
#

i really don't know what this is so complicated.. i must be doing something wrong somewhere

#

nope still doesn't work

#

i can still move the client around

meager spade
#

just cause the value is set

#

does not mean input will be ignored

#

if you pass in true to force (in AddMovementInput)

#

it will ignore it

twin juniper
#

hey i am using blueprint system on my game and i want to know some tips to host a client server in a mac

#

the game i am working on is in mac but it will be available for windows and mac both

#

please help me

#

reply me

foggy rain
#

I have an issue. The following delegate that initializes UI called when am playing as a server and does not called If as a client.
The question is why OnNewPawn is not called on the client's controller?

#

This function is inside my class that inherited from AHUD. It called to display the UMG HUD and subscribe to updates when the controller posesses pawn (to display UI updates).

#

Perhaps I ran into some kind of bug? How do you usually subscribe for Pawn parameters changes for a HUD?

#

I also want to add that other networking stuff works correctly (spells, attributes) and replicated from client to server.

compact trail
compact trail
#

could you explain?

#

It loads Directly from save wrong variable

#

Save is not replicated

foggy rain
#

Double checked, it looks like OnNewPawn is not called on clients. Is this expected?

normal jacinth
#

Hi, I'm unable to connect to Steam with my game any more. it's really strange, even the option to join another friend's game when you right-click on them in the Steam Friends list is gone; I can only 'Invite to watch'. Any idea what could be causing this?

normal jacinth
#

Has a new SDK come out or something?

#

This is my DefaultEngine.ini (the app ID is correct, just blacked out

meager spade
#

is steam running on your machine?

#

(that can happen sometimes), check to see if a steam_appid.txt file gets created in the same directory as the exe

#

remember you cant connect via PIE, only standalone

normal jacinth
#

Yes it is @meager spade

#

I can't find steam_appid.txt, where should I see that?

#

the installation folder in Steam?

normal jacinth
#

I see it now, it does get created

#

Something to do with this maybe? "Shipping Builds
In shipping builds, the engine will check to make sure that the logged-in user is properly subscribed to the game and will shutdown if the engine's test returns false (this is one way to help secure the game). Additionally, using Steam DRM (see the Steamworks SDK) should further protect the game from being tampered with."

#

Does Steam need to approve the game before a Shipping build will work?

bitter oriole
#

Nope

#

Shipping builds just need to be launched from the Steam client, or have an appid.txt file next to the binary (under project/bin/etc; not the root one)

#

If the Steam overlay works, you're good

normal jacinth
#

So the steam overlay appears, I can see on Steam that I'm playing the game, but the Invite Friend overlay doesn't work, and I can't add anyone to the game by inviting them through Steam (the option doesn't exist, as if a Session is never created)

#

Does this look OK as a Create Advanced Session node?

#

Would not having "GameServerQueryPort=27015" in the Engine.ini stop it from working?

dry cloud
#

Anyone has some experience using FFastArraySerializer? My PostReplicatedAdd/PreReplicatedRemove don't seem to get called on clients for some reason

ancient badge
#

Hello, can anyone tell me how i get "Convert to Mouse Location to World Space" Variables to the server and Update them like a "tick event"?
i tried passing them trough the "Run on Server Event" and "set" them with a "timer by event" but for some reason the variable will change between 0 on XYZ and the actual mouse postition every 0.01 second instead of just updating the mouse position.

dry cloud
#

@ancient badge Maybe because you're running that timer on both client and server accidentally

#

use something like IsLocalController before starting the timer

ancient badge
#

Starting the "Timer" through the Server Event make it automatically only run on the server?

#

but i will check

dry cloud
#

@ancient badge I assume you are looping the timer on the client only and have him call ServerUpdateMouseLoc() event each timer elapsed that passes the mouse location to your server

ancient badge
#

The "Update World Location" and "Update World Direction" i need for a Function that i use inside a "Timer by Function"

normal jacinth
#

Do I need to use Steam 1.47 with Unreal 4.26? I've been using Steam SDK 1.51 and wondering if that's why my project won't work?

bitter oriole
#

No

#

SDK updates are never required

normal jacinth
#

So I should use 1.47?

bitter oriole
#

There is no need to do anything

#

Just use the SDK that comes with the engine

normal jacinth
bitter oriole
#

It's never been applicable to packaged builds

normal jacinth
#

oh right

#

Any idea what I might be doing wrong then?

bitter oriole
#

The "Steam App ID" is the first real step

#

Check the "Configuring your Application's Settings" section for the important parts

#

The "End Result" part is basically the only required work for Steam

#

If it doesn't work it might be a problem on the Blueprint side

normal jacinth
#

yeah I've done that

#

Does anything look wrong to you with this?

bitter oriole
#

Destroying the session before seems weird, and the destruction is asynchronous, so the result code does not indicate that the session is done destroying,; just that it was requested to

#

Make sure you follow the examples

normal jacinth
#

ah right, so perhaps it's destroying the session that it's making?

#

I'm trying that now, but also noticed this in the logs: LogSteamShared: Display: Loading Steam SDK 1.47
LogSteamShared: Steam SDK Loaded!
LogOnline: OSS: Creating online subsystem instance for: Steam
LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
LogOnline: OSS: Unable to create OnlineSubsystem module Steam
LogOnline: OSS: Creating online subsystem instance for: NULL

#

I'm guessing that's not normal?

meager spade
#

@dry cloud figure out your array serializer issue?

dry cloud
#

@meager spade Nope!

hybrid zodiac
#

Hi everyone, what is the purpose exactly of the AGameSession class? All the tutorials I've seen online regarding creating sessions and hosting online tend to do all the work in the game instance, so is the session meant to just hold info for convenience's sake? Also, does it persist across the entire duration that the server is running, or does it get recreated during a server travel (e.g. when changing map)?

meager spade
#

whats the issue?

hybrid zodiac
#

@meager spade More just interested in how this class should be used properly

#

I'm also finding some conflicting info on it, including documentation that says the "RegisterServer" function is only called on dedicated servers, but my testing shows it is also called on listen servers too

#

Basically, I just want to make sure I understand what the class is for and what it is designed to be used for in case I'm missing a trick

dry cloud
# meager spade whats the issue?

The fast serializer has 3 functions available including PreReplicatedRemove to be triggered on clients so they can react to add/remove events in the array. Those functions do not seem to trigger on clients for me. the array is replicated properly on clients however

meager spade
#

can you show the code? can move to DM if its easier, like show your setup.

dry cloud
#

Yes I'll DM those

lusty sail
#

I currently am creating a multiplayer chess game, and I store the locations of all the pieces in an array to know where other pieces can attack. When I move a piece, I call set array elem to update a piece location, and I call that event on the server. It does not seem to be replicating though, so can set array elem be replicated? (the array is currently replicated and adding items to the array does replicate correctly, but set array elem is seeming to not replicate)

lusty sail
#

It is kinda a mess rn, but what happens (when doing it on a client) is it updates the array (from an event called on the server) and the item in the array seems to be updated on both client and server, but then if you update it on the server, then I realize that it actually didn't update.

twin juniper
#

i use launch character , when i packaged as dedicated server and connect with clients, luanch character goes in inverted direction, but it works fine if a client connect to a client using listening host, what can be wrong?

twin juniper
#

Guys, I need some help. The people from #cpp advise me to ask the same question here, since I'm planning to code a listen server. Please consider that I'm still fresh. I'm trying to make two players to see through the same camera perspective, so, initially, I placed the code inside the PlayerController, just to see if would work from a standalone perspective. It didn't work: the players are still seeing the world from their Pawn's camera perspective, not from the static camera I have placed in the world . If you can help me with this issue in a standalone perspective, I would be appreciated too. But I believe that, to make it worl in a multiplayer perspective too, I must or to make a RPC to the server (from the PlayerController?), to call the SetViewTarget, or to call the SetViewTarget from the GameMode and do a multicast to all the players (I'm not sure about how to do this)? Any help will be appreciated. Here are the snippets:

#
#include "ActorUtils.h"
#include "PongCamera.h"
#include "Kismet/GameplayStatics.h"

APongPlayerController::APongPlayerController(const FObjectInitializer& ObjectInitializer)
{}

void APongPlayerController::BeginPlay()
{
    Super::BeginPlay();
        

    APongCamera* MainCamera = Cast<APongCamera>(UGameplayStatics::
        GetActorOfClass(GetWorld(), APongCamera::StaticClass())
        );

    if (MainCamera)
    {
        SetViewTarget(MainCamera);
    }

}```
#
APongCamera::APongCamera(const FObjectInitializer& ObjectInitializer)
{
    Camera = ObjectInitializer.
        CreateDefaultSubobject<UCameraComponent>(this, TEXT("Camera"));
    Camera->SetProjectionMode(ECameraProjectionMode::Orthographic);
    Camera->SetOrthoNearClipPlane(0.f);
    Camera->SetOrthoFarClipPlane(5000.f);  
    Camera->SetFieldOfView(90.f);    
    SetRootComponent(Camera);

}```
#
{
     // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    bReplicates = true;

    static ConstructorHelpers::FObjectFinder<UStaticMesh> 
        RacketMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube'"));

    Racket = ObjectInitializer.
        CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Racket"));
    Racket->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    Racket->SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);
    Racket->SetGenerateOverlapEvents(true);
    Racket->SetSimulatePhysics(false);
    Racket->SetStaticMesh(RacketMesh.Object);
    Racket->SetWorldScale3D(FVector(.2f, 2.5f, 1.f));
    SetRootComponent(Racket);

    CameraBoom = ObjectInitializer.
        CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
    CameraBoom->SetUsingAbsoluteRotation(true); //Prevents the arm from rotating with the racket
    CameraBoom->SetRelativeRotation(FRotator(-90.f, 0.f, 0.f));
    CameraBoom->bDoCollisionTest = false; //Prevents the camera to be pull when colliding with the scenario
    CameraBoom->TargetArmLength = 1500.f;    
    CameraBoom->SetupAttachment(Racket);

    Camera = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("Camera"));
    Camera->bUsePawnControlRotation = false; //Prevents the camera to rotate relatively to the arm
    Camera->SetupAttachment(CameraBoom);

    Speed = 3000;

}```
#

I didn't replicated anything yet, just set the editor to Play as Listen Server

raven moss
#

What's the trick to connect multiple computers?

#

I thought it was just open IP and that would connect?

#

I just build a standalone of the Play As Listen Server for the host

#

and the clients run the open command with the intent to connect to it.

#

But it's not connecting

#

This is 4.26

#

This is still the process right?

raven moss
#

I think it was just I had to add the port

#

open IP:17777 worked for me

pallid canyon
#

Alright, I may have made some terrible errors if this doesn't work like I thought it does.
If I have a replicated variable, I'm under the impression that I need to tell the server when a change to that variable occurs. (non-repnotify)

RPC->run on server reliable-> switch on auth -> set replicated var

And that's enough for me to update the server on what the client tried to do. My long winded questions is: if I wait a really long time to do that RPC, will the server eventually send its version of the replicated var to the client (based on net update freq) and overwrite what I was eventually going to send to the server in the RPC?

#

I read a couple sentences about replication that hinted at this happening

winged badger
#

server will update the clients only if its variable changes

pallid canyon
#

Dope

winged badger
#

and auth switch is redundant on the far side of the server RPC

pallid canyon
#

I was horrified for a moment

#

yeah, I've done it as a best practices thing cuz I don't think and just follow tutorials sometimes

#

ty for the answer!

exotic yoke
#

Hi! I'm new here. Does anyone know if it's possible to program a game with UE5 that can connect to a server and download files. Like game levels for example. If so then do you perhaps know where can I learn more about it? Like different solutions or methods that could be used.

astral perch
#

For me, I'm doing my learning in UE4 right now, but figure I'll end up translating it all to a fresh start in UE5

#

Question: Can someone help me understand why, when playing as 2 clients, clients 1 and 2 see each other's Print String output on the Controller's BeginPlay event.

#

PlayerController's BeginPlay I mean

#

I suppose actually, it's more than that. When player 1 triggers an event that has a Print call, it shows up on Client 2 as Client1:whateverwasprinted. I guess it just seems like client 2 shouldn't know about client 1's output unless it's specifically being multicast.

#

Hmm. Maybe Print itself is just always multicast because it's a developer function. I don't know.. I guess I'll move on.

chrome bay
#

Is there any reading materiel out there on custom delta serialization using NetDeltaSerialize()?

#

Just noticed that FNetDeltaSerializeInfo has both a "Connection" property and an "Object" property, which would theoretically allow for connection-specific replication of properties.

#

Quite interested in exploiting that

unkempt tiger
#

Please do share your findings!

chrome bay
#

Also never occurred to me before but NetSerialize also has the UPackageMapClient, so long as you aren't using shared serialization, which could maybe be abused to do the same thing. Innnnnteresting

meager spade
#

@astral perch prints go through the engine, if you test in pie you normally have Use single process ticked. This is the reason. Nothing more.

astral perch
peak sentinel
#

Size of an RPC determined by the parameters, right?

#

The body doesnt matter?

brazen sluice
#

Hello! Hope everyone is havign a good weekend
I have a weird issue I could use some help with!
As you can see in the video, this is a CLIENT player connected to a distant server.
It seems that when I walk around in some very specific places, I somehow get TP'd to 0,0,0 coordonates, and as soon as I walk out of that specific point, I get re-TP'd back to where I was as if nothing happened (It's very snappy but you can see in the video at some point I manage to stay there in the exact point of TP-ing)

What could cause such odd behaviour? Thanks !!

#

OK it seems to happen when I step on a plant or any small object suck as rocks, also the TP happen client only, not on the server where the position is just fine. Also this doesnt happen in singleplayer.
Bonus question if you know why some plant randomly stay at 0 0 0 on the client

chrome bay
#

@peak sentinel yep

exotic yoke
#

Thanks to those who answered and sorry for the late reply ๐Ÿ™‚

brazen sluice
#

Ignore my last comment about size -- it seems to be an issue where the client think its not allowed to step on those items, even thought it is

#

Those 2 actors share the same Blueprint, with the flag "can step on" to true.
I can step on the oven on the right, but not on the tall grass on the left.
I cant make out what the difference is

#

OK I got the difference: one is replicated the other one isnt, but then they still exist at the same place at the same time, why does it break the collision ?

ancient badge
#

Which one is replicated?

brazen sluice
#

The Oven

#

the one that works

ancient badge
#

What is when you set the grass one to replicate too?

brazen sluice
#

Then it's fine for the long grass

#

And if I disable replcation on the oven, it breaks

ancient badge
#

so set both to replicate and it works? or do you have a reason to not replicate the grass?

brazen sluice
#

No I dont want to replicate it, because there are a lot of plants

ancient badge
#

Well, i'm new to multiplayer stuff myself, but if im correctly. if you don't replicate the grass to your "client". Your client will not know that here is something to step on.

brazen sluice
#

Yes it does because the client spawns it too

ancient badge
#

ah ok

chrome bay
#

If the client spawns it locally then the network ID's will not be synced up, so you can't use it for movement etc.

#

If you're using character movement, then this will break the "based movement" part

#

If a client spawns something locally, it should never have collision

brazen sluice
#

So you mean it will break the character to step on 2 actors with different network ID ?

chrome bay
#

The character can't walk on an object unless it's net-addressable

#

If you spawn stuff independently on the client, it's not network addressable

ancient badge
#

Why do even want the player to "step on it" would'nt it be better if he can walk into it.

brazen sluice
#

There are many items such as rocks and fences Daikota

#

Can I force the network ID ?

chrome bay
#

nope

brazen sluice
#

Surely i can do something else than just blindly replicating thousands of static blueprints

chrome bay
#

You can't, but you shouldn't replicate them

#

Procedural generation of levels is very difficult, Zlo found some methods for syncronising network ID's between server/client and fooling the network system to allow for it

brazen sluice
#

I have unique identifier already that is consistent between client/server if I can enforce the netid that would solve the issue

chrome bay
#

You can't do that

#

NetID is unique between all players to start with

#

The UID part

brazen sluice
#

The block position in the grid is unique

#

There's always only one actor per coord

brazen sluice
chrome bay
#

If you need those spawned actors to be used by the networking system in any way, they have to either be:
A) Part of the serialised map
B) Spawned and replicated from the Server
C) Spawned deterministically from a seed, and with some trickery to fool the networking system into thinking it was serialised from the map.

#

And walking on stuff does count as using it with networking, because character movement needs to be able to resolve what it's walking "on" exactly

brazen sluice
#

D) Can I change the character movement maybe to not do that this way ?

#

What is it using the actor for ?

chrome bay
#

If the object is dynamic of moving then no

brazen sluice
#

The objects are static

#

always

#

they're like... plants and rocks

chrome bay
#

In which case AFAIK, it doesn't use the "based" movement

#

So long as the primitives are not "movable" it should be fine

brazen sluice
#

Ahhh

#

so if I set the "movable" to false after spawning them it should work

chrome bay
#

When you stand on a movable primitive, character movement switches to a "relative" system to avoid jitter etc.

brazen sluice
#

Right now the flag isnt set

chrome bay
#

They should be either static or stationary

brazen sluice
#

Dude love you

#

ok all perfeect now thanks you!!

twin juniper
#

Good morning! I'm trying to do a RPC to the server, but I'm getting a crash, where is said that it failed to find a specific function . I will post the snippets, but should I move the logic to the GameMode instead, storing the players controllers in the PostLogin and setting the PlayerControllers view targets in the HandleMatchHasStarted? Also, the camera component of the target camera actor must be replicated, using RepOn, etc., right? Here is the snippet:

#

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "PongPlayerController.generated.h"

/**
 * 
 */
UCLASS()
class PONGONLINE_API APongPlayerController : public APlayerController
{
    GENERATED_BODY()

    UFUNCTION(Server, WithValidation, Reliable)
    void ServerRPCChangesTheCamera(AActor* Target);

protected:
    virtual void BeginPlay() override;

public:
    APongPlayerController() = default;
    
};```
#
#include "ActorUtils.h"
#include "Kismet/GameplayStatics.h"
#include "Net/UnrealNetwork.h"
#include "PongCamera.h"

bool APongPlayerController::ServerRPCChangesTheCamera_Validate(AActor* Target)
{
    return true;
    
}

void APongPlayerController::ServerRPCChangesTheCamera_Implementation(AActor* Target)
{
    SetViewTarget(Target);

}

void APongPlayerController::BeginPlay()
{
    Super::BeginPlay();    
        
    APongCamera* MainCamera = Cast<APongCamera>(UGameplayStatics::
        GetActorOfClass(GetWorld(), APongCamera::StaticClass())
    );

    if (MainCamera)
    {
        ServerRPCChangesTheCamera(MainCamera);
    }    

}
twin juniper
#

I just removed the SetViewTarget RPC call from the player controller, but now I'm getting the same "failed to find function" error in another RPC I'm making, from the Pawn to the server, to set his location. It wasn't happening yesterday thou =\

kindred widget
#

@twin juniperI personally feel like you'll have a lot easier time making each client handle their own camera stuff. You should just replicate the simple conditions. In this case. If you have two cameras, one before game start, and one after. You would simply have a replicated state value of like.. EGameplayCurrentState or something. Enum with some simple states. Gameplay tags could work too but might be overkill for pong. Playing, Finished, Starting, Lobby, etc, or whatever you want. Put it in the Gamestate, Make an Onrep for it. And the OnRep can have clients locally find correct cameras based on your game's current state. Now all you're replicating is the match's state, no extra actor or component replication, no need for pointer resolving, etc.

twin juniper
shy kelp
#

I'm pretty new to multiplayer but can someone give me a specific instance where multicast would be used? I have built a large part of my project and haven't used it once so i was wondering

#

Like?

#

Oh, I have been using forloops in gamestate

#

Oof

peak sentinel
#

Multicast is just a way to tell UE "send this RPC to everyone connected to me"

shy kelp
#

Can u use multicast to control umg changes that affect everyone?

kindred widget
#

Personally. I feel like the majority of things you'd use Multicasts for, are better off in Replicated state variables. The only usecase that comes to mind that really is useful are small notifications that don't need state. And even those can be done via replicated joining function overrides.

kindred widget
#

Maybe things like "Player "Dudebro" reached level 12"

shy kelp
#

I just use component replicates for most things

kindred widget
#

Fire and forget stuff.

shy kelp
#

So multicast is for things everyone needs to see but it doesn't really matter

peak sentinel
#

Two major difference between OnReps and Multicast RPCs are
1- OnReps holds the data for hotjoiners too, while RPCs are fire and forget as Authaer said
2- RPCs are fast, they work like "hey send this, now, dont wait" but replicated variables work in different way

shy kelp
#

Ok

#

Thank you

#

I knew what multicasts did, just thought they were pretty useless

#

But I think I get it now

twin juniper
twin juniper
#

I mean, I believe I need to, somehow, in the GameMode PostLogin, store the PlayerControllers, and, inside the APongGameState OnRep_MatchState, access this custom game mode container and set their view targets?

shy kelp
twin juniper
#

lol

leaden atlas
#

im doing UObject replication and i want to predict the creation of the objects

#

is there a good way to make sure that these objects will be named exactly the same on the client and server?

#

the uobjects are owned by the player state if that helps at all

#

actually nvm i don't think i have to worry about matching up the names

winged badger
#

you don't, netguid will match if they ar erplicated

leaden atlas
#

i was worried that if i allowed the client to predict and create objects then the names might not match up

#

not about the object creation being replicated from the server to the client

meager spade
#

you need to ensure the names are deterministic

#

and can never go out of sync, then sure.

leaden atlas
#

yeah that's what im worried about

meager spade
#

we do this for our random semi-procedural levels

#

client and server spawn the map, independently, but everything matches

leaden atlas
#

also i didn't know if there would be name conflicts between different players spawning objects, but since they have different outers it seems like the names can be the same

meager spade
#

nope name has HAS to be unique

#

regardless of outer

#

in the level ofc

#

as the outer will technically be the world

leaden atlas
#

really?

#

the outer is the player state

vivid seal
#

for a multiplayer game, where would you store things like the spells that a player has unlocked, or their action bar setup (which abilities are in which action bar slots) so that they will be the same every time a player plays the game? I know ultimately you want either some kind of file locally for the action bar or a database, but when actually loading into the game, would this go in the GameInstance so it can be retrieved in any level, or would you load it in something like the player state every time you go to a new map?

leaden atlas
#

it seems like there can be two objects with the same name and different outers

#

and it works

meager spade
#

oh thought you was on about actors

#

sure components can have same name with different outers

leaden atlas
#

actually im really confused

#

is the PlayerState not stable for networking?

gleaming vector
#

the player state is not name stable for networking, if that is what you are asking

#

player state is fully dynamic, it cannot be referred over the network by name

leaden atlas
#

yeah

gleaming vector
#

it must have a net id assigned to it

leaden atlas
#

how does that work?

gleaming vector
#

the net id?

leaden atlas
#

yeah

gleaming vector
#

when you go to replicate a UObject over an actor channel, the actor channel hands the object to the PackageMap to assign it a network id

#

if the name is stable for networking, it uses the name

#

if it's not, it creates one

leaden atlas
#

is there anything associated with the player that is stable for networking?

gleaming vector
#

generally no

leaden atlas
#

hmm

gleaming vector
#

keep in mind

#

name stable is a very minor feature

#

all it does is rather than send the network id in the initial packet, it skips that initial identifier packet and just starts saying "yeah this object is being updated now"

#

no book keeping or handshaking to establish what object it actually is (or creating it if it doesn't exist)

#

the server just starts talking about it and the client is expected to know what that object it's talking about is

#

that is what name stable for networking means. the name is already agreed upon before the client connects to the server

leaden atlas
#

ohhhhhhhhh

#

thank you

gleaming vector
#

if the name is not stable, the server negotiates with the client to create the object and assign it a network id

leaden atlas
#

is there a way i can do creation prediction?

gleaming vector
#

nothing that is spawned dynamically is name stable

leaden atlas
#

on the client side?

gleaming vector
#

uh, boy

#

probably not

#

you'd have to dive deep into actor channel to make that happen

#

you'd have to have some kind of prediction key to send to the server, and then the server send that prediction key back with a new object creation packet

#

then migrate your predicted object's network id over to the id that the server sent you

#

that would be a big engine edit

leaden atlas
#

okay

#

i think im just gonna rewrite this system i got to not use object creation prediction then

gleaming vector
#

unreal tournament has a method to do something similar

#

they create projectiles on the client

#

and then when the server replicates the authority projectile back

#

they hide the authority projectile and bind the client predicted one to the server

#

like, make the client one be at the server's position, but simulated forward for Ping seconds

leaden atlas
#

ive seen that one

#

i think it'd be way too much effort for what i want to do

gleaming vector
#

well, predicting object creation is so much more effort, Epic went with that strategy haha

ancient badge
#

Can anyone tell me why this is only working on the server not on the client?

leaden atlas
#

is there anything special i have to do for replicating an array of structs containing a uobject

#

vs an array containing uobjects?

#

I have ReplicateSubobjects overridden in my actor containing the array

#

and i was using ReplicateSubobjectList before

twin juniper
#

I don't get it. Well, I tried to code something similar to what @kindred widget said, but, apparently, isn't working. Inside the GameMode PostLogin(), I stored all the PlayerControllers in an array, and, in the GameState OnRep_MatchState(), i got the static camera actor I have in the map and set the view targets for these Controllers. Their view targets didn't change.```#include "PongGameMode.h"
#include "GameFramework/GameMode.h"
#include "PongRacket.h"
#include "PongPlayerController.h"

APongGameMode::APongGameMode()
{
DefaultPawnClass = APongRacket::StaticClass();
PlayerControllerClass = APongPlayerController::StaticClass();

}

void APongGameMode::PostLogin(APlayerController* NewPlayer)
{
AGameMode::PostLogin(NewPlayer);

if(NewPlayer)
{
    APongPlayerController* PlayerController =
        Cast<APongPlayerController>(NewPlayer);

    PlayerControllers.Add(PlayerController);
}

}```

#
#include "GameFramework/GameMode.h"
#include "GameFramework/GameState.h"
#include "Kismet/GameplayStatics.h"
#include "PongGameMode.h"
#include "PongPlayerController.h"
#include "PongCamera.h"

APongGameState::APongGameState()
{}

void APongGameState::OnRep_MatchState()
{
    AGameState::OnRep_MatchState();

    UE_LOG(LogTemp, Warning, TEXT("The game state has changed."));

    if(MatchState == MatchState::InProgress) 
    {
        const APongGameMode* GameMode = GetDefaultGameMode<APongGameMode>();

        if(GameMode)
        {
            APongCamera* MainCamera = Cast<APongCamera>(UGameplayStatics::
                GetActorOfClass(
                    GetWorld(),
                    APongCamera::StaticClass()
                )
            );
            
            if(MainCamera)
            {
                TArray<APongPlayerController*> PlayerControllers = 
                    GameMode->GetPlayerControllers();        

                for(APongPlayerController* PlayerController : PlayerControllers)
                {
                    if(PlayerController)
                    {
                        PlayerController->SetViewTarget(MainCamera);
                    }
                }
            }
            else
            {
                UE_LOG(LogTemp, Warning, TEXT("There is no camera in the level."));
            }
        }
    }

}```
#

I put an UE_ LOG there

#

isn't executing the OnRep?

kindred widget
#

You're expecting GameMode to be available in an OnRep. GameMode only exists on the server.

#

Since you're using C++. In the OnRep. If you don't allow multiple local players, just do GetGameInstance->GetFirstLocalPlayerController or whatever it is.

twin juniper
#

Hum, shouldn't use the GetDefaultGameMode then?

#

wait

#

But the OnRep isn't called in the server, when he is about to replicated the variable that changed, in this case the MatchState, to the clients? I thought that , when I called GetDefautlGameMode, i would get the reference to the GameMode located in the server

hollow eagle
#

GetDefaultGameMode does not give you an active gamemode object, it gives you the CDO which is not the actual gamemode.
Anyway, OnRep is running on the client and the gamemode doesn't exist there so even using the correct function (GetAuthGameMode) wouldn't work.

#

If you want to iterate the list of local player controllers you can use GetWorld()->GetPlayerControllerIterator()

#

You cannot get anything other than local player controllers on a client - controllers exist purely on the server and the owning client, not other clients.

twin juniper
#

Thanks for the reply! I really thought that OnRep was supposed to run in the server during the replication act, just like an event. I tried to use the GetConstPlayerControllerIterator, didn't work. Also I have changed the code to```#include "PongGameState.h"
#include "GameFramework/GameMode.h"
#include "GameFramework/GameState.h"
#include "Kismet/GameplayStatics.h"
#include "PongGameMode.h"
#include "PongPlayerController.h"
#include "PongCamera.h"

APongGameState::APongGameState()
{}

void APongGameState::OnRep_MatchState()
{
AGameState::OnRep_MatchState();

UE_LOG(LogTemp, Warning, TEXT("The game state has changed."));

if(MatchState == MatchState::InProgress) 
{        
    APongCamera* MainCamera = Cast<APongCamera>(UGameplayStatics::
        GetActorOfClass(
            GetWorld(),
            APongCamera::StaticClass()
        )
    );
        
    if(MainCamera)
    {
        APongPlayerController* PlayerController = 
            Cast<APongPlayerController>(GetGameInstance()->
                GetFirstLocalPlayerController());                

        if(PlayerController)
        {
            PlayerController->SetViewTarget(MainCamera);
        }
            
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("There is no camera in the level."));
    }        
}

}``` Just like @kindred widget said, i still got this, the player views are from the cameras attached to them

#

Nope, same result as before, when i used the iterator: ```#include "PongGameState.h"
#include "GameFramework/GameMode.h"
#include "GameFramework/GameState.h"
#include "Kismet/GameplayStatics.h"
#include "PongGameMode.h"
#include "PongPlayerController.h"
#include "PongCamera.h"

APongGameState::APongGameState()
{}

void APongGameState::OnRep_MatchState()
{
AGameState::OnRep_MatchState();

UE_LOG(LogTemp, Warning, TEXT("The game state has changed."));

if(MatchState == MatchState::InProgress) 
{        
    APongCamera* MainCamera = Cast<APongCamera>(UGameplayStatics::
        GetActorOfClass(
            GetWorld(),
            APongCamera::StaticClass()
        )
    );
        
    if(MainCamera)
    {
        //APongPlayerController* PlayerController = 
        //    Cast<APongPlayerController>(GetGameInstance()->
        //        GetFirstLocalPlayerController());                

        FConstPlayerControllerIterator It = GetWorld()->
            GetPlayerControllerIterator();
        
        for(It; It; ++It)
        {
            APongPlayerController* PlayerController = 
                Cast<APongPlayerController>(It->Get());

            if(PlayerController)
            {
                PlayerController->SetViewTarget(MainCamera);
            }
        }                
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("There is no camera in the level."));
    }        
}

}```

#

What is strange is that the first UE_LOG isn't printed in the Output Log at all, like any method that isn't called

ancient badge
#

Can anyone tell me why my client can't see the colors?

kindred widget
#

@twin juniper I'm actually a little confused by this at the moment. default match state is a string. How are you comparing it with an enum?

twin juniper
#

Well, I saw, inside the AGameState, the way that the engine does the OnRep ```void AGameState::OnRep_MatchState()
{
if (MatchState == MatchState::WaitingToStart || PreviousMatchState == MatchState::EnteringMap)
{
// Call MatchIsWaiting to start even if you join in progress at a later state
HandleMatchIsWaitingToStart();
}

if (MatchState == MatchState::InProgress)
{
    HandleMatchHasStarted();
}
else if (MatchState == MatchState::WaitingPostMatch)
{
    HandleMatchHasEnded();
}
else if (MatchState == MatchState::LeavingMap)
{
    HandleLeavingMap();
}

PreviousMatchState = MatchState;

}```

#

They're FName

#

And the enum is inside the AGameMode

#

But I think I found the reason behind my problem, let me check first

covert heath
#

Is there any reason for a client's controller not to possess its pawn. I mean, my "OnPossess" function is never getting called.
Research on the internet made me figure that I should override the Restart function of the Pawn blablabla, but isn't the Possess function supposed to be called in a first place?
๐Ÿ˜ฆ

twin juniper
# kindred widget <@456226577798135808> I'm actually a little confused by this at the moment. defa...

Yeah, as always, the issue was caused by a dumb act of mine: please discover who doesn't set the GameStateClass inside the GameMode? Well, using GetGameInstance->GetFirstLocalPlayerController "worked", but there is another problem: the second player, apparently, doesn't spawn in the PlayerStart. Should I, inside the GameMode, retrieve all the PlayerStart and, inside the PostLogin, assign and pop an PlayerStart for the controller that was passed ?

twin juniper
covert heath
#

Well, it seems like both my controllers are spawned in proper instances.
I think server is having all player controllers and each client has its own player controller.
I'm playing in listen server (no dedicated server) so one player is also the server.

So I don't get why the client's controller would not autopossess its pawn

#

The weirdest is that each pawn has its controller referenced with the function "GetController" not returning null. So it doesn't make sense that my controller hasn't possessed it yet right?

twin juniper
#

Yeah ๐Ÿ˜ฆ

twin juniper
#

Well, for some reason, I have two PlayerController, but only one Pawn possessed

twin juniper
#

Any clues? I didn't find anything in the internet?

glad fiber
#

Hey Guys, I am trying to setup a basic system where two players can load in and the server sets up some basic info about them such as setting their username that displays above their head. I have a function in the Character which is a multicast and sets the text render object. I call this function from the gamemode after getting their username from an external API. My issue is that the username is only changing for everyone on one client. On the other client it only changes for the player themself, not other players.

#

Code on character:

#

Code on GameMode

twin juniper
# twin juniper

I'm trying to figure out why, in my game, I have two PlayerControllers, but only one Pawn spawned. I mean, since the GameMode only exists in the server side, who is responsible for spawning a Pawn for the PlayerController? Why it doesn't work, I didn't find an answer in the internet

sinful tree
sinful tree
twin juniper
#

But only one of the players has an Pawn spawned for him

#

To be more specific, it doesn't spawn a Pawn for the Client. The window located in the left side is the Client, the window located in the right side is the listen server

thin stratus
#

Do you maybe have only one spawn point and the second pawn fails to spawn due to colliding with the first one?
Your log should show a warning if that happens.

twin juniper
#

So what you said makes sense, I have to test it

#

BUT

#

I have stored all the PlayerStart actors inside an array, in the GameMode, and, in the HandleStartingNewPlayer method, I have assign a PlayerStart to the PlayerController through the usage of the SetSpawn(SpawnPawnFor(PlayerController, PlayerStart)). It "worked", but now both players, client and listen server, don't react to the PlayerController inputs T_T

thin stratus
#

You don't need to use HandleStartingNewPlayer for that

#

There is FindPlayerStart and ChoosePlayerStart

#

Which you can use to return a PlayerStart for the specific Player that tries to be spawned.
This will also call when you try to respawn a player.

twin juniper
#

Here you can see what method called ChoosePlayerStart and so on. But should I call it directly in another place, like PostLogin()? Also, doesn't ChoosePlayerStart choose a random place, and SpawnPawnFor allows to choose a specific PlayerStart?

thin stratus
#

That's up to your code if it's random or not

#

You go over your player starts and then you decide which one you want to return

#

And you would not call ChoosePlayerStart on PostLogin

#

You use RestartPlayer to spawn a Pawn for a Controller that has none.

twin juniper
#

Hum

#

Thanks @thin stratus , I will try to figure out based on what you said. Also, your compedium is great! But I didn't finish to read it T_T

thin stratus
#

Glad it helps (:

twin juniper
digital current
#

Will an actor created through NewObject replicate?

silent valley
#

So recently I was tracking down a bug that turned out to be caused by failed replication. This error was printed out and the actor on client did not have any replicated members set.

LogNetPartialBunch: Error: Attempted to send bunch exceeding max allowed size. BunchSize=72770, MaximumSize=65536

The only custom replicated members the Actor has was a TArray<bool> with 28'000 + members. It got me thinking, how does the bool array with 28000 items translate to an initial bunch size of 72770? Does anyone have a rough breakdown of base Actor replication size before adding derived members?

thin stratus
#

I would suggest using the NetProfiler and/or Unreal Network Insights.

#

That might help you a lot more than anyone here can

silent valley
#

Good idea, thanks ๐Ÿ‘

chrome bay
#

UE tries to replicate actor properties atomically IIRC, especially if it's a spawn/open packet. Combined with all the other props it might be pushing it up over the limit

compact trail
#

How can I load save from client save? I want to load variable and i always end with server save

#

Sorry, I know that I'm noob.

#

But I really need help with this. I have tried many ways to load client save, but i allways end with server save

chrome bay
#

You can't load a client's save file on the server - but you can tell them to load their own save file

#

and perhaps send the server some info back once that's done

compact trail
#

Something like this?

chrome bay
#

Clients can't set replicated variables

#

You have to send Character ID back to the Server via another RPC

compact trail
#

Create new event with "Execute on server"?

chrome bay
#

And also bear in mind, this will all happen asyncronously

#

So it won't be available immediatelly

#

You can't send an RPC or two and immediatelly use that variable, it won't be correct

compact trail
sinful tree
#

Set the variable as Rep Notify. You'll get a function created which you can then use to update whatever you need to with the updated value.

compact trail
#

Ok

#

How About Variable in save?

sinful tree
#

Saves aren't replicated at all. No point in changing the replication values.

compact trail
#

ok

#

Save event should be "Run on server" not multicast?

sinful tree
#

Correct. You should see a function called OnRepCharacterID

compact trail
#

Yes

#

I see

sinful tree
#

So that function is executed when the replicated value of Character ID is changed.

#

Are you doing this in game mode?

compact trail
#

No This is character

sinful tree
#

Ok. So then what will happen is that when that value is replicated, all clients that have their copy of that character will receive the update and run that function.

#

So after the replication, you use that function to do whatever you want any clients (and server too) to do when they receive the value.

compact trail
#

This fuction executes localy?

#

So Print event should be in this function

sinful tree
#

It executes on any relevant clients. Ie. a Rep Notify variable on Player Controller would only ever execute on the server and the one client as other clients can't see other player controllers. A replicated character would exist on all clients, so a rep notify variable on a replicated character would execute on the server and any clients that have a copy of that character.

compact trail
#

So Spawning player can be connected to this function? It executes only one time, after spawning player orginal actor will be removed

sinful tree
#

You could.

#

But you'd want to do that on server only.

compact trail
#

It is closer

#

When I'm joining game it seen Douglas C but there is still Megan_C (Server)

#

It executet 3 times. I have 2 prints

#

1 In Event and 2 in function

#

This value is outdated

#

I think that LoadSave can't keep up

compact trail
#

Value that I'm looking for is Douglas_C

#

this executes only one time and works without problem

sinful tree
# compact trail This value is outdated

So here's the thing... If this is on a character blueprint, begin play will fire on:

  1. The server.
  2. The owning client that controls that character.
  3. Any other client that has a copy of that character spawned.

So if I'm player 1 and you're player 2, and we both join the game together and get our own copy of the character that means:

  1. Server will fire begin play 2 times (one for each of our characters)
  2. My client will fire that begin play 2 times (one for your character, and one for my character)
  3. Your client will fire that begin play 2 times (one for your character, and once for my character)

What's worse here is that the server will be asking the owning client to load the value for that character, so the server would be asking me to load the value for your character that exists on my computer, and my own character, and it will also ask you to load the data for my character that exists on your character and your character.

That being said, the print value on Begin Play will never be valid - everything executes immediately (effectively) when you're on an execution path that is not delayed or held up by a huge loop. When you call "Load Save" you're calling to the client to do something, but it doesn't wait for that event to finish - it goes on to the next step immediately, so you'll be printing whatever the default value is of that variable as the new value would not have been RPC'd back yet from the client to be set on the server - and that's why you have the OnRep function - once the value is changed, you can do something with the new value.

I highly recommend you read through this, and look up some tutorials on replication within UE4.
https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

compact trail
#

Thank you very much for explaining me this

#

One more question. Does this wait until it's executed? Or immediately goes to next step?

sinful tree
#

Immediately - the value being set is being referenced so there wouldn't be a problem here. That's why your other example worked without issue - you're on the RPC back to the server setting this value, so the server is going to have the right value.

compact trail
#

Something broke, last time I was using this script all player could possess

#

But now only host can posses

#

Now I get
"Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetInstigatorController_ReturnValue". Blueprint: SpawnCharacter Function: Execute Ubergraph Spawn Character Graph: EventGraph Node: Possess
"

digital current
#

I have a question. All the items in my inventory are contained in an array of structs in an actor component. This array is a Replicated variable. I have a problem now though. The inventory I am making is a jigsaw/spatial inventory (each item takes specific space on a grid)

#

Now the way I am handling the inventory UI is whenever the inventory is updated, I regenerate all the tiles in the inventory (thereby keeping the chances of something being off to a minimum). The problem I am facing is, when I pick something up and drop it somewhere else, I have to run the code that adds the item into the inventory on the server (because the array is a replicated variable) but the refresh I do immediately. This causes the item to not show up because I regenerated the inventory before the client received the updated array. What workaround could I use to solve this?

#

How would I go about updating the actual UI?

thin stratus
#

Has anyone made some "Player A grabs Player B and from there on Player A moves both of them" stuff? Most basic idea I would have is to define a location in front of Player A and if Player A has Player B in their hold, I set the Location of Player B to that.. on Tick?
Kinda still need collision to work, cause you should be able to push Player B through the wall.

#

I assume the whole issue would also apply to simple Singleplayer and an AI

kindred widget
#

I think it just depends on how you want the carrying to handle. If you want PlayerA to stop with PlayerB between them and the wall, you'd probably want to affect their movement and just attach PlayerB to PlayerA temporarily. Which would make it much easier on replication. I assume the issue with ticking PlayerBs movement to that spot would be that it'd probably end up acting more like a physics constraint. You'd have cases where PlayerA could walk up and face a wall while holding PlayerB, but PlayerB would kind of jitter off on the side.

dark edge
thin stratus
#

Ah you can imagine a simple grab from behind like in Splinter Cell

dark edge
#

If it's slow paced enough I'd probably go down the custom movement mode or Lorashs idea

thin stratus
#

Doubt that fits both without being too wide

dark edge
#

THICC BOI

thin stratus
#

Right so cmc basically handles it by knowing who to follow via custom mode

#

Makes sense

#

Shit show to setup i guess haha

dark edge
#

A nice intimate supple grab would maybe make for a 50% bigger capsule I'd guess

#

If that's the type of game you're making

thin stratus
#

Yeah it would be slow movement and probably always backwards directed

#

Plus minus some steering

#

Hitman could also be an example

#

When he grabs people from behind and walks a bit with them before snapping the neck

#

But okay. Will try the cmc road

dark edge
#

Maybe first try just turning off the victims CMC and collider and attaching. For single playeryer I'd think it would work fine

plain elk
#

hello, so im facing 2 specific issues with the current build. The reload animation of the client is not showing up on the server side. Also the up and down torso movement is not showing up on the client side even though the server side is clearly doing it. The opposite of this is working

thin stratus
kindred widget
#

@plain elkIt's very hard to say with that information. There are dozens of different ways people can set up animations based on networking. In short though, your animating shouldn't care about networking, it should only care about what is on the local machine. Your networking should set those values, and animation should simply update itself based on the values it can retrieve locally.

merry harness
#

Hiho

#

Unfortunately, I don't know exactly what topic this question fits into. I'm currently translating my game but it doesn't work that well ^^

manic terrace
#

What does the UnrealMultiplayerGamemode class have more than the Gamemode one (regarding multiplayer)?

alpine crest
#

Hello guys , im new to unreal engine , and new to multiplayer but want to create a 1vs1 game just for fun and have some cool idea ๐Ÿ™‚ Im an old guy with many ideas , i saw lots of tutorials etc with unreal and thats why i chosen it ๐Ÿ™‚ So i have some basic question with it when you create a game you start from Hud ? or LEvel ? or characters 1st ? or anyway you can ? just curious what way its optimal maybe ! i have a full plan for the game so i know what i want. just not sure where to start XD most important question im interested is is it posible to create game where 1vs1 you play randomly against others ? Or for that i have to pay for a server ? Or what platform to chose Epic ? Steam ? im sure some of you have more experience with those ๐Ÿ™‚ Thanks ๐Ÿ™‚

kindred widget
#

@alpine crest What is your general background regarding coding, or design work?

alpine crest
# kindred widget <@!323039801668534274> What is your general background regarding coding, or desi...

I would say i know many things about design work and have brains for visual coding ๐Ÿ˜„ Im Solidworks expert XD i know thats not unreal but to me its pretty same , And i know CNC coding XD yeah i know its not C++ but again im easy learner ๐Ÿ˜‰ And will visual code some stuff ! Just need some basic info never tryd programming in such powerful engine ! Long time i learned Basic XD and PAscal XD i just wanna do it its like i didnt had a chance , and now i see many great assets to help in market ๐Ÿ˜„ i will start tomorrow anyway ๐Ÿ˜„

signal lance
#

Lets move this conversation/question to #lounge as it is not really multiplayer related, more of a general game development advice

muted perch
#

How do I fix this error: LogOnline: Warning: OSS: Failed to send discovery broadcast SE_EHOSTUNREACH

#

I don't know what other detail I should give.

dark edge
#

@alpine crest make something small and fun and single player first

twin juniper
#

Guys, please, correct me if I'm wrong, but the call order InitNewPlayer->FindPlayerStart->ChoosePlayerStart happens before the AGameMode::MatchState::EnteringMap, right? I'm asking because I'm overriding the AGameModeBase::ChoosePlayerStart_Implementation, but anything I do inside its scope is empty. If I call UGameplayStatics::GetAllActorsOfClass() inside its scope, the OutArray has no actor inside. So is safe to assume my assumption, right?

kindred widget
#

@twin juniper EnteringMap is the default state of MatchState. At least it's set that in the GameMode's constructor. Not sure what that has to do with actors existing in the world though? How are you using the get all actors call in the ChoosePlayerStart?

fierce elbow
#

I got a bit of an odd question, I've never really done Multiplayer before and i've been setting up a Sessions class for my game so I can handle rudimentary lobby creation/joining and have been checking the ShooterGame example in order to get a grasp on how the OnlineSubsystem interface works

I noticed that when a client disconnects he should call DestroySession, however with my current setup my client can't do that as the client can't access the GameMode in order to grab a reference to the GameSession (And therefore the session manager)

Is there a better way to handle this? I've seen in some examples people put the Sessions code inside of their GameInstance so they have access to the OnlineSubsystem there, but I wanted to keep the Sessions/Instance code separate

I'm using a listen server setup if that makes much difference -- I think i'm probably just missing something simple pepesadcat

twin juniper
#

But I believe that, besides what I have said above, my main problem is that I have no GameSession created, as you can see in this picture.

#

Since I'm still fresh, is there a good source explaining how to create, find, join an destroy a GameSession?

sinful tree
fierce elbow
#

Oh? Hm.. Maybe i've read these examples wrong -- I'll look for some other way of leaving sessions sanely, thanks @sinful tree!

sinful tree
#

Well like if you're going through your UI and selecting something like "Leave Session" then you can make that open the main menu map for them which would disconnect them.

fierce elbow
#

Ah, I wasn't sure if just travelling to another map would disconnect them properly, i'll try that ๐Ÿ˜

fading birch
#

Is there a server side call for AActor::NotifyHit? I'm seeing that the RemoteRole is Role_Authority but the local role is a proxy.

#

Should I use an rpc on the server there?

short arrow
#

So does Get Game Time In Seconds automatically update correctly for everyone? Regardless of joining late?

#

I cannot test it currently in my build so if anyone knows it'd be helpful

fading birch
#

sec my IDE is having an aneurysm

#

World is technically local to each client

#

as they create their own

#

you'll want to get the time from the server

short arrow
#

right, currently I have get game time stored in game state. I was just wondering if it was necessary

#

Thanks for letting me know

fading birch
#

np

fading birch
short arrow
fading birch
#

It's a bit out of place. It's actually normal c++ for some reason.

twin juniper
#

I was reading the Cedric's Compedium, and in the last pages, he says that you can connect directly without GameSessions, calling OpenLevel (but where? In the GameMode? In the GameInstance?) and ClientTravel (from a PlayerController). But isn't working for me, here is the snippet

#
#include "GameFramework/GameMode.h"
#include "GameFramework/PlayerStart.h"
#include "GameFramework/PlayerState.h"
#include "Kismet/GameplayStatics.h"
#include "PongGameState.h"
#include "PongPlayerController.h"
#include "PongRacket.h"

APongGameMode::APongGameMode()
{
    DefaultPawnClass = APongRacket::StaticClass();
    PlayerControllerClass = APongPlayerController::StaticClass();
    GameStateClass = APongGameState::StaticClass();

    UGameplayStatics::OpenLevel(GetWorld(), "PongMap", true, "listen");
    
}

void APongGameMode::BeginPlay()
{
    Super::BeginPlay();

    

}

AActor* APongGameMode::ChoosePlayerStart_Implementation(AController* Player)
{
    if (!bIsStartSpotsCached)
    {
        UGameplayStatics::GetAllActorsOfClass(
            GetWorld(),
            APlayerStart::StaticClass(),
            StartSpots
        );

        bIsStartSpotsCached = true;
    }

    if(StartSpots.Num() > 0)
    {
        return StartSpots.Pop();
    }

    UE_LOG(LogTemp, Warning, TEXT("The PlayerStart array is empty."));

    return Super::ChoosePlayerStart(Player);

}```
#
#include "ActorUtils.h"
#include "Kismet/GameplayStatics.h"
#include "Net/UnrealNetwork.h"
#include "PongCamera.h"

APongPlayerController::APongPlayerController(
    const FObjectInitializer& ObjectInitializer
) : Super(ObjectInitializer)
{
    ClientTravel("127.0.0.1", ETravelType::TRAVEL_Absolute);

}

void APongPlayerController::BeginPlay()
{
    Super::BeginPlay();

    

}```
vivid seal
#

how does GetPlayerName work from the player state? specifically, i'm trying to load a savegame object using the player's name as the name of the save. this is happening in the InitializeComponent function of a component, both on the server and on the autonomous client. I'm not sure where player name is determined, or where I should be setting it so that it will be correct before BeginPlay (if that's possible)

twin juniper
#

Anyone knows why my project still cannot open open source file Online.h, when I have added, in the Public DependencyMouleNames, the OnlinSubsystem? I read in the UE4 forums that the addition of this module name should work fine. Also, UnrealNetwork.h had the same problem, but I added the Net/ยด

autumn maple
#

is there any open source server framework or free plugin for UE4? Thanks

twin juniper
#

Hello everyone currently i am developing a shooting game where the shooting is completely server authoritative.But sometimes the gun location is not syncing b/w client and server.Is there any way to visualize how my client looks like in server??.Thank you

frozen sun
#

hi
can we use shared server for multiplayer
in unreal engine

thin stratus
#

You can only go and send the server the data of the client when they tried to fire

#

Or print it and compare

twin juniper
thin stratus
#

Yeah but pretty outdated in terms of compilation

twin juniper
#

Because I couldn't find the one that were linked to your compedium

thin stratus
#

Yeah cause epic took down the wiki...

twin juniper
#

in the HostSession

thin stratus
#

Right feel free to edit it if you can

twin juniper
#

kk

thin stratus
#

I'll probably rerelease one on my private blog in the future

twin juniper
#

Nice to know ๐Ÿ™‚

thin stratus
frozen sun
#

@thin stratus Can we implement multiplayer functionalities in shared hosting server instead of dedicated or listen server?

thin stratus
#

UE4 only offers these two. Everything else is up to you to code.

#

That said, not sure what you mean with Shared Hosting Server. I only know that term from WebDev, where it means that you use a shared hoster for your website which distributes the required resources among its users.

#

Which in that case would go hand in hand with Hosting a Dedicated Server on that?
But not sure you would want that. Depending on your Game it's probably better to have full control over the resources required for your DediServer

wise zephyr
wise zephyr
wispy elk
#

Hi, I have a question โ€”
I am just starting development in UE4. If I wanted to make a multiplayer game where a person has their cash balance, game currency, and some other data needed to be stored, would I be creating an online subsystem? Can it be done via blueprints, or do I need to utilize cpp? Do I need a dedicated server with a database?

twin juniper
viral island
#

hey do you guys know any video about random player types with 2 random color depending on the types that support multiplayer

edgy valve
#

Guys does anybody know where i could learn how to improve the physics simulation ? i tried to tweak some variables in the physics simulation settings but the objects still moving like they are in the moon

#

I was trying to make something similar to a Domino chain reaction, when i change the linear / angular damping i get some extra speed, but some point things starts to go really crazy

#

I also tried changing the gravity in world settings, nothing that i tried seems to work =/

manic terrace
#

Anyone know why this would throw an error?

#

UFUNCTION(Server)
void ServerOnFire();

#

if I remove the UFUNCTION(Server) it works fine

eternal canyon
manic terrace
#

No I dont

#

Should I?

empty axle
thin stratus
#

Reliable/Unreliable and WithValidation

twin juniper
#

@wise zephyr Sorry for answering so late. Yes, I did, mad don't worry, was just a false positive

gusty slate
#

Hello,
A game like Satisfactory for example, where you join a "Singleplayer" game and can host and invite people while never leaving that map, is that done by having all games launched with "?listen" + always hosting a session and controlling whether it is public for friends or private?

chrome bay
#

Most likely

gusty slate
#

I assume if everything is P2P there is no real impact for the host when no one is in the session with him

hollow saffron
#

Can someone confirm, you can replicate UObject derived objects with ReplicateSubobjects, but you can't seem to network a reference to that sub object(via RPC, etc)?

empty axle
hollow saffron
#

Yea pretty sure. This was many seconds later

chrome bay
hollow saffron
#

Hmm. Ok, I'll double check my work.

silk abyss
#

Cause all the client controller have a mirror on the server.(think of them like remote control emit and receiver)

#

I don't know what cause the 3rd hello from server maybe some sort of echo from how you set up print?

#

You can go to blueprint and have a drop down see a list of compatible controllers

#

can you hit the drop down while you have it playing in editor windows?

#

It will list the controllers you have.

#

Yeah, so like I said, there should be 3 print

#

One for client, one for server, and one for clients mirror on the server(the receiver)

#

So I also said I don't know where the 3rd server print is from.

#

Did you happen to have some server module that have the same print node attached to begin play?

#

Cool, mystery solved. :+1:

#

It's a nice habit to attach the classname when you print though

#

(or the instance name )

fading birch
wispy elk
fading birch
#

it's a different type of server that you're thinking

#

honestly I host my API on digital ocean for $5 a month

#

along with my database

#

granted, i'm not in production stage

#

but i've stress tested my setup and I can handle around 10k requests per second without load bearing which is fine imo

meager spade
#

@twin juniper i don't see the issue

meager spade
#

server has a copy of every clients controller

#

and client only has his own controller

#

so on listen server you get 3 server prints (1 for server controller, 1 for player 2 and 1 for player 3), then the 2 clients, (1 for player 2 and 1 for player 3)

#

which == the 5 prints you see.

wispy elk
fading birch
#

yes it can

#

you just have to build all of that yourself

ancient badge
#

Hello, I'm working on a Game with a Listen Server.
I call an "Event OnPostLogin" in my GameMode (whats only on the server right?) and after some conditions i call an Event that is inside my "PlayerState" but that Event only fires on my Listen Server not on my Client. Any Idea why?

half jewel
#

gamemode does not exist on client

half jewel
ancient badge
#

Thats the point why i used the gamemode

wispy elk
fading birch
#

Thats not a database. That's connecting to the database

wispy elk
#

Yeah I meant using blueprints instead of code to connect to the database

#

I think I will just use a mySQL database on a simple hosting platform that also runs apache so that it can also serve as a registration/login page

#

does that sound logical at all lol

meager spade
#

they dont

#

where does it show that?

#

those prints are perfectly valid

#

2 clients on a listen server, would be 5 begin plays

#

3 server, and 2 client

#

for the player controller.

#

what part are you not understanding? maybe i am not clear enough?

manic terrace
#

Is there any free option for hosting a server? For example if I want to play a game I have made with friends do I have to pay? I have seen hamachi but I am not sure.

meager spade
#

can just run the server on your own pc

#

or get a cheap VPS

#

if its just for you and friends

manic terrace
#

How would I run the server on my pc?

meager spade
#

well either do listen server (where one player is server also) or build the dedicated server, which requires source engine.

wispy elk
#

you can get a free tier ec2 instance on amazon aws

meager spade
#

maybe that will clear things up.

manic terrace
meager spade
#

you would need to use some nat punchthrough like steam

#

or open the ports on your pc and firewall to allow connection

manic terrace
#

I don't like that idea

meager spade
#

you need to do one or the other

manic terrace
#

isn't that not safe?

meager spade
#

open the port 7777 (default UE4 game port)

#

and make sure your router forwards that to your pc

#

your friends may also need to open port 7777

#

Natpunch through solves this by configuring your router dynamically

#

i replied here

#

unless you are directly connected to the internet and not via a router, you need to do something

manic terrace
#

that's what I saw being used in a udemy course

#

though I was always afraid of how safe it was

meager spade
#

people use it, i have never personally used it.

manic terrace
#

do I have to pay to use the steam stuff?

ancient badge
#

I'm really lost right now... The "GameMode" only exist on the server right?
The Server knows about all PlayerController and i call an Event from a Player Controller over my GameMode, shouldn't that work?

meager spade
#

clients would need to send a server (event) rpc

#

so the server can update the game mode

#

as you rightly said, GameMode is server only.

#

if you want to send an event to clients from GameMode, you would need to call a Client (event) RPC from the gamemode

ancient badge
#

What is a Client RPC?

#

A Normal Costum Event?

#

What im trying to do is. I have the "Event OnPostLogin" in my GameMode, when 2 Players Login it should start an Event that is located in my PlayerState

twin juniper
#

Does anyone know a better explanation for the FOnlineSessionSearch::PingBucketSize? The objective is to cluster sessions in specific groups based in the ping value?

fading birch
#

@wispy elk Yes you can do it through BP entirely if you want. Personally I find coding it much easier.

fading birch
fading birch
ancient badge
#

Ok, im trying this another way. But still have a problem. ๐Ÿ˜„

I'm using the "Steam Advanced Session" Plugin for Host/Join Stuff.
After i press Host or Join a widget loads with "Waiting for Players"

and after all Players connect to the session, the game start with game level.
Until now i just used "Open Level" right after "Create Advanced Session"
But how would i tell the game to wait until the second player is connected to load the new map? How do i do this?

fading birch
#

you should look into the GameState class

#

and read through those functions

#

you can check the number of players in the map, using the gamestates players array too

#

I believe a function gets called on the gamestate after a player joins as well

#

to set them up

ancient badge
#

I actually got that now and the "Waiting for Players" is working too. Found a way around it.
Instead of Loading the Map after all Player Connect, the Host is opening the Map, a Widget blocks the view to the map and he waits there for the other player.

Only problem is still that my client player won't start the event that starts a part of the game.

fading birch
#

your client doesn't start the game, your server does. You need to call the Server RPC to start the game

ancient badge
#

Not the game itself

#

Before i set up this whole "Waiting for Player" Stuff i used "Begin Play" to Spawn "Cards" that the player use to play.

#

And i need the Server to spawn this cards now

round star
#

Okay so. A player wants to place a barricade on a wall it does a line trace and then when you click it spawns at the location. Replicating the location works perfectly (before the client only ever returned a 0 Vector) However when spawning the board it does not show up for the Client. The mesh and its actor is set to replicated

#

Okay debug shows even though the location of the replicated variable location is correct its still spawning the board at 0,0,0

#

wtf?

#

Ah crap. The print string is running on server..its what the server sees not the client....but then why wouyldnt it work...massive head scratching

#

Okay so this straight up doesn't work. Having the server run a multicast works but then it spawns the boards twice...

#

Hm. Setting the variables of its rotation and location to replicated dont work...Whyyyyyyy

#

I've tried doing the server to run a multicast when the player clicks to spawn. This ends up spawning the plank twice..one plank in correct rotation, the other zeroed out

#

So the server does the final line trace (on click) ..which makes sense in my head..but it doesnt actually work..

dull lance
#

sort of... quick question: what is an optimal way of creating lobbies on the main server, and only until the lobby creator decides it's ready, do we actually set a lobby hosted by the lobby creator and get all in the lobby to travel to that session?

#

like say in the main menu you select the lobby but don't actually travel; that way you can quickly drop in and out of lobbies in case you change your mind without connecting to the host of that session (staying on the main server where all players connect to when logged in)

#

so far I've only worked with lobby systems like say Battlefield, where there is no intermediate lobby. You're either on the main server allocated to your player pool or in the game session, and not entirely sure how to approach this

grizzled stirrup
#

Have a look into beacons

#

Steam party plugin is a good example with code

dull lance
#

I see. I only have SteamCore:: atm; I'll take a look at that.

fading birch
#

@dull lance beacons and setting your session as visible for searches.

sinful tree
round star
sinful tree
#

What does your trace look like?

round star
#

trying back to the server calling multicast to see if I get this to work. It does spawn it in the correct place but the rotation is always set to 0

#

server rotation is different than the client....hm

#

sigbeiugbiregnekrjgnregjngejgnergergnregoireigoirongreg

sinful tree
#

Don't multicast that. You should have your actor set to replicated and then all you should need to do is spawn it on the server. Multicasting makes every single client (including the server) execute what you've put.

round star
#

that doesnt work though

sinful tree
#

That means you don't have it set up right.

round star
#

something to do with how line trace is handled

#

I know what you mean..I could all day everyday do this with any actor but the line trace location/rotation is totally not working

sinful tree
#

The two "Rotation Board" values (Y and Z) are probably values that you're also manipulating on the client, these would need to be passed to the server.

fluid summit
#

Hi! Is there any standard for datababase when using dedicated servers?

#

Like, do you have to connect the server to a sql database or does it come with one already?

fading birch
#

you'll need to make your own and a way to communicate with it

#

I use a REST API and persist my data in a SQL db

round star
fluid summit
fading birch
#

I created my rest api in Java using spring boot as my boiler plate. There are several options you can use. You can technically interact directly with your db via ue4 but that can cause a ton of issue if your source ever gets out

fluid summit
wispy elk
fading birch
twin juniper
#

has anyone had issues with dedicated servers built for linux on 4.26? i can get it to compile just fine, it starts up fine & looks like everything is working, but the client gets a timeout while connecting and the server doesn't log anything about the client trying to connect. windows servers work just fine. i've built dedicated servers for linux a bunch of times before on older versions, and never ran into anything like this.

meager spade
#

yup that is also correct @twin juniper

#

playerstate is replicated to everyone

#

so should be 9 prints

#

client will have one copy of each players playerstate

#

server will also have a copy

twin juniper
#

@thin stratus I was reading your tutorial about Game Sessions and there is a point I'm trying to see if there is a corner case you have thought that I haven't ```void UNWGameInstance::OnStartOnlineGameComplete(FName SessionName, bool bWasSuccessful)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString::Printf(TEXT("OnStartSessionComplete %s, %d"), *SessionName.ToString(), bWasSuccessful));

// Get the Online Subsystem so we can get the Session Interface
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
    // Get the Session Interface to clear the Delegate
    IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
    if (Sessions.IsValid())
    {
        // Clear the delegate, since we are done with this call
        Sessions->ClearOnStartSessionCompleteDelegate_Handle(OnStartSessionCompleteDelegateHandle);
    }
}

// If the start was successful, we can open a NewMap if we want. Make sure to use "listen" as a parameter!
if (bWasSuccessful)
{
    UGameplayStatics::OpenLevel(GetWorld(), "NewMap", true, "listen");
}

}```

#

Shouldn't be the if(bWasSuccessful) block inside the if(OnlineSub) block? I'm asking because I know we have to check it anyway, but you only have a successful session start if you have an non-null OnlineSubsystem, right? In this snippet, the if(bWasSuccessful) condition will be checked even if the OnlineSubsystem is null, am I missing something? Is there a corner case where your IOnlineSubsystem pointer is nullified between the Sessions->StartSession() execution and the OnStartOnlineGameComplete?

fading birch
#

the online subsystem would never be null if it wasn't at the get go. It starts when the game does.

twin juniper
fading birch
#

Shouldn't need to no. Those if's are doing 2 different things.

twin juniper
#

kk

thin stratus
#

No, there is no edge case here. This is just how I coded it.

#

I think my thinking back then (and also now) was never "If the subsystem is valid, check the boolean."

#

What I did was "Even if the callback was not successful, we want to kill the callback binding.

#

@twin juniper

#

You could probably wrap the bool check into the subsystem check, but I don't see much value. The Subsystem won't be null if the callback happened I assume, cause the subsystem triggers it after all

#

Would even go as far as not nullcheck the sub at all now adays

#

Let it crash if the subsystem is null, cause then sh't is going on anyway

twin juniper
#

Hello, Cedric! Thanks for the reply! I'm just modifying what you taught us in the tutorial, and I'll probably test it today (actually, is 03:42 am here T_T)

#

Because the clients were getting a "LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)" in my Ouput Log, I thought I should connect through Game Sessions. I have to test it btw

twin juniper
#

The way you could change what was presented in your tutorial, to run a dedicated server, is related to the way you call those functions? For example, to run as dedicated server, I should use the HostSession(), while the clients would use something like if(FindSessions()) { choose the session that has the lesser latency call JoinSession() }
? Or should I go beyond the engine and learn how to code a master server? Also, the GameSessionName is stored in a variable to be used as a cache, and making possible the session destruction? This was the first thought I had when I saw it. Another thing I saw is that ULocalPlayer->GetPreferredUniqueNetId() returns a FUniqueNetIdRepl, and IOnlineSessionPtr->FindSessions (for example) only accepts, as the first argument, an int32. Is there an alternative or should I start overloading/overriding things?

tranquil yoke
#

Hey, i have a question regarding the net dormancy of an actor.
-- We can only change net dormancy state on server ?
-- does net dormancy state effects the RPC
-- If i have scenario where spawned actor is initial state, then i do something with actor, once done i change its
dormancy state to dormant all. Next time it does nothing, because some code which are check is on server.
is it because of this ?

light monolith
#

Can someone tell me why this is not working? I'm calling this in an actor that is placed in the level in editor so it exists for both client and server

#

Sucess Server never fires

violet sentinel
# tranquil yoke Hey, i have a question regarding the net dormancy of an actor. -- We can only ch...

-- We can only change net dormancy state on server ?
yes
-- does net dormancy state effects the RPC
no, only replication
-- If i have scenario where spawned actor is initial state, then i do something with actor, once done i change its
dormancy state to dormant all. Next time it does nothing, because some code which are check is on server.
is it because of this ?
you can simply lower replication update frequency to lower how often object is considered for replication
or yes, waking up object after interaction and forcing net update

sleek elk
#

Sometime you can choose what to replicate:

  1. Replicate a actor reference and read values from actor after replicating the actor-ref on each client.
  2. Or read values from actor on server and just replicate the values itself and not the full actor reference.
  3. Or do not replicate actor reference nor single values, but replicate actor class reference and read class defaults (of course only possible if class default properties are the one which needed on clients).
    Do you know any good topic about the overhead/difference on replicating values, actor reference or actor class reference? I did a web search but do not find some content, what uses more replication bandwidth/size. Would be cool to know, what is the "cheapest". Or any idea how to measure?
violet sentinel
sleek elk
#

ah, good idea

sleek elk
#

Would you guys had expect this or is it more a suprise?

thin stratus
#

Well, it doesn't pass the whole object

#

It passes a unique id

#

All the data inside of that Actor replicate on their own

#

If you have 4 floats and a String in there, you actually have more stuff replicating than just those 5 values.

#

@sleek elk

thin stratus
#

Actors that are placed in the Level are not owned by your Client.

#

A ServerRPC requires that however.

#

Ownership can also only be set to one client at a time and has to happen on the server, so move the RPC into something that is owned by that client, e.g. Character/Controller/PlayerState.

light monolith
#

yeah i used the player state and it works thanks to your compendium ๐Ÿ™‚

thin stratus
#

Awesome

sleek elk
# thin stratus Well, it doesn't pass the whole object

Hi Exi, great Compendium! Of course I am not surprised totally, and my question and test was just about "how many single values replicating are using more bandwith as replicating the full refrence". #multiplayer message
But, yes, for me it was surprising how early it makes more sense to replicate full actor reference: Already a RPC with replicating a float used more size as a RPC replicating the reference to the actor. Seems referencing ID is smaller as I thought. ๐Ÿ˜‰

thin stratus
#

I don't understand what you are comparing there then

#

If you need 2 floats replicated to Clients, then replicating them directly is better than replicating some Actor Ref

#

Because the Actor Ref still has to replicate those two values

#

So you only add onto the bandwidth, you aren't saving anything

warped berry
#

Is there a way to filter the sessions that are coming back from steam? I use the free port 480, and I cant test all data

sleek elk
# thin stratus If you need 2 floats replicated to Clients, then replicating them directly is be...

I think there are many examples. A trigger per RPC by an event from server to the players player-controller to message something on their hud (event based, not permanent) and with text content including some default/static actor values (perhaps max-health). You can replicate values per RPC or actor reference.
Like in my example, only for one time event RPCs, of course not for values you replicated by property replication anyway. Then you could simply do it on change by rep notify or whatever.

violet sentinel
warped berry
#

do I need to put all other setttings?

chrome bay
#

So it could be vastly more expensive the first few times, because it's akin to sending a full string with unknown length

#

But yeah either way, using an actor to replicate two floats by proxy isn't saving you anything

violet sentinel
warped berry
#

i mean i dont want other people's who are currently testing as well, I want results only from my game executable

fading birch
#

You can add a special key, value pair to your session when you create it and use that in your search to filter out other games.

warped berry
#

and sometimes other sessions appear too

chrome bay
#

By default you'll only get a valid ping to a dedicated server with the Steam OSS

#

Ping to listen servers aka "lobbies" will always be 9999 since AFAIK Steam doesn't give you a method to ping lobbies, though even if it did those pings are very inaccurate

tranquil yoke
#

@violet sentinel For some reason, if i keep actor in dormant all state, one of its comp does not do RPC to the server.

violet sentinel
#

are you having thousands of them ?

tranquil yoke
#

not thousand but they can increase and decrease

violet sentinel
#

if there is small amount of actors just let them be in normal state

tranquil yoke
#

i have reduced the net update frequency to 10

#

i can go lower though right, making it 1 , can optimize things better

violet sentinel
#

if it is object that changes its replicated variables rarely then yes. even 1 (1/1 = 1 update per second)

tranquil yoke
#

object only changes value, when i interact with it, otherwise does nothing, only render stuff with data it already have.

so my plan was to make it dormant, which i think wont work, unless i pass it through PC or something to change its state to awake, before sending RPC , i think.

we can update the rate at runtime on server right, like do force net update, before changing the amount of updates, when we start interact with the object, but once done change it back to 1 or even lower, can we do (0.1) ?

violet sentinel
#

i wouldn't try to play with dormancy unless i find that object high in network profiler chart

tranquil yoke
#

okay i see

violet sentinel
#

get too hard to support later

tranquil yoke
#

thanks, make sense, will do profiler first then do the optimization.

fading birch
#

Net update frequency can also be misleading

#

while it'll update at w/e rate you do

#

it still falls into the net priority

#

if it's bottom tier in priority, you can have it update every frame (not advised) and it would sitll get misses.

meager spade
#

we just call FlushNetDormancy

#

if server need to replicate a property

#

this puts it back into dormant after sending an update

#

dormancy does not affect RPC's

#

@tranquil yoke

tranquil yoke
#

@meager spadeyou call this on server ?

meager spade
#

from client yes

tranquil yoke
#

yeah actually, i had issue where i was not even able to send an RPC from cilent to server ,it was inside a component, which is inside the Actor, whose net dormancy state is dormant all

#

the best solution i can think of right now is, have a server event on PC, and change the dormancy state for any actor, before sending an RPC from that actor itself.

twin juniper
#
NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection
RelevantTimeout=2
bNeverApplyNetworkEmulationSettings=true```

Is there any issue if I change `RelevantTimeout` to for example 0.1, the issue is that I'm overriding AActor::IsNetRelevantFor and it takes like 5 seconds for the actor to stop being relevant on certain conditions, and that happens even when I'm calling ForceNetUpdate
#

and I need the net relevancy to look seamless

past totem
#

In BP Multicast event, is there a way to get the player pawn/controller that's executing the event? (Like, Multicast executes on all clients, so I would want to use the client as a variable when executing)

fading birch
#

each controller is executing the event

#

the server version is the one that initially executes the event

#

and then the client version execute the same event

meager spade
#

@tranquil yoke Dormancy should not affect RPCs

#

RPC is nothing to do with dormancy

#

complete separate systems

tranquil yoke
#

okay thanks, my issue is something else then, i will try to debug that

stray oxide
#

Im having a bit of a weird situation. The client is not being detected by collision but the server is. I have an enemy attack that will attack the player character using a box collision or a sphere overlap actors (I have one of each). Neither of them are detecting the client, only the server. This is a recent issue and it was working fine and I am not sure what I changed to make it not work now.

dull lance
#

quick design question (divided into two): Say that your multiplayer game as a turn system.

  1. Would it be better to make this a UComponent (and say have it in the Game Mode / GameState) or as an Actor?
  2. Would it be better to keep the Turn System strictly on server (Say GameMode / Actor existing only on server) and then have another actor that broadcasts results to clients?
dark edge
#

Gamemode controls the turns, GameState is where the turn state lives so clients know about it

#

Playerstate being where your individual turn state lives like whether your turn state is ETurnState::MyTurn or ETurnState::OtherPlayerTurn etc

#

depends on how it's done

dull lance
#

the Player State part is done, and it's what controls the Character.

I was initially thinking to not have the Turn System be replicated, but can't really think of a reason why to not have it; All I'd have to do is to block any function calls from the Clients and keep almost everything private with the say the GameMode being the friend (for instance) and update the variables using ReplicatedUsing (or even FastArraySerializer because of the call back functions) and have that call back function update the players locally.

#

But I also understand that that might not be fully optimal, hence the question

#

I'll take your suggestion into consideration. Thank you for your answer ๐Ÿ˜Š

fossil veldt
heady python
#

I have a 3d widget in my world that all players can use. How do I get a reference to the player that is interacting with the widget currently? (Pressing a button)

half jewel
#

from the widget? its all local, meaning the widget only exists on players machine

#

if u want the world widget to do stuff, try calling server rpc on the actor the widget belongs to @heady python

#

widget andriodkeyboardarrow the widget actor ref andriodkeyboardarrow server rpc

gleaming vector
#

if you are on SDR, that will work, but you need to opt in

severe tendon
#

We're trying to replicate visemes from OVRLipSync across a network reliably, has anyone successfully done this?
I'm at a point where it crashes if I send it all as a Json string or individually as Floats on device, sending it unreliably ends up causing it to send in a random order and adding a time to make sure it only got the latest packet still caused issues with morphs.

gleaming vector
#

steam datagram relay

viral island
#

hey i want to make multiplayer soccer game with listen server but why when player 1 kick the ball the in player 2 doesnt got kicked and when player 1 pick up a hat player 2 cannot see player 1 using the hat, waht should i do?

fading birch
severe tendon
viral island
#

no

#

player 1 kick the ball but player 2 doesnt see player 1 kicked it

#

and player 2 doesent see player 1 pick the hat

autumn maple
#

How to compile to VR(default 1stPerson view) & Mobile(3rdPerson view) from one same project and source code? is there any demo or tutorial?

severe tendon
empty axle
#

You can take a look at ShooterGame

chrome bay
#

^ It's old but still valid.

chrome bay
#

The only example project Epic made with multiplayer was the "Multiplayer Shootout" demo, but that's about it.

#

Blueprint doesn't have the majority of multiplayer tools, only the basics.

chrome quest
#

Does anyone know if ue5 will improve on large player count in multiplayer?( Not sure how to word the question properly)
If not, can anyone link resources on how to implement and optimize server maps of greater than the standard 100 players(in ue4/5).

PS. I'm not making a MMO. Lol

bitter oriole
#

There's little reason for it to

#

And there's no way anyone can link you a resource on >100 players, since 100 is nowhere near standard, no one has done more in production, and so no one has resources on it

#

100 is completely insane already

chrome quest
bitter oriole
#

Rust is Unity

chrome quest
chrome quest
bitter oriole
#

100 online players means you have insane player counts for the average PC game

chrome quest
bitter oriole
#

Assuming 5 servers geographically, and no concept of matches, that's 500 online players, a lot more if you have matches

#

500 games on Steam can do that

chrome quest
#

True. I wonder when it'll be possible to achieve greater. Dual universe claims to do 30k

bitter oriole
#

Depends on your marketing team

#

90% of Steam games have <10 online players

chrome quest
bitter oriole
#

It's an MMO, so yeah, sure

chrome quest
#

So let me get something straight. It's possible to achieve such numbers but not with ue4 and possibly ue5

#

I would love to get my hands on their tech.lol

bitter oriole
#

What would you do then ? Ask someone to give you the $100M in marketing to actually get the 30k players ?

#

No, Unreal cannot do that

chrome quest
#

C'mon man, at least try to give me some hope here.๐Ÿ˜…

But seriously. I really want to know how they do it.

bitter oriole
#

Using Unreal as a renderer and having a completely different server stack, is how

#

But no, there is no hope for that, reasonable people hope for 20 online players

#

So that they can matchmake 3 players cooperative games

#

People don't make MMOs, publishers do

#

Dual Universe has been at it for very literally a decade and fired the entire company twice

chrome quest
bitter oriole
#

Owning a publisher sure is

chrome quest
#

Lol. Wanted to send a DreamWorld joke here. But I dunno who is watching.

chrome bay
#

Indie MP Todos:
10-20 Player Servers Max, Listen Servers if you can, Add PVE, keep it simple.

Just a fun fact we've shifted >1 Mil copies on Steam (with publisher) - and even with that number our peak 24hr concurrent player count is like 2-3K at the most. Consider that the vast majority games on steam barely even scrape a few hundred sales, it's suicide to do anything else commercially.

#

If you can't support listen servers for any reason, ship the dedicated server binaries and let people host wherever they want too.

bitter oriole
#

Simple dumb cooperative PVE multiplayer is stupidly hard enough.

chrome bay
#

yeah definitely

#

I like (sort of) the challenge of MP but the market is something else ๐Ÿ˜„

finite goblet
#

Is it normal for RPCs to get called even before GameInstance has called Init() ?

winged badger
#

no, and they dont

finite goblet
#

in editor they do

#

I store my gameinstance a static singleton in init.
However that singleton sometimes can be a null if Beginplay rpc looks it up on the client

bitter oriole
finite goblet
#

well what I mean is , the client seems to receive the RPC from server before the gameinstance for client has called its init.

bitter oriole
#

No, the game instance is created way before a client can even connect to anything

#

Remove the singleton first and call GetGameInstance<myclass>() directly when you need it

devout berry
#

Does AIPerception/AIPerceptionStimuliSource not work over network? ๐Ÿ˜ฎ

#

I have set both components to replicated and it works as intended in singleplayer, but as soon as I host an online game, the perception isn't working.

#

Neither on the server nor on the client that is

thin stratus
#

Never reaaaally worked with it, but I would assume all of that should run server side

finite goblet
bitter oriole
#

My point is that you probably messed up your singleton

#

Now with PIE everything's possible, but I'm guessing what happens is more "singleton is messed up by the double windows thing" and less "actors exist before game instance"

thin stratus
#

All the behavior is server side sooo

devout berry
#

My patrol set up seems to work on the server (and is replicated). Just the perception isn't kicking in for any side

finite goblet
golden nest
#

Hi, does someone knows if blueprint interfaces run on server when i call the interface event?

#

Can i do this?

#

Or it will only change the boolean on client?

thin stratus
#

It's not a ServerRPC, is it :P

finite goblet
#

call another Event from it that has replication mode set to client or multicast

finite goblet
#

That;s a good fallback

thin stratus
#

You have a Singleton to the GameInstance?

#

Sounds redundant but sure

finite goblet
#

its just personal convenience for shorter code

devout berry
#

Ok I think I am a step closer with my ai perception issue.
It appears it has nothing to do with network/server/client but rather with standalone vs. editor.

It works fine in editor, but does not work in standalone game (which is where I happen to have tested always with network)

half jewel
#

i posted it cause he goat clept again and he thought he was immortal. i bet he stil think it right

devout berry
#

I think I found a fix. I checked "Auto register as source" on the stimuli component. For anyone that might be interested.

bitter oriole
finite goblet
#

are you sure there is no out of order events in PIE?

bitter oriole
#

Your fix proves there aren't

#

Assuming that WITH_EDITOR part was added to fix the issue

#

In any case the singleton pointer is completely pointless

#

Caching pointers, especially UObjects, is a bad idea

#

Especially in single process PIE

finite goblet
chrome bay
#

You can have multiple game instances in PIE

bitter oriole
#

^

chrome bay
#

PIE does many sp00ky things

bitter oriole
#

Each window has one

thin stratus
#

Has anyone had issues with the Client just not getting its ViewTarget changed to its Pawn?

#

Kinda stomped atm, as I don't get any warnings or errors. Just remains on the previous camera

bitter oriole
#

Just don't do singletons with UObjects is my straightforward advice

thin stratus
#

Hm, seems to be something in my PlayerCameraManager... checking that first

digital wyvern
#

Does ue4 keep all replicate actors on client at all times?

short arrow
#

Is there a way to have a vertical box automatically place it's child at the top? I think it's so weird that it's only changing the location of X

upbeat gazelle
#

Question:
Multiplayer with level(world) streaming.
If playerX at the one end of universe will create a box
will server command to create a copy of this box to
playerY at the other end of universe(at another level)
?
How should it work?

empty axle
short arrow
#

Oh I didn't even realized I asked it here

#

Thanks

spiral halo
#

Hey there, is it possible to implement an independent networking solution from the unreal engine editor?

#

And, if so, can anyone give a brief overview of how that would work?