#multiplayer

1 messages · Page 200 of 1

dark parcel
#

For sure, I'm using cmc atm so that's taken care off

nova wasp
#

there could be a case where the player is moving so darn fast maybe it's worth predicting them opening the door to avoid corrections

dark parcel
#

Currently working on projectiles atm. Right now the client sort of say, I hit this person. Trust me bro. Which is okay for my use case but I want to have some treshold before the server says. Nah you are too laggy, your request will not be proccessed

nova wasp
#

there are a few different aspects to consider here that I consider distinct parts

#

The act of shooting from your local client is generally predicted and simulated locally by most games... which sure beats the alternative of quake 1 style leading your shots

#

okay, so now you send that information to the server... what does the server need to do?

dark parcel
#

I guess server can roll back and simulate in his machine based on the timestamp. Also check if the shoots are possible. Right now, I am skipping those check just to see if the game is tolerable under high ping.

#

Oh and I'm spawning the projectile locally in each client... so I think each machine may see different results based on their latency... not sure how to tackle this for slow moving projectile

nova wasp
#

what you would need to do to have a threshhold imo

#

is to know where the player was roughty when the shot happened

#

and be able to get a fuzzy idea of if the simulation they proposed made sense in context

dark parcel
#

🙇‍♂️

nova wasp
#

this is mostly me talking from how I would approach it, I've never fully implemented something like this myself

#

making everything 1:1 is going to be difficult... Valorant actually does this and they basically had to completely replace how unreal animations work to rollback skeletal mesh state lol

dark parcel
#

Tyvm

#

Will read that

proven pagoda
#

If you use C++ I learned a method using a TDoubleLinkedList variable to save 1 second of hitboxes on the character and if the clients hit it would rewind the timestamp to the frame saved hitboxes and run another line trace to confirm but since then someone else told me to look into sparse arrays and I haven't yet

#

Also Unreal has a component for predicted projectiles

proven pagoda
# dark parcel Will read that

There's an engine type FPredictProjectileParams that's not custom and a few functions I use with it to locally predict the entire path

snow trail
#

hello, if i were to make a multiplayer RTS, what would be the best way to replicate stuff? can unreal handle replicating thousands of units reliably? or is it better to replicate commands and simulate everything on every client? are there any other solutions?

fossil spoke
#

UE is not designed out of the box to support RTS games.

#

Their network requirements are massively different to FPS games (which it is designed for).

snow trail
#

yeah, fair
reason i was asking is because if a player disconnects youd probably have to resimulate everything up to current time right?

fossil spoke
#

Im not going to speculate on what you may or may not need to do for an RTS game, you may as well be asking how long is a piece of string.

#

Maybe you should try architecting these things yourself and see how far you can get.

#

You will learn much more that way, then asking broad questions here.

#

It takes years and years to build these types of games.

snow trail
#

alright, i will keep that in mind

tidal temple
#

Is there a way to increase the server's "tolerance" for the difference between client and server movement? My character is moving fast enough to cause prediction errors, but I seem to be transmitting data correctly, using flags, applying Velocity correctly, etc.

kindred widget
tidal temple
vocal marlin
#

Where to store players XP in multiplayer game, in character or player state?

dark parcel
#

Where ever make sense for your game.

#

If you look at red alert, each unit have exp of their own. And it's not like they can get revived so it make sense to have it on the character

#

You are asking for something that really depends on your project needs

vocal marlin
#

I have like logic where whenever player deals a a damage, he receives 1 xp per 1 damage, from server function, but i want to keep players xp if it dies

#

I am new at ue

nova wasp
#

if you want to keep it persistently then probably their player state?

vocal marlin
#

Yeah, thats what i thought, thanks

#

Which database should i pick for mmorpg tho?

dark parcel
#

If you have to ask that, you shouldn't do mmorpg

vocal marlin
#

That answer i was looking for 🤣 i ill make game even harder

vocal marlin
#

I know that it shouldn’t be postgres or mongo or redis

#

Is it Dynamodb?

karmic briar
#

.

little pumice
tardy fossil
#

sqlite

lament flax
#

i am using PlayerState for my AIs because they have shared functionality with players

could this cause some performance lose since playerstates are always relevant ?
maybe i should try to move the functionality somewhere else like the Pawn

#

(in my game Pawn is never destroyed, so switching to Pawn doesnt impact the design idea)

#

and since the PS have a ASC, the current net update frequency is 100

#

i aim to have around 20 playerstates max in a single game (players + AIs)

little pumice
#

if it does you can override relevancy behavior for AI PS (mb introduce extra baseclass)

lament flax
#

this would make AI behavior more laggy then

#

they are as important then players

little pumice
#

all AI behavior is that important? then what's the question? you just have to have it in PS.

#

also relevancy is flexible thing, e.g. "distance" feature, it won't introduce lagginess though reduce overall load

woeful trout
neon summit
woeful trout
tame sapphire
#

Not sure if this should be here or in Blueprints but it is for multiplayer so here goes. (Context: turn-based multiplayer ability/action) when selecting an ability/action is it best to spawn a separate actor with collision and a decal for target previewing on the player controller for owning client and pass through a location/transform and class for the server to spawn effects/tags on targets etc.... or should the spawned actor be run on the server from the player controller and looped through by the server for with actors of class to spawn effects/tags and show/hide the decal as appropriate... TLDR - should spell previews be a seperate actor or not from the ability/action?

woeful trout
little pumice
woeful trout
little pumice
woeful trout
#

huh i still dont understand anyhow can you help me with that??

#

@little pumice

neon summit
#

Kinda proves his point

woeful trout
#

???

little pumice
#

describe case in few words e.g. Player does X, server does Y, then it's expected Z on client

#

from Player's perspective, not in terms of your current code

neon summit
#

Widgets only exist locally for each client. Replicated events do nothing on widgets. And posting a video moving all around is quite annoying

#

Provide some context of what you want to achieve

woeful trout
#

i know bro but what can i do lol i thnik thats the problem is the replication of widget anyway

woeful trout
#

cause i follow a tutorial which is made not in multiplayer...

#

and i think i can do it myself :/

little pumice
upbeat basin
#

So APawn::NotifyControllerChanged should be called on both server and clients according to the comments above it. However for the clients there is a check inside APawn::OnRep_Controller (where NotifyControllerChanged is being called from) to see if the controller did not have any pawns before possessing the current one. This causes possessing another pawn to not recieve the NotifyControllerChanged call on clients, since setting the pawn inside the controller to null isn't being replicated, as it's being set to another value in same frame. Is this a bug or are we users supposed to be aware of this and implement our logic accordingly?

little pumice
woeful trout
little pumice
#

and you can't even blame author of tutorial, it's just has different goals

woeful trout
#

i didnt blame someone just said i follow a non multioplayer tutorial
With the mindset i can do it myself the replication

woeful trout
#

?

little pumice
#

learn about replication (properties + RPC) then things may become more clear

little pumice
#
  • RPC ("client <-> server" actions)
#

also I guess you have to implement some kind of persistent storage on server to keep players progress. (Database)

woeful trout
#

anyhow thanks for respond ill rechech all of the code

little pumice
#
  1. Player gets quest from npc (RPC client -> server)
  2. Server handles it, changes state, and state gets replicated to client.
  3. Quest is in progress, when client receives update it can reflect it on UI (OnRep_ callback may be useful)
    The rest is kinda similar pattern e.g. client notifies about it's actions, server handles it, updates replicatable state, client receives updates and so son
woeful trout
little pumice
#

I believe when you start reading UE5 networking docs it will make sense for you

ivory snow
#

I am trying to replicate jetpacking using a custom movement mode, but I don't understand why I get server network correction just few minutes after the player starts jetpacking. Should I change the way I apply the force on the Z axis to the player ?

void UEsLyraCharacterMovementComponent::PhysJetpacking(float deltaTime, int32 Iterations)
{
    if (deltaTime < MIN_TICK_TIME)
    {
        return;
    }
    
    /* Amount of resource in seconds needed to use the jetpack for this round */
    bool bIsJetpackResourceEnough = false;
    if(IsValid(JetpackComponent))
    {
        const float MaxJetpackResource = JetpackComponent->GetMaxJetpackResource();
        const float ResourceNeededForJetpacking = deltaTime / MaxJetpackResource;
        bIsJetpackResourceEnough  = JetpackComponent->GetJetpackResource() >= ResourceNeededForJetpacking;
    }

    
    if ((!Safe_bWantsToUseJetpack  || !bIsJetpackResourceEnough ) && CharacterOwner->GetLocalRole() != ROLE_SimulatedProxy)
    {
        UE_LOG(LogTemp, Warning, TEXT("Trying to cancel jetpack ability"));
        Safe_bWantsToUseJetpack = false;
        if(!CancelJetpackGameplayAbility())
        {
            UE_LOG(LogTemp, Warning, TEXT("Jetpack ability wasn't canceled"));
        }
        SetMovementMode(EMovementMode::MOVE_Falling);
        StartNewPhysics(deltaTime, Iterations);
        
        return;
    }

    Iterations++;
    bJustTeleported = false;
    
    CharacterOwner->LaunchCharacter( FVector(0,0, JetpackVelocity), false , true);
    auto CurrentRotation = CharacterOwner->GetActorRotation().Quaternion();
    FHitResult Hit(1.f);
    FVector AdjustedLocation = Velocity * deltaTime; // x = v * dt
    SafeMoveUpdatedComponent(AdjustedLocation, CurrentRotation, true, Hit);
    
}
woeful trout
little pumice
amber stone
#

Hey, im in the process of trying to update my project to use the newest unreal version 5.4.3 and my previous version was 5.2.1 Im having a pinch of issues with compiling my network session code now

#

looks like some build in variables are now undeclared identifiers

#

I was wondering if anyone could tell me where the identifiers are defined now or if their names have changed?

lost inlet
#

a find in all files would likely help

amber stone
#

previously all I needed to include was

#include "OnlineSubsystem.h"
lost inlet
#

well if you got away with it then unity builds were likely helping you out

#

I see these all defined in OnlineSessionNames.h and all I did was find in all files

amber stone
#

Yeah that was my first idea was the recurse the search

#

and I included that already

#

but it didnt work

lost inlet
#

yeah can you be specific with didn't work

amber stone
#

one moment

lost inlet
#

it's also in a plugin called OnlineBase

amber stone
#

im halfway in between reading error messages

lost inlet
#

so that'll need to be included in Build.cs

amber stone
#

thanks, thats all I needed was to include Online/OnlineSessionNames.h

#

my dumbass forgot to put the Online/ prefix on it

echo snow
#

How do I invoke an RPC from owning client to server to multicast in order to change camera rotation. But skip setting the camera rotation for the owning client so that client can do it locally and not rely on server?

echo snow
#

The player controller

thin stratus
#

You Multicast in the PlayerController?

#

I somewhat expected you to write Character or Pawn

echo snow
#

Sorry, the code to add input is in player controller, I set the camera rotation in the character

thin stratus
#

Right, so the Character has the Multicast?

#

Then just do "IsLocallyControlled -> False" and then apply the Rotation.

echo snow
#

I'll try that thanks

#

it kinda works

#

the camera is flickering

thin stratus
#

Why do you even need the Camera Rotation like that? Would "GetBaseAimRotation" be enough?

echo snow
#

I'm using a quaternion to simulate zero-g camera control

#

instead of control rotation

#

Player Controller (adding input):

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

void AXKPlayerController::AddQuatYawInput(float input)
{
    const FRotator INPUT_ROTATOR = FRotator(0, input, 0);
    QuatControlRotation *= INPUT_ROTATOR.Quaternion();
}

void AXKPlayerController::AddQuatPitchInput(float input)
{
    const FRotator INPUT_ROTATOR = FRotator(input, 0, 0);
    QuatControlRotation *= INPUT_ROTATOR.Quaternion();
}
thin stratus
#

You are doing things twice

#

You are already replicating the Rotation via DOREPLIFETIME and then you also use a Multicast.

#

The DOREPLIFETIME Part will already cause your Local Client to get the data back from the Server, which will jitter

#

You probably don't want to actively replicate the Quat

echo snow
#

let me try that, I was wondering if it was better to just replicate the QuatControlRotation or only replicating the camera rotation

thin stratus
#

I mean it's two different things, cause replicating in the PlayerController won't reach SimProxies

opaque forge
#

What's the best approach to making an FPS where you see an "arms" viewmodel yourself (with dedicated animations), but the regular character model for everyone else?

#

There's suprisingly little resources about this

echo snow
#

you can hide models from owner

thin stratus
#

Two SkeletalMeshComponents, one for the FP Arms, one for the TP Body.
Then the Booleans that haft posted.

#

"Owner" is a bit misleading, it's mostly the ViewTarget that controls this.
So if the Character is the ViewTarget, which it usually is in that case, it will work with those

#

There is also "OwnerOnlySee" for the FP Arms then

opaque forge
#

I thought you were talking about the net owner for a second

thin stratus
#

Na, which is why that boolean is shitty named

opaque forge
#

lol

thin stratus
#

If you spectate another player, and you make that Character the local player's ViewTarget, it will also hide the TP Body, which is usually wanted.

opaque forge
#

So if I have a weapon actor, what do I attach it to? It can be picked up, dropped, and passed between players so spawning and despawning the actor(s) is not viable

echo snow
#

I stopped replicating the quaternion and changed the bp to look like the screenshot. The player view seems fine with no stuttering but from other players perspective its flickering and not accurate

thin stratus
#

Which you probably need C++ for, cause by default, Attachment is replicate, so whatever the Server uses as AttachTarget will replicate to everyone :P

opaque forge
#

I don't really understand proxys lol

#

But wouldn't that break the spectating thing you were talking about?

thin stratus
#

AutonomousProxy is the local Player that controls the Character

#

SimulatedProxy are the other Characters of other Players that the local one sees running around

thin stratus
thin stratus
lost inlet
#

this hasn't really been much on the multiplayer side

opaque forge
#

Or maybe I could just always use the "real" actor in the world model and create a separate "viewmodel" actor

lost inlet
#

and I did work on a game with first person spectate

#

why do you need different actors? the first person mesh is just a separate component

echo snow
opaque forge
#

Maybe I misunderstand how actor/component parenting works.

#

If I parent an actor which uses a mesh as it's base to an attachment point, won't all its components also follow it

thin stratus
#

If you parent an actor you basically parent its root component

opaque forge
#

In which case you'd need another actor to display on the viewmodel, which isn't connected to the world model

thin stratus
#

So yes, everything else follows

#

One Actor is absolutely enough for the Character

#

And then one Actor for the Weapon fwiw

lost inlet
#

still, why would you? thought I think in the end we may have just spawned a component at runtime and attach it to the hands mesh at runtime

#

but it's a while back now

opaque forge
#

But is it possible to parent the viewmodel component of the weapon to a different mesh & attachment point?

thin stratus
#

What is a ViewModel Component?

opaque forge
#

The component that is the viewmodel mesh

lost inlet
#

viewmodel is a term for 1st person meshes

opaque forge
#

Which we're saying doesn't need to be a different actor from the world model

thin stratus
#

I only know ViewModel from MVVM

lost inlet
#

well I'm familiar with the term from Goldsrc/Source

thin stratus
#

Either way, 2 Components with the OwnerNoSee and OwnerOnlySee that you can parent the Weapon to is enough

opaque forge
#

Can you parent the first person component to a different parent than the main actor?

thin stratus
#

One Character, 2 Components

opaque forge
#

I'm talking about the weapon here

lost inlet
#

though instead of the OwnerNoSee stuff, we ended up with an UpdateFirstPersonPerspective function that toggled visibility of meshes when the camera mode or view target changes

#

somewhat related, I'm looking forward to the FPS mesh stuff in 5.5

thin stratus
#

Yeah you can probably solve it in different ways .Depends on the game and needs. There are also cases where you don't have any spectating and you might as well just spawn the TP and FP Components runtime to not even have them exist if not needed.

#

Idk how your Weapon works. In most Games it's a separate Actor that one parents to the FP or TP MeshComp when equipped.

opaque forge
#

Another big consideration is that you can drop the weapons on the ground and they become physically simulated

thin stratus
#

There are, again, of course other ways fwiw

opaque forge
#

But you can only parent it to the first person or the third person model iirc

#

Not both

lost inlet
#

why not just attach the individual components to whatever parent you want?

opaque forge
#

Can you do that?

#

Cause then I could spawn a duplicate mesh component which is parented to the FP arms

#

Also, will OwnerNoSee work if the camera is in the parent actor?

thin stratus
#

o.o duplicate mesh Components?

#

Just parent it to FP or TP based on the IsLocallyControlled or not

#

And disable the default Attachment Relication fwiw

opaque forge
#

That breaks spectating tho

thin stratus
#

Or override it and handle it manually

#

Then reparent it when the player starts spectating..

#

It's all local anyway. The same frame you handle the viewtarget change, you can just change the attachment fwiw

opaque forge
#

Fair

thin stratus
#

If you pack that into some functions that do all of that based on some "IsViewTarget" or so logic, you can probably automize the whole stuff

#

UpdateWeaponAttachment -> IsValid(Weapon) -> IsViewTarget -> Attach to FP Mesh

#
    /** Called when this actor becomes the given PlayerController's ViewTarget. Triggers the Blueprint event K2_OnBecomeViewTarget. */
    ENGINE_API virtual void BecomeViewTarget( class APlayerController* PC );

    /** Called when this actor is no longer the given PlayerController's ViewTarget. Also triggers the Blueprint event K2_OnEndViewTarget. */
    ENGINE_API virtual void EndViewTarget( class APlayerController* PC );

    /** Event called when this Actor becomes the view target for the given PlayerController. */
    UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnBecomeViewTarget", ScriptName="OnBecomeViewTarget", Keywords="Activate Camera"), Category=Actor)
    ENGINE_API void K2_OnBecomeViewTarget( class APlayerController* PC );

    /** Event called when this Actor is no longer the view target for the given PlayerController. */
    UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnEndViewTarget", ScriptName="OnEndViewTarget", Keywords="Deactivate Camera"), Category=Actor)
    ENGINE_API void K2_OnEndViewTarget( class APlayerController* PC );
#

That's base AActor functions

opaque forge
#

And that just checks if the controller is looking through the owning pawn's camera?

thin stratus
#

ViewTarget is a concept of its own

#

It's what actually defines where your Camera Location originates from

#

The CameraComponent is just an offset + extra camera settings fwiw

grave notch
#

Is there a way to set blendout time for montage preemptively, i need to do that for multiplayer replication, before stopping montage?

opaque forge
#

Cool thanks

#

Is there a way to get a callback when the view target changes?

thin stratus
#

I already posted the answer to that

opaque forge
#

Oh doi

thin stratus
#

Although, a generic one, I would need to check

opaque forge
#

For the player in particular

thin stratus
#

Then just the functions I posted above

opaque forge
#

I skimmed that and assumed it was a boolean check

#

thx

thin stratus
#

Generic there seems to be this FGameDelegates::Get().GetViewTargetChangedDelegate().Broadcast(PCOwner, OldViewTarget, NewTarget);

#

That's called in the same function as BecomeViewTarget

vivid seal
#

getting a lot of net corrections trying to use a root motion source for dashing (no GAS), with 1%pkt loss each way and 100ms. anyone know what I might've missed? I apply it locally, save off a flag into saved moves, then on the server apply it from the flag as well. it works most of the time but when i do get corrections they're pretty huge.

#

@thin stratus i saw a lot of messages from you a while ago having a similar issue (but using GAS), did you ever figure out how to avoid such violent corrections?

thin stratus
#

So start by putting that back to 0

vivid seal
#

i mean setting it to 0 i get basically no net corrections at all, but do i really want to not test the game with any packet loss?

thin stratus
#

And then it was mostly due to the following factors:

  • Start Location of the Character on Server and Client were not the same. We ended up sending the Server the Location we started the RMS with
  • End Location of the RMS on Server and Client were not the same. That was mostly due to using teh Start Location to calculate the End Location. And with the Start Location being not 100% the same, the End Location wasn't either
  • We had Latent Nodes that destroyed the Prediction Window in GAS, which we had to recreate. And then we had to additionally call "FlushServerMoves" on the CMC (had to be exposed to BPs for us) before the RMS
thin stratus
#

A totally smooth game?

vivid seal
#

no, some hiccups probably

#

but for this specifically it almost seemed like it was doubling the distance of the dash

thin stratus
#

Package Loss is the worst case. The only reason you want to debug that is to ensure you don't soft-lock the player

#

You can't really fix Package Loss. For Movement, some Systems send additional older Input Packages to the Server, but for the time the Server didn't get the Input Package, it will just assume you kept doing the same as last Frame.

#

That's all just Band-Aid fixes for something that isn't really solvable.

vivid seal
#

hmm, okay. well it works fine with no loss, just thought i should be testing with some

thin stratus
#

Despite if you literally lose the package that started the whole thing from a key press

#

Cause then the Server never dashed and teleports you back fwiw

#

The only thing package loss should do is cause correction in general

spice pebble
#

i only get 1 player controller in the editor when playing 2 standalone games. any ideas?

#

both connect to the same world and has 2 characters but 1 controller

#

seems to only give control to whoever is hosting

thin stratus
#

@spice pebble That wouldn't make any sense. Why do you think there is only one PlayerController?

spice pebble
#

because when i try to control the second character there is no movement despite using the same class. & The world outliner shows only one controller

thin stratus
#

PlayerControllers are not replicated to other Clients

spice pebble
#

the player controller isnt even there though

#

the NetMode is play as standalone

thin stratus
#

The Outline can be set to view different "worlds"

thin stratus
#

Your Outliner shows that it's currently displaying the Client - 1 World

#

Switch it over to the Server and you should see two PCs

spice pebble
#

i have set the net mode to listen as server and i still only have one

#

This is my joining code, could it be something to do with when i setup the local server

void ADLG_TemplateGameModeBase::BeginHostGame(bool IsLan)
{
    if(IsLan)
    {
        //String Manipulation to get map asset location, prevents Hard coded Values
        FString ServerLocation = "";
        ServerLocation = _FallbackMap.ToSoftObjectPath().ToString();
        ServerLocation.RemoveFromEnd("."+_FallbackMap.GetAssetName());
        GetWorld()->ServerTravel(ServerLocation + "?listen");
        GEngine->AddOnScreenDebugMessage(-1,5,FColor::Red,TEXT("SERVER HOSTED"));
    }
}

void ADLG_TemplateGameModeBase::EndHostedGame()
{
    //Exit All Players to Lobby Map and assign new host
}

void ADLG_TemplateGameModeBase::JoinGame(APlayerController* Player,bool IsLan)
{
    if(Player)
    {
        Player->ClientTravel(_MyLocalIP,TRAVEL_Absolute);
        GEngine->AddOnScreenDebugMessage(-1,5,FColor::Red,TEXT("Joining Game"));
    }
}
thin stratus
#

Or rather 0 in that case

spice pebble
#

ah i see, i do have both controllers, but one doesnt do anything when i select the viewport of it

#

and its the client character that doesnt move

thin stratus
#

There is only one PlayerController per Player

#

The Server has access to all

#

The Client only to its own

#

You can't see more than one PlayerController in the Outliner of a Client World

#

Unless you spawn local coop players fwiw

spice pebble
#

i see, thank you.

#

so i have mis identified my issue initially.
the issue is that both controllers possess their pawns. but one of them doesn't move.

#

(always the client)

#

when i try with 3 the two that are not hosting do not take input it seems

#

It appears that on the controller when BeginPlay is called and i set up the mapping context GetLocalPlayer() for all the joining controllers is NULL

lost inlet
#

well yeah... there's no local player for a remote player

spice pebble
#

so how should i be setting up player input for a controller if not local player

lost inlet
#

the server doesn't apply IMCs

#

the client willl

#

so BeginPlay is still appropriate, but the server doesn't need to do anything

spice pebble
#

i use that on the player controller, thats the only place i add mapping contexts, still the client doesnt have input

kindred oyster
#

Hey, another day another question, maybe someone has a idea or tip 🙂 I have an actor (harvestable) that drop items (actually its a fixed item) but I want to implement a "loot" table where I can set two or three items with a chance. I actually thought I can set it up with a map where i can list items and chance but maps aren't replicatable. Otherwise the Server Run the Loot Event so this data hasnt to be replicated right? Is a map legit for such stuff?

spice pebble
kindred widget
kindred oyster
#

Yeah that was my second thought on it, only the server need it

#

replication is not neccesary

gusty slate
#

I mean you're setting that data on the object itself, so it's static data

#

everyone will have it anyway, but like said, you would decide the outcome on the server and process the loot there

lost inlet
#

But on the client, getting the subsystem will be fine since there is a local player

spice pebble
lost inlet
#

then the problem is elsewhere. did you at least set a breakpoint on the AddMappingContext call?

spice pebble
#

it doesnt even get into the adding for the second controller because getting the local player is null

summer rivet
#

Is there a way to replicate only variables on an actor and not all of its other properties? I dont want the transform to be replicated to the clients i only want the variables to be replicated

lost inlet
#

and now it's suddenly in OnPossess?

#

which only happens on the server?

#

and if this is only needed for when a pawn is possessed, you might as well override SetupInputComponent on the pawn and just set the IMC there

spice pebble
#

i shall try it in setup then

lost inlet
#

override SetupInputComponent on the pawn

#

though I'm still not sure why you won't debug it

spice pebble
#

it already is overridden by default. do i need to do anything in the override

lost inlet
#

yes, since that's usually where you'd set your action bindings and IMC

spice pebble
#

control for a character should be on the player controller though, thats what my uni lecturer taught us???

#

we should just call functions on the character from the controller

lost inlet
#

lol why?

spice pebble
#

because the characters can be destroyed, player controller shouldnt be

lost inlet
#

yeah and?

#

binding in the pawn's SetupInputComponent is a pretty typical approach

spice pebble
#

ok, i will try to figure a way out with that then

peak wadi
#

got a potentially really dumb question, but here it goes

does the mesh simply not scale correctly for actors in UE5? Even though I've turned the bool for replication on for both the capsule and the mesh, the mesh displays correctly only for one client (but not the other)

#

I'm doing this mostly in c++, blueprint in the back is mostly for quick tests and debugs

lost inlet
#

this is such a common misconception with the replication of components

#

having a component marked as replicated does not mean it'll suddenly replicate every property

#

it'll only replicate properties marked as Replicated

#

and scale isn't one of them

peak wadi
#

I'm aware, I simply assumed it would replicate transform properties

lost inlet
#

you will need an alternative means to replicate the scale and then set the scale of the mesh from an OnRep

peak wadi
#

will do. Had to ask for scale specifically 'cause I found some info on the net, where Epic staff themselves said they might address this, but I couldn't find whether or not they did address this at any point

#

so figured I'd ask here as well as couple of other places

lost inlet
#

well it's a pretty simple solve, and replicated movement only does position, rotation, and velocity

peak wadi
#

ye

#

I just had to make sure I'm not doing something wrong, and that this is the intended behavior

rustic sable
#

is there any reason a collider won't attach to a mesh on the server, either post init or begin play

#

not sure if a timing issue or I'm messing smth else up

#

ah ok, didn't have 'always tick pose /update bones' thingy checked

dusk fable
#

-----------------quick request
is there a better way to handle when new player joins the lobby ? for now , players are moving in lobby , but whenever someone joins , they restart at their current position

#

basically i want when new player to join , others wont have to restart /refresh at their position

peak wadi
#

still a bit peeved that 2/3 transform components replicate with no proper indication that the scale wouldn't

summer rivet
#

@dusk fableyour adding the new player to your array, then making everyone in the array restart. Why not do all of that but instead of making everyone in the array restart, just the one person who joined?

#

If anyone has an idea of how to get around Actor Location automatically being replicated when set on the server let me know. I want the client to set the location of the local version, then do a server RPC to tell the listen server version to set itself and not replicate the GD location back to the client when the location is set. I need the actor to be replicated for the other variables on it, but I dont want the built in location replication to work

rigid steeple
#

Hi, I have a problem in working with multiplayer, I can not create an Actor on the server on behalf of the client. But from the server side, the client side Actor is created without any problem. I followed this video step by step https://www.youtube.com/watch?v=sZ0zSj3Z3aA&t=28s , but at 13:50 on the client side of the video on the server creates Actor, but I do not. The screenshots are my code and the game footage. On the top it says on whose behalf the screenshot was taken, and on the spheres it says by whom the sphere was created

Patreon: https://www.patreon.com/SneakyKittyGaming
Discord: https://discord.gg/W5g6pZXfjh

In this video we create the implementation of our theory and discussions from the previous 1.0 video with our projectile by learning more about and using a Server RPC!

▶ Play video
glad robin
rigid steeple
#

There's only logic for a single player game

#

The beginning of the function

glad robin
#

In the code you are checking if they do not have authority and if not you are calling ServerSpawn.
If they do have Authority you need to call run the spawning code I believe.

rigid steeple
#

All the multiplayer logic happens here, I also added Multicast RPC, but nothing has changed

glad robin
# rigid steeple All the multiplayer logic happens here, I also added Multicast RPC, but nothing ...

To test real quick, on phone so hard to read everything. So just going to run through very roughly what I think happening.

So first we have function:
AClass::SpawnShot(FVector Location)
{
blah blah blah spawn logic
}

Now we want to spawn stuff from the server so in the Fire we go
AClass::Fire()
{
if(HasAuthority())
SpawnShot(MuzzleLocation);
else
ServerSpawnShot(MuzzleLocation);
}

Then we have ServerRPC :
UFUNCTION(Server, Reliable)
AClass::ServerSpawnShot(FVector Location)
{
SpawnShot(Location);
}

So if they have Authority they can just run the spawn code normally. If they do not, then they use the ServerRPC to run the SpawnShot. I don't believe you need to multicast anything because we only want the spawning to happen on Server.

rigid steeple
#

I've done this before, but it doesn't work. I tried creating a new 1-person template project and completely repeat the script from the video there, but again it doesn't work.

glad robin
#

Share rest of Fire() aha. Just realized you posted more code but not the function I wanted lol

#

Let me check I know I've seen a github repo you could look at to check for difference, just have to see if I can find it.

glad robin
rigid steeple
#

By the way, we can only edit the _Implementation and _Validate functions in the .cpp file, right? The ServerShot function should remain only in the header file, we should just apply it, but not put logic into it?

#

void AWeapon::SpawnShot()
{
AActor* Sphere = GetWorld()->SpawnActor<AActor>(SpawningActor, GetActorLocation(), FRotator::ZeroRotator);
}

void AWeapon::ServerShot_Implementation(FVector MuzzleLocation)
{
SpawnShot();
}

#

void AWeapon::Shot()
{
if (HasAuthority())
SpawnShot();
else
ServerShot(MuzzleSocketLocation);
}

rigid steeple
glad robin
#

comment out the 'if(!HasAuthorty())' and just run ServerSpawn() no matter what. That's the only thing that looked off from what I saw. Multicast you don't want because client shouldn't/cant spawn so no point in running

rigid steeple
#

All the same, when creating an Actor from a client, neither the server nor other clients see it

#

There is another point, the created Actor from the client appears on the server in the list of objects in the Outliner, but it is not visible

glad robin
#

So the server is spawning it so it's running properly. Looking at the spawning you are just spawning it at the AWeapon's location so I believe should be fine.

I was kind of unsure about how you are setting replication currently. I think ideally you would have AProjectile class and in the constructor there set the bReplicate and bReplicateMovement or whatever they are true.

In yours you spawn the projectile (just AActor) and then set replicate true after it has been spawned. If I was on computer I could test but I think because Server spawns it setting its location and then it's toggled to replicate, that intial location spawning is never replicated as it happened before turned on.

rigid steeple
#

As an object that will spawn, I just have an Actor blueprint, inside which an ordinary sphere is a primitive. Replicates is already installed in the Blueprint settings

glad robin
#

Hmm I got then. If it's showing in the outliner and you can double click and view it, it exists and is spawning properly so I'd just go review the logic on the location and you'll prob find the issue

rigid steeple
#

It would make sense that it moves to zero coordinates, but it's not there)

glad robin
#

You are just spawning at the AWeapon location. Is it colliding with something and messing up the spawn. Theres a settting somewhere, SpawnCollisionHandlingMethod or something

rigid steeple
#

If I don't use GetActorLocation(), but enter just any coordinates on the level - nothing will spawn there either..

#

The client shows that it's there, but the server shows nothing

#

Other clients have nothing, either

lucid badger
#

Is it all right for RPC to happen kind of a lot? hmm Server needs to know client pawn's Z rotation, which for some reason rotation is not automatically syncing up from client to server on CMC the way position does hmm I could RPC it up but it would need to happen like multiple times per second...

rigid steeple
#

Doesn't work

#

The client has spawned the sphere, he has it, the server and other clients do not have it, the Outliner has it
I put the cube on the level myself before the start of the game

lucid badger
#

Client can't spawn things for anyone but themselves. Need to ask the server to spawn it, is my understanding.

rigid steeple
#

Yes, that's how it works for me, the client contacts the server and it creates a cube

#

void AWeapon::ServerShot_Implementation(FVector MuzzleLocation)
{
SpawnShot();
}

#

🤕

lucid badger
#

From searching this channel it sounds very much like CMC is supposed to handle syncing of rotation from client->server/others

#

What am I doing wrong I wonder hmm settings are pretty close to stock

#

Oh I have to turn it off and on to use it with Orient Rotation to Movement Hmmge

#

Ah yeah that's it

sinful tree
rigid steeple
dark parcel
thin stratus
#

Oh, chat didn't scroll

#

:D nvm

twin juniper
#

Hi, got a doubt there, I should be AutonomousProxy of an actor on my local client only if I own it right ? Otherwise I'm the simulated proxy ?

chrome bay
#

AutonomousProxy is usually reserved for things you possess, not own

twin juniper
chrome bay
#

Usually Pawn yeah

#

You can own something but it may not be an autonomous proxy

twin juniper
#

Literally just learned it rn after 4y of working with mp stuff lol, always thought you was Autonomous on your local version of the actor

twin juniper
#

Thanks !

chrome bay
#

The roles are more like what "control" you have over that actor but the rules aren't as clearly defined really. IIRC by default it's only your pawn the engine sets your role for

nova wasp
#

Is there a simple way to force atomicity with two replicated properties that isn't just merging them into one struct?

#

I suppose you could have a pair of onreps wait for both values to show up (ugh) but man

chrome bay
#

yeah struct with NetSerialize() is the only way

nova wasp
#

it would be nice if I could bully unreal into considering two members one atomic thing

#

maybe with Iris member descriptors but... yeah I would rather just make a giant struct lol

thin stratus
mystic estuary
#

Hello, does anyone have experience with VOIP talker? I'm trying to use it, but it doesn't seem to do anything. That's what I have in my character begin play. I don't get any warning/error in the log. I'm using Redpoint EOS for backend, I don't know whether it matters though. I tried it in PIE standalone with two different EOS accounts, I don't know whether trying it in packaged version would change anything

ember vine
#

anyone smoothed out autonomous proxy client corrections before ? sadly calling smooth correction is only for simulated

thin stratus
lime echo
#

Lag comp question: For a server-side rewind system, what do you think from your experience should work better?

  1. Rewinding based on ping/synced network clock.
  2. Client sends ID of the UCharacterMovementComponent move he's currently performing predictively and IDs of the two moves the character he hit is interpolating between on his local screen, and then the server can find those moves and rewind to them.
    Option 2 seems more promising but I've barely heard people talk about it so just wanna discuss this with you.
    And btw the ID I thought of in option 2 is the TimeStamp that the UCharacterMovementComponent already sends to the server (for simulated proxies a custom ID might be needed).
solar stirrup
#

I use the GMC which gives access to the simulated proxy current simulation timestamp

#

So whenever I do hitreg, when the client hits something I have it send the target's simulated timestamp along the hit info to the server

#

That way the server can just rewind the target to that timestamp (within reason)

lime echo
#

Nice, so you're going with option 2?

#

Does it work well for you?

solar stirrup
#

Yep! I generally add a margin of error that's allowed

#

If you wanna go for cheap checks, you could use bounding boxes

lime echo
#

That's really cool. And you're saying I have timestamps by default I can use also for simulated proxies?

solar stirrup
#

I use the General Movement Component which does

#

I'm unsure if the CMC provides something similar

lime echo
#

Yeah I'll check it out cause it is quite crucial. And I guess you're considering simulated proxy interpolation right?

ember vine
#

@thin stratus it smoothes simulated proxy corrections but not autonomous, with autonomous it just teleports u to correct

solar stirrup
#

It provides that, a simple rewind to timestamp function, buffering simulatedd proxy moves

lime echo
#

My problem is that currently everything's in theory for me. I'm not even sure how critical the interpolation might be. So currently I just assume it's mandatory and without accounting for it in the rewind, the rewind wouldn't work.

thin stratus
ember vine
#

is there some setting for that ? coz i tried messing with them and doesnt seem to affect the local client

thin stratus
#

There are settings on the CMC to control how it behaves, but you should not teleport with default settings either

ember vine
#

ClientAdjustPosition_Implementation just calls SetWorldLocation

thin stratus
#

Yeah cause the Capsule will be teleported

#

That's normal

#

The Mesh will be smoothed though

ember vine
#

thats the behaviour i get for sim proxies, but with autonomous it teleports for me even on a blank project Thonk sec lemme grav a bid

lime echo
#

Is the smoothing just linear interpolation between the 2 last moves from the server?

ember vine
#

there's exponential as well

#

it's handled in SmoothCorrection in the cmc

lime echo
#

Thanks I'll check that out

ember vine
#

average my ass but still

#

i cant seem to find anything to smooth out the corrections for auto prox

#

im fairly certain its teleporting the mesh as well or its just not smooth enough

thin stratus
#

Hm, guess I'm too spoiled by Mover

#

Was pretty sure CMC does that too

ember vine
#

yea i was hoping i could just override ClientAdjustPosition_Implementation and call SmoothCorrection like whats done with the simulated proxies but there are some asserts in there that kick off, plus it doesnt anyway

#

so ig im gonna have to spend some time figuring out the internals abit more so i can smooth the correction over a few frames while it runs the rest of the auto prox logic

#

was hoping someone would have done this before and documented it but i couldnt seem to find anything

#

such an ugly default behaviour

ember vine
#

also very tempting to just go for GMC but really expensive

ashen plume
#

And yes there is zero documentation or runtime examples

honest bloom
#

Any place where to start in order to learn how to solve latency / bandwidth issues in networking for a beginner ?

#

unreal docs seem not to contain nearly not even enough information about the networking debugger

honest bloom
# dark parcel define the issues first?

Well, I used what I learned about RPCs and Replication initially to make my game networked correctly.
Now, I'm not so happy with how smoothly the player is replicating really, and my assumption is that it has smth to do with networking optimisation in term of latency and bandwidth.
Now, I'm not nearly as enough versed into how those 2 things work or just how optimizing the networking part works .. so I'm seeking resources to understand what are the common causes to such things .. how to do actual simulation of multiplayer on pc .. cause the stuttering when using 2 different devices is much bigger compared to launching the game in listen server mode on the same pc .. which is normal.

dark parcel
#

I've no idea what your issue is, stuttering could happend because of reasons.

If your character anim is stuttering in packaged game. Try to look at this

#multiplayer message

#

Anyway gonna sleep gl

honest bloom
#

Well yeah I don't know that much about networking to explain my issue to you nor to myself.

But thx for pointing me at a direction at least.

Have a good night Sir 🙂

lament flax
#

So what does all of that really do ?

meager spade
#

you can read the comments in the class

#

or where they are used, too much to explain

lament flax
#

Okay thanks

ember vine
#

@ashen plume does that mean lyra has an example of smoothing the autonomos proxy correction by replicating acceleration ?

sterile aurora
#

tyler ahoy

echo snow
#

Where can I store data relevant to the player across all multiplayer sessions?

Like the player character cosmetics

lament flax
#

regarding COND_OwnerOnly
i've been recently confused on what the actor's owner truly is
is it only the server or any client connection ?

little pumice
#

listen server is out of equation

snow trail
#

is there a way to know who owns an actor? printing the owner just prints a blank string

little pumice
tall drum
#

Hey
I am trying to obtain the Hit result from the Get Hit Result Under Cursor for Objects function.
I can retrieve it without problem with my client-server however, for my client, even if the function is fired on server side, it doesn't return any value
Any idea?

When I was debugging, both actor component pass the Is Server condition. Also, I can see the execution line in runtime and it does pass well the condition

little pumice
#

first of all listen server is a special case it's both server and client at the same time, second true Server(dedicated) has no mouse cursor, it's client-side thing

tall drum
#

I am only on Listen-server, I am not doing dedicated

little pumice
#

for second player it's kinda the same as dedicated

#

I guess you have to grab hit result on client and feed it to some of the ASC function

#

which replicates/transfer to server things for you

tall drum
#

What is ASC function?

little pumice
#

ability system component

tall drum
#

do you mean RPC ?

lavish sierra
#

hi , I have a question , how to make the client and the server both own the actor ?

little pumice
#

unless you create local only non-networked entity

lavish sierra
#

ok ? but if I set the owner of the actor to the client will the server still replicate it ?

little pumice
#

replication can work for any client, not only owner unless specifc setup llike COND_OwnerOnly

little pumice
lavish sierra
tall drum
little pumice
#

each requires specific setup

snow trail
#

hello, does anyone have a clue about what could be an optimal way of replicating lots of turrets for a game like a tower defense? my idea was to have the turrets do everything locally, but only the server can actually apply the damage, and while that would work it would cause visual desyncs and differences which isnt very optimal... if anyone has any ideas, please let me know

little pumice
#

how many is lots?

tall drum
#

However, I am not sure to understand something..
On listen-server, server has all the player controllers. It should be able to retrieve mouse cursor for each client, am I wrong?

snow trail
little pumice
little pumice
regal grail
#

Has anyone ever done client side predictive actor spawning + client side targetting hit results (/w server validation)? (e.g. for a projectile)
I have it mostly working but am reconsidering the entire design/approach.
My current approach fully encapulates all the logic in the projectile itself. Client spawned gets reconciled with the server replicated one.
But I'm considering dropping and having some kind of secondary world subsystem for reconciling it later. But I feel like every approach is littered with edgecases :/ I guess that's multiplayer for you

little pumice
#

also check for smaller count e.g. 10-20 maybe it's setup issue

snow trail
tall drum
little pumice
#

I think 200 is doable, though UE isn't very suited for RTS-like games with bunch of entities

little pumice
#

you have to send extra stuff manually

tall drum
#

mh, I see!
Is it by experience you know that?

#

or was it written somewhere on a documentation?

little pumice
#

Well PlayerController itself may be fine, the thing is that its function just communicates with another "system" which is obviously client-specific

#

e.g. viewport

lavish sierra
little pumice
tall drum
little pumice
#

so maybe start with reading docs and exploring examples

#

replicated props is a "Server -> Client" thing. To send stuff in the opposite diirection use RPCs (client -> server)

lavish sierra
little pumice
#

don't forget that RPC should be used from "net owning" client

crisp shard
#

kinda semi panicking on this one, but i basdcially attempted a bunch ofthings and now my project is seeemingly unopenable and i've tried rebuilding it but it fails due to plugin issues, etc.

im planning to take a recent backup of the project in 5.3 and then using that to then migrate specific assets i need to a fresh project in 5.4

are there going to be any issues im missing w this when it comes to the migration? of course, plugin stuff, but other than that, can you just migrate stuff from 1 project in 1 engine version to another project with a different engine version

#

perhaps wrong channel to ask

rose turret
#

what's the best way these days to serialize a float or FVector and quantize it a little? I see SerializePackedVector but maybe Iris has some better library methods for that now?

snow trail
#

hello again, ive noticed the player state of a pawn isnt immediately valid on BeginPlay. is there an event i can call when it becomes valid? on Possessed? receive restarted?

rose turret
snow trail
rose turret
amber mesa
#

I'm getting alot of unreachable code when building DebugGameServer!

1>[1/696] Compile [x64] Module.ChaosCloth.cpp
1>E:\Projects\GithubClones\UnrealEngine\Engine\Plugins\ChaosCloth\Source\ChaosCloth\Private\ChaosCloth\ChaosClothingSimulationSolver.cpp(1400): error C4702: unreachable code
1>   while compiling Chaos::FClothingSimulationSolver::GetWindVelocityAndPressureField
1>[2/696] Compile [x64] Module.ChaosCaching.cpp
1>E:\Projects\GithubClones\UnrealEngine\Engine\Plugins\Experimental\ChaosCaching\Source\ChaosCaching\Private\Chaos\ChaosCache.cpp(374): error C4702: unreachable code
1>   while compiling UChaosCache::FlushPendingFrames
1>[3/696] Compile [x64] Module.ChaosNiagara.cpp
1>E:\Projects\GithubClones\UnrealEngine\Engine\Plugins\Experimental\ChaosNiagara\Source\ChaosNiagara\Private\NiagaraDataInterfaceChaosDestruction.cpp(2490): error C4702: unreachable code
1>   while compiling UNiagaraDataInterfaceChaosDestruction::PerInstanceTick
1>[4/696] Compile [x64] Module.Chaos.20.cpp
1>E:\Projects\GithubClones\UnrealEngine\Engine\Source\Runtime\Experimental\Chaos\Private\GeometryCollection\GeometryCollectionConvexUtility.cpp(484): error C4702: unreachable code
1>   while compiling ``anonymous namespace'::CreateNonoverlappingConvexHulls'::`2'::<lambda_4>::operator()
1>[5/696] Compile [x64] SharedPCH.Engine.Project.NonOptimized.ValApi.Cpp20.cpp
1>[6/696] Compile [x64] Module.Chaos.2.cpp
1>E:\Projects\GithubClones\UnrealEngine\Engine\Source\Runtime\Experimental\Chaos\Private\Chaos\ChaosDebugDraw.cpp(1048): error C4702: unreachable code
1>   while compiling Chaos::DebugDraw::GetFirstConcreteShapeType
1>E:\Projects\GithubClones\UnrealEngine\Engine\Source\Runtime\Experimental\Chaos\Private\Chaos\ChaosDebugDraw.cpp(1062): error C4702: unreachable code
1>   while compiling Chaos::DebugDraw::GetFirstConcreteShapeType```
Any what is the possible cause of this
latent heart
#

Don't build from source. Or use a stable version of the source.

amber mesa
#

kk

opaque forge
#

Does the character movement component automatically replicate movement speed updates to the client?

quasi tide
#

No

lavish sierra
#

hi how to do RPCs from player controller ?

#

or is it even possible ?

lost inlet
#

why wouldn't it be possible

#

it's a pretty common thing to do

#

and since the player owns the player controller, it usually just works. player controllers generally won't multicast because that makes no sense

lavish sierra
lost inlet
#

???

regal geyser
#

How should a server authoritative system for bomb planting work?

Let's say that you start planting a bomb, you start animation, you see a progress bar, when the progress bar is at 100, you plant the bomb. Now, to make it responsible as much as possible, you probably don't wait for the server to allow you to start the planting process, but instead you immediately start the animation, fill the progress bar locally and then when you want to plan the bomb, you tell the server to plant it, thus it's replicated everywhere and it's server authoritative. But this would allow the cheating client to just tell the server to plant the bomb immediately, without any animation and progress bar. Is there any "win win" general approach for this type of issue, or all alternatives have their pros and cons? As for example making the progress bar being replicated and server authoritative, so you just tell the server to "start the planting process" and "stop the planting process".

lavish sierra
# lost inlet ???

I mean like the RPC does something so will this thing be replicated to the server ?

lost inlet
#

I'm not sure you fully know what an RPC is, as there's 3 types. If it's running on the server from input on the client, then anything you want the client to know about has to be replicated back to them either through replicated properties or another RPC.

lavish sierra
#

and thats how I call it

lost inlet
#

you don't use multicasts on a player controller, they're only relevant to one connection anyway (the client the PC relates to)

lavish sierra
#

so how to make it relevant to other connection ?

rose turret
lavish sierra
#

how to do that exactlly ?

little pumice
lavish sierra
#

so I am trying every day to get any help to just finish it 🥲

little pumice
lost inlet
#

like the player state

lavish sierra
#

or game state?

little pumice
#

you can trigger RPC in player controller from begin play (with a delay node for convenience)

#

HasAuthority node can help you trigger code on client or server

compact flame
#

How do I get this replicated?

lost inlet
#

animation generally doesn't

compact flame
#

There has got to be a way though

sinful tree
#

You replicate through the owning actor.

#

You have the animation blueprint read the values from its owning actor.

lost inlet
#

you replicate state that allows the animation to match on the client

#

so in this case, you'd have to replicate the "look at" position so other clients know about it

compact flame
compact flame
lost inlet
#

well you implemented this as a multicast for some reason?

#

so each client (and the server) will just compute its own camerahitlocation anyway

compact flame
#

Multicast is the only way I thought It may work

lost inlet
#

why would it? that's kinda not how a multicast works anyway

compact flame
#

Multicast runs to server

#

Then server gets executed

lost inlet
#

multicast runs on server and all relevant clients

#

so the relevant client running this code will just overwrite the replicated variable, though sometimes the server copy might overwrite it, that order really isn't guaranteed and is based on server framerate anyway

compact flame
#

So should I just feed the code to tick instead of all these custom events?

#

Well that half worked

lost inlet
#

the server OR the client could compute the "camera hit location". if it's the client, it sends it to the server which then replicates it to others (though I don't think you can do COND_SkipOwner in BP)

compact flame
#

lol

lost inlet
#

if it's the server, the server is just setting the replicated value with no RPCs

compact flame
#

Right

#

Its replicateing but it very jittery

dark parcel
#

Prob fighting each other

#

Or server don't update fast enough, and it couldnt

#

For movement you always interpolate to the new value

dark parcel
cyan bane
#

Is there a delegate I can attach to as a client that will notify when all server actors have been spawned on the client on join? Because I’m having an issue with getallactorsofclass returning nothing on clients that join mid game as the actors haven’t all spawned yet.

hollow eagle
#

there is no way to know that

dark parcel
hollow eagle
#

you cannot know when "all" actors have finished spawning and replicating, there can always be more.

#

you can build your own system for knowing how many to expect, however

dark parcel
#

Ahh yeah I see, I thought it's just about spawning some number of specific actors

hollow eagle
#

the server would have to replicate the number of actors you should have, and you'd have to check against that. There are other ways too but it generally comes down to that.

#

but there's no generic way to know when you're "done" receiving replicated actors because there is no such thing as done, as soon as you receive the last one you might already be missing a newly spawned one.

cyan bane
#

Ah darn. Guess I’m gotta refactor.

eternal dune
#

Got a weird problem. I have an inventory component attached to the PlayerState object. It, of course, is replicated. I am using RepNotifies with log statements in them so that I can see log messages when replication occurs. When I pick up an item I do see the count of items in the inventory going up. But then when I try to print a dump of the inventory contents I get that there are zero items in the inventory. If I pick up a second item, the inventory count goes up to 2, but still the dump says I have 0 items. I have no idea why this is. I've attached two BP images. The first is the code for picking up an item, and the second is the code for printing the item dump header showing the number of items.

#

Any ideas would be greatly appreciated as this has me stumped so far.

#

The only thing I can think of is that the PlayerState is being gotten from different sources for some reason. In the first screenshot, that is code on the Box item that I am picking up. I get the PlayerState associated with the interaction event's InstigatingPawn, which should be the player.
In the second screenshot, that is code on the actor that is the player pawn.
So I should be getting the same PlayerState in both BPs, but maybe I'm not?

#

Oh, and the interaction code in the first screenshot runs on the server, while the inventory dump code runs on the client.

warm sparrow
#

i want the server sided code in the gamestate to retrieve the player choice from the playerstate using this interface

#

but i want the player choice to be only stored locally right until the server requests it

#

im drawing blank on how to make that happen

opaque forge
#

Actually, what would happen if it attached to something that wasn't replicated. I'm thinking a non-replicated "weapon attachment" component that changes its own parent depending on the context.

modern kindle
#

Hey guys, how should the client properly exit the dedicated server? I use the Quit Game node, but I noticed that sometimes the server doesn't receive the client's exit message, causing the client to black screen when reconnecting to the server.

sinful tree
warm sparrow
sinful tree
warm sparrow
sinful tree
warm sparrow
#

yes its inside a component in the playerstate

sinful tree
#

Yep, then that'll do it.

warm sparrow
#

alright thanks!

sudden dock
#

I am getting an error in my Output log that says, "LogUdpMessaging: Display: Added local interface '192.16x.x.xx' to multicast group '2xx.0.0.1:6666' LogUdpMessaging: Warning: UDP messaging encountered an error. Auto repair routine started for reinitialization". Does anyone know what I can do to resolve that?

weary tapir
#

hey guys, so i have this event thats called every 0.01 seconds when placing a building in my game. i want the distance from the player to the building to be variable depending on where the player looks. The weird thing is, that the lerp node you see on the bottom only replicates to the server, but not to the clients. does anyone have an idea as to why that is?

woeful ferry
crisp shard
latent heart
#

When I say a stable version, I mean not the latest from git, but the version from a release tag like 5 4.

crisp shard
latent heart
#

What version of the engine are you using?

#

Like what did you get from git?

thin stratus
# opaque forge How can you actually do that? Can you un-replicate something that's replicated i...

Actors have a replicated Property for Attachment. That's why you can't split what it attaches to by default, since the Server's choice will override the local client.

You'd need C++ for that. Either disable the whole property from replicating (via DOREPLIFETIME macros, there are some that can disable replication of parent properties), or by overriding OnRep_AttachmentInfo (I atually don't know what the exact name is, but I'm sure you will find it) and doing custom stuff.

thin stratus
#

I would see that more as a bug than a wanted result

crisp shard
# latent heart Like what did you get from git?

no, this was all done on 5.3.2.. i just was attempting to solve issues and bascially just kept making things worse, so keep going back and now attempting to migrate things from 5.3.2 to 5.4.3

latent heart
#

So not a source build?

crisp shard
#

i get this error sometimes that tells me to "try compiling from source"

#

or "build from source" etc

#

that's where that term / phrase has been mainly implanted in my mind and i usually associate that w any type of build in an IDE but im also very limited in this side of thigns

quiet fjord
#

Guys, I have a problem in a multiplayer mechanic when it comes to assigning clothes to my players when they have their respective pawns. It turns out that as the graphic quality increases, the characters sometimes do not appear and I get an error in the skeletal mesh of my players.

#

Is there a trick to smoothly assign the change of clothes to my players?

thin stratus
#

That often happens if you primarly work in IDEs and compile only for DebugGame, and then suddenly decide to open the Editor via UProject file, which needs the Dev Binaries

crisp shard
zealous knoll
#

ey @thin stratus do you have your compendium updated in pdf? I have 4 hours flight soon🥲

#

because I dont know how to download the website made in React js etc

thin stratus
#

Sadly not, no

zealous knoll
#

im about to build from source 5.3, is it problematic this red minus symbol?it says "Ignored"

#

I downloaded from github 53. then double click Setup.bat
then I double click GenerateProjectFiles.bat
following this tutorial https://youtu.be/jFe37SviLk8?t=325

In this video, we'll walk through the process of building the Unreal Engine from source. We'll cover everything from setting up the development environment to compiling the engine and creating a custom build. Whether you're a developer looking to contribute to the Unreal Engine project or just interested in the inner workings of one of the most ...

▶ Play video
crisp shard
#

Failed to load /Game/MAiBLUEPRINTS/CHARACTER/BLUEPRiNTS_2D/2DCHARACTER/NEWSPRITE_CHAR/ANIM/ABP_NEWSPRITE.ABP_NEWSPRITE_C Referenced by Animation

i get this error when loading in but everything w this asset works fine in the editor and nothing isn't properly referenced that is being used. is there a way to solve this error? or maybe something im missing?

meager spade
#

hole crap do i see caps abuse here lol

#

and random lowercase i

woeful ferry
crisp shard
crisp shard
woeful ferry
#

and very much so

crisp shard
#

🤣

#

i love it, but yes the caps were before i realized the error in my ways

#

or should i say... MAi ways

woeful ferry
#

you do you

crisp shard
#

my man

meager spade
#

tutorial to build ue from source o_0 w/e next haha

#

but just build it

#

not sure what "ignored" means

#

but if it builds it builds

zealous knoll
#

Ok maybe is some plugin of VS

errant swallow
grizzled stirrup
#

In general is it preferable to call fewer RPCs with heavier amounts of data than it is to call more RPCs with light amounts of data each?

For example a shotgun blast could create 16 different damage events each happening within 0.1 seconds of each other.

In a client auth game (PVE) where the client has authority over damage, would it be smarter to batch damage events into a single array that then gets sent via a single RPC every 0.05 seconds (if there is something to send) rather than sending 16 different damage events each with their own RPC?

#

I should note that these have to be reliable RPCs (pretty much the only mandatory reliable RPC in the game)

hollow eagle
#

batching will almost always be more efficient but you're paying for it with a lack of responsiveness for other players.

#

it's not really worth it for that purpose

grizzled stirrup
#

Ideally the result will feel pretty much identical but with far less RPC overhead, can even re-use my damage struct so instead of sending separate ones and separate RPCs I can just add damage to the batched struct if hitting the same person multiple times

kindred widget
#

AFAIK usually batching is only worth it per frame. EG shotguns. are the most common case.

grizzled stirrup
#

Unfortunately can't quite do it per frame in this case as even the shotguns have projectile travel time but it's possible to have many damage events in a short space of time (but not neccessarily the same frame) depending on upgrades

#

It will be an interesting experiment anyway

chrome bay
#

May as well batch all the hits that occur in the same game frame at least

#

That's probably the most common case even if you have travel time.

woeful trout
#

hey i want to make this replicated but i already have all the variables replicated and all of the characters and components and actors can someone help me please!

grizzled stirrup
# chrome bay May as well batch all the hits that occur in the same game frame at least

yeah makes sense! Just with extreme cases with like 100s of projectiles dealing damage in short spaces of time I do wonder if just having a local func called 30 times a second that will send an RPC if BatchArray.Num() > 0 could feel very similar but be much more efficient because no matter what, a max of 30 RPCs will be sent rather than potentially 100s more if you have unlucky situations where loads of shots are hitting on slightly different frames

#

It's PvE with no real limits on player power so RPC count starts becoming the bottleneck on long games. An interesting problem to think about though

wanton bear
#

i mean if you dont need to try and anti-cheat, you could just use a random stream with initial seeds matching, then you dont need to send anything except check total damage every once in a while

grizzled stirrup
#

In this case the bottleneck is just the player delivering damage info to the server via reliable RPC, everything else doesn't really need to match and is unreliable. Just basically reducing that one reliable RPC count is the goal

#

I think the batching will work nicely though

wanton bear
#

if its only damage idk if i would bother sending 30 times a second, you dont need 30 corrections per second if they dont match up?

grizzled stirrup
#

Well in the case of damage it needs to feel quite responsive so if sending even 10 times a second the percieved responsiveness could start being noticeably delayed randomly (depending on the shot) but still 30 times is still hugely lower than some of my current profiled worst cases where like 2K RPCs get sent in a short timeframe 😄

#

But yes even 10 could work, will find the magic number of responsiveness and efficiency

wanton bear
#

wait are you making the player wait for a response from the server to apply any damage on their side

grizzled stirrup
#

Yes server still needs to have authority over health, it's just that player is allowed decide how much damage is dealt

#

It works fine it just needs to be sent regularly just not quite every single damage event as an RPC on the same frame as I have it now

wanton bear
#

if youre looking for responsiveness you usually do whatever the client does on their machine, send data to the server, the server checks it then either sends back a response saying yes or no and then the client either continues or has to rewind whatever action just happened like taking health

grizzled stirrup
#

Would this include things like health bars and such? The way I have it now works fine (client waits for server before getting damage confirmation, seeing enemy healthbar go down etc.) and doesn't have to rewind but it's interesting to think about doing even more prediction locally

wanton bear
#

have you tried doing a ping simulation?

grizzled stirrup
#

Yes of course, it works fine in practice even on really bad pings like NA to AUS

chrome bay
#

The problem with prediction is you also have to be able to roll them back and notify clients when they failed to predict correctly. Predicting damage is pointless IMO since it's not like the client can kill the object anyway, so you're getting some latency regardless.

grizzled stirrup
#

And feeling cheated

#

I believe an older call of duty game used to do this and you'd get damage feedbaack locally which lead to really frustraating fights

#

Where you'd deal way more than enough damage but it was actually faked

wanton bear
#

isnt the idea to make sure it almost never predicts incorrectly

#

unless theyre cheating

chrome bay
#

yeah but GL;HF doing that

grizzled stirrup
#

Well at the end of the day in this case waiting for the server to report back is completely acceptable in most cases, it's just trying to optimize what the client is sending the sever to prevent crazy amounts of RPCs is the goal which I think batching should nicely solve

#

Anyway thank you for the help gents!

woeful trout
meager spade
#

what would cause replication to not happen between server and clients

#

i cant find anything obvious on why its not replicating

kindred widget
#

Back on the character thing? 😄

meager spade
#

yeah @kindred widget

peak lintel
#

Hello. I have a flying AI and I want to follow some points, so I have to use Set Actor Rotation and Set Actor Location, but the AI is very jittery when it's moving. What I'm doing wrong here? Thank you 🙏

woeful trout
meager spade
#

well i know for a fact its not calling ServerMovePacked

peak lintel
woeful trout
# peak lintel Can you please explain?

Hello guys, in this quick and simple tutorial we are going to learn how to move a character along a spline in Unreal Engine 5!
↪️Join my Discord Server, NOW: https://bit.ly/GorkaGamesYouTubeDiscordServer

Check out my Steam Game! https://bit.ly/3rVlXU1
Follow me on Twitter: https://twitter.com/GorkaGames
Follow me on Instagram: https://bit.ly/In...

▶ Play video
#

if i understand correctly

peak lintel
#

I also need to follow the client in some conditions. I don't need a pattern

glad robin
#

I have a weaker understanding of networking so this may be dumb question but: UI doesn't run on Server, I know that. But with a UserWidget, is this running on the Server? I originally thought yes, but I didn't know if there was something else, like while yeah, ListenServer there is still some separation from the Player/User and the Server part.

woeful trout
peak lintel
#

Yes (this also), beside the roaming to random points.

#

Showed the example, for a simplified explanation

woeful trout
peak lintel
#

I can't use simple move to location, because it's a flying actor.

kindred widget
# glad robin I have a weaker understanding of networking so this may be dumb question but: UI...

UI is entirely local to a player. It should have no concept of "The server". It reads current gameplay state on that machine. This is regardless of whether it is a Client or Listenserver.

For example you have an ammo counter widget to display ammo used/left. You have an ammo variable in your character or a component on the character. The widget gets the character/component and binds callbacks to listen for when that value is changed, or polls it each frame.

Your net code replicates the ammo value on the character/component alone, nothing to do with the UI.

When the net code affects the ammo value on the character/component, the UI updates itself.

peak lintel
#

Multiplayer

woeful trout
#

on ais settings

peak lintel
#

Yes, it's a child of a character actor.

#

The character actor is used for the clients, so it's working as expected, since I'm using the movement component (built in replication)

glad robin
woeful trout
kindred widget
glad robin
#

Ah ok I get it (:

woeful trout
kindred widget
#

Don't multicast quests.

woeful trout
peak lintel
woeful trout
woeful trout
kindred widget
woeful trout
#

yes to so you the problem start to the quest log

#

its replicated but not in log

kindred widget
#

In general. When you're learning networking. Don't multicast. For any reason. 97% of the time, you want to replicate things and use OnReps, not multicast.

woeful trout
#

thats the problem actually

kindred widget
#

you want to replicate things and use OnReps, not multicast

woeful trout
latent heart
#

Depends on the thing, but multicast is rarely the right call.

woeful trout
latent heart
#

Yes

woeful trout
lost inlet
#

such a weird question

latent heart
#

I have a generally good understanding of how replication works, yes.

woeful trout
#

i dont think so cause the real problem is the quest goes only to the serever and not on client

latent heart
#

I haven't read about your problem. Just making a comment about multicast.

woeful trout
#

if you can help me 🙏

woeful trout
#

does anyone know a replicated quest system??

glad robin
#

May be a bit of a stretch because I was handling this wrong and others may not but for 5.4 users, did anyone else notice an increase in issues with Client input while having input setup in their character's BeginPlay()?

I was previously calling AddInputMappingContext() in my character's BeginPlay() and I had an issue when testing maybe every 25 plays. After changing to 5.4 the issue was pretty much every other run haha.

I fixed the issue with the ReceiveControllerChangedDelegate, but I was still curious if anyone else noticed something, or the increase was more so my machine haha.

lament owl
#

Hi ! I have a question about Inventory System.
I'm making Item-Drop function at inventory in Multiplayer.
Inventory is TArray<UItemInstance*> (UObject, already Replicated).
Item drop be triggered in Client-side DragDropOperation.
but when I was about to implement drop, I'v realized that ItemInstance in TArray need to be removed at Middle-Index using ServerRPC.
I think removing at Middle Index is not cheap in server-side (maybe O(N)).

can anyone advice to me in terms of Data structure or Server-side Logic?
I don't know that either choice TMap instead, or removing at Middle Index can be tolerated in Server.

limber gyro
#

I have a character that when placed in the map works fine (it moves), but when i spawn it dynamicly in game it doesnt work( doesnt move), im doing the movement like this GetCharacterMovement()->AddInputVector(finalDirection) in flying mode

#

what am i missing here?

limber gyro
#

found the solution, so apparently when you spawn a character it doesnt come with a controller and you have to do "spawnedEnemy->SpawnDefaultController();"

lament owl
ashen plume
#

anyone have thoughts on how i would server authorize a "hold to interact"?

kindred widget
# lament owl Hi ! I have a question about Inventory System. I'm making Item-Drop function at ...

You have an item object. Which should be a replicated uobject. You don't need to care about indexes. And you shouldn't care about them. If you need to remove it from the array, it should be as easy as calling remove with the object pointer. The array shouldn't care if it's reordered. Gameplay logic at least shouldn't care about the array order and when you put it in UI you should be sorting and filtering the objects anyhow.

unique epoch
#

Hi, Im making a multiplayer game with a dedicated server. I normally built my server and launched it and I can perfectly connect to it. When I implement Advanced Sessions Plugin for steam I cant connect to my server it gives a PreLogin failure: incompatible_unique_net_id. How can I fix this can anyone help me? Thanks.

limber gyro
#

whats happening here is that you are trying to connect to a steam server through an IP connection

#

and so it doesnt let you, you have 2 options as far as i know, you can extend your game mode class and override prelogin and pass an empty net ID

#

OR

#

you can connect through a steam id

#

it goes something like open steam.23123123131312

#

now that begs the question, how would you get that 12312313123 number from steam?

#

you need to implement one thin from the steam SDK, i think its a function called "pingServer" if i am not mistaken.

#

Then you can ping whatever server you want to connect to and it will give you the steam ID in the response and you can connect using that

thin stratus
#

The SteamPing stuff was something I got told isn't even needed. But I don't know the alternative.

lament owl
kindred widget
#

Handling UObjects you don't really destroy them. You mark them as garbage. So to remove the item from the inventory you would need to call remove on the array of UInventoryItems with the UInventoryItem you want to remove. This removes it from the array. Then you need to remove it from the replicated subobjects. This stops it from replicating to clients. Then you need to mark the UObject garbage.

#
void UInventoryComponent::RemoveItemFromInventory(UInventoryItem* ItemToRemove, bool BroadcastChange)
{
    if (IsValid(ItemToRemove))
    {
        RemoveReplicatedSubObject(ItemToRemove);
        InventoryItems.Remove(ItemToRemove);
        ItemToRemove->MarkAsGarbage();
        if (BroadcastChange)
        {
            OnInventoryUpdated.Broadcast();
        }
    }
}```
#

For example

lament owl
#

yes... I think my question brought misunderstanding.
What i'm curious about is removeAt() operation's time cost. when I remove element in TArray in server, it's expensive except last index.
because of successive memory allocation.

kindred widget
#

It's an array of pointers so it shouldn't be that costly. And if it's an issue you can just RemoveSwap. Which will only invalidate one pointer.

lament owl
#

Oh. thanks. it's a good option.
and.. I searched about RemoveSwap, I think TArray isn't completely with std::vector.
it's enough UE Document to learn TArray's low-level feature ?

kindred widget
#

I'm unsure. I've never personally used the standard library stuff.

lament owl
#

I'm gonna read about engine code.
Thanks for reply !

compact flame
#

Im using a spring arm and I attached a static mesh to it for weapon sway but it does not seem to be working for muliplayer can someone tell me on to how I get it working on there?

limber gyro
night crater
#

Can I do a multiplayer game with blueprint?
Also, is it not good to make the user as host if game 3 vs 3

kindred widget
night crater
#

it is competitive

kindred widget
#

Then you should not make a player the host regardless of game size. Even if it's a solo player.

night crater
#

Thanks so much

quaint tendon
#

Is it possible to have a non-replicated character in a multiplayer game that ticks only on the client? i.e. have npcs that only the client sees. I'm trying to set it up but the character movement component and gravity never activates when running on a client connected to a dedicated server, even if everything in the npc character is not replicated. Seems like the server locks any character unless it's replicated.

Seems like the CharacterMovementComponent locks the character if there's a dedicated server.

little pumice
#

I would look into replicated character which is "net relevant" only for owner

vivid seal
#

If I change two properties in a replicated struct on the server in the same frame, can the client receive those two changes at different times?

#

basically can the client ever be in a state where he has a wrong value for one field but the right one for the other field, if they're set at the same time on the server

little pumice
vivid seal
#

neat thanks

sinful tree
quaint tendon
#

They aren't characters really, they are for tutorial purposes and I wanted to eliminate any potential for server corrections by making them client side authoritative. A correction in the middle of a tutorial will make complicated game mechanics even more confusing.

Which is why I ended up creating an Actor BP that doesn't have the CMC. Considered just using video screens to give tutorial info but that really breaks the immersion.

warm sparrow
#

i was using onpostlogin in gamemode to assign playerstate player numbers and do some other stuff but it doesnt work reliably because it is called way earlier than the initialization of the playerstate. If I have the playerstate let the gamestate know that it is initialized then potentially have the serverside gamestate relay that to the gamemode why shouldnt i rather just move all the logic in the gamemode into gamestate to avoid the extra work? I probably have misconceptions about how i am supposed to use the gamemode. What kind of stuff do people usually do inside the gamemode class? Because i cant find a good use for it other than maybe storing information such as how long each round should last etc

fossil spoke
#

Things like, timelimit, scorelimit, team makeup etc etc

#

Are usually governed by the GameMode.

#

The GameState is the current state of the game.

#

The Current Time

#

The Current Score

#

The Current Team makeup

#

The GameMode describes the boundaries of a match.

#

The GameState is the current state within those boundaries

warm sparrow
#

i see. So gamemode mostly has variables that hold information that is like the rule set?

#

Or for example gamestate might ask gamemode: there is one player alive remaining, should we declare him the winner now etc. That kind of stuff?

fossil spoke
#

Sure

#

Another example might be that a rule is "teams must always be balanced", therefore as Players login, the GameMode decides what Team they belong to.

#

Since its executing that rule of ensuring balanced teams

#

The line can get blurred with more complex use cases.

#

But this is generally a good way to think of the difference between the 2 classes for new users.

warm sparrow
#

ok thanks

floral sail
#

Is it just me or character movement started to jitter all of a sudden? I swear it didn't just 2 days before, now it does. I don't understand whether its something wrong with my net or Spacewars server.

twin juniper
#

Hi guys, a question, I have a function that spawns an actor on the server side (it's a run on server event). The thing is that it spawns an actor depending on the number of players on the server, for example if there are 2 clients it spawns 3 actors (2 from the clients and 1 from the server), what can I do so that it only spawns one?

#

Hey guys, is there any guide about making a prediction system or just predicting a variable? I haven't seen any guide or general information anywhere. So it is just trial and error?
The only guidance i got are those 6 lines from GameplayPrediction.h

waxen tartan
#

Spaceship is a pawn and drop pod is a pawn, do other people have issues with attachment of pawns in vehicles?

#

It also only happens on clients.

fossil spoke
fossil spoke
twin juniper
#

It can't be that simple..?

fossil spoke
#

The Client running a change that its assuming the Server will run as well.

#

The reason you Predict, is to give immediate feedback to the Player.

#

That does not mean you want to then go and try and predict every action.

#

You want to predict as little as you can get away with.

#

To give the Player the illusion of responsiveness.

#

While maintaining Server Authority

#

(Thats the correction/miss prediction reconciliation part)

cerulean karma
#

Hi, i'm just getting started on multiplayer and i'm trying to have a variable replicate to the clients on my pawn. I have this variable on my pawn, it is set to replicate on RepNotify, and when i update the variable i can see that it triggers the function, however it seems to be triggering on the server instead of the client. I've checked this by checking if the instance has authority inside the OnRep function and it does:

#

I'm running in editor, with only one player in client mode. I'm at a loss right now.

fossil spoke
#

In this case, its calling it for the Dedicated Server and the Client

#

(Since you have 1 Client, its creating a Dedicated Server in the background)

#

(Clients are always connected to some kind of Server)

cerulean karma
#

It doesn't seem to ever get called without authority though, for example here my debug object is the pawn on the Client, and the path below never gets triggered:

#

if i switch to the server as the debug object i get to the breakpoint in the top, but the bottom one is never triggered

fossil spoke
#

What are you trying to Replicate?

#

You maybe trying to Replicate something that doesnt support Replication

twin juniper
fossil spoke
cerulean karma
#

Ah that might be it, it's a reference to an object of a class i created, but yes i did not att the Replicates to the macro in class cpp here

twin juniper
#

Bruh i have been sitting in this server/channel forever of course i got c++

cerulean karma
#

So it is not the same as if i enable it here in the editor?

fossil spoke
#

If you are runtime generating "GridData" as DataAssets, they wont replicate out of the box.

cerulean karma
#

ok, so if i'm understanding correctly i would need to add ReplicatedUsing=OnRep_CurrentCell to my CellDataAsset, then implement that function on my cpp file

#

or can it be an empty function then overriden in the blueprint editor?

fossil spoke
#

No, you are not understanding what I am saying.

#

Lets start from scratch.

#

What are you trying to do exactly?

cerulean karma
#

I have a grid actor which has a 2darray of these cell objects which cover my entire level, and each of one has a value.
I'm initializing the grid with some values and updating them in the server, and i want to replicate the value of the cell a player is on whenever they move from one cell to the next.

#

This initialization process happens on BeginPlay for the actor i've placed in my level

fossil spoke
#

Ok well you probably want to replicate the Cell ID instead.

#

And let the Client do a Lookup with that ID

#

For the actual Cell Data

cerulean karma
#

Ok, yes that would work, but wouldn't that mean that the client needs to have also a copy of all the values in the grid if i want to do this lookup locally?

fossil spoke
#

Well I would have thought that the Client would have already loaded Cells locally.

cerulean karma
#

No right now the grid is only initialized on the server, the clients have no data related to it. I could initialize the grid on the clients as well, but because it uses random values to generate it the values won't match between clients and the server

#

So what I'm trying to do is initialize once on the server, then replicate to the clients. My thought process though was that i didn't need to replicate the whole grid, but only the cell the player is on at a time

fossil spoke
#

Generally speaking, most systems like this will take a Seed value, which then dictates the deterministic generation of the grid data.

#

That way, the Seed can be replicated and Server and Clients can generate the same data.

#

If you only need the "current" cell data, then just create a struct that contains the limited information you need about that Cell Data and replicate that.

cerulean karma
#

I see. that raises another question because the values on the grid's cell can change depending on the actions of the players or the Ai. so if the values are constantly changing I need to keep that syncronized, and it's not changes that could happen deterministically

fossil spoke
cerulean karma
#

Sorry i sent before i was done writing

fossil spoke
#

Oh you edited the message

cerulean karma
#

Yes, sorry

#

I think i might be going too far into the deep end without understanding the basics, i'll read more on replication and maybe do some tutorials unrelated to my case first

fossil spoke
#

Well if the cells data changes, just send that change down to the client again?

cerulean karma
#

Ok, i'll give that a try, i'll start with generating the grid from a seed and then move with trying to replicate the value once it changes.

#

I appreciate the guidance!

fossil spoke
#

👍

cerulean karma
#

It works! Thank you so much for the help. to test i initialized my grid with 0s on both client and server, and then added a value on the server to the cell at the player’s position.
I created a struct that contains the id and the value, and replicated that.
I could kiss you right now 😗

#

Tomorrow i'll untangle my spaghetti blueprints but for now i'm off to bed. Thanks again!

coarse sky
regal grail
# coarse sky I kind of need some predictive actor spawning (not projectiles). You care to sha...
  • you spawn actor client side
  • save it to a list somewhere (e.g. static array or some subsystem or whatever)
    • This list is for local client spawned actors only.
  • in beginplay you check if you are a Role_SimulatedProxy (server replicated actor)
    • if you are, you can compare against client spawned actors, either via some ID, or whatever mechanism you need on how to match up the actors, lots of choices on how to do this. e.g. UnrealTournament compares location to match. In my instance it doesn't really matter, I assume its mostly in same order.
    • Then update appropriate values on either client or server actor. You can hide/destroy 1 of them and modify the values of the other one. In case of UT example they delete/hide client, but in my case I hide/delete the server replicated one
modest crater
#

It will be cool one day, Star Citizen is a tech demo more than a game 😆

lost inlet
#

More meme than game

tame kraken
#

Hello, can someone help me with the proper command to servertravel to another level as absolute?
I try adding ?absolute to the end after the level name but it's not working, as indicated by strange things happening like the widgets not appearing and characters falling from the earth

random prism
#

servertravel MapName?listen

#

if ur using the server travel bp node just do
MapName?listen

tame kraken
random prism
#

can you take a screenshot your blueprint setup for the travel?

tame kraken
#

I'm using the execute console command because I don't know how to specify the game mode with the Advanced Sessions node:

random prism
#

wouldnt the game mode just be whatever the levels gamemode is?

tame kraken
#

I want to change it, similar to how we can change it with the regular travel.

I just want to know why it's not being absolute first 😅

random prism
#
Epic Developer Community Forums

That would mean duplicating huge amounts of built lighting data (unless you can tell the duplicated levels to use existing data which I don’t think you can). I figured it out, the command was simple: you just add ?Game=(path and proper game mode BP name). The problem was wrong specified asset name format. Correct one is: GameMode_BP.GameMode_B...

#

this should help

lost inlet
#

also you can use gamemode aliases to make the ?Game parameter less complicated

tame kraken
lost inlet
#

"eventually"? it's just a project setting

#

so you can write ?Game=DM instead of ?Game=/Game/GameMode/Blueprint/BP_Gamemode_DM.BP_Gamemode_DM_C

tame kraken
#

I mean eventually because the solution doesn't hinge on this semantic change

violet sentinel
#

usually write helper that builds url from level path and game mode path (and map<string,string> of custom params)

random prism
#

can someone help me figure out why my door replication isnt working properly? when the server opens the door it opens correctly and replicates to the clients, when a client opens a door, it doesnt open. heres my door blueprint with comments i put from debugging

little pumice
#

Well, I guess it's more about "seamless travel" experience rather than huge battles. Single PC performance is still a bottleneck. For example EA Battlefield series has same goal (huge player amount) yet still supports 64x64 or 128x128 (less likely). Maybe if in a perfect world where every Player has powerful PC and broad connection and Devs would't reduce costs on servers (poor tickrate, not high end machines, or even multiple game-server instance on a single PC) then we would reach bigger Player counts copium

tardy fossil
#

tribes 1 could do 64 player servers "decently" back in the 56k days

soft relic
random prism
#

called by the server to multicast

soft relic
#

to interact is called on all?

#

if so, add a Switch Has Authority on the door's interact event, so only the server can set this

#

Second, you can just have one timeline rather than two, and simply Play/Reverse based on Open/Close

#

Then your server can basically Multicast what the door should do (open/close and the direction to do that to). Dont rep notify that because you are replicating 2 values, there's no guarantee one will be replicated before the other

#

so instead use a multicast and set the variables, the variables can still replicate with a rep condition Initial Only, for taking care of the door state for late joiners

random prism
soft relic
#

probably good for the client to pass what to interact with to the server and then multicast it

#

id start by checking whether your Interact event is called at all

soft relic
#

right

twin juniper
#

imagine we gonna go to mars and our server not getting 1000 people

random prism
#

ive been trying to fix this for days

#

should i pass the player ref through the server as well?

soft relic
#

nope

#

since its always the actor calling the interact event, self is fine

random prism
#

for the switch has autority its supposed to be like this right?

soft relic
#

right

random prism
#

you also said i should move all the direction and stuff to the multicast?

soft relic
#

ideally the multicast can pass that data so its passed at the same frame and calls the right function

random prism
#

ok did that

#

also i dont know what you mean by use a rep condition initial

#

for the rep notify

soft relic
#

That is for late joining but can get quite complex, Id say make sure this works as of now

random prism
#

it mostly works theres just a small issue where if the door is opened and then closed from one side of the door the clsoing anim flips, but the other side it works fine, and on the server it looks normal

soft relic
#

yeah thats why multicasting instead of doing this on rep is better, it could be the value not being set before the anim plays

random prism
#

this is the only variable i rep notified, the other one was just replicated

quick yacht
#

Question for yall, I'm going over some ideas for my game and one that I really like is multiplayer, I'm indie so can't really afford large servers. Do you need servers for combat multiplayer games that are primarily 1v1, or at most 2v2?

lost inlet
#

well you can do listen servers, but that will inherently have host advantage if you're doing something reasonably competitive

random prism
quick yacht
#

So if you want a competitve experience with no inherent advantages, the only solution would be servers?

soft relic
#

Yeah, peer to peer means the host is the server, so he technically has authority over everything and can hack into the game

quick yacht
#

Makes sense, so this would be good for coop experiences, but not for anything competitive

#

thanks!

random prism
crisp shard
#

is getting charged for a static ip address by my interent provider normaL?

quasi tide
#

UE doesn't support peer to peer out of the box

soft relic
#

I guess im more referring to the Create Session/Join Session functionality

quasi tide
#

It is an often misunderstood thing

soft relic
#

Where the host is the server

quasi tide
#

There are no servers in peer to peer

#

UE only supports something being a server

soft relic
#

Right, I do see it often being referred to as P2P though

quasi tide
#

Yes. People often say the wrong thing because they don't know any better.

#

People think it just means "one person connects to another person"

crisp shard
quasi tide
#

Can't really say. Depends on region and all that. In my area, business accounts get static ip address by default.

crisp shard
#

makes sense. i was baffled they said it was 5 bucks extra a month for one, when i thought it was just seomthing you could setup on any home internet

lost inlet
#

being charged for a static IP on a consumer ISP is relatively normal, if they even give you the option at all

solar stirrup
#

^

#

Look into dyndns as an alternative

crisp shard
#

iim just getting into to setting up servers and not sure if i'd even want my computer/ home to be the static ip address used, but i also don't know the long term play for setting something up that i can handle personally

gray sparrow
#

hey can i set in construiption script of controller my team variable? for every controller?

magic furnace
#

Hey, I am so confused, in my replay using the built in replay system my pitch inputs are not registered, only yaw? The character shows all the inputs, plays the animations for them in any replication scenario, just not when viewed in replay. I am so lost as to why this may be. Only idea I have is that my aim offset is not replicated in my linked anim graph. That shouldn't matter though as it still displays correctly for all the other users.
Edit: My AimOffset Y indeed stays at 0, curious

vernal nest
#

Hey, guys. I'm wandering what's the best practice to call a delegate within server rpc from a client.

As I understand it correctly, to make it work, I need to bound every single player character in the game to the delegate so it's kinda complicated to manage since players can login and logout during the match.

Is there any better solution to this?

thin stratus
magic furnace
thin stratus
thin stratus
magic furnace
vernal nest
# thin stratus > I'm wandering what's the best practice to call a delegate within server rpc fr...

I have a spawner actor (in game mode) which spawning items in the world and my characters use a delegate to spawn items in the world through it (I did it to avoid storing all information about the spawning actors within my character class). Everything works fine until I try to spawn an actor from a client, my delegate just doesn't work, because it's bound only with player controlled character.

magic furnace
#

now it's getting hilarious, best I take a video, just used GetBaseAimRotation

vernal nest
#

So I'm thinking how I can make it pretty

thin stratus
#

BaseAimRotation uses a replicated pitch value for non-autonomous proxy fwiw

thin stratus
magic furnace
thin stratus
magic furnace
#

only for the other players tho, not the user controlling the character

thin stratus
#

Yeah the user controlling the Character uses Control Pitch

#

Shouldnt really be different though

magic furnace
#

it is a massive difference, let me show you lmao

vernal nest
thin stratus
#

What does the Interface do here?

#

You are just slapping random stuff onto your spawner :D

#

What are you spawning anyway?

vernal nest
#

Pickable items 🙂

thin stratus
#

Like, dropping them from an Inventory or enemies that die?

vernal nest
#

When I drop those from the inventory of my characters

thin stratus
#

Then just handle that in your InventoryComponent

#

Or whatever has your Inventory

#

ServerRPC -> SpawnDroppedActor

vernal nest
#

So then my inventorycomponent will have to store all the items in the game? Isn't it bad performance-wise?

thin stratus
#

Why would it need to store all the items in the game? Your Inventory can't really drop an item it doesn't have, or?

magic furnace
vernal nest
#

My items are uobjects and pickables are aactors

thin stratus
vernal nest
#

So my inventory now only operates with uobjects

thin stratus
#

And then use the AssetManager to handle the DataAssets fwiw

#

If you drop an item you can tell the Server what Slot the Item got dropped from and it can spawn the actor with the data

#

There is no need for your Inventory to know more than that specific Item that is being dropped

#
  • whatever other items are in the inventory of course
vernal nest
#

Yes, so my inventory then will need information about pickables, I was trying to avoid it, because it seemed better for performance, isn't it?

gray sparrow
#

THIS PLUGIN reads on game start the contrllers and there team variable

#

but how can i set team variable before game start?

thin stratus
#

So what's so bad about having a reference to one single class that you fill with the UObject

#

You are overcomplicating stuff for some unknown gain of performance that you don't even know you need