#multiplayer

1 messages · Page 89 of 1

quartz iris
#

I think I did something wrong

cursive steeple
#

Yeah :x

#

What you had in the pic will never work cz increasin the int is locked behind a condition (them being alive)

#

Which makes no sense

#

Thats why im sayin first increase the integer, without conditions

quartz iris
#

I was thinking the player thats alive would have the games won variable increased though?

#

Rather than the player thats dead has a death count variable

cursive steeple
quartz iris
#

How can I do this?

cursive steeple
#

Well you surely know which player died when someone dies right?

quartz iris
#

I need to know the alive player

cursive steeple
#

You also know who killed them no? The one dealing dmg.

quartz iris
#

To call the win widget for the alive one

#

Good point

#

But say

#

What if the other player died to the level

cursive steeple
#

Is it always 1v1?

quartz iris
#

Yea

cursive steeple
#

Then take the one thats not the dead one

#

With only 2 players youre right, cz iterating doesnt make a difference and can still be optimal

quartz iris
#

How can I do it with code tho

#

Cus what I did just doesnt work

cursive steeple
#

Cz you had the order wrong, individually the code parts you had are good

#
  1. player dies
  2. check player array and see who's alive, for those increment the integer
  3. check if anyone has won overall
quartz iris
#

Is this not what I did?

#

Sorry if I missed something

#

If I were to get that variable in the widget is this correct?

#

I think if you were to show me it would help

#

When you can

cursive steeple
quartz iris
#

Thank you : )

cursive steeple
wooden abyss
#

Quick question regarding Seamless Travel and Transition Maps. Does the Transition Map have to have the same GameMode/PlayerController/etc configured to actually work or can it be completely blank?

#

Like this? Or do I need to set the same GameMode/etc as the Level im transitioning from/to?

dark edge
#

why would player state 0 be local player?

#

player state 0 is the first player to join the game

quartz iris
sinful tree
#

Get owning player of the widget, get playerstate from that.

sinful tree
#

Casting isn't getting.

#

From the owning player, get the player state, then you can cast to your custom playerstate.

quartz iris
#

Ah got it

twin juniper
#

I have this session created and working properly but on joining server the pawn is not spawned and the game freezes. So, GameMode wouldn't itself spawn a new pawn for client on joining session and I do have to manually spawn pawn on client right?

twin juniper
grand tree
#

if you don't define a struct's NetSerialize function, where does the default netserialize functionality come from? edit: found the same question #multiplayer message

#

reason im asking is bc i need to write a netserializer for a custom target data struct that contains another struct and i'm not sure what to call to serialize that

echo bough
#

how do you usually handle server destroying the projectile before the client projectile actually hits something? I wanted to play particle on hits

quiet fjord
#

Guys, I'm running a gamelift aws server and when I choose a larger c4 server I get this problem Current limit of instance type of c4.xlarge have been reached.

#

Does anyone know how to fix it?

latent heart
#

Buy more instances of large servers?

quiet fjord
#

I have informed myself and I have increased the quota but I tried it again and it still does not work for me

latent heart
#

Maybe ask gamelift?!

quiet fjord
#

what do you mean by gamelift this is what gamelift uses to set up dedicated servers using the ec2 service

#

The problem is that I can only use c4.large and with this the server gives me problems since it prevents me from migrating data for clients

latent heart
#

Erm, sorry, ask amazon.

dark edge
#

set it to some state and set its lifetime

tight crow
#

Can anyone see why this would work for both client and server when server runs the code, but when client runs it, it only effects the clients side?

dark edge
#

Repnotify my dude

tight crow
#

lol ok, ill look into that then

#

thank you

dark edge
#

Here's how things work with repnotify

Client action -> run on server event
Run on server event -> set replicated variable (you'd set bIsLightOn)

EVERYWHERE -> runs the RepNotify function when the variable changes (this is where you'd set visibility)

tight crow
#

so your telling me.. that ive been doing this whole server to client / multicast, and all i have to do.. Is use a has authority switch, and just set the variables to change to repnotify?

dark edge
#

hell you can probably do it clientside too and get some janky "prediction" out of it

#

Input -> toggle light bool -> also request server to toggle light bool

Onrep_LightBool -> change the things that depend on lightbool

Not sure what will happen but you might just get an instant light

tight crow
dark edge
#

You already have an object to interact with

tight crow
#

yea, im confused af

dark edge
#

do you have an interaction interface or component or base class?

#

Are you trying to do general interaction? Get close to thing, press E , have it do the thing?

tight crow
#

im using an interact interface

dark edge
#

what

#

oh interface

#

ok

#

so just do this

#

Input -> run on server event (pass over ObjectToInteractWith)
Run on Server Event -> call Interact on ObjectToInteractWith

#

that's it

tight crow
#

i interact with object, it brings up a Widget, i pass the info for the specific object when clicked, then run the code i showed

#

ok, so i still use the server replicated custom event, yea?

#

just not the multicast

dark edge
#

You need one run on server event to tell the server stuff

#

don't multicast anything rn

tight crow
#

correct

dark edge
#

Just tell the server the actor you want to interact with

dark edge
tight crow
#

that is in the widget, yes

dark edge
#

Show a screenshot of the widget so we can know what you're actually doing and what it looks like

#

in game, in the world

tight crow
#

right now, its just this

#

when you press interact, that switch on string event runs

echo bough
#

is there a reason why in the listen server, the animation of character will get choppier the higher the latency is to the client?

dark edge
# tight crow

Each object only has 1 thing it does in response to interaction right?

tight crow
#

yea, i have a public variable that is set to one of those cases ie. Light Teddybear, Teelvision, etc

dark edge
#

delete all that case stuff

#

its no good

#

Since you have an interact interface, each item does whatever it does on interact

dark edge
# tight crow

This is for nearby object right? So CycleObjects changes which object is "targetted" and Interact does the interaction, right?

tight crow
#

are you free to VC for a few minutes so I can share screen and show you?

dark edge
#

I'm at work on a phone lol

tight crow
#

i may not explain correctly

dark edge
#

I'm guessing CycleObjects cycles through nearby interactable objects

tight crow
#

you can possess objects basically.

#

yea, it cycles all interactable objects

dark edge
#

since widgets are not replicated, it'll have to go like this

#

ButtonPushed -> call event on Pawn or PlayerController (whichever one makes more sense), passing in the object you want to interact with

Pawn/PlayerController
Event from widget -> call ServerInteract(passing in object you want to interact with)

ServerInteract -> call Interact on passed in object

Object
InteractFunction -> do the thing

#

Widget tells Pawn/PC tells serverside Pawn/PC tells the item that it's getting interacted with

tight crow
#

so basically i have to put the code inside the actual object, not in tis widget

dark edge
#

the code for what

#

for what it does when interacted with?

tight crow
#

yes

dark edge
#

yup

tight crow
#

lmaoo i didnt realize widgets didnt replicate

dark edge
#

the widget doesn't care, it just tells it its being interacted with

tight crow
#

it was werid that it worked for server, but not for client

dark edge
#

Or rather, it tells the pawn which tells the SERVER version of the pawn which tells the item

dark edge
tight crow
#

so that multicast, because it was in a widget, was ONLY running if it was the server running the code

dark edge
#

the server is pretty much playing a single player game

tight crow
#

well you just cleared a lot up for me. thank you very much

dark edge
#

Your setup is a bit more complex than most peoples as you have UI involved

tight crow
#

i like to make stuff hard for myself apparently hahah

dark edge
#

But at the end of the day, it pretty much looks like this

Something tells the serverside version of itself (run on server event) that it wants to interact with a certain actor (passes over an actor ref)
Serverside version calls Interaction interface on the passed over actor
Actor does its thing.

#

You just have to have the widget tell the local version of the pawn/pc to kick it off

tight crow
#

that makes a lot of sense after you explained it

dark edge
#

Put that Venn diagram as your wallpaper

tight crow
#

I was so confidant in my abilities till i started multiplayer stuff lol

quiet fjord
#

Guys, a question with the new aws update, should I update my gamlift unreal sdk to connect to the fleets?

tight crow
#
  1. When you interact.
  2. Creates that widget, passing the info along,
  3. When you click the interact button.
  4. The code on the same blueprint that was interacted with (what you said to do? lol)
#

its just a stupid light haha i feel so dumb

thin stratus
#

Adriel told you to use the PlayerController or Pawn

#

You can't run server RPCs in random actors that aren't owned by the calling client

#

Read the Network compendium properly. It's all explained in there

tight crow
#

the code is in a pawn

thin stratus
#

The RunEvent?

tight crow
#

yes lol

thin stratus
#

In your own pawn?

#

The one that is possessed?

#

Cause only the owning local client can perform server rpcs in that

cosmic trail
#

Does it maybe make sense to try to create a local client AAIController for some level of movement/behavior prediction in a networked game?

tight crow
#

I made a pawn BP that acts as an interactable / possessable object. I take "control" of that object, then show a widget, that allows you to interact

thin stratus
tight crow
#

the code is within that Pawn, not my player

thin stratus
#

We meant your controlled player pawn

#

Not any that is randomly standing in the level :P

tight crow
#

HAHAHAHAHA

#

so, all server calls and such, should be within the player character

thin stratus
#

Widget Button Press -> GetOwningPlayer or GetOwningPlayerPawn -> ServerRPC with interactable obejct as param -> CallInteractEvent

#

Not all

#

But your are restricted by ownership

#

You can't call server rpcs in non client owned actors

tight crow
#

that would explain why the code wont run at all...

thin stratus
#

Pawn/Character (if locally controlled by the calling player) PlayerState and PlayedController are the basic ones that worl

#

Work

#

After that you have to ensure that any other actor is owned by the client

tight crow
#

ok, NOW i think i understand fully

#

Thank you for clearing that up

thin stratus
#

Ownership can also only be assigned by the server. So you can't just do that on the client either.

#

That's usually done when spawning replicated actors by giving it the PlayerController of a player as owner

#

Or on an already spawned actor by calling SetOwner

#

But again only server can do that

#

And only one owner per actor is possible

thin stratus
#

You can also use a different actor as owner than PlayerController as long as that actor is somewhere owned

#

So a chain works

dark edge
#

What is the actual game mechanic you're trying to do? Just explain it as a little story.

thin stratus
#

But again this stuff would be clear If you read the compendium

tight crow
dark edge
#

Tell a story.
The player does ?????????????? And ?????????????????? happens.

tight crow
dark edge
#

Ok so that's totally different from the typical interaction system.

#

Are you still the ghost the whole time or do you literally control and drive around the thing?

tight crow
#

you take control of the object, everytime. theres a camera that your view changes to per object

dark edge
#

Ok

tight crow
#

but only some will move, but thats not really important right now if i cant turn a light on and off haha

dark edge
#

So you really need the UI widget or would you rather just have controls do different things when in a prop, like how GTA you use the same controls to drive or walk

tight crow
#

id prefer the UI so that we can add other options as well

cosmic trail
# thin stratus Afaik CMC prediction only works for actually client controlled character

Yeah, trying to make prediction for server controlled (AI), it's AI controlled because all the units are RTS units so have their own logic to follow, while the user just issues commands. Wondering if it makes sense to create a local AAIController to do some of this prediction work for the client in this case. Or if there is some simpler solution. It would be a lot of work but trying to figure out the best approach

tight crow
#

if theres something i SHOULDNT be doing thats making this rough to do, i can adjust, but i figured this would be okay to do this way

dark edge
#

The big thing that possession changes is the fact that you are directly controlling the possessed thing

#

Where before I said you had to route your request through your pawn

#

The object IS your pawn

#

So you can just do a direct run on server event within the thing

tight crow
#

did you see the picture i sent?

#

is that what you mean? cause thats inside the possessed objet already

dark edge
#

Are you going to make a widget bp per pawn BP?

#

How does the widget know what actions are available

tight crow
#

no, its the same widget

#

that switch on string controls the code to run

dark edge
#

No don't do that

tight crow
#

in the level, when i add an instance of the object, I change the string to one of those cases

dark edge
#

Nooooooo

tight crow
#

in this case, i have a light, i call it "light" and it runs only that code when interacted on the UI

dark edge
#

Nah

tight crow
#

i changed that to repnotify, but clearly its wrong lol

dark edge
#

Ok how many actions do you want to support

tight crow
#

like, how many unique objects essentially?

#

right now, im just trying to interact, and change what happens when interacted, based on which object it is. Like for all the lights, itll just control a point light to turn on and off

#

im mainly tryin gto make placeholder code that works, that we can copy / paste and adjust, you know?

dark edge
#

Ok the first main decision to be made is whether or not you're going to actually use possession

tight crow
#

well, the main reason i was possessing everyone, was to use the camera inside the object

#

so you can watch what happens around the object,

dark edge
#

You don't need to possess to do that

tight crow
#

think of like a prop hunt game i guess?

dark edge
#

Can some props walk?

tight crow
#

yes

#

exactly

dark edge
#

What I'm getting at, is doesn't make sense for all props to have a single base class? All of them.

tight crow
#

technically, its a parent, so i can absouletly determine if it needs possession or not instead of doing it this way

#

cause your right, they dont ALL need it, i just thought you had to to use its camera

dark edge
#

It gets tricky because you fundamentally have two categories of objects. Those that can walk around, and those that can't.

tight crow
#

i can deff set a public bool, and switch between UIs or w.e but id assume this way SHOULD work

#

i dont know a whole lot about multiplayer lol obbbbviously, but logically, it makes sense haha

dark edge
#

I'm thinking your base class should just store a text variable which is what is displayed by the ui. I should just have a do-action event which is what is called by the UI

#

Don't switch on strings or whatever, that's gross.

tight crow
#

I mean, i can make a child for each unique object, and run the code directl y within each?

#

in my mind, im thinking that i can then just set code in each seperately, and pass along that specific object instance when interacted with, then run the code for that object itself from the UI 'interact event'? but i feel like itd be basically the same as im doing now, just minus the switch

twin juniper
#

It says there is no game in session to join but joins successfully?

twin juniper
tender spruce
#

Hey everyone, hoping to get some assistance on an issue I've been trying to fix the last few days. I'm thinking it might be a fundamental lack of understanding but after so much time it might be best to get another opinion.

I'm trying to test my multiplayer game in UE PIE with one player as the listen server. In the character's PossessedBy() function I'm calling a CreateHUD() function from my player controller.

In CreateHUD() I'm calling the native function of GetHUD() from APlayerController::GetHUD(). The player on the listen server immediately gets a nullptr for this function. The clients do not return null.

Can anyone help me understand what I'm missing?

kindred widget
kindred widget
#

Ah. My bad, the GetHUD, not the controller is null.

#

That's odd. All AHUD spawning should be done before the player is given a pawn according to GameMode code.

tender spruce
#

Yeah, I've been stuck on this one for a while. PossessedBy function below if it would provide any additional clarity.

void APABaseCharacter::PossessedBy(AController* NewController)
{
    Super::PossessedBy(NewController);

    // Player State
    ABaseCharacterPlayerState* PS = GetPlayerState<ABaseCharacterPlayerState>();

    if (PS)
    {
        // Set the ASC on the Server. Clients do this in OnRep_PlayerState()
        AbilitySystemComponent = Cast<UPAAbilitySystemComponent>(PS->GetAbilitySystemComponent());
        PS->GetAbilitySystemComponent()->InitAbilityActorInfo(PS, this);
        AbilitySystemComponent->SetAvatarActor(this);
        AddCharacterAbilities();

        // Set the AttributeSet for convience attribute functions
        AttributeSet = PS->GetAttributeSetBase();


        // If we handle players disconnecting and rejoining in the future, we'll have to change this so that possession from rejoining doesn't reset attributes.
        // For now assume possession = spawn/respawn.
        InitializeAttributes();

        // Set HUD
        APABasePlayerController* PC = Cast<APABasePlayerController>(GetController());
        if (PC)
        {
            PC->DisplayControllerID();
            UE_LOG(LogTemp, Warning, TEXT("Created %s"), *FString(__FUNCTION__));
            PC->CreateHUD();
        }
    }
}```

The first thing I do in CreateHUD is check if GetHUD() == nullptr:

```void APABasePlayerController::CreateHUD()
{
    if (GetHUD() == nullptr)
    {
        UE_LOG(LogTemp, Error, TEXT("GetHUD() returned null"));
    }```
kindred widget
nocturne quail
#

delegate auto replicates if called from a net multicast reliable event?

lunar radish
#

Does it matter how multiplayer is implemented? (Blueprints, or C++) pros and cons of each?

dark edge
kindred widget
# lunar radish Does it matter how multiplayer is implemented? (Blueprints, or C++) pros and con...

There are minor differences to each. EG stuff like in BP OnReps are also called from setting the value on the server. In C++ you have to explicitly call the OnRep or update function after setting the value. RPCs are mostly the same.

The major thing you'll find is that BP lacks a ton of tools that make a lot of networking better. You don't have FastArrays, prereplication conditions, custom serialization, replication graph, etc.

lunar radish
#

So for performance and optimization. I would want to go with c++. (Gotta go learn it then lol)

nocturne quail
#

from func1(); to func3(); will be called on every client by server?

Server_Reliable() { NetMulticastClientReliable();}

NetMulticastClientReliable(){func1();}

func1(){funct2();}

func2(){func3();}
tender spruce
# kindred widget I'd maybe breakpoint in the two places HUD is created in the controller and see ...

Hey, thanks so much for giving me your insight/opinion! It really helped me to rethink my approach. I think I was just all over the place and stuck in an abyss of frustration.

Overall, I set my HUD on the PlayerController within the BeginPlay() where GetHUD() did not return null. In research I saw lots of things saying the HUD is not replicated to the server which got me to thinking that I should be creating the HUD like I would in a single player game.

For the clients I did the same in OnRep_PlayerState() for the PlayerController and it seems to be working now. Honestly, I may need to research this portion more but I'm mostly just trying to learn GAS right now so trying to follow along with the documentation provided by tranek.

ebon zealot
#

I have a replicated UObject and i'm trying to call rpcs on it (client->server) it seems to call the implementation function on the client instead tho not the server

fathom aspen
#

Remove _Implemenation from the call

ebon zealot
#

the call doesnt involve Implementation

fathom aspen
fathom aspen
#

It can be called client-side only if you didn't really call the RPC

#

But the local version dispatched internally

ebon zealot
#

hm

#

I'll see if the stacktrace can give me more info

#

calling Server rpcs on the player controller works fine

#

It's probably an issue with replicating uobjects

#

stack trace looks completely different in the player controller vs the bugged object

quaint roost
#

How do I get all the player starts in a level?

nocturne quail
quaint roost
#

nvm it’s just GetActorsOfClads

#

Class

dark edge
spark pine
#

I'm working on a multiplayer game but my pawns get visually culled even though there is no max draw distance. It only happens when the pawn is possessed by a human controller. If the pawn is possessed by an AI controller or just placed on the map, it does not get culled. Does anyone know what the problem might be?

dark edge
#

they culled visually only or do they get yeeted out of existance / end play?

spark pine
# dark edge relevency distance?

The relevancy is set to default. They only get culled visually, if I shoot for example, that still work so the pawn is still on the map and replicating.

#

I'm testing it on a clean level, there is no cull distance volume on the map or anything like that. 🤔

quiet yarrow
#

Anyone know why my Physics enabled component does not spawn on client initially when the component is replicated? I found that I can get it to spawn by switching authority and setting simulate physics, but then the server it does not spawn...

fathom aspen
fathom aspen
ebon zealot
fathom aspen
#

Oh yeah replicates and owned by the client

queen escarp
#

Hey Guys needing Tips

so this is a projectile when overlapps do stuff everything works except it wont ignore the target when it has "Death" Tag it still Collides i excpet its due to the server counting an overlapp and the client also ?

#

any ideas on how to ignore targets with tag ?

sinful tree
queen escarp
#

:O:O:O

#

y enemy and terrain work

#

@sinful tree just realized im applying "death"

#

omggg

#

been at it for days xD

#

lets try

small grail
#

Make an interface for the characters has tags

queen escarp
#

or acctualy im aplyying "dead"

#

yeah but im keeping it simple for learning purpose

small grail
#

Is the tag right?

#

And I think the overlapping is on server side, is it?

queen escarp
#

yeah so the "dead" tag applies correctly

#

i think so yeah

sinful tree
#

Is it "dead" or "Dead" you're applying? Your logic is checking for "Dead".

queen escarp
#

its fiering "hello" when the brach checks for Dead

#

so its correct

small grail
#

Hello comes with checking dead exists or not?

queen escarp
#

exist

small grail
#

The video you posted is server or client?

queen escarp
#

playing from client

#

so its the server that respons

small grail
#

I'm not sure tag is replicated or not.

#

How do you add the tag?

queen escarp
#

but since the server can sense the tag since its printing shouldent it be replicated then ?

#

im applying on server

small grail
#

Yeah, but how is tags?

#

Is it replicated?

queen escarp
#

hmm

small grail
#

You may check is dead

#

instead of tag to see if it works.

queen escarp
#

thers no option to replicate :/ ?

#

ok ill check for that instead and se

small grail
#

It is the variable in Actor which is engine contents

queen escarp
#

oh right

#

yeah its replicated

twin juniper
#

Everything is replicating from server to client correctly, Just that Players cannot see each other. What can be the problem?

queen escarp
#

@twin juniper there is an option to hide for other players

#

if your using the fps template

#

in the player BP

small grail
twin juniper
queen escarp
#

@twin juniper dont remeber excatly think its in the character

#

@small grailhmmm

sinful tree
#

You may want to put in a has authority on the overlap to make sure it's only the server performing the logic.

queen escarp
#

@twin juniper hmm i rember doing it once dont rember where try googling it

#

@sinful tree hm using authority still gives same response

sinful tree
queen escarp
#

@sinful tree thats the one

#

ok but tags not being replicated there is no workaround for that ?

#

or do i need to cast to player begin overlapped and check the dead option instead

twin juniper
#

Thank you man. It was in mesh component of character BP

sinful tree
queen escarp
#

yeah i am

#

hmm lemme check i think

#

the weird thing is with my melee attack on the char BP

#

im using same logic but that works

#

the projectile however is spawned on the server

#

by*

#

ok so this is weird

#

thats cause its not being replicated

#

i suppose?

#

im going to try applying the tagsa locally to

#

yeah so that fixed it 🙂

#

however on the respawn it dosent collide gah

#

thers always sometihng

small grail
#

You could OnRep for your isDead variable to apply tag on client side

queen escarp
#

hmm ayee never used on Rep

#

what dose that entail ?

#

i mean i would prolly go watch tutorial or read up on it before using it since ive never used it

chrome bay
#

Use of OnReps is essential

#

Blueprint deals with them differently (incorrectly), but they are still used a lot.

twin juniper
#

what happens if we call server RPC from the server?

small grail
#

I think the system just drops the RPC

meager spade
#

no, it will run it

small grail
#

On which side?

meager spade
twin juniper
meager spade
#

maybe it is dropped 🤔 i am sure it never got dropped, but yeah

#

dont think i ever had that issue

chrome bay
#

Server RPC called by Server doesn't get dropped

#

Just runs like it's a local function

meager spade
#

thats what i thought

twin juniper
#

What is the best way to implement projectile firing in multiplayer? Using multicast?

meager spade
#

i mean i have been using ue for a fair few years, i am pretty sure it was not dropped

twin juniper
#

If it doesn't get dropped then I can just call OnFire for server and server RPC for clients, right?

meager spade
#

depends if you want true projeciles or fake projectiles

#

true projectiles, server just spawns a replicated actor

#

no multicast needed

twin juniper
meager spade
#

well you normally try to have fire initiated by client, to reduce "input" delay

twin juniper
#

You mean simulated proxy?

meager spade
#

then have the server spawn the projectile

#

but we normally hide projectle spawn behind muzzle flashes

#

so client gets to see muzzle flash instantly

#

but the prjectile is slightly delayed

twin juniper
#

What should be the approach? I am confused?

#

I can't use flash

chrome bay
#

For the simplest possible solution, you call a Server RPC which spawns a replicated projectile

#

It's "good enough" for a relatively low number of projectiles, and muzzle flashes and sounds do quite well to hide latency too

twin juniper
#

It is for a job test task

small grail
#

Usually just server spawns a replicated projectile for most of the multiplayer games.

twin juniper
twin juniper
#

Thank you everyone for the help

small grail
chrome bay
#

Yeah, just gets called like a normal function. The Server can call any 'Server' RPC at anytime

quasi geyser
#

Is it viable to make a multiplayer shooter in Blueprint or are there issues with that?

twin juniper
#

Just out of curiosity, when we setup online subsystem in unreal using any service you may such as steam or xbox, if you have a dedicated server, how do you manage fault tolerance during deployment for a massive scale Multiplayer?

winged badger
#

anything more complex... i wouldn't recommend

quasi geyser
chrome bay
#

Blueprint has only a small fraction of the engines multiplayer systems exposed to it. Anything that requires high performance or security needs to be in C++

#

Also the overall increased complexity of MP projects usually makes it harder to cope with in BP

quasi geyser
fervent leaf
#

Hi, could someone tell me what happens on the server on BTT-tasks and what on client? Or does everything happen in both server and client if you dont add server functions to it. I'm currently not sure if I should check authority and add server functions inside of the BTT's. Thank you

winged badger
#

AI controllers that run BehaviorTrees are not replicated by default

#

unless you make them replicate, all BTs and BTTasks will be server only

fervent leaf
#

@winged badger thanks

twin juniper
#

Is Game State replicated by default?

fathom aspen
#

Yus

twin juniper
fathom aspen
#

But it has nothing with what you asked and what I answered

#

GameState replicates by default

#

There is not Owner for GameState

#

Your condition make no sense

#

And makes no effect most prolly

twin juniper
lunar radish
#

I have been following gorka games rpg tutorial, but I want to make a multiplayer rpg, just not sure where to start with implementing it, or when, or how. Any tutorials that you guys suggest I watch to start understanding multiplayer implementation?

#

Like, should I already be implementing multiplayer or wait? Theres so much I dont know about it

twin juniper
nocturne quail
#

what will happen if I press the Action key? where will I end up?

void OnDelegateEvent();

GameState->DelegateEvent.AddDynamic(this, &AMyClass::OnDelegateEvent);

PlayerInputComponent->BindAction("Action", IE_Pressed, this, &AARMACharacterBase::Server_Event);

void Server_Event()
{
    DelegateEvent.Broadcast....
}

void Multicast_Client_Event()
{
    //some logic to be called on all clients by server
}

void OnDelegateEvent()
{
    if(HasAuthority())
    {
        log("Called by authority");
        Multicast_Client_Event();
    }
    else
    {
        log("called by no authority");
    }
}
nocturne quail
#

if I run the game with 3 clients, and spawn an item it shows on all clients which is correct.
but if I run with 4 clients or +4 clients, the item only shows on 3 clients

#

what can cause this issue?

vagrant roost
#

so just a general question, im making a "2D" platformer, but just using a sprite on a capsule. does anyone know the direction to look for what i need to replicate for updating to the correct direction of the sprite? basically when the player inputs left or right i flip the control rotation and actor direction, so my guess would be, do i need make some dummy variable that is set everytime the player flips left or right to replicate?

pure elm
#

Can anyone help me with my lobby networking? When the players are in the lobby, I am trying to achieve a player readiness system, so when a player presses the ready button, all the other players see the text update like "Going to Ivan (2/6)". But for some reason it is not working, and it seems as though my casts to the gamemode do not work (Sorry for bad grammar, I'm Russian)

#

Here is my gamemode script

#

Here is my PC

#

Here is my Ready button code

#

And here is the label code

#

Another thing that would be good to mention is that I am using Advanced Sessions Plugin

#

I've been fighting this issue for around 5 days and it seems I might be going mad

twin juniper
pure elm
twin juniper
pure elm
#

Wdym?

twin juniper
#

Are you creating session in game instance class?

pure elm
#

This is al my session code

#

I've been doing this in a widget

#

Sorry if I sound a bit dumb, this is basically my first time touching UE multiplayer

twin juniper
twin juniper
pure elm
#

So another question, does this multiplayer actually work? I mean, right now I have only tested it while launching the game several times on my PC, but will it work if I hand my friend a copy of this and we try to connect?

twin juniper
pure elm
#

How would I set it up though steam?

twin juniper
pure elm
#

k Thanks

#

Ok so, I did not find any way to set the gamemode, and I think It probably has some restrictions towards the authority of the player that can cast to it, i.e. the server

#

I am probably wrong though

#

What happens if I change the variables replication?

twin juniper
pure elm
#

I'm trying to replicate the variable that holds the number of ready players, but failing spectacularly

twin juniper
pure elm
#

Wats dis?

twin juniper
#

variables won't replicate by themselves first of all.

#

Have you declared the variable to be replicated?

pure elm
#

Now yes

twin juniper
pure elm
#

Idk, this is the only thing I am trying to replicate, but movement replicates fine

twin juniper
pure elm
#

It's in a widget

twin juniper
pure elm
#

Where do I set it?

twin juniper
#

I'll explain

#

You have this widget added to viewport in level BP?

pure elm
#

Yep

twin juniper
#

Who's setting the variable on widget?

pure elm
#

The widget itself

twin juniper
#

Both client and server have their own instances of widgets

pure elm
#

But can't I copy the value between all instances of widgets?

twin juniper
#

There maybe somewhere you are getting the values that you set for the variable?

twin juniper
pure elm
#

Wdym by signify?

twin juniper
pure elm
#

Storing the number of players that pressed the ready button

#

Do I move it to the player controller?

twin juniper
#

Store it in GameState that is set in Game Mode Settings but has it's own instance on client and server and then get it from there.
When you'll replicate the variable it will replicated it to all the game states and then you can access it via Get Game State

pure elm
#

Ok, so I move the variable to the Game State and set it to Replicated

#

Gonna try that, thanks!

twin juniper
twin juniper
pure elm
#

Thanks!

twin juniper
#

See widget variable replicating on both server and client

pure elm
twin juniper
dark edge
twin juniper
dark edge
#

The widget can just get the variable from the gamestate whenever it wants, either tick or binding

#

then the widgets handled

#

just mark the variable as replicated on gamestate and set it on the server-side and you're good

gusty hedge
#

I am trying to use Advanced Sessions plugin and setup a dedicated server for steam. When I go to build I get these compilation errors1>J:\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSessionAsyncServerSteam.cpp(307): warning C4996: 'GetBuildIdAsSteamKey': UE4_PROJECT_STEAMGAMEDESC has been renamed to UE_PROJECT_STEAMGAMEDESC. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile. 1>J:\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSubsystemSteam.cpp(44): error C2059: syntax error: 'namespace' 1>J:\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSubsystemSteam.cpp(45): error C2143: syntax error: missing ';' before '{' 1>J:\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSubsystemSteam.cpp(45): error C2447: '{': missing function header (old-style formal list?)

#

I am building in 5.2. Not to sure what is happening.

thin stratus
gusty hedge
#

facepalm I saw that but only just realized that it was refering to the Target.cs file...

thin stratus
#

The error I'm not sure

gusty hedge
#

It's probably a false error because of the depreciated definition I had...

thin stratus
#

could be

#

But it should more orl ess take care of it

gusty hedge
#

It's happened before.

thin stratus
#

That's also 2 different files

#

OnlineSubsystemSteam vs OnlineSessionAsyncServerSteam

#

But that one also has a define above it that you might not have updated

#

UE_PROJECT_STEAMSHIPPINGID

gusty hedge
#

I am building now. I will let you know.

gusty hedge
mystic estuary
#

Hello, I'm looking a way to pass some data to a server I'm player connects to along the request message or something like that. Does anyone have any idea how to do so? I was trying to go through some source code, and found AGameModeBase::Login function which takes FString Options, but I'm not quite sure how I would pass something in there. It seems like there is a lot of code.

Could anyone give me some advice on how to achieve this?

sinful tree
#

Usually you wouldn't be doing this, but using sessions instead which I believe you can do something similar.

mystic estuary
#

How would I add something to the parameters though?

#

I didn't find a function for that

sinful tree
#

You just add more to the string as you need.

#

Unless you're talking about sessions specifically.... That i'm not sure about but there is supposedly a means to do it.

mystic estuary
#

Yeah, I do understand that you can append values to a string, but what's the place I would do it?

sinful tree
#

When the client is connecting to the server. I don't think you can do it when playing in editor.

mystic estuary
# sinful tree Unless you're talking about sessions specifically.... That i'm not sure about bu...

What do you mean? I don't get it. 😅

Just to make it more clear:

What I want is passing the player hero data to a server, which is not just a hero class, but different other things, such as equipped items, level etc. This data is stored on the user computer, i.e. no main server which would contain the data and avoid cheating or something.

The reason why I need to pass these data as soon as possible, instead of making a client RPC call to a PC, which would make an server RPC with all the data, is because I need to use to use it to initialize the PC/PS using it.

olive kraken
#

Hey @fathom aspen another chapter of desync root motion on client.
Someone smarter than me found the real issue, apprenttly is related when the culldistance closes and reopens a channel.
https://issues.unrealengine.com/issue/UE-119442

Hope epic fix this one or pulls the workaround as a bool.

Unreal Engine

Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

sinful tree
# mystic estuary What do you mean? I don't get it. 😅 Just to make it more clear: What I want ...

The client needs to make a connection request to the server at some point. It's when you're making that connection that you pass in options that the game mode's Login function will read from.
In blueprint, you'd use something like the "Open Level" node on the client that is going to be connecting, in which case you pass in the connection string that I mentioned earlier (127.0.0.1:7777?playername=Jeffery?character=5) and then when the server receives the client's connection attempt, the Login function is fired and it reads in the "options" that were passed through on the connection string.

#

Sessions would work similarly, you should be able to pass through some options when establishing a connection.

mystic estuary
#

Ooh, yeah, I forgot about the Open Level node. The thing is that I'm using Lyra, and it joins a session this way, that's why I wondered how I would actually pass the options.

Are you familiiar with this approach by any chance?

sinful tree
#

The "Session Entry" may have some means of adding additional data, but I can't seem to add the Common User plugin in 5.2 to be able to see it myself.

fathom aspen
#

I mean the only function I know of that changes the active state of RepRootMotion (and it makes sense to be that way), is PreReplication.
Wondering on why would it always set it to false when the ActorChannel gets reopened

#

I mean literally breakpointing ACharacter::PreReplication and checking what's going in there

mystic estuary
#

It seems like it's not about options/arguments, but more about a found session instead.

#

Oh, wait, I didn't see the GetStringSetting method, perhaps that's what I'm looking for...

#

Apparently it isn't. It is the found session data, such as game mode, ping, map name, players current and max amount etc.

#

The only data client passes is the LocalPlayer, however, by following the functions chain, I found that at some point the LocalPlayer is not passed anymore, but its UniqueNetId instead.

sinful tree
#

You'd end up having to change UCommonSessionSubsystem::InternalTravelToSession and anything up to it to pass along additional options.
It eventually calls

PlayerController->ClientTravel(URL, TRAVEL_Absolute);

The URL value would be the same as the string you'd use in an Open Level node.

nocturne quail
#

if the server calls a MyMulticastEvent , so every client should call MyMulticastEvent too independently?

thin stratus
#

If the actor is replicated and relevant for them all, yes

olive kraken
#

What I don't get, is the reason of being backlogged

fathom aspen
#

Obviously Iris...

#

Well what I know is ActorChannels can get closed due to several reasons, but obviously not because their Actor has a low net priority. Lower net prio means lower considerability for replication. The ActorChannel shouldn't be closed.

#

From what I recall of the footage you attached at the time, you were not passing the the default net cull distance, so unless you had a really short one, your issue could be something else bing_shrug

vagrant roost
#

so just a general question, im making a "2D" platformer, but just using a sprite on a capsule. does anyone know the direction to look for what i need to replicate for updating to the correct direction of the sprite? basically when the player inputs left or right i flip the control rotation and actor direction, so my guess would be, do i need make some dummy variable that is set everytime the player flips left or right to replicate?

pine reef
#

I'm spawning a character and the is locally controlled is false on the current client and also for others, what could I be doing wrong?

pine reef
#

yes

dark edge
#

When are you checking is locally controlled?

pine reef
#

begin play of the actor spawned

#

I asked in chat gbt and it said this:
Replication: If the node you're referring to is an actor or component that is set to replicate across the network, the "Locally Controlled" property might be false on non-authoritative clients. By default, Unreal Engine only sets the "Locally Controlled" property to true on the authoritative client (server) and false on remote clients. This behavior ensures that remote clients don't modify the replicated data directly.

dark edge
#

BUT

#

you might be checking too early

#

print it on tick, does it eventually say yes?

pine reef
#

let me check

dark edge
#

might be a race condition

#

note, it'll only be locally controlled on the machine of the player who possesses it

pine reef
#

also false

#

always

#

I found another way of testing, Im checking the owner if is empty or not

#

it worked for the behavior I wanted, basically hide actor to the opponent and show after a certain time

nova kelp
#

So I have an ActorComponent on my AI controller, what the best way to get value forClient UI purpose?

dark edge
#

what does it represent?

last grail
#

How do I wait till all controllers have connected/been spawned in as a pawn to complete tasks in a variety of blueprints?

nova kelp
#

I have an actor component managing states of the AI, like idle, attack etc and I want to be able to get it and display it on the Player as a widget so on client

#

I am creating the widget on the Client already link to the player PC that part working well be I can't find a way to get that value specifically

dark edge
#

That can be a thing, or just put it on the pawn

#

pawn is replicated

#

AIController isn't

nova kelp
#

oh hence broadcast didn't work

#

I tried to broadcast the value on a Multicast but was nover triggered for client

#

I will check the PlayerStates, thx a lot!

quartz iris
#

Why does this code show the widget for both players when it should only effect the player who was in the collision?

#

This code is within the player

hollow eagle
#

you haven't posted what is triggering the start of that big chain but my guess is you're running that code on all clients

#

both clients are running that code for both players in their own worlds. So AddToViewport is getting called on both clients, and... adding that widget to the viewport.

quartz iris
#

Is there a way to fix this?

hollow eagle
#

don't use a multicast?

#

or, if that does need to stay a multicast, check if the character is locally controlled before running code that needs to be run only for the owning client.

drifting stirrup
#

why does 1 of my repnotify functions have graph properties but the other ones say "graph is not editable"?

drifting stirrup
#

sure

fossil spoke
#

Not sure why it would be doing that, you shouldnt be modifying OnRep functions anyway

drifting stirrup
#

why

fossil spoke
#

Because they are auto generated and called automatically, you have no control over what gets passed into them

#

Let me clarify, you shouldnt be modifying the function signature

#

You can do whatever you need inside the function, thats fine.

quartz iris
# hollow eagle don't use a multicast?

But now if I do it like this the server is always effected, though I would want the character who's in the hitbox to be the one that has the widget displayed not the server every time

hollow eagle
#

that's not what I said to do

#

I said don't use multicast. Running on the server is not the only option... just change it to be a client RPC instead

drifting stirrup
#

when i spawn my character doesnt get replicated to others

quartz iris
# quartz iris So run on owning client

This code does the reverse of what I need it to do, as it's effecting the player who did the confusion spell rather than the one who should be effected

drifting stirrup
#

and when i check SIE my char stays in the same place it spawned at

#

how do i fix

drifting stirrup
#

they both are named char0 when selecting debug object

#

normally it will have debug objects with (client) and (server) on the end why am i not seeing this anymore?

#

ok net mode was standalone instead of client, i feel dumb now

sinful tree
# quartz iris

The 3 types of RPCs:
Client -> Server or "Run On Server" indicating you want the server to execute something.
Server -> Client or "Run On Owning Client" indicating you want the server to communicate something to the owning client of the actor, keeping in mind that you can't send anything via a Server->Client RPC if the actor is not owned by a client. Usually Player Controller, Player State and their controlled pawn, as well as any of the components attached to these actors normally would have a client owner. The code in this RPC will only be executed on the client.
Server -> Multicast or "Run On All" indicating that you want the server to communicate to all clients that see this actor as relevant, and each client will execute the code themselves.

If you only want the player that is performing the overlap to display a widget on an overlap, then you likely want to check if the overlapping actor is "locally controlled" and then create and show the widget. No need for any RPCs. If you want it to be server authoritative, then somewhere on your overlap you'd need to use a "Has Authority" node and use the "Authority" branch, and then have a Server->Client RPC on the character to then display the widget for the owning player, or, you'd use an OnRep variable like a boolean called "IsConfused" and when changed the OnRep will be called in which case you'd do the same thing and check if the actor is locally controlled and IsConfused is true, and display the widget if so.

nova kelp
drifting stirrup
#

im doing set w/ notify on the server for a bool but it fires only on the server

small grail
#

Did you check the replication condition

drifting stirrup
#

its repnotify

small grail
#

The condition of replication, like replicate to all or?

small grail
#

Ok, so what class is it?

drifting stirrup
#

?

small grail
#

The blueprint you set the replication variable.

drifting stirrup
#

its character

small grail
#

Is it replicated?

drifting stirrup
#

yea

small grail
#

Always relevant?

drifting stirrup
#

no

small grail
#

Try this flag

drifting stirrup
#

still prints only on server

small grail
#

Where did you print it out?

drifting stirrup
#

in onrep function

#

might be confusing but make sure you dont confuse "use controller rot yaw" and "use controller rotation yaw"

small grail
#

Ah, okay. Maybe try to set the break point to see if it is really triggered on client?

#

Looks good for me though.

drifting stirrup
#

ok

drifting stirrup
#

repnotifys can only be called in server right?

small grail
#

Nope, it should be on both sides.

drifting stirrup
#

set w/ notify should work if u call it from client too?

small grail
#

No, only set the variable on server will replicate to the clients means OnRep get called because it replicated.

#

And, does you change the value actually?

#

If the value not changed, it won't trigger.

drifting stirrup
#

ill set it to both true and false

#

still only prints on server

small grail
#

If it was false and you set it false, OnRep not called.

drifting stirrup
#

but it just does not want to fire on client

drifting stirrup
small grail
#

Ah that's it.

#

Maybe the client side didn't spawn at that time.

#

Try to make a delay?

drifting stirrup
#

i did

#

it didnt work

small grail
#

😆

drifting stirrup
#

ill try it again

small grail
#

Does RPC work?

#

Like multicast

drifting stirrup
#

lemme see

#

yes

small grail
#

Only OnRep not working?

drifting stirrup
#

yea

small grail
#

That's very weird.

drifting stirrup
#

ig it doesnt matter i just found i can set it in properties, im still getting a bug with flicking though

humble wadi
#

Hey there!
Can someone help me out with Actor component replication?
I've set up an ActorComponent that has a function that periodically calls a Server RPC.
Said Server RPC will then call a Client RPC which I would expect to be executed on the client that owns the Owner actor of the component.

More about the setup:
The ActorComponent is set to be replicated in its ctor via SetIsReplicatedByDefault(true);
The ActorComponent is instantiated at runtime, on server-side in the PlayerController's BeginPlay() function. It's registered properly.
The ActorComponent is set to replicate so the PlayerController on client-side will have the component set.
I've checked ownership and it seems to be fine, that is:
Client's player controller is set as owner of the ActorComponent.

The problem I'm facing is that when calling "ClientUpdateWorldTime" it seems that its called on server-side whereas it should be routed to the client.

Attached a screenshot for reference:

humble wadi
drifting stirrup
#

how do you not be a fool lol

odd locust
#

I have a question regarding sessions: Is it possible to connect a client to two (or more) dedicated servers at the same time?
Assuming the servers would run the same level, and let's say server A has some actors F, G, H, and server B has some actors R, S, T. Could I connect a client C to servers A and B so all actors (F, G, H, R, S, T) are replicated on the client C?

fossil spoke
#

It would require heavy modifications to the engine.

winged badger
#

there is usually a way simpler solution, what is your goal here?

silver totem
#

Is updating a value over network every 0.03 seconds a terrible idea? Even if it's just 3 floats?

#

It's for a fast firing gun, aiming target

winged badger
#

target as in vector or target as in actor?

ebon zealot
#

if I have a replicated property that's a uobject and on the client it was modified and I want the client's version to be the same as the server aka correct it, how'd I generally do that

#

if I send the uobject in an rpc from the server to the client would that do anything?

silver totem
#

So like just 3 values. Not that much but I'm more concerned about frequency not size

winged badger
#

unreliable server RPC on Tick is fine

silver totem
#

Gotchu 👌

#

Though maybe like, once every two ticks

#

Barely noticeable

winged badger
#

as long as its unreliable, you're good

#

reliable doesn't make sense for something running on that frequency

#

because if the RPC needs to be resent, data for it is now already way out of date

silver totem
#

I see

winged badger
#

yes

#

well, your target vector doersn't really depend on slow or fast firing weapons

#

and you might want to turn the character aiming, even if not firing, towards the target so other clients can see that too

silver totem
#

I just don't see a reason to send aiming updates if the fire rate is less that aiming send rate. My "single shot" is really also just a vector.
So that way, if a weapon only makes 10 shots per second, I'd be sending ~30 aiming updates per second (once every two ticks)

#

While with single shots I'd be sending 10. But single shots must be reliable, so there's that

#

Network optimization looks pretty deep

#

I really made this "start fire" "stop fire" thing cause I don't know if I'll ever have guns so fast they fire multiple times per frame 🤪

solar stirrup
#

Hey hey, anyone know which FArchive is used for net serialization?

#

need to check how an operator is implemented

vagrant roost
#

so just a general question, im making a "2D" platformer, but just using a sprite on a capsule. does anyone know the direction to look for what i need to replicate for updating to the correct direction of the sprite? basically when the player inputs left or right i flip the control rotation and actor direction, so my guess would be, do i need make some dummy variable that is set everytime the player flips left or right to replicate?

odd locust
# winged badger there is usually a way simpler solution, what is your goal here?

I have multiple solar systems in a persistent universe, similar to Eve Online, across multiple dedicated servers. But rather than just piloting only one ship like in Eve, it's more of an RTS, so theoretically players can have ships in multiple solar systems at the same time.
As I see it there are only two options here:
(A) Whenever the player switches from controlling a unit in solar system X to a unit in solar system Y, connect to a different server.
(B) Connect to multiple servers at the same time.
Option (A) seems rather expensive in terms of network traffic if you swap often between solar systems, and constant load times could be annoying, so I would prefer somehow figuring out how to do (B).

winged badger
#

there are distrubuted dedicated server solutions out there

#

where servers also comunicate with each other

#

basically, multiple servers running the same world scenario

odd locust
#

If I understand it correctly, it would mean implementing server-to-server replication right? Or does such a feature/plugin exist already?

winged badger
#

it does, i can't remember the name of it

#

and it wasn't free

odd locust
winged badger
#

that sounds familiar

#

it was originally made for MMORPGs i think, so it shouldn't have that transition problem

#

but i remember very little, i just watched a presentation and it was years ago

#

if they are still around and compatible with 5.2 its a good sign

odd locust
#

Yeah I remember reading about it quite a long time ago, but haven't kept up to date with it. I'll check it out, thanks for your help! 🙂

daring gorge
winged badger
#

are you replicating your capsule or skeletal mesh?

daring gorge
#

uerm yes both

#

but i did it after i saw the jitter

winged badger
#

they can cause jitter when replicated

daring gorge
#

oh yeah just turned it off and that fixed it, thats weird

winged badger
#

aside from that, you might have different movement speed on server and clients

daring gorge
#

not really, i have the same thing- the only thing i added to this project was an ability to dash and roll and neither change the speed- i originally had an issue with my roll and saw this jitter on input and couldnt tell why

winged badger
#

blueprints?

daring gorge
#

quick question, i want to apply velocity to te character here when i roll, would i do it on netmulticast or only server

#

cpp

#

some stuff in bp

#

like the roll is completely bp

#

atm atleast

winged badger
#

usually for special movement modes you need a custom FSavedMove

#

inside the CMC

daring gorge
#

oh, what is that?

#

im v new to cpp so i dont know much

winged badger
#

its a struct containing predicted movement data

#

so, odds are that you can't dash and roll predictively, which then causes corrections

daring gorge
#

yeah, everytime i roll it jitters to the location

#

rather than smoothly going there

daring gorge
winged badger
#

the idea is you send your FSavedMoves to the server

#

server uses those to move you/calculate your position

#

then it RPCs your position on server back to you

#

after that, you reapply all your saved moves after the time server sent an update to the server provided location

#

and then if there is more then iirc 3 UU difference, correction happens

#

with no data that you're rolling in FSavedMove payload, that won't work

daring gorge
#

i see, i sadly dont understand much of this so i shall look into unreal documentation for more deeper explanation. Thanks for helping out though! i appreciate the information and the help : )

winged badger
#

search the pins on the channel

#

here

#

there is probably some good CMC stuff in them

daring gorge
#

oh okay i shall do that then

pure elm
#

Hi again, I've tried the solution advised earlier and now it almost works. So I moved the variable to the Game State and made an update event, which will be called every time I change the value. Issue is, this only works when I press the button on the server, then it replicates the changes towards all the clients and it works; However, when I press the button on the client, it does not replicate at all, and it seems like the R_Ready_S (Execute on server) event does not fire at all. Does anybody know what I am doing wrong? Sorry for possibly being a dumbass, a have little to none experience with networking

#

This is my Game State Blueprint

#

And this is my Widget Blueprint

dull marsh
#

should instantiation of vfx be handled on backend or client side?

quasi tide
#

Client side

radiant dew
pure elm
#

Wdym?

radiant dew
#

have u ran the code in game and seen what wire executes when u press on client?

#

u said that run on server most likely doesnt execute

pure elm
#

I have seen that using the print strings, and it showed that the run on server event does not even trigger

radiant dew
#

another great debugging tool is to run the game and then u see wires light up in real time

#

but i think ur problem is that client cannot run the "run on server" since its not the server or owning client

#

so ur Switch has authority node doesnt work

daring gorge
#

Why would you have the switch has authority there though?

radiant dew
#

well the "remote" doesnt work

daring gorge
#

I dont understand

radiant dew
#

since it cant work

#

but since im bad at explaining lemme link you something

daring gorge
#

You are either way running a server event on remote players

radiant dew
daring gorge
#

Just get rid of the switch has auth and run the server event that runs the multicast event. Pass the val from the server event to the multicast event?

dark edge
#

the only thing a client can send data through is a thing they own, usually PlayerController or Pawn

#

Or PlayerState I think

pure elm
#

How would I do it? Move the entire thing to player controller?

dark edge
#

Or PlayerState, Ready should be a variable on PlayerState anyway

#

The State of the Player is that they are Ready

grave notch
#

If i want to have classic multiplayer where players need to wait server for each action (so they feel ping and dont need to predict anything), is it enough to just send RPC from client and then server execute it and clients just replicate all data or i need something more complex?

grave notch
#

okay

dark edge
#

The only way clients can send the server things is through a run on server event

#

from there, you should default to replicated variables with repnotify if you want to run code clientside when the variable changes.

toxic pawn
#

I'm not quite sure I understand the difference between AutonomousProxy and SimulatedProxy, specifically for normal actors, not characters with their character movement component. If an actor is owned by a pawn, does that make that actor's role also AutonomousProxy, like the pawn? And how does that change anything in how it's movement is replicated, for instance?

pure elm
dark edge
#

show your code

pure elm
#

1 sec

dark edge
#

multicast doesn't mean shit in a playercontroller

pure elm
#

Do I move it to the player state then?

dark edge
#

Widget:
Input -> send a bool to serverside playercontroller or playerstate through a run on server event

PC/PS:
recieve bool serverside -> set bIsReady on Playerstate (repnotify)

Repnotify
Do whatever you want with the new bIsReady -> Has Authority? -> call CheckIfAllPlayersAreReady wherever that lives (Gamemode probably?).

#

don't multicast ANYTHING

#

Learn it, love it

pure elm
#

k, Thanks!

lost inlet
#

Well I found out some news on UDN today for anyone who was interested in the network prediction plugin: it's confirmed dead. There's going to be a new general purpose network prediction implementation in the engine (timeframe tbd I guess)

pure elm
latent heart
#

Whenever the variable is updated over the network, yeah.

pure elm
#

So this is what I ended up with

#

I might be going insane

#

pls help

#

im dumb

pure elm
#

Ight, Imma gonna go take a nap, pls ping me

dark edge
#

That's not really it

#

you're making things way more complicated than they have to be

#

The variable for if you're ready or not should live in your PlayerState, and should be replicated with repnotify

#

so instead of your flipflop, READ that variable and send its opposite (not boolean)

#

It's your gamestate's job to check if all ready

#

not the playerstate

#

the playerstate just tells the gamestate to check (since its ready state just changed)

worthy wasp
#

I"m using some custom MatchStates that i've declared like below - and when I log/printstring these (after setting them in GameMode) they're coming through the gamestate as 'None' . What am I doing wrong?

UE_LOG(LogVIGame, Log, TEXT("%s => MATCH STATE CHANGED => %s"), NETMODE_WORLD, *MatchState.ToString());

namespace MatchState
{
  const FName Default;
  const FName StageIntro;
  const FName Lobby;
  .....
}```
#

this is defined in my projects GameMode (NOT BASE)

subtle peak
#

Hey does the player state persist when switching game modes?

#

And if not, what class can be used that persists for the player between maps and matches?

sinful tree
quasi tide
#

GameInstance is the only thing that persists by default. (And the GI Subsystem)

#

Any other persistent thing needs to be set up manually

subtle peak
#

Thanks guys

dark edge
#

save -> change map -> load

halcyon totem
#

what can cause this error on my server logs?

#

LogNetPlayerMovement: Warning: ServerMove: TimeStamp expired: 32.698910, CurrentTimeStamp:

#

well how long before we should restart them?

worthy wasp
#

i would suggest at least that.

turbid lake
#

Hey y’all! I’ve been having a lot of trouble replicating an actor change within my game! I have capture points set up, and they are supposed to change color once a player captures them, however the color only changes on the server. I tried server to multicasting the changes, and that did not work. After more research I believe the rpcs are getting dropped because the capture points are just blue print actors that I have thrown into the scene, meaning that they are unowned, and in turn dont have a net connection. I tried to set the owner using SetOwner() to fix this issue, but it didn’t work. I set the owner to both the first player controller and the game mode, to no avail. I even tried having game mode spawn them in but that didn’t work either. If anyone can give me some tips or advice for getting unowned actors to have a net connection so that they replicate, that would be extremely appreciated!!

sinful tree
# turbid lake Hey y’all! I’ve been having a lot of trouble replicating an actor change within ...

Stateful things should be happening through replicated variables set up with Rep Notify. When you change the value on the server and the value replicates, the OnRep function will execute on the clients which you can then use to do anything visual you want.

Mutlicasts can work as well, but they're a fire once and forget, so if the actor goes out of relevancy for a client, the client won't receive the change.

#

You do not need to use ownership of these objects unless you want the clients to be able to send an RPC to the server through them (which you shouldn't need to in your situation). All that should be required is that the actor is marked as replicated and any variables you want to use to convey data about the actor to clients are marked as replicated.

turbid lake
sinful tree
# turbid lake I see, so currently I have the entire BP set to replicate, however I want specif...

Placed actors marked as replicated will end up having a net connection.

Your replicated variables should be specific about the state of the actor. You don't necessarily want to set components to replicated unless you know for sure they have values that actually can be replicated. You probably have some sort of variable keeping track of who has the object captured, like an enumerator that has three states: Uncaptured, CapturedRed and CapturedBlue, then you'd definitely want to use that one particular value to be replicated and set as with Notify. The OnRep can then use the replicated value and make the required to changes on clients without having to worry about marking the components as replicated.

turbid lake
#

Got it, I will try this out, thank you!

boreal bison
#

Quick question, losing my mind a little bit here. I'm trying to have my clients be able to click a button that spawns a tile. I know I have something wrong here but I don't know how to fix it. The reids video said you have to own an actor to run an event on the server on the actor, but I don't believe I'm implementing that correctly:

#

for reference, it's calling this function on the gamestate:

sinful tree
# boreal bison Quick question, losing my mind a little bit here. I'm trying to have my clients ...

Don't cross execution lines when dealing with network related stuff. The input would be client side, so only the client knows about that particular cast value, the server wouldn't.
Additionally, you cannot call Client->Server RPCs on the gamestate or any other non-client owned actor. You must RPC through a replicated client owned actor (like their controller, character or playerstate, or any of their components that are replicated) then when running on the server you can have the server call the gamestate or the actor that you want to interact with.

#

You also can't change ownership on the client. It must be changed by the server if it is a replicated actor.

boreal bison
#

In other words how can I have the client click on a button to call a multicast

sinful tree
#

In their character you'd likely have some kind of interaction event that you would trigger by key press or mouse input. You'd need to do some kind of trace or know which actor it is that you want to interact with.

You then RPC to the server on the player's character with an "Actor" input on the RPC to allow the client to tell the server which actor they want to interact with.

When running on the server, you can validate that the player is close enough to complete the interaction, and if so, trigger any additional logic that you want to happen as you're now running on the server. A common thing to do is create an interface and implement it in any interactable actors you may have, so then you can pass in the actor reference from the RPC through that interface, and trigger the implemented interface in the actor. Through the interface you're now executing on the server and are running code on the actor. You can now multicast from the actor or change any replicated values as you're running on the server.

#

With the button sprite, I'm not exactly sure how it needs to work, but you'd have to send it back to the interacting character/controller and do the client->server RPC from there.

boreal bison
sinful tree
#

Well what is that button? is it a widget?

deep shore
sinful tree
#

Glad to help 🙂

boreal bison
sinful tree
#

Ok, so then the On Clicked event I believe only ever executes on the client - you can test this yourself if you put a print string immediately after the event and try clicking on it....
You'd likely only see "Client: Hello" and not see anything like "Server: Hello" right?

#

The only time you might see "Server: Hello" is if you happen to be running a listen server and are clicking the button on the listen server's window.

boreal bison
#

OKAY I think I got it

#

hoooooly

#

On the button:

#

On the player controller:

sinful tree
#

That's looking better.

boreal bison
#

thank you so much!!!

#

this was killing me lol

drifting stirrup
#

how do you replicate anim data

#

1 sec

turbid lake
# sinful tree Placed actors marked as replicated will end up having a net connection. Your re...

Are you sure about placed actors marked as replicated having a net connection? I tried the rep notify and it seems like the function that is called on rep notify is not being called even though the variable changes. I have for sure set the object to be "replicated" within its blueprint, do I have to do anything special in the Cpp file? Because as it is now the obejct still does not have a net connection

sinful tree
turbid lake
#

and how can I make sure that I am changing the value on the server?

sinful tree
#

That's something you'd need to know - like, if you're doing something like an overlap, checking if there's authority or it is a server when the overlap happens etc.

#

When you have that gated off, then whatever function calls after that should be executing on the server.
Same if you started the logic from a Client->Server RPC, you know from the RPC you'd likely be running on the server, but unless it's a player owned actor, the RPC wouldn't fire.

turbid lake
#

And I call this RPC within the captre point object itself

sinful tree
#

No for two reasons:

  1. You don't want clients telling the server they captured the point, as then players could call that RPC whenever they want.
  2. You can't call Client->Server RPCs on non-client owned actors.

The server should already know when a player is capturing, and when they have successfully captured the point. Again, good example would be an overlap where you would have it check if the server detected the overlap, and if so, have some kind of timer or what have you, and when the timer expires, the server then knows it was captured.

#

When the server knows the capture was successful, that's when you'd set the variable.

dark parcel
#

Hey gys, question. Do Rep Notify condition on blueprint works? Eg SkipOwner, etc

dark edge
#

That's to run on client from server

#

Button -> run on server event

boreal bison
#

Run on server event on the player controller? I could’ve sworn I tried that, but I’ll try it again, thanks!

twin juniper
#

hello everyone.I am facing an issue.I am making a multiplayer game for android where the max people in room is 4.There is no point in going dedicated server.EOS is having all the library issues and crashing on android.Can anyone tell what is the best solution for android for 4 people.Is it relay or listen server.Any hint on how to do that??

woeful ferry
#

OnEndPlay should call on the client aswell, when an Actor has been destroyed on the server, correct?

silent swallow
#

Anyone having experience **multiplayer with ** chaos vehicles?

  • Jitters on server authoritative simulation
  • Out of sync on client authoritative simulation

How should I approach this?

I have a hypothetical solution
Please correct me if I'm wrong

  • Use client authoritative simulation , and let physics handle state of my vehicle on server and other clients (activate vehicle movement component on owning client only).
  • Or use server authoritative simulation and try to control jitters somehow

Any headings or tips are appreciated

dark parcel
#

So OnRepNotify can have a pointer to the Variable being replicated. How can we expose it the same way in Blueprint RepNotify?

thin stratus
dark parcel
#

😢 @thin stratus Got u, thanks

plucky prawn
#

oh is that cpp only?

thin stratus
#

Yop

woeful ferry
twin juniper
#

Guys i am making a listen server mode game.I am getting public ip of the host using whatismyip.org website.But when i use open ip command,i am not able to connect.Can i know how to connect??

#

it is working locally but not working when we are on diff networks and using public ip address

quiet fjord
#

Guys I'm making a game mode where my gamemode will spawn some players and when I meet a minimum number of players the game will start but I don't know whether to possessing in gamemode or call a function to my pawn which is the best

small grail
quiet fjord
#

Having told you, my game needs a minimum of 2 players, that is, 2 player controllers that I know using the postLogin function, I save this in an array and check its size, if this array contains 2 elements, that is, my 2 player controllers, I will generate 2 pawn with their statistics from which I will get another array of the stored positions of other actors. The question is if I do the possessing within the gameMode or is there another way to do it

#

It's just that sometimes I'm having problems synchronizing the positions when my game starts between the players, so it usually happens to me like jerks between them

small grail
quiet fjord
#

I have a question, what is the use of the OnPossessed event of the pawn then?

#

Does this run every time a pawn is owned?

fallen dawn
#

Hello, i am trying to replicate this function, when i use the custom nodes i made so it work on multiplayer i get a total different result

meager fable
#

How would you go about creating a password protected session? I'm seeing 2 ways right now both equally bad
-Add the password to a session settings and check before joining on a client - fast but prone to hacking around
-Join the server and check on pre-login - this will be a pain in the ass because you have to travel before getting kicked

cursive steeple
meager fable
#

yeah but that's still prone to hacking since the client can just read the password on his machine

#

I'm reading up on one way encryption and it seems like a good way to go

rocky kestrel
#

I have MMO survival game and it is open world and works with dedicated server. It works! But I want to create one dungeon (separate level) what could be best way to do it?

pure elm
#

K, so I have redone my code as advised earlier, however now it only works when I press the button from the server, and for some reason not when I execute it on client, and I have no idea why

toxic pawn
#

I have a weapon sway component I made in cpp. I tested it in standalone mode and everything seems to work smoothly. However, in multiplayer, even when playing as listen server (so when my instance of the game has authority, just to make sure it's not some weird replication issue), it looks very stuttery. I added a video to show what I mean:

#

Any idea what may be causing this?

strange canopy
#

hello there, new to multiplayer here, is OnRep_Notify intended to not fire before joining a server or am I doing something wrong?

pure elm
# pure elm

Update: after debugging I have managed to locate that for some reason even though I set the event as Run On Server the "has authority" still declines

#

I've been at it for a week

gusty slate
#

Hello,
out of curiousity and to better my code, let's say I have a Manager class that manages a bunch of Trees, if I know that a function in the Tree is 100% only going to be called from the authority Manager ie from a server RPC in the Manager, I shouldn't need to make that Tree function an RPC right?
I tend to lean towards the habit of making it a server RPC even though I know it'll be called from a server referenced context

sterile sparrow
#

Hello, I have a small and stupid question, is the replication working well in the construction script?

quasi tide
#

No

agile loom
gusty slate
#

isn't that still the same as my paranoia making it an RPC? 😂

#

I guess it's always best to be safe though

agile loom
gusty slate
#

Server functions inside the same actors aren't all RPCs but what I'm refering to mostly is when a different actor with server authority is calling a function of another actor from a server reference

#

I mean, it technically doesn't need to be an RPC

#

unless it could be used on its own somewhere else and even then it's better I think to just create a function then an RPC to call that function if you need it

agile loom
gusty slate
#

Yeah Widgets are only present on the client

pure elm
#

So Run on server events do not work?

gusty slate
#

Yes you would need to use a different actor to call RPCs

agile loom
gusty slate
#

for example the player controller

gusty slate
gusty slate
#

and make the widget button call that from a reference to the controller

agile loom
gusty slate
gusty slate
fallen dawn
#

how can i replicate this node?

pure elm
agile loom
pure elm
gusty slate
#

You're calling the local SetReady

#

because widgets are on the client only that RPC ToggleReady is just local

#

Try changing OnClicked of the button to get the controller then call RetryOnServer

#

or make SetReady a ServerRPC

#

you'll get the call

pure elm
#

K, thanks

#

I hope it works, networking drives me crazy

toxic pawn
gusty slate
#

Do you actually need that delayed movement handled by the server?

agile loom
agile loom
agile loom
toxic pawn
agile loom
gusty slate
#

It worked fine on 1 client but didn't work with 2

#

Are you sure your code isn't impacting the gun of another player?

#

and also, do you need that swaying to be handled by the server? if it's only for the player's visuals, you should just do that locally

fallen dawn
toxic pawn
toxic pawn
agile loom
toxic pawn
#
// Called every frame
void UEquipmentSwayComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    if (!OwnerAttachedSlot || OwnerAttachedSlot->SlotType != EEquipmentSlotType::Hand || GetOwnerRole() == ENetRole::ROLE_Authority)
    {
        return;
    }

    FVector DeltaLocation = LastOwnerWorldLocation - OwnerAttachedSlot->GetComponentLocation();

    FVector LastOwnerLocalLocation = EquipmentOwner->GetRootComponent()->GetComponentTransform().InverseTransformPosition(LastOwnerWorldLocation);
    FVector DeltaLocationLocal = EquipmentOwner->GetTransform().InverseTransformVector(DeltaLocation);

    FVector FinalVector = DeltaLocationLocal + StraightenStrength * -EquipmentOwner->GetRootComponent()->GetRelativeLocation();

    FVector NewLoc = EquipmentOwner->GetRootComponent()->GetRelativeLocation() + FinalVector;
    EquipmentOwner->GetRootComponent()->SetRelativeLocation(NewLoc);

    LastOwnerWorldLocation = OwnerAttachedSlot->GetComponentLocation(); // Update after we applied our changes only
}

This is my code for the sway component in case it helps - I added the authority check just now to check if it helps

toxic pawn
agile loom
gusty slate
#

^

toxic pawn
gusty slate
#

You could check its owner

#

you're attaching it to the character so the owner of that component would be the character

#

chain checks from that

#

the character (Pawn) has a check if it's locally controlled as well

toxic pawn
#

This is the result I get if I don't add the StraightenVector from my above code - it seems to have no lag at all, even when playing as client with 2 players. It seems the jittering is caused by that other vector after all, and there's just something that makes it worse when in MP, but it's still there in standalone

toxic pawn
gusty slate
#

That's a Rep Notify replication function it'll only trigger when the value gets changed

#

That wouldn't work really seeing that the gun gets attached while in gameplay

#

I mean a suggestion would be to have a Multicast after you equip the gun, you can call sounds effects there for equipping and also handle the tick, check if it's attached to a local character, etc

toxic pawn
thin stratus
#

Keep in mind that any state change should always be OnReps

#

Not Multicasts

toxic pawn
gusty slate
#

You should defo read Cedric's Compendium haha

#

that's what got me started into networking in UE

toxic pawn
#

Didn't even notice it was you @thin stratus , your docs really helped me!

#

Even though I still don't have such a good grasp on some networking features 😅

#

But in this particular case, can you give me an example of what you mean by state change?

gusty slate
# toxic pawn What do you mean by state change?

To try and explain it better:
OnRep (Rep Notify) is triggered whenever a value is changed, so players who were in the server will get it and players who join afterward will get notified as well. So anything which is classified as a State should be a RepNotify, for example Equipped gun, eeehm Hat, for example if you can apply paints on your body, etc

Multicast is only triggered when the call happens (somewhat), so it is more aimed towards things which are relevent to current players in that current time, for example sound effects on equipping, gunshot particle effects, etc

#

(To my current understanding and experience of course)

twin juniper
#

Guys anyone implement NAT PUNCH THROUGH for listen server in unreal engine

thin stratus
#

I usually take an explosive Barrel as an example. When you destroy the barrel you want to:

  • Play a Sound
  • One Time Explosion VFX
  • Changed the Mesh to a destroyed one
  • Turn a little infinite fire VFX on that burns in the broken Mesh

Part of that is State, part of that is one-time actions.

#

MULTICAST:

  • Play a Sound
  • One Time Explosion VFX

STATE/RepNotify/OnRep:

  • Change the Mesh to a destroyed one
  • Turn a little infinite fire VFX on that burns in the broken Mesh
#

You can argue that some of that can be predicted ,etc. but that's not the point of the example

twin juniper
#

I have an enum stored in player start and I want to set the same enum value in player states of the players that player start is used to spawn. How can I do so?

thin stratus
thin stratus
#

But maybe someone knows

twin juniper
#

i am making an android game in ue4

gusty slate
thin stratus
twin juniper
#

EOS is crashing on android always

thin stratus
#

(i don't know from the top of my head)

twin juniper
#

so trying to implement it.

twin juniper
thin stratus
#

Const would mean you can't set any state in it

#

If it's not const, then you should have access to the Player that is supposed spawn or?

twin juniper
thin stratus
#

Probably in form of a Controller pointer

twin juniper
#

Problem is player controller is on server

thin stratus
#

Relatively sure the function has an input of AController Player

#

Yeah that's what I thought, that should work

twin juniper
#

But it seems that it doesn't trigger for client

thin stratus
#

In the image you are only casting to your PlayerController though

#

If you want the PlayerState then you have to get that one and set the value on that