#multiplayer

1 messages ยท Page 642 of 1

twin juniper
#

Three tasks were asked, within two weeks

#

Ah, the template generated that

thin stratus
#

Well

#

Tick runs on every player

twin juniper
#

and this is the last task

thin stratus
#

So you are executing the code above on everyone

twin juniper
#

im doomed after coding an AI

#

no time to solve tihs

thin stratus
#

You need to limit the Axis stuff to the LocallyControlled player.
And then use a non-reliable ServerRPC to tell the Server to move.

#

If you have the boolean checked for rep movement, it should happen automatically.
But that has no smoothing and no prediction. So higher pings will make this really bad

twin juniper
#

Do you mean the bReplicatedMovement? I've got a squiggle for that, so i used bStaticMeshReplicateMovement

thin stratus
#
void ASpaceMayhemPawn::Tick(float DeltaSeconds)
{
    Super::Tick(DeltaSeconds);

    if (IsLocallyControlled())
    {
        // Find movement direction
        const float ForwardValue = GetInputAxisValue(MoveForwardBinding);
        const float RightValue = GetInputAxisValue(MoveRightBinding);

        // Clamp max size so that (X=1, Y=1) doesn't cause faster movement in diagonal directions
        const FVector MoveDirection = FVector(ForwardValue, RightValue, 0.f).GetClampedToMaxSize(1.0f);

        // Calculate  movement
        const FVector Movement = MoveDirection * MoveSpeed * DeltaSeconds;
        const FRotator NewRotation = Movement.Rotation();
        if (Movement.SizeSquared() > 0.0f)
        {
            ServerMoveActor(GetActorLocation() + Movement, NewRotation);
        }
    }    
}

void ASpaceMayhemPawn::ServerMoveActor_Implementation(const FVector& Location, const FRotator& Rotation)
{
    SetActorLocation(Location);
    SetActorRotation(Rotation);
}
bool ASpaceMayhemPawn::ServerMoveActor_Validate()
{
    return true;
}
#

Something like that maybe

#

But that's mainly pseudo code of course

#

Or send Movement as a vector and use your root stuff

#

Never used that before though

twin juniper
#

Thank you very much! I will try to modify it to see what happens ๐Ÿ™‚

thin stratus
#

The boolean is squiggled cause it's private

#

read the errors please...

#

You can use SetReplicatedMovement(true) iirc

twin juniper
#

kk thanks

#

๐Ÿ™‚

twin juniper
#

@thin stratus I'm getting these errors

#

D:\GAME DEVELOPMENT\PROJECTS\BIG MOXI GAMES - TEST\Task 2\Source\SpaceMayhem\Source\SpaceMayhem\SpaceMayhemPawn.h(53): error C4596: 'ServerMoveActor_Implementation': illegal qualified name in member declaration
1>D:\GAME DEVELOPMENT\PROJECTS\BIG MOXI GAMES - TEST\Task 2\Source\SpaceMayhem\Source\SpaceMayhem\SpaceMayhemPawn.h(55): error C4596: 'ServerMoveActor_Validate': illegal qualified name in member declaration

#

I tried to remove the _implementation from the .h, but then I've got this

thin stratus
#

Show me the header part where you declare the function

twin juniper
thin stratus
#

You aren't declaring it as a server RPC

#

UFUNCTION(Server, WithValidation, Unreliable)

#

put that above it

#

(above the server function)

twin juniper
#

the ServerMoveActor_Validate must be declared too?

#

in the .h?

#

Now im getting 1>D:/GAME DEVELOPMENT/PROJECTS/BIG MOXI GAMES - TEST/Task 2/Source/SpaceMayhem/Source/SpaceMayhem/SpaceMayhemPawn.h(54): error : Bad event definition

#

when i use the UFUNCTION

thin stratus
#

No you only need to define the name

#

Without _Validate

#

And without _Implementation

#

The UFUNCTION() macro does the rest

#

When you call the function you use the normal name of it

#

When implementing it you implement only the _ versions

twin juniper
#

then

#

I put UFUNCTION(Server, WithValidation, Unreliable) void ASpaceMayhemPawn::ServerRPCMoveActor(const FVector& Location, const FRotator& Rotation); in the .h and

thin stratus
#

_Validate is probably const

#

And you are missing the _Implementation behind the main part of the function

#

And your header shouldn't have the ASpace... in front of the function name

twin juniper
#

Wtf i didnt see that

twin juniper
#

I keep getting the same BS., the bad event definition thing. It sucks, because the page tells nothing. Const or not, the result its the same =S

#

The error is inside the _Validate

#

But const or not, wtf I don't get and the page says nothing

#

IF I remove the Validate from the .h, the compiler tells me that the class has no member _Validate

#

I removed the namespace that I forgot in the validate line

lost inlet
#

what even happened here

#

the actual UFUNCTION definition needs a function signature that doesn't end in _Implementation, a declaration for the _Implementation function will be created if not defined

twin juniper
# lost inlet

Thanks for your reply! But If I remove the _Implementation from the RPC signature, I vot this

#

in the cpp this

lost inlet
#

read the error

twin juniper
#

kk

#

I dont get it

lost inlet
#

also the tooltip placement doesn't help

#

well that part is clear, the screenshot I posted is what I would expect from someone who has no idea what is front of them

#

are you following a tutorial?

#

also changes not saved

#

also you wouldn't call Implementation directly unless you know what you're doing

twin juniper
lost inlet
#

then you didn't follow it correctly

twin juniper
lost inlet
#
void SomeRPCFunction( int32 AddHealth );```

this is what an actual RPC declaration looks like, you do not create an implementation for this function yourself
twin juniper
#

I did this

#

and in the cpp i wrote _Implementation in the end

lost inlet
#

this poorly formatted 5 year old blog is not something I would follow

chrome bay
#

You're calling the _Implementation part

#

which is wrong first of all

twin juniper
#

IF I not call, the compiler tells me that there is no

#

I still get an error

lost inlet
#

it doesn't help that the error is not shown in the screenshot

twin juniper
#

I will post it

lost inlet
#

also the Validate function would need the same arguments as the actual RPC

twin juniper
#

Ah, ok this must be the reason then

thin stratus
#

No

twin juniper
#

Well. it compiled, but i had to match the parameter list of the validate with the list of the implementation. the fact that it was empty was causing the error

#

@thin stratus @chrome bay @lost inlet Thank you very much ๐Ÿ™‚

thin stratus
twin juniper
#

No worries, you three helped me a lot today

#

thank you

#

๐Ÿ™‚

#

And now I have a better understanding of RPC in UE4

#

Now let see if is going to work XD

#

Loading the editor here

#

Haha the Pawn movement apparently is sync, but when I change from one viewport/PIE window to another, the controller is not working correctly, lsomething relatd to the GetInputAxisValue i guess after moving from window to another,

grizzled stirrup
#

Almost always I use SetLifespan(2.0f) just in case. In this case it's more that the projectile explodes instantly if firing point blank into a wall, so the explode FX can in theory play before the projectile is inited on the client if bExploded reps before the init repnotify property which is a UDataAsset*. I'll try and delay about 200ms before showing FX if the init property hasn't repped yet, should do the trick. Thanks!

#

If it didn't explode instantly it would appear to either fly through the wall or would hang in space until the property reps

shell moth
#

Hey, I'm having this issue where client characters are falling through the level because they spawn before the client finishes streaming in the level. The dedicated server places the characters where they need to be. You can see here in one of the clients, we see the other client standing on the landscape, but the other clients show they're falling. I can push the character to send another movement replication update and the client fixes itself

Any tips on how I can force the client to finish streaming the level before enabling physcis/etc? I'm trying the Flush Level Streaming node, but I guess that's not doing the trick

I'm pretty sure this is related to World Partition not forcing the cell from loading before the player starts. I have a non-WP version of this map and it seems to work fine

Thanks!

meager spade
#

@grizzled stirrup issue is easy to kinda solve

#

if the OnRep is set before the projectile is replicated to client

#

the bool will be true on the client in BeginPlay

#

so just do the same path

#

explode it.

grizzled stirrup
#

@meager spadeDamn true that!

#

Another example of calling the code twice to make sure it runs

#

Thanks

#

Would be great if beginplay was guaranteed to run before OnReps do

#

on clients

#

To prevent these messy double calls

meager spade
#

OnRep should fire before begin play

#

if client side is different to server side

lost dune
#

I need help for an issue with multiplayer in blueprints , free or paid.

#

okay

#

i have asked the same question 2 times already

#

so i prefer ask for personal help

#

or you will strike me for spam

short arrow
#

Given the names of both GameState And PlayerState I can assume that PlayerState Is player specific and only replicates data from the owning pawn

If that's the case GameState would primarily be used to to replicate information that is non player specific but important such as things like Total Team Scores, Total Game Time, Etc?

#

The uses for GameState and PlayerState is a little foggy to me

hollow eagle
#

That's generally correct, except that PlayerState is owned by a controller, not a pawn.

short arrow
#

Oh I see, So then Both the server and the owning controller can make changes to it's player state?

However only the Server can Update The GameState?

hollow eagle
short arrow
#

Thanks

lost dune
#

I'm looking for people who has not already tried to fix my issue:

I call the server who call a multicast using "set master pose" on clients , the operation fails

The same function set the master pose correctly in singleplayer mode.

#

everything but the set master pose works

#

These images are inside the character BP

#

The cast fails , the clients does not know the child actors

#

Why

unkempt wing
#

Is there a way to use replication conditions to replicate values to specific clients (on a team) and not replicate them elsewhere? It, in theory, could be done with an actor which lives on the server and uses client RPCs to specific clients, but that sounds hard on bandwidth.

lost dune
#

@unkempt wing

#

do your conditions in function of the id

unkempt wing
lost dune
#

i mean you can test the player id ( is like a client id) to accept the brodcast or not

unkempt wing
#

For which broadcast? I'm not very familiar with property replication conditions.

lost dune
#

Oh you are talking about property replication sorry , ithought you were asking for event replication

unkempt wing
#

No worries! Sorry for the confusion.

lost dune
#

After google searchs , it appears that child actor components are never replicated ,so i'll not use them

sand iris
#

in a first of third person template, when I move the camera with my mouse when the game is running, is the rotation of my camera replicated from the client to the server every frame?

hardy valve
hollow eagle
#

Network data isn't sent out at the client framerate, that'd be incredibly inefficient. Data is bundled up over a short period of time and sent out all at once.
Anyway, I don't believe either of those templates replicate anything about the camera. At most they replicate the horizontal control rotation axis. iirc you need to replicate the vertical axis yourself if you care about that.

sand iris
# hardy valve Dont think so and that sounds very unnecessary to replicate something only the c...

I see, I was asking because in my game I have several features that require the game to know which direction my camera is facing (such as wallrunning) and so far I have been calculating such values in the client and storing them in two variables called CameraRightVector and CameraForwardVector and then calling a server RPC to set those variables on my server too from the MoveForward and MoveRight input-axes-bound functions...

But maybe there's a better way to do this?

hardy valve
#

I would have 2 boleans for "Running on wall left" and "Running on wall right" and just send when the state starts and when it ends

sand iris
sand iris
hardy valve
sand iris
hardy valve
#

I would run states on the animation and all fancy stuff and then the position is checked by the server,

#

But im not a pro at this

sand iris
#

right, do you know if collisions are server authoritative? like if the player puts a fake wall introduced by a hack on the client, will the client run through it as if it wasnt there because the server will not see it? or what happens?

half jewel
#

the client will get blocked then glitch inward

#

i think character movement component will stop there however

sand iris
#

i see but someone should not be able to put a wall in a client through a to wallrun upwards vertically right? the client will glitch but they wont be able to suddenly start floating in the air on the server side since the server will autocorrect teh position?

half jewel
#

try it ๐Ÿ˜…, setup an input bind that spawns a wall only on that client and have client 2 view what happens

sand iris
half jewel
#

i would make an input bind for the pawn that would just spawn a cube when i hit V or somethinf

#

input in graph editor not project settings, all input is clientside only

#

can also make a umg widget that has buttons to spawn diff walls and stuff

dusk tinsel
#

Does anyone know how to make like an account system were you create your account, and when your in-game it shows your name you chose when you signed up, something like battle net or epic games

#

(Multiplayer) ^

sand iris
half jewel
#

this is exactly it

lost dune
#

Is it normal when i launch the game in multiplayer , there is only 2 players and their Player ID are 478 and 479 ?

brittle lake
#

Hi guys! I have been working on a street fighter like game but even though i made a spawn and possess system in the default game mode, i still cant have my other controller to possess the second character even though my keyboard possesses the first character here is my blueprint for the multiple characters so can anyone tell me how can i fix it so that my second controller would possess the second character and make it playable?

empty axle
thin stratus
#

Shouldn't it be enough to override IsNetRelevantFor?

#

ReplicationGraph sounds like overkill for this

thin stratus
empty axle
chrome bay
#

Yeah unless you're dealing with high numbers of actors or connections rep graph probably is a bit much.

woeful ferry
rocky night
#

HI Guys, i have a npc that loses blood when running.. but i dont see it on clientside. so ho can i replicate this decal?

winged badger
#

replicate the state - bleeding

#

have clients spawn their own decals

rocky night
#

the state where i call it is flee, and it is replicated.. but just no that dang thing there:D

winged badger
#

turn on the repnotify

#

and spawn decals from onrep

#

or start/stop timer that spawns them, i assume they fade out after a bit

rocky night
#

yes i have them with a timer and fade. where can i call the repnotify? it is all called in a npc bp

winged badger
#

just swap from replicated to repnotify

#

and onrep funvction will appear

#

note: onrep will also run on server

rocky night
#

the thing is i cant set nowhere in the character bp something on details. xcept i make a custom event out of it

twin juniper
#

Guys i am having slight problem.I have two clients in my game and i also set use mouse for touch controls as true.I am having a left virtual joystick but when i drag that joystick it is controlling other client rather than my client but WASD keys are working fine for my client.Plz help me.Thank you

#

It is also happening for default third person character as well.Joystick is controlling other client rather than this client

hushed breach
#

anyone any experience with 'allow client side navigation' i'm using it to control 'click to move' player characters in multiplayer, anyone know if it can cause issues with cheating?

hardy valve
#

Now i got an interesting issue, When i spawn an Actor its correct for the server but for the client the spawned actors inherited components are split (like 100-200XYZ transform) from the rest? ๐Ÿ™ˆ ๐Ÿ˜‚

viscid monolith
#

Hi guys, im working on game, where players can switch characters. How would i make possession? I can't get it to work, because in my case only server triggers possession event, client is ignoring

#

Is it done through RPC? or how?

ashen bobcat
#

I have done multiplayer possession with a multicast RPC

viscid monolith
#

Logically, as i got it, i get GameState and call Server RPC function on it, that checks if everything is okay and then it gets PlayerController and calls Client RPC on it to possess

#

But something somewhere is not working

#

Like clients don't even get to Server RPC function

#

Even though GameState presents on all sides

#

If I'm right

ashen bobcat
#

Just to make sure we are on the same page:

#

Yeah GameState is present in all clients;
You need to make a call from Clients with a SERVER RPC;
Then the server RPC should make a call to a MULTICAST RPC;

#

When you call a Client RPC its supposed to be called from the Server to be executed on the client

#

Did I understood your implementation?

viscid monolith
#

I call Client RPC method from Server RPC method function, is that right?

#

I just dont get RPCs

#

But you got it right

#

I will get to my code in few minutes

winged badger
#

why in the world would you multicast a possession?

#

all the code that needs to run to make it happen is server side

ashen bobcat
#

have you done it?

winged badger
#

if you need to notify other clients, there is such a thing as PlayerState and OnRep_Pawn

ashen bobcat
#

in my case the clients dont change possession until they do it locally

winged badger
#

other clients don't even have an instance of the possessing controller

viscid monolith
#

Here's my implementation, i got my code

#

First of all, there is custom GameState class

#

There is 2 of them, but i will look at first one

#

This function is getting called from UMG

#

UMG gets GameState, casts it and executes this function

winged badger
#

2nd signature is wrong

ashen bobcat
#

Oh ok, two different players swap between two characters

winged badger
#

unless you have split screen

viscid monolith
#

Why is it wrong?

winged badger
#

unless you have 2 players playing on the same machine

viscid monolith
#

Server doesn't know about other player controllers?

winged badger
#

you will never have 2 different valid PlayerController references on a client

viscid monolith
#

ohhh, i got it

#

So if i call first function from different client, will it pass invalid controller?

winged badger
#

you only have one controller to pass

#

use PlayerStates

#

those are replicated, so all clients have them

#

and server can resolve their controller just by doing Cast<APlayerController>(PlayerState->GetOwner())

viscid monolith
#

It's hard to understand as i only started to work with networking...

#

Doesn't server replicate all APlayerControllers?

winged badger
#

no

#

it replicates only 1 controller to each client (their own)

#

but each controller has a PlayerState

#

and those are replicated

viscid monolith
#

So i would pass PlayerState instead of APlayerController

#

and use it to possess

winged badger
#

server has all PCs

#

so it can grab a PC from the PS reference, as PC is the PS' owner

#

like PCs, PlayerStates are also 1 per player, 1:1 relationship with the PC

viscid monolith
#

Okay, got it

winged badger
#

some recommended reading

#

the compendium

viscid monolith
#

but actually, when i call GameState Server RPC method, it doesn't even get called from client

winged badger
#

you can only send server/client RPCs through actors client owns

#

GameState is not one of them

viscid monolith
#

oh damn! I got it

winged badger
#

PC, PS, Pawn, theiir components, anything owned by them

viscid monolith
#

it's ownership problem

#

Im just a bit stupid, i got it now, thanks!

viscid monolith
#

Damn, i just got wrong all the concept of RPCs...

prisma ore
#

Is this channel the proper channel for setting up steam for my game ?

winged badger
#

yes

viscid monolith
#

Can i use GameState to possess PC? Possession is not RPC method as i guess, and server knows about all PCs

#

sorrry for my stupidity again...

#

I mean i got that clients do not own GameState, so they won't be able to call RPC function to them

#

But can GameState make SomePlayerController->Possess(SomePawn)

#

in not RPC function ofc

#

Actually i can write down what im really planning to do

brittle lake
#

Can someone help me fix a problem with my 2nd controller system in ue4?

#

Ive already posted my problem here but some help would be appreciated

viscid monolith
#

Like we have 4 characters in game. And some players (1 to 4) can connect to server, so they will be able to switch through these characters, because some of them can do something better. Some characters can die and you can get more characters to your team. I need to somehow make UMG that will have buttons to switch characters, so i need player to press on character button and it's player controller will possess pawn

#

That's in short

brittle lake
viscid monolith
#

I just don't understand much, though i watched some YT videos and readed some guides

brittle lake
#

Its not server or internet related but my second controller is not possessing the 2nd character in my project

twin juniper
#

Would I need to port forward or something to setup a dedicated server?

ancient badge
#

Hey, i have a question related to replication.
I have a 2 functions that i use to move around my objects with my mouse.
(see blueprint below)
Do i need to set the 4 variables to "replicated" or "repnotify" so the listen Servers knows this variables?

bronze arch
#

since players camera rotation doesnt sync with server so..

bronze arch
#

basically i did this as simple but thats exploitable somehow.
guess what valo uses method to send players view angle? anyone knows?

#

thats so fun lol. if anyone wanna brainstorm with me about that valorant uses method to send server player view rotation(angle), mention me please. Thank you.

lyric lagoon
#

@bronze arch That looks very cool !

bronze arch
tough gyro
bronze arch
lyric lagoon
#

@ancient badge I'm not sure what you are trying to achieve exactly, isn't setting your object as replicated shares it's location automatically?

tough gyro
#

@bronze arch check how the controller is replicating the client rotation to the server

bronze arch
#

thats why i cant control it up or down

empty axle
bronze arch
#

with quick settings (nvm the async task its just sample)

#

its look so different tho Thonking

#

guess the one way is go with rpc sadge

empty axle
#

works great for me in my quick test

bronze arch
#

yes btw you can see the R= is Zero, thats for rotating up down

empty axle
#

it's roll

#

it's not for rotating up and down

bronze arch
sand iris
#

Is there such a thing as an RPC call limit or bandwidth limit for RPC?

I have a Server RPC function which I was calling inside a function that pretty much ran on Tick. Even when I completely comment out the contents of the server RPC function, just the act of calling it seems to create position net corrections when I run:

empty axle
sand iris
#

this is just running in the editor btw

bronze arch
#

well i tried with CMC its work but im using custom movement replication to avoid high send rate and bandwidth for 10v10 players in match hh_sweatW

empty axle
#

for 10vs10 you are most likely fine with the default CMC replication

empty axle
#

and what is that Do Async Task node btw?

bronze arch
#

similar but asynced ticking for performance gain purpose

empty axle
#

if that is running on a separate thread then it is not safe to use it like that.
You shouldn't read/modify resources from another thread if they are not thread-safe

bronze arch
#

yes if i do use CMC replication it works, but not for custom movement replication

bronze arch
empty axle
#

if those task are running on a game thread then there is no performance gain from that ๐Ÿค”

bronze arch
wheat magnet
#

does game instance exist on client?

bronze arch
wheat magnet
#

i mean on dedicated server

#

i'm running dedicated server on playfab

#

does game instance on that dedicated server works?

bronze arch
#

everyone has game instance on locally, you just cant RPC'ed or replication something on there

wheat magnet
#

i'm getting a variable from game instance and using inside game mode

#

but it's value is false

#

i mean the value looks like false from server

#

in client side the value is true

bronze arch
#

dude

#

thats what i mean its LOCAL not in the NETWORK

#

so you cant read a client variable instance from server

#

its special for game like

#

uhhh

wheat magnet
#

@bronze arch

#

the value is false

#

for dedicated server, where should i store a variable like persistent variable?

wheat magnet
wheat magnet
#

thanks, i already have this book, will read for sure, can you please tell me a solution?

bronze arch
wheat magnet
#

i want to get variable in game mode and store in somewhere

#

like what i did earlier i saved in game instance, which was incorrect

#

so where should i store variable?

#

so it works in dedicated server as well

#

state means player state or game state?

#

@bronze arch i think the best solution is to store value in state ( so game state or player state )?

bronze arch
#

Well, If you don't find out yourself, there's nothing I can do. because we don't even share the same project/mind. Also, it won't help you in the future when you alone.
That's why most of the time I research and do it myself.
just saying tips.

wheat magnet
#

does variable needs to be mark as replicated as well?

bronze arch
#

if you set it from server yes, if not you only way to send that variable via RPC to server

wheat magnet
#

i'm just setting like normal method, get player state -> cast to my player state -> set bool to false or true

#

does it works on dedicated server?

bronze arch
#

if you know of to get playerstate from your locally controlled character, yes. if no, google it. Also add send to server rpc event on playerstate. Hope that's enough tips for you, im gotta go

wheat magnet
#

i need to set variable inside widget

#

i mean i want to get player state inside widget

#

does it works?

#

well, it looks like i can't able to get player state inside widget

#

what is solution to this?

#

@bronze arch

#

i only see game state inside widget

#

does game state exist on server? so does it works?

lapis zinc
#

does unreal support ipv6? I'm trying to replication right now and its working for local games using ipv4 address, but I can connect with my friend thru ipv6. am i missing something?

silk abyss
#

Ie. when I local host a listen server, I need to setup my port forwarding first so my friend can connect with my public IP address.

#

So if you are doing some prototyping locally with your own computer, try to make the Nat layers as less as possible.(sometimes need to talk with your ISP)

#

My setup is modemโ†’routerโ†’pc

#

I just talk with my ISP so the modem is in bridge mode so it doesn't operate it's own Nat layer

lapis zinc
#

so it my code working then?

#

also when I put in my public ipv6 address it returns me to the default map not the designated map I chose. is this normal?

#

I assume if there were any problems it'd be here

languid igloo
#

stock AStaticMeshActor is not network replicated right?

#

so I need to make an empty BP actor with a staticmeshcomponent to be able to set replication on them?

#

my current issue is using AStaticMeshActor the client doesn't see them, only the server instance can see them

lapis zinc
#

So apparently ipv6 and ipv4 work the same way and doesnโ€™t matter? Hmmm

lapis zinc
#

How we that be done in blue print?

winged badger
#

@languid igloo the component will replicate with the actor, its on CDO

#

you can just do SetReplicates(true) at runtime

#

depending on what you're up to

languid igloo
#

on the stock actor? the actor that gets created when you drag a static mesh onto the editor

winged badger
#

non replicated Actors spawned on runtime won't propagate to clients, but you can turn the replication on per instance

#

then its part of the package

#

client should see them fine

languid igloo
#

where do you set replication on it?

winged badger
#

bNetLoadOnClient = true

#

you don't need it

#

unless you need it to replicate its own members/subobjects

languid igloo
#

no it's just a non movable static mesh actor

#

weird that it's not showing up in client

winged badger
#

if its saved with the level

languid igloo
#

it does, it's placed in the editor

winged badger
#

and has bNetLoadOnClient checked (default true)

#

it should not only be visible, it should also be net addressable, meaning pointer to it can be resolved over network

#

its no different then your floor mesh in that regard

languid igloo
#

weird,

winged badger
#

it definitely doesn't need to be replicated

languid igloo
#

I ended up just created a new actor with a static mesh component with replication checked

#

and they worked

winged badger
#

you really don't want to be replicating actors that don't need to be replicated

#

net broadcast tick time is a thing

#

and its not cheap

lapis zinc
#

whats the best way to do line traces for replication?

lapis zinc
#

i think i got it

lapis zinc
round star
#

Anyone get advanced sessions to work in ue5 XD

prisma ore
#

I have not tried with UE5

round star
#

ALS seems to be working well

distant talon
#

just checking, if a server calls a c++ replicated on server event, is ue4 smart enough to bypass the replication? Are there any downsides performance wise? It's easy to do it the other way but it's much cleaner just to have one function that gets called from client or server im thinking

silent valley
distant talon
#

i dont mean if you call the _implementation, i mean if you call the base function which acts like an rpc

#

might be the same answer just trying to clarify

thin stratus
#

You are not replicating it AT ALL

#

Read the Network Compendium that is pinned to this channel.

#

Second pin from the top

#

@twin juniper

steep terrace
#

Hey, I have a problem need someone to help . How can i stop character mesh follow control rotation? It follows contol rotation when my character moving.

chrome bay
#

The mesh doesn't follow control rotation, the character capsule does

#

The mesh is attached to that capsule and inherits it

#

The character movement system moves and rotates the mesh independently for smoothing, so you should avoid moving it yourself for anims etc. Use a bone if you want to do that.

lament sinew
#

Hey,
Is steam matchmaker able to launch a dedicated server instance on demand and send ip/data to clients in the queue?

chrome bay
#

no, spooling up server instances is something you have to setup with whatever service is hosting them

#

Steams matchmaking is just about querying for suitable servers as a group, that's about it.

gentle depot
#

I have an issue that I haven't figured out what could be a problem.

Basically I have a Inventory System that I create items hidden at the beginning of the game and I call the item information from spawned item (like it's image, transform, uid, variables etc.)

But the problem is, when I create items at the beginning, Server has no issue but when client spawn items, they only valid for client. I saw the spawned items on Server, I check replication status and they are fine, when I try to take items from ground by Server has no issue, but if I spawn 8 items by client sometimes 3 sometimes 4 of them return as Valid for Client. When I check isValid status of item from client-side, i have no issue and it returns true, but when I call isValid status on replicated on server event, they return invalid. (As I said, I also test replication status and has no issue)

https://blueprintue.com/blueprint/fuf5v3po/
This is where I create items (Create Item event is Replicated on Server + Reliable)

https://blueprintue.com/blueprint/984ambfk/
Here is Create Item Event (TempItem is replicated variable)

Honestly I am not looking direct solution my issue, but if you give me some idea about what could be a problem I could work on it.

Thank you! :)

steep terrace
kindred widget
#

@gentle depotWhat exactly is that function intended to do? It's named Sort, but it's creating things?

gentle depot
# kindred widget <@!326358689990836226>What exactly is that function intended to do? It's named S...

This is just for developer mode, sort is for sorting inventory for players. It's called at construct event of widget. It spawns the items depends on the items he chose before starting game (I haven't sent that part because I only use developer part to make tests) and the sort inventory function spawn items and then sort the inventory by getting information from spawned items.

Basically;

  • Player chose the items at the items widget of lobby.
  • Then inventory system called at game start.
  • Server and Client spawn items invisible at the place they start game.
  • Inventory System get the information of items (like Image to Show inventory Block, Amount of the item, Name of the Item etc.)
  • Sort the inventory depends on the choice of the Player.

And the result;

#

But the problem is When I click 1-2-3-4-5-6-7-8 (inventory buttons) for server he has no issue to equip. But when I try it on Client, sometimes 1st 2nd 3rd items works fine but others not, sometimes 1st 3rd 5th works fine, but others not

kindred widget
#

I don't know if this is bad wording, but it's wrong. Clients never spawn anything.
- Server and Client spawn items invisible at the place they start game.

gentle depot
#

I know, client send the item list to server to spawn

kindred widget
#

Ah, noted.

#

That function you posted, is it ran just on the server, or is it ran on clients too?

chrome bay
#

Problem is your inventory items will be arriving on the Client at all different times. There's no guarantee they will have all arrived when you create the widget. You should use OnRep callbacks to tell the UI to update based on the inventories current state.

gentle depot
#

Yes both run the sort inventory function at the beginning, Create Item event is replicated on server

#

Yes but if inventory has the issue to collect item information, it doesn't get item image too.

#

Because item images also variable on item.

chrome bay
#

Yeah exactly

#

So the UI has to respond to the inventory changing

gentle depot
#

Yes

chrome bay
#

So use OnRep callbacks, and when the inventory changes, broadcast an event that the UI has subscribed to so that it can rebuild itself

#

You can't ever guarantee that the UI will be created at the perfect time, networking is inherently latent and subject to race conditions.

gentle depot
#

I also check the item information in inventory system and items created and saved greatly on Client-side inventory. This is why I thought it's replication issue but replications seems fine when I test it on server-side

chrome bay
#

If you simulate that with latency, it will probably not work at all

gentle depot
#

Okay I can try replication callbacks too :) Thank you, I can inform again with latest results

chrome bay
#

- Server spawns the inventory
- Client has an 'OnRep', which pushes an event when TArray<MyInventory> changes.
- The UI panel binds to this event, then rebuilds itself based on the current state of the inventory - and also when it's first created.```
winged badger
#

or better yet, a fastarray that can broadcast just per item changes

chrome bay
#

I think this is all BP @winged badger from what I gathered

winged badger
#

slightly more complicated, but not by far

winged badger
chrome bay
#

BP = Multiplayer: hard mode

winged badger
#

its doable as long as you have <= 4 players and a small game

#

i think, was never actually crazy enough to try networking in BP

lusty sky
#

do you have to keep the array of items synced in order between client and server?

kindred widget
#

@lusty sky Normal Array will do that by default. At least as far as it can. Usually best not to allow clients to mess with the Array and only handle copies if you need sorting or stuff.

gentle depot
#

If you ask me, no, I only sync them when the item equipped or drop the ground, because I need to replicated dropped item to see everyone. Other than that status, they always stay still as Hidden at the place they used last.

lament sinew
gentle depot
#

For sync I have no issue honestly, when the item returns valid, drop and equip works fine, but honestly I don't understand what the issue totally. Because theoretically everything works fine, and doesn't work same time :)) Half of the items works fine, half not. But I guess maybe spawning items quickly causes that issue, maybe I can create custom for which have a delay on every tick if this is the issue :)

potent cradle
#

Hmm, what actually happens to the player's possessed pawn when they exit the game/disconnect from the server. It seems to be removed, is that right?

lament sinew
#

i belive it gets GC'd if its not longer referenced xD

lusty sky
#

LOL obviously its getting destroyed did you expect something else?

potent cradle
chrome bay
#

You can change that behaviour

#

But yeah by default, the server kills the players' pawn when they logout

potent cradle
#

Yeah, overriding the function ๐Ÿ˜„

#

Curious how the event isn't in blueprint

#

Gotta expose it

chrome bay
#

Meh see above RE Blueprint and Multiplayer ๐Ÿ˜„

potent cradle
#

Heh, yes

#

The further along I get, the closer I get to understanding the whole "multiplayer needs C++ mantra"

warped berry
#

I'm making a lobby and using BeginPlay in PlayerState to notify join or leave for players, but on the host screen player name property for all clients is empty in BeginPlay but on client screen all names are there! why on host it is not ok?

#

client name on host screen is empty, but all names on client screen are there

warped berry
#

in BeginPlay everything should be replicated, right?

chrome bay
#

No, no garauntee of that at all

warped berry
#

is it a coincidence that it's working correctly on clients?

short arrow
warped berry
#

I guess it's a delayed replication? but why and all clients get the correct data

chrome bay
#

Begin Play is called by the GameState when that replicates, so depending on whichever order things replicate in, BeginPlay may be called at different times

short arrow
#

To see if it's delay with begin play just add like a 5 second delay timer

#

And then have the server run that

#

All clients should be loaded in by then

chrome bay
#

can't garauntee it though

#

and it won't work for join-in-progress

#

using delays to get around race conditions is a quick way to end up with a very unstable MP game

#

You just need to make the code more resilient to that kind of thing

short arrow
#

I meant it for test purpose, certainly not a good thing to keep

chrome bay
#

yeah for sure

warped berry
#

yea actually I'm currently trying to get rid of all timers, so I thought begin play is the way to go

chrome bay
#

The way to work around initialisation ordering issues is to use OnRep callbacks mostly

#

But a lot of actor properties don't have those exposed to Blueprint

#

In fact I don't think any of them are for base properties

warped berry
#

I'm in C++ so it's fine, but I want to make like a lobbying system so that when a player joins everyone else is notified

#

and in case I have many properties, I'll have to depend on OnRep for all ?

warped berry
chrome bay
#

You should be able to get any of the PlayerState's own properties in it's BeginPlay without issue - but only for that actor.

#

What you can't do is use say, the GameState begin play, and assume that all other player states will have replicated by then.

warped berry
#

ok cool, but I'm using PlayerState's BeginPlay

chrome bay
#

But the order very much matters - because you could receive another players player state before your local UI is even available.

warped berry
#

oh okay, hmmm but my own player state will BeginPlay after my UI is available, right?

#

and the idea I wanted to implement is to listen to changes in PlayerArray but I cant find a way to!

#

since it gets filled locally

chrome bay
#

it get filled via AGameState::AddPlayerState

#

So you could add an event - but you will also need your UI to wait until the GameState is available too, before you can bind to it

warped berry
#

you need to replicate it

chrome bay
warped berry
#

set it to replicate and use RepNotify in BP to update UI , and it will be updated automatically on all clients

warped berry
warped berry
#

you should change the value on server in order to replicate, you can read more about replication first

warped berry
#

to run that on server you have to make that call from an actor that's owned by the client

warped berry
#

use player controller

kindred widget
#

Character is owned by the controller that possesses it by default and should be fine to make RPCs.

warped berry
neat seal
#

Hello everyone! I am curious to know if anyone has found a proper solution for multiplayer observer cameras after dying. (ie to spectate other players once you are dead and out of a match). I have tried several approaches but they have all suffered from jittery movement on the character being observed. So far using SetViewTargetWithBlend and providing a reference to the players private pawn as the target as opposed to the camera or controller is the only solution I've found that follows the camera's pitch as well, without additional networked data retrieval (though it does not include things such as FoV changes on the observed character when aiming and such) but it still suffers from the same jittery movement issue on the player being watched as the others.

If anyone has found a way to do a proper observer camera that views from the target players point of view (ie shows what they are seeing/ sees what they are aiming at etc, not just following their character), and does not suffer jittery movement issues, and would share the solution (I would be willing to pay for the solution too if can show it working properly in an actual networked setting similar to a real game and not just a couple pawns in an empty scene), it would be extremely appreciated! Thanks.

winged badger
#

CMC? SkeletalMesh is interpolated, Capsule is teleported

#

@neat seal

neat seal
#

cmc = character movement component? if youre asking what the observed characters are / how they move, they are character based actors and yes use character movement component

meager spade
#

ShooterGame/UT4 has observer setup

#

and that is smooth over networking

neat seal
#

ive tried various targets for the setviewtargetwith blend, ie the characters controller, the pawn etc, so far the private pawn as target gives best results as its the only target object that also lets you see the observed characters camera pitch too

#

ah does it @meager spade ? ok I will set a proejct up with that and take a look at what they are doing

meager spade
#

problem is the capsule is teleporting

#

and the camera you are observing is likely attached to the capsule

neat seal
#

ah ok thats a good point

meager spade
#

so your seeing a jump everytime the server sends new capsule location in

#

camera needs to be on the mesh

neat seal
#

so maybe attaching the camera to the skeletal mesh would fix that

meager spade
#

as that is what is interpolated client side

neat seal
#

ok now i see

#

I will try that right away

#

and yes now that you mention it my springarm is attached to the capsule itself, thats probably the culprit!

meager spade
#

100percent the issue

twin juniper
#

Im trying to update the weapon mesh of a component in my actor. I first line trace to find an actor and then get the data from that actor, then set that as a variable which is a struct. That variable is rep notify and in the notify event i call a function called update weapon mesh which just takes the data from earlier and sets the new mesh. However, when the client does this the server does not see the new mesh, but when the server does it the client can see the new weapon. Anyone know what Im doing wrong?

neat seal
#

awesome I will make that change and see how it goes, thanks guys ๐Ÿ™‚

#

are you making sure the repnotify var is being set by a function running as server? I use similar setup for char customization mesh changes and it works well

#

and the repnotify ensures that even clients out of relevancy range or who join the game after the change still see it correctly

twin juniper
#

ahh no im not setting it on a server let me try that

#

ty it works ๐Ÿ™‚

neat seal
#

awesome

kindred widget
#

Because you're spawning it on beginplay once for each character.

#

So if you have two players, you'll have four widgets total, two on each player's screen.

#

That is more of a complicated question than it seems. Realistically this should be called on owning client only through some virtually overridden functions in the possession line. If you're blueprint only, a simple and easy, and fairly performant hack is to just check the local controller's pawn on tick in the HUD class and call functions based on whether that changes.

lament cloak
#

Anyone know why GetNetConnection() is returning Null on the server?

I've tried grabbing one from the PlayerController, Game State, and other replicated actors. What am I missing? Everything seems to be replicating fine so I'm very confused

#

Testing in editor on 4.25 as a listen server

#

All I really need is a UPackageMap though

severe widget
#

@lament cloak probably have to interrogate ClientConnections in a different way

#

I don't know the other way

#

dig around

foggy idol
#

is there any way to calculate the delay between a client and a server

#

like say you have a timer

#

if I can calculate that delay then cant i just offset the local timer by that delay

eternal canyon
#

as ping is both ways

#

so ping / 2

#

is one way

foggy idol
#

actually I just solved the issue

#

I was dividing ping by 1000 instead of 10

#

so if the delay is 2

#

then I subtract 0.2 from the length of the timer

#

and end up with synced timers on the client and server

#

Thanks tho @eternal canyon

#

F

#

it does not work noww

severe widget
#

wait what

foggy idol
#

what is ping measured in ?

severe widget
#

ms

foggy idol
#

I wanna convert it to seconds

#

so then / 1000 ?

eternal canyon
foggy idol
#

this is basically what im trying to do

#

the function is called On_Rep so I expect delay

severe widget
#

Well what you wanna do is replicate the servers GameTimeSeconds and figure out the delta to get a synced time that is shared.

So each world (clients, server) will have whatever (based on uptime) but they have another one that is synced.

foggy idol
#

but im stuck on trying to compensate for that delay

severe widget
#

Any business logic on clients uses ActualServerGameTimeSeconds

foggy idol
#

I can just pass the game time as a client event

severe widget
#

OnRep of that, you need to factor in the ping/2 (at the time the server starts replicating the timestamp)

#

you do that once on join

#

then any time value the server sends should be approximately the same on clients

#

you can resync the time periodically

foggy idol
#

Im gonna need time to comprehend this

severe widget
#

Hrm

#

I see what you're doing though and that could work to have the timer be close

#

it's difficult to perfectly sync things

#

but you could also send down an event to run a function at a particular time

#

The standard timer stuff can't do that though

#

RunEventAtGameTime is nice because if a client happens to be ahead it can immediately fire (or ignore it, if too much time has elapsed)

foggy idol
# severe widget Hrm

Im sorry to ask but would it be possible for you to summarise your solution above ?

severe widget
#

use that

#

Timer Manager doesn't use that and can't be made to use that easily

hybrid zodiac
#

Hi everyone, I'm using the Advanced Sessions Plugin in 4.26.2 to get dedicated and listen server functionality working. However, while I have dedicated servers working great, I'm completely stumped as to why my Steam listen servers don't show up in the Steam browser, or when using "Find Advanced Sessions". To test, I have a very simple setup. When I hit comma, it starts a session and listen server:

https://gyazo.com/a4039ba44501957b6b569ca1210810de

It appears to create the session successfully and I travel just fine, but when I then check in the Steam server browser, or run a search for advanced sessions within the game, the server doesn't show up. If I run a dedicated server it works fine and shows up. Am I missing something here? All the tutorials say the above is correct...

#

I am running from a source build of the engine, and I have added the global definitions to both my Target and ServerTarget build files, as well as added the necessary bits to DefaultEngine.ini. I am testing by simply launching the game from the uproject file

stone dust
#

the problem is the movement replicates on the server side but when I move in the client side the pawn does not move in the server screen

hybrid zodiac
#

@stone dust which pawn class are you using?

foggy idol
#

its not perfect but stays close even at 200 ms delay

sinful tree
foggy idol
#

oh well

#

it is what it is

#

at least it works

lament cloak
foggy idol
#

In-Case anyone wants it this was the final solution

#

the pin above the subtraction is connected to the length the timer is supposed to be

keen ivy
#

so from what I understand, GameInstance is the correct class to use to persist variables across maps
however, I'm having trouble replicating variables from server to client
is it supposed to work?

#

I'm replicating an array of structs

sinful tree
keen ivy
#

really

#

so whats the proper way to carry information across maps in a multiplayer game

sinful tree
#

You can still store it in game instance, you just can't replicate from it.

keen ivy
#

for my use case im trying to store a character selection, and in the next map, spawn the actor, but i call the method from the server

#

which I believe is correct for spawning actors in MP

sinful tree
#

So the server should call to the appropriate player controller when something is needed. The player controller can then read its game instance, then send back the data to the server on the player controller.

keen ivy
#

interesting

#

the thing is, for my game, the player controller is kind of separate from the actors it controls

#

its a multi unit game

#

I was thinking of storing netId on the units

#

so it determines what you can select and control

#

so youre saying

#

on one map, let each player make their character selection, store it in each player's game instance, then load the next map, the server side player controller will attempt to spawn the unit based on the previous selection

#

so call a server only function that takes an argument for what to spawn

#

and call it from each client

#

fetching the data from the local game instance?

#

so its kind of like how input is handled then

#

ok that worked lol

sinful tree
#

The player controller should be thought of as strictly the "essence", "brain" or "mind" of the player. Even if the controller is not strictly possessing any specific unit, the "mind" still exists and can exhibit control over what you allow it to.

Ideally you wouldn't allow your player clients to store their selection as that means they can attempt to manipulate the value locally in their memory --- as an example, let's say you had a multiplayer game where each character could only be selected once under normal conditions but someone keen on cheating could manipulate the value they have stored and then allow them to spawn as something they shouldn't be allowed to spawn as since someone else already selected it.

That being said, yes, you can store the value on the game instance and then have the server request from the clients for their selection.

keen ivy
#

yeah, I get that

#

for my game its probably okay, considering its a co-op game

#

but I can see how that would be an issue in a competitive mp game

#

whats the right way to do it?

sinful tree
#

If you're doing a lobby-like game where players can't drop in, then I believe you can use seamless travel which can make the player controllers and player states to persist. So then you have your players connect to the server - make their character selections, then all of them move to the new map. So your server can store it on the server copies of the player states of those players.

keen ivy
#

ah

#

yeah I remember having some issue with seamless travel

#

Ill have to look into it

#

good to know though, thanks

#

which class is the appropriate class to use as a container for game wide replicated variables?

#

is it game mode?

#

not cross map, just in general

sinful tree
#

Game State would be best

keen ivy
#

ok

sinful tree
#

Game Mode is not replicated to clients.

keen ivy
#

only game state?

sinful tree
#

Well I mean... You could use an actor placed into the level and replicate from that, but Game State is already available and meant to be used as a means to replicate stuff that is common to all players.

keen ivy
#

makes sense

sinful tree
#

ie. Team* Scores

keen ivy
#

was mostly curious if that was the only one which was replicated, amongst game mode, game state, and game instance

sinful tree
#

yes out of those, only game state is something that is replicated and can be accessed by all clients.

#

Game Instance is like the "game" copy itself - accessible only locally, and even clients have it.
Game Mode is only available on server in multiplayer. It doesn't exist at all on clients.
Game State exists on all, and is common between all connected clients.

#

So anything replicated on Game State will exist on the client versions.

keen ivy
#

gotcha

#

thanks for the info

keen ivy
#

kind of random but have you ever had issues setting a custom game state?

#

I set it in my project settings and in my game mode (also a child class)

#

and its always returning game state base when I call get game state

#

is it per map or something?

sinful tree
#

If you used game mode base for your game mode, you need to use game state base.

#

if you used just game mode, then game state should be used as the parent class.

keen ivy
#

got it, thanks

rocky night
#

HI, how can i replicate this?

short arrow
#

I believe this is known as RPC cast

rocky night
#

can i call it in th e npc bp or only in the World bp?'

short arrow
#

That said you can skip the RPC cast and just multicast it if it's called by an AI

rocky night
#

i got what you mean, but this node dont offers to change it to multicast from itself. thats why i struggle here a bit

lapis zinc
#

alr im confused as hell, is unreal "replication" and "listen client servers" only local, like LAN over wifi? How do you make a true online game then without using steam or dedicated servers?

short arrow
#

In which case you'll need to create a new custom event that calls multicast, and then point to it

short arrow
peak sentinel
#

Anyone has any guide or article about how push model works

twin juniper
#

Hello everyone.I have a gun skeletal mesh actor and it is not replicated.the socket transform of that skeletal mesh is not same in both server and client.But the skeletal mesh transform and actor transform is same in both server and client.I am using that socket to attach my camera during scope action.I am problem with it.Thank you

lapis zinc
#

i have had many successful attempts or wifi but never across multiple network connections

twin juniper
#

Hello guys.I am currently developing a game in ue4 dedicated server method.But I am having some problems with socket positions.Is there any way to visualize the server pawns like how they look and their state.Thank you.

winged badger
#

skeletons are disabled from ticking on dedi by default iirc

bronze summit
bronze summit
hybrid zodiac
#

@twin juniper you need to make sure the mesh is set to "always tick pose and refresh bones" in the "optimization" section. By default meshes are set to only refresh bones when rendered ("always tick pose") but since dedicated servers have no renderer then the mesh is in a permanent t-pose

#

You can change it at runtime as well if you want to only enable it for a period of time (e.g. during an attack animation)

#

Unless you need socket positions to always be updated on the server then enabling/disabling it when needed is a good way to avoid too much overhead on the server

brittle yew
#

right now we do an if iOS{DynamicallyLoadedModuleNames.Add("OnlineSubsystemIOS");} else if android{DynamicallyLoadedModuleNames.Add("OnlineSubsystemGooglePlay");} in the build.cs. on a kindle without the google play framework installed we get a startup error message stating that google play is not supported on the device. is there documentation on where and how to check the available subsystem before the error message pops up to change the subsystem to null to avoid the error message?

#

It throws an error message so i think there should be an exception that gets handled via showing the error and changing the subsystem or disabling its features. i just dont know how to find the code responsible for that and i hope i dont have to edit engine source.

#

"[Game Name] won't run without Google Play services, which are not supported by your device"

dark edge
#

Bullet impacts?

cyan drift
#

Hello, i am using the advanced sessions plugin for game sessions on steam, and some players are reporting that after a while they are disconnected from the session.
Does anyone know any possible cause for this?

south rampart
cyan drift
#

oh, I use the first one, Create Advanced Session

south rampart
#

I think I found out what is causing me such a huge headache. Inside editor it works, outside it doesn't. What suddenly becomes active outside of editor -> SteamParty.

This could cause 2 OnlineBeaconHost implementations to become active. I don't know this but maybe that is a bad idea ๐Ÿ˜…

south rampart
#

Create Advanced Session Dedicated has a lot less options. So I would definitely try it out for your dedicated servers ๐Ÿ™‚

#

@thin stratus so yeah I'm not there yet. The TestBeacons you found are pretty similar to the PingBeacons I found. But it was while I was looking at the TestBeaconHost I noticed it inherits from OnlineBeaconHostObject.
Talk about being confusing. Then I noticed pretty much nobody inherts OnlineBeaconHost. It's this that got me thinking maybe the problem lies there

But alas not there yet :/. It simply refuses to work outside of editor still.

ancient badge
#

hey, i have this funtion that is hooked up with a event tick.
https://blueprintue.com/blueprint/r_qd_f55/
For some reason the "Last Card location" isn't replicated to the Listen Server. So the Actor i'm moving in my Second Player isn't moving on the fist player( the listen server)

cyan drift
drifting slate
#

Do root motion montages work with "Run on server" type multiplayer? the animations arent playing on the client side.

round star
#

Can someone point me in the right direction for dedicated server hosting that works well with unreal engine games

#

Nice okay

south rampart
round star
#

Is there a discord for advanced sessions plugin

#

For some rason I thought there was but I cant find it ๐Ÿ˜›

#

So using a dedicated server host...isn't each 'game instance' require its very own VM

regal sand
#

I have two players in a local multiplayer game using controllers, and for some reason, the second controller does not get input

#

When I use a keyboard and a controller, they both work as intended

#

What could be the cause of this?

#

This function is how I find out what player answers first

thin stratus
#

Small heads-up for everyone actively reading this channel right now: We are splitting the Online Subsystem, Session and Beacon topics from #multiplayer .
The new place to discuss these will be in #online-subsystems

#

Please re-direct users if you see them not finding the right channel (: And do so kindly!

#

Yes

south rampart
#

Yes advanced sessions is built upon online subsystem

thin stratus
#

#multiplayer should now "only" handle general Local and Online Multiplayer. Which mostly boils down to replication and the network gameplay coding.

wispy path
#

I am trying to modify the spine bones to correspond to where the player is looking. I found a tutorial online but it doesn't really work for multiplayer. So I tried making a replicated rotator in the character bp and and tried to reference it in the animation bp but it says its not in scope. Is there a proper way to do this or does somebody know a tutorial that works for multiplayer? I havnt found one.

thin stratus
#

I think if you want to use variables in the AnimBP states, you need to have member variables and fill those from the Character

#

So you can't use your Character reference and get the rotator inside an anim state

#

You need to grab it in the EventGraph and save it to a variable in the AnimBP

#

But either way, the look rotation should be available via GetBaseAimRotation @wispy path

#

it has replicated pitch

wispy path
cloud estuary
#
When using either subsystem(right now the default one), and opening two separate instances of the game in any mode (PIE, standalone, packaged, etc...), why can I control the character in only one of the instances, and not both?

My setup goes like this:
A gamemode blueprint, a gamestate blueprint, a gameinstance blueprint, and a player character blueprint. The player character is controlled via the Enhanced Input System and takes the player controller ID from the gamemode, which itself uses OnPostLogin to add the new player to an array and then cast that index to a newly spawned player character. I have player spawns with tags from 0 to 3 and I'm trying to use them via the FindPlayerStart node.
Here's the blueprints:

#

Sorry if the english is a little broken, I'm just very tired.

thin stratus
#

Your PlayerIndex that you feed into the PlayerController and PlayerCharacter nodes is wrong

#

The Index on those nodes is for Local Games

#

You should use 0 as index

#

And that is also kinda wrong

cloud estuary
#

I used 0 as well and it gave the same result

thin stratus
#

If you are inside of a Character, you can use GetController to get the relative controller of that

#

And that also only works on Server and owning Client, cause GetController returns null on other clients

#

And then BeginPlay is too early to get the Controller, that's what the Possessed Event (server only) is for

cloud estuary
#

It's triggered by OnPostLogin

thin stratus
#

I would also check if you have the same issue without the ALS system

#

Well, no you have code in BeginPlay of the Character

cloud estuary
#

Oh, right

#

the context thingy

thin stratus
#

And why is it even trying to get the PlayerPawn

#

You are inside of the Character

#

Like, just use "this"

#

or "self" in BP

#

That is as redundant as it can get haha :D

cloud estuary
cloud estuary
thin stratus
#

PlayerIndex used wrong. Then getting the ID from the Controller, which is the PlayerIndex, and then getting the Pawn, that you are already in

#

I suggest stepping back from that BP and using a simple Character that has basic Movement Inputs

cloud estuary
#

The entire thing is a mess but I'm just trying to get all the players moving lol

thin stratus
#

And then getting back to it once that works

cloud estuary
#

I guess

#

I'll try the thing with a fresh project

thin stratus
#

In addition you should make yourself familiar with the Functions you can override in the GameMode

#

There are a lot of functions you can use to just spawn a Character

#

The way you currently spawn it you can just leave the DefaultPawn as that class

#

And not spawn manually at all

#

Ah well you have custom spawn points

#

You can override the FindPlayerStart or ChoosePlayerStart functions for that

winged badger
#

and ShouldSpawnAtStartSpot, or the first 2 won't work ๐Ÿ˜„

cloud estuary
#

Yep, seems like the player controls work just fine in a LAN listen session with two instances open of a default third person project

#

Thank you guys for helping

#

I'll get learning :)

fierce elbow
#

I've been having troubles changing a value on a clients PlayerController through BP..

I'm basically spawning a player using a UMG widget based on which team they select. I set the PlayerController's TeamID before I pass it to my spawn function, but once inside the spawn function it's showing TeamID as the default -1 that's set in the constructor and not the value we passed in. It seems to work for the server player but not the client
TeamID is replicated. I've even gone so far as to declare a BlueprintCallable function that sets the TeamID within the PlayerController itself but I still only get -1 when spawning as a client

#

Am I just approaching this the wrong way?

kindred widget
#

@fierce elbowYou're setting the value from input. Input is on the client. Spawning is done on the server. Server has no idea or care what the client's value is. You have to set the ID on the player controller on the server.

#

Replication is one way, Server to Client. The one and only way a client can ever talk to anything else is through a ServerRPC through an Actor that the server has set that client's playercontroller as the owner of. Clients cannot do anything else. Anything done on them will be ignored by the server, or overwritten from the server onrep if that value is ever set on the server.

fierce elbow
#

Ahh yea, I'm still pretty new to C++ in general and I just assumed because I was passing the controller to the function afterwards that the changes would be reflected, but I guess it's still going to grab the server's version of that controller and not the clients version.

I added a team parameter to the function and set the teamID on the server in the spawn function and it works now.

Thanks for your help (:

cyan drift
#

Can someone tell me if a player reaches a certain ping limit he is disconnected from the server?

south rampart
cyan drift
regal sand
#

If I am running a function on the client, and I need to send the output to the server, what replication type is that? Client RPC?

kindred widget
#

@regal sand The type is always the destination. So in this case if your client wants to send something to the server, you need a ServerRPC.

regal sand
#

Ok cool. thank you

#

Can I write that function in the gamemode, can call it from the client, using it in blueprints

south rampart
cyan drift
warped berry
#

on the server all player states have a Net Mode = NM_Client , right?

meager spade
#

no

#

server will have NM_ListenServer or NM_DedicatedServer

#

what made you come to that conclusion?

warped berry
#

because there's the HasAuthority() I thought it should be different!

#

I mean when to use the Role and when to use the net mode, there's no difference then, right?

meager spade
#

there is a lot of difference

#

an Actor will have ROLE_Authority on whatever spawns it

#

so a client can have ROLE_Authority actors.

#

when connected to a multiplayer game, you can always rely on GetNetMode to return NM_Client if its a client, or < NM_Client for any type of server.

#

but roles are also crucial

#

ie, if an actor is LocalRole ROLE_Authority and RemoteRole is ROLE_AutonomousProxy, then we know that actor is the server version of a clients locally controlled actor.

#

if LocalRole is ROLE_Authority and RemoteRole is ROLE_SimulatedProxy, then we know this is the servers version of a replicated actor that simulated proxies see.

warped berry
hollow eagle
#

You can't have different net modes per actor

meager spade
#

that is not possible

hollow eagle
#

netmode represents the local program's mode of operation

#

it doesn't say anything about the actor

meager spade
#

the server will always have NM_ListenServer or NM_DedicatedServer

#

GetNetMode is based on the NetDriver

#

not the actor.

#

Single player, non network game, will be NM_Standalone

#

so yes, the server will have NM_ListenServer or NM_DedicatedServer for the playerstates as you said

#

it will also be ROLE_Authority

#

on the actor.

warped berry
#

yea okee, so I'm iterating over PlayerArray and I wanted to know which player state is the host's one

meager spade
#

you cant do that ๐Ÿ˜„

#

tho granted host is normally the first one

#

but i would not trust that

warped berry
#

yea because it doesn't replicate same order everytime

meager spade
#

it doesnt replicate at all.

#

PlayerArray is not replicated

warped berry
#

ah yea it gets filled locally, I meant like when the GS does

meager spade
#

when a playerstate replicates, the PS tells the GS to add it to the PlayerArray

warped berry
meager spade
#

anyway to find the host, you need to cache who the host is

#

cause it does not work like that.

#

btw listenserver is always the host

#

if your dedicated server, you have no host.

#

so not sure what the problem is?

warped berry
#

yea I don't have a dedicated server

meager spade
#

you mean you want clients to access the host player?

#

that sounds like a bad design choice, unless its for a widget

warped berry
#

the thing is: I wanna make a lobby when the host can have a kick button on all other players but not his own item in UI xd

meager spade
#

then like i said, you want to flag the listen servers playerstate with some bool.

#

We use steam, and i have a function that the UI asks steam who the lobby owner is, and sends in the users steam id, this returns true if that is lobby owner

#

so i can show the kick buttons, etc

warped berry
#

hmm nice xd, I use steam too, but idk, I didn't want to put subsystem code in UI

meager spade
#

wrapper functions ๐Ÿ˜„

#

you could cheat a bit

#

if GameMode is valid

#

you are host

#

if not, you are not host

#

job done, hacky af, but it will work.

warped berry
#

haha koool

meager spade
#

works ok for listen servers

#

another thing you can do

#

use the IsServer bool

#

if that is true, show kick buttons

#

else, dont show them

#

a non-hacky solution

warped berry
#

that bool is in steam right?

meager spade
#

no

#

right click any BP

#

and type IsServer

#

if that is true, show kick buttons, else don't

warped berry
#

in c++ it is in gameplay statics?

meager spade
#

or just do GetNetMode() != NM_Client

#

in the widget

#

bool bShowKickButtons = GetNetMode() != NM_Client;

warped berry
#

oh that's why I started to ask here cause I used that but it just hides them all

meager spade
#

that will not hide them for the listen server

#

listenserver netmode is always < NM_Client

#

unless you never join into the game

#

and this is pure lobby

#

if you are not connected to the host, via open <steamid>

#

then you need to mark the playerstate of the lobby owner

#

and check that.

warped berry
#

yea true, though I get the net mode of the player state from PlayerArray

#

thank youuu, I will try these solutions and see

merry steppe
#

heya, I've been researching this the past couple of weeks and I'm wondering whether there is a best practice for this.

In the multiplayer combat action adventure we are making the attacks move you forward similar to how it is in Dark Souls or Fable. You can chain your attacks, which means you can interrupt your first attack after a point and start a 2nd attack.

The problem I'm having is that if I use animation root motion then there's gonna be a desync as the client interrupts it's own ability, that the server receives later, so root motions do not end at the same time, hence why the desync.

Am I doing something wrong with the animation root motion cancelling or is this a scenario where they are not as useful for network replication?

twin juniper
#

Anyone know why calling "DestroyComponent()" from a server function isnt replicating down to clients? Trying to destroy a sphere collision thats being used to test overlap for picking up items, goal is to prevent equipped items from being picked up. Currently the comp gets destroyed on the server but still exists on the clients allowing other clients to yoink the item from the players hands/body/etc

peak sentinel
#

Actually that makes sense since components are initialized on actor spawn, Epic might never needed to replicate it

#

So you might need to use a multicast

twin juniper
#

@peak sentinel hmm interesting, I will keep messing around with multicasts and see if I can get that to work. thanks!

peak sentinel
#

Dont forget to check if the component is valid or not on multicast

#

Only attempt to destroy component is valid

#

Good luck

half jewel
twin juniper
#

@half jewel yeah I think any of these solutions would be fine, just having issues getting anything I do to this component to replicate to clients, whether from server function or net multicast

cyan drift
#

Hello, i am receiving a warning on output log saying that there's no owning connection for actor and a function won't be executed. Anyone know how can I solve this?

sinful tree
twin juniper
dark edge
pearl moon
#

So I'm at the point in my game where I'm ready to start setting up a dedicated server to host game sessions for players. I've taken a couple of courses and did some minor research here and there with the overall functionality of unreal's built in multiplayer features. However, I haven't really found any clear examples of how to set up a server / client model that allows multiple connections over internet or just over LAN. Are there any built-in unreal engine functions or BP nodes to allow you to send and receive objects or other data to another separate unreal project? Closest I found was a plugin called Object Deliverer, but haven't been able to get it to work over a LAN connection to my server running the other unreal "game"

hollow eagle
#

If you're just setting up a dedicated server, why are you trying to communicate with a separate project?

round star
#

Let me get this right. A benefit of a dedicated server is that it doesn't have to render the game, only crunch the logic and replicate data to clients. In theory, does this increase performance of the logic then?

hollow eagle
#

It means the process has to do less overall. That may increase performance (if the game is gpu-bound), but it also means the hardware requirements for the server are lower (no GPU required, more servers can fit on a single VM/machine or you need a smaller VM size/lesser hardware).

#

Anything related to visuals (that doesn't affect gameplay) can also be turned off which means the server has to do even less.

round star
#

I need to hire someone or a team even to do networking ugh

#

Listen server stuff is simple enough I can do most of it..but when it comes to managing a dedicated server I just ...idek where to begin

#

Im at a part where I am just seriously overwhelmed. I've done everything myself and now I feel lost and have no idea how I am going to do networking

edgy valve
#

Hi Guys, does anyone have any links where i could learn how to expose some functions from the steam API to blueprints , i have no experience with C++, So far i have learned how to expose a function to blueprints, but to use the steam sdk and expose its functions looks very complicated to me, any help would be much appreciated !

peak sentinel
peak sentinel
#

It should be exposing them to BP

edgy valve
# peak sentinel Check out Advanced Steam Sessions

Man i was doing that just now haha, I'm overwhelmed with all this information man... I will graduate next year, i've learned java and i thought i would be able to learn the different aspects that C++ has, but honestly man... I feel like i can't call myself a programmer, C++ is SO different from java there is so much stuff that i never heard of, i'm feeling really sad today, this is the first time i feel like i have lost all hope๐Ÿ˜ข

peak sentinel
#

Never worked with Java, but from what I've heard its just very similar to C#, UE's C++ workflow should be easy to understand after a while

#

Check out Cherno's youtube channel, he explains core structures of C++ very well

distant talon
round star
#

it feels so daunting

distant talon
#

Ah yeah, that can be annoying. It's often easier to just grab a spare computer and throw your dedi on that especially at first

#

or running it in the background on your dev machine can work too if you only need the server up now and then

wanton marlin
#

I watched a video on networking

shy aspen
#

@round star don't be discouraged - it's not as difficult as your mind might make it out to be ๐Ÿ™‚

hoary lark
#

you don't have to do pre-hosted cloud servers like AAA games do... self-hosted dedicated servers (used to peeposad) exist too FYI ๐Ÿ˜„

#

sounds like you're trying to wrap your head around building your dedicated server package and also renting a VPS or something to run it

thin stratus
#

@edgy valve @peak sentinel Try to use and redirect to #online-subsystems for this in the future please (:

peak sentinel
#

Okay eXi, thanks ๐Ÿ™‚

ancient badge
#

Hello, can anyone tell me why my "Print String" is giving me the right numbers for the "host" player but only 0 on XYZ for the "Connected" Player?

#

This is inside of the "Player Controller BP"

#

Trigger Event is a RPC with "Run on Server"

twin juniper
#

@winged badger @bronze summit @hybrid zodiac Thank you.It worked like a charm.

sinful tree
ancient badge
#

@sinful tree So, make them to a Variable and set them to "replicate"?

sinful tree
#

Then you can pass the values from the client:

#

Then you'd have to add those inputs on to your function as well:

ancient badge
#

@sinful tree Thank you very much! i checked all my variables but never even thought about this two.

hybrid zodiac
#

@twin juniper You're welcome! Good luck!

twin juniper
digital current
#

What is the default region (the one you set in the downloads tab) when you create a session on steam server browser?

#

and where can I change it

twin juniper
#

is there a special way I should be passing actor references to a net multicast function that gets called from a server function? The server function spawns an actor to the world, and tries to pass a reference to the net multicast function, but the reference is invalid for all clients but is valid for the server

twin juniper
#

^ still not totally sure what the problem here was but I fixed it by calling the server function from the actor itself rather than the character/actor that owned it

silent valley
#

Or store pointer to the new actor in a replicated var and it will eventually resolve on clients it is relevant for.

hollow flicker
#

Hello, in this current ,,system" my server is able to do everything as planned (dig up a chest), and the client sees everything. My client can dig up that chest aswell, but the server does not see it happening. How could I let the server see the change aswell or just always let the change happen on the server?

kindred widget
#

@hollow flicker You shouldn't be calling server RPCs and then doing the same thing on the client. Not without a thorough understanding of prediction methods. Keep things simple. Handling controls like this in the overlapped actor can work, but you also need to handle how your RPC to server. For instance here, with your exact setup, if your client walks over this actor, even your server can press Y, cause you're enabling it on that client and the player0 on the server.

#

Also here, if your client overlaps and presses Y. What is happening and why the server doesn't see it, is that you're pressing Y, calling a server RPC, then doing the logic locally. The issue is that the RPC is never going through. That client does not own this actor, and therefore cannot send RPCs through it. So the RPC never actually happens.

#

@twin juniperPart of your issue is calling RPCs shortly after spawning. RPCs are sent and forgotten. If the RPC arrives on the client before the actor replicates to it, the pointer won't be valid.

south rampart
hollow flicker
south rampart
#

It would be weird if advanced sessions disconnected players by default for high ping

kindred widget
#

@hollow flickerThe client would need to own the actor to call RPCs from it. You can set this on the server from the overlap, or you can reroute the RPC through some more generalized function in your client's controller or character.

drifting slate
#

I'm having a similar issue to Bruce. My client cant see the server attacking, but everything else seems to work fine. Here is mine to add to the picture. This is all in the Character Blueprint.

hollow flicker
thin stratus
#

Can more than one Client use that Actor, Bruce?

kindred widget
#

You could make an assumption that if it's overlapping on the client, it'll overlap on the server. Can be safe for handplaced things. You just set the owner as the overlapping character's controller. But this will lead to issues with the last or first character always having control.

thin stratus
#

Like, can 2 stand in the Overlap and interact with it?

#

Generally, there is little need to set an Owner on overlap, unless it's an Actor that is picked up and only belongs to one player for that duration.

#

The better idea is to have a place in your Controller, or a Component on that, through which you route RPCs

#

And to already RPC in the Character when starting your interaction.

#

E.g. Press E -> RPC -> LineTrace
or Press E -> RPC -> Interact with current overlapped Actor

#

The RPCs shouldn't need to happen in the Actor you overlap

#

And it will become problematic if you have an Actor that needs to be interacted with from more than one Client at a time

#

Because only one can own it at any given time.

#

It's safer to just not use the SetOwner function then, and RPC in the Character/Component/Controller/whatever fits your system

hollow flicker
#

@thin stratus Two players could stand there and interact with it, yeah. I didnt know there could only be one owner at a time, just setting the owner probably wouldnt be a good solution then. How would I go about routing RPCs through my Character?

toxic lion
#

I'm having some trouble debugging an issue here
I'm working with Logic Pro, and on a state, I am choosing a waypoint to move to, and then traveling towards it

#

Here is the logic for choosing the waypoint

#

The problem is, that the point chosen in the Chose Next Patrol Point function, and the returned value in the state are often different

thin stratus
leaden atlas
#

where in the code does the client send the request to join the server?

#

i want to change the login URL that the client sends

thin stratus
#

You mean when you call JoinSession?

leaden atlas
#

is that what its called?

thin stratus
#

Idk what you are doing so

leaden atlas
#

i dont know how the client connects to a server

#

is that in game instance?

thin stratus
#

How are you connecting to a server to begin with

leaden atlas
#

open ip:7777

thin stratus
#

Then you can just pass stuff along there

#

open ip?Key1=Value1?Key2=Value2

#

But you need C++ to retrieve that in PreLogin and Login in the GameMode

leaden atlas
#

yeah

#

i want to change it so that it stops sending the computer name basically

thin stratus
#

There are other ways to do that

#

You could just override how the PlayerName is returned

leaden atlas
#

i'd prefer not to

dull lance
#

Why is not sending the computer name important?

hollow flicker
leaden atlas
#

my playtesters dont like it

thin stratus
dull lance
#

Hmm, are you using their computer name as a "player tag/ID" in game?

leaden atlas
#

im using PlayerName from PlayerState

#

the client seems to send the computer name as part of game mode login

dull lance
#

For test builds that are not implementing a specific / finished subsystem, I usually just assign random names and store them

#

The online subsystem eventually takes care of that (steam/aws/etc)

leaden atlas
#

i might end up using the null subsystem

#

or whatever is it whenever you dont use one

#

and just join by IP

#

are the unreal docs down?

dull lance
#

their websites have been rocky this past week, a lot of 404's

leaden atlas
#

eugh

dull lance
#

Either way, I'd just assign them a random name on join and use that instead

#

until you have a production-valid user name assigning method, their names don't matter

leaden atlas
#

im just curious like, where in the code

thin stratus
#

Best thing would be just override the part that forwards the PC name

leaden atlas
#

yes exactly

#

that's what i want to do

#

where in the code does it send the computer name as part of the connection URL?

#

on the client side?

#

i found where it receives it on the server side but i cant find the code where it sends it on the client side

thin stratus
#

I would check the LocalPlayer class

dull lance
#

That, and/or you might be able to find it by searching the declaration of the open IP command , then follow that line of instructions

thin stratus
#

open ip is a bit overdoing it

#

Becaues that's really hard to follow

#

Just check the ClientTravel function and go from there

#

Sits in the PlayerController

leaden atlas
#

ClientTravel is actually a lot more helpful

#

i can just breakpoint that and look at the callstack

#

thanks

thin stratus
#

It's further down the line

#

There is a function in the LocalPlayer to return options when connecting