#multiplayer

1 messages · Page 683 of 1

peak sentinel
#

its only happening when i have multiple players
whats the possibility you are on PIE and running 4 instances in same machine?

winged badger
#

yes, and its supposed to

#

if you don't wish to play some effects from a repnotify, include a timestamp, and sync them between server/clients

peak sentinel
winged badger
#

there is no difference between recently changed property and property changed hours ago

#

changes are not timestamped themselves

#

and client decides on firing repnotify or not,

carmine ember
#

Yeah i get that, but the point is whether or not it is fired for events before the client connects

winged badger
#

the actor property is changed from the CDO value

#

when actor first replicates, it replicates all its delta properties in same package

#

which will trigger RepNotifies, if they are configured to fire

carmine ember
#

ah okay and then if the value is that same as it was in the CDO, the rep notify doesn't need to be fired

winged badger
#

you have one bit of grace there, RepNotifies for changes that happened before the client joined (initial replication) will happen before BeginPlay on clients

carmine ember
#

i just need to figure out why they're not firing on join then

#

thanks!!

winged badger
#

(before the client joined = initial replication)

#

on clients, its PostNetInitialize that calls BeginPlay, and that is called right after the initial RepNotifies

#

(for replicated actors)

carmine ember
#

oh i see

#

thats handy to know, thanks!

winged badger
#

side note:

#

if you do deferred actor spawning on server

#

you can set some variables before you finish spawning, before begin play is called

#

and that allows you not to have to branch the logic on BeginPlay for client and server

#

as both can then inject some replicated properties and call set/repnotify prior to BeginPlay

#

makes for much cleaner code for actor that require some data injection at the time of spawning

slate patio
#

I'm working on my firing still. When Fire from the client it is only accurate when I'm in view of the server. I'm using predict projectile trace from the weapon class itself. What do you think I could be missing.

distant talon
#

Anyone had luck with making dynamically created components net addressable without replicating them?

#

Need to conditionally spawn some components without replicating them and it'd save a lot of work, they get saved to the same pointer in the same class so i think there might be a way to force it

vague spruce
#

sup. i've been doing some research on NetSerialize for a struct but i'm not able to find the answer on google.

i'm inheriting from a struct that requires me to setup NetSerialize and i have a TWeakObjectPtr<AActor> TargetActor field that i need to send over the wire. do i just need to write the actor to the buffer using Ar << TargetActor and i'm GTG? or will this have problems deserializing?

distant talon
#

About the thing i just asked about. It seems to just work by setting SetNetAddressible() as long as the component name is unique for that actor.

winged badger
#

normally component is net addressable if it has a stable name on a net addressable actor

#

you would need to spawn a component on both the server and client (on the same actor ofc), with the exact same name

#

then call SetNetAddressable(true)

distant talon
#

Yep, that works! Good stuff.

winged badger
#

@vague spruce i recommend giving the FHitResult::NetSerialize a look

#

its an excellent example of how to do NetSerialize

vague spruce
#

perfect

#

THANK YOU

winged badger
#

they are not

#

ai controllers dont normaslly exist on clients

vague spruce
#

as i have it understood, actors that are replicated on clients are proxies. AI are simulated proxies. if something specific needs to happen to an actor on every client, you probably need to do a multicast to all of the server's clients. if the simulated proxy doesn't exist on a client, then the pointer would just be NULL. that's my understanding at least, it's very likely i'm wrong

winged badger
#

proxy is just what the engine calls their role

vague spruce
#

what i mean to say is that the actor is server controlled and all of its behavior lives on the server and is replicated to clients. that's my understanding of proxies within unreal

winged badger
#

replicated actor on client is actor like any other, it has a NetGUID that matches the server instance, and an actor channel

vague spruce
#

right right, it's just another replicated actor

winged badger
#

that allows it to send RPCs and get updates to replicated properties

vague spruce
jagged flax
#

How can I optimize pedestrian NPC on open world multiplayer game?

gaunt cliff
#

anyone has an idea ?

rose pilot
#

Hi all, I packaged development server and launched in my local machine and when I join using open 127.0.0.1 from my editor then I can join the game hosted on the local machine. However when I built the development apk and try to connect using open 127.0.0.1 or 192.168.0.1, I cannot join the server from my android. My pc and android are connected over same wifi. Why I am not able to join?

rose pilot
#

I can't move forward unless it is solved

#

It would be great if someone can guide me to get through the issue I am facing.

silent valley
rose pilot
#

I guess the issue is port forwarding.

#

Can you help me with that/

#

?

small tartan
#

Any ideas how to get windows client to connect linux dedicated server.
Client error message UEngine::BroadcastNetworkFailure: FailureType = NetChecksumMismatch hints that game in server and client missmatch but full rebuild(s) did not help. Everything works agains locally run windows server. Linuxserver is crosscompiled on windows.

silent valley
vernal cobalt
#

why isn’t the client possessing the pawn that it is supposed to be?

twin juniper
#

is it intended behavior for the "skip owner" replication not to skip the owner if it is the listen-server? That's what I notice when using this condition

sinful tree
#

If the owner is the listen server, then you're setting on the server anyway.

sinful tree
twin juniper
hoary lark
#

@gaunt cliff is the new inventory item not replicated somehow? If so why bother with a second message over the network, can't you trigger things client-side without your broadcast event?

gaunt cliff
#

No its replicated

#

I'd like to update the UI based on the inventory

#

if you add a new skill the icon and info pop up in the inventory

#

afaik UE4 doesn't have reactive programming

#

so watching for value changes isn't possible

#

however broadcasting them is the solution

#

but for some reason, trying to broadcast them (even with a UFUNCTION(Client, Reliable) ) doesn't work

#

it only prints on server

hoary lark
#

Run some code on Begin play, run some code in a variable's onrep... You don't need to send the info twice

#

Not sure why you're having issues with what you did try though, you'd have to send full code I guess

gaunt cliff
#

its on RPGCharacter.cpp

#

can I DM you ? @hoary lark

vernal cobalt
#

i checked again and the pawn is being possessed by the controller

#

but i can’t seem to move the pawn at all on the client now, any ideas?

unkempt tiger
#

Anywhere I can read the 'separate process' PIE session server's console output before it crashes and the console window closes?

#

Yes, PIE advanced settings -> network emulation settings

jagged spade
#

You can add this line to DefaultEngine.ini

[PacketSimulationSettings]
PktLag=120 ;Ping

Or console command:

net pktlag=120
kindred widget
#

@vernal cobalt You need to call possess on the server version of the controller. If you're doing that, something is off with your input bindings.

#

If it's a turn based game, sure. If it's realtime, anything over 140ish is probably pretty bad.

#

I wouldn't intentionally kick them. If they want to try to play at that latency, let them I suppose. Intentionally kicking them is going to be bad business. You're going to see reviews popping up like "Devs enforce strict network, I have to pay $100 a month in my area to get good enough net to play this game"

meager spade
#

with dedicated servers the only person who will be suffering is the client (unless the server is having issues..)

kindred widget
#

I mean. 1 to two seconds is a mildly different story. Even international latency is like 350 at it's worst through satellite relays. Two seconds is reaching some standard timeout ranges. Serious gamers aren't going to care, as they'll make sure their net is good enough to stay < 30-60. Average players can stand up to 100ish. 150 is kinda pushing fast paced boundaries. 200 is pretty much unplayable for fast paced games, but is perfectly acceptable for anything turn based, or less APM spamming required.

meager spade
#

the player will d/c automatically if it gets too severe, engine handles that (you can adjust those timeouts/limits), but i would not kick someone for having a bit of lag.

pure hearth
#

I'm trying to change a Value of a Actor from Player i was actually trying with a array but it didn't worked so i decided to test a single value and it still don't work

#

tried using GetRemoteRole() but it didn't worked either

sinful tree
#

Think you meant to use something other than < ROLE_Authority

meager spade
#

@sinful tree that would fail tho

#

nvm was thinking netmode, role has auth last..

#

just check if (GetNetMode() == NM_Client) { ServerRPC } else { blah }

#

also ensure your actor is replicated, and its owned by the player issuing the server rpc

winged badger
#

i am of two minds about that, HasAuthority() is simpler and faster to type in, ROLE_AUTHORITY has different syntax coloring which makes it easier to skim through later

pure hearth
meager spade
#

does the client calling the RPC own the actor?

#

you do know about ownership right?

pure hearth
#

didn't knew about that

#

how would i do that? the actor needs to be placed on the level before the game starts

#

on the Editor

#

did something like this gonna test later

#

it's not good for multiplayer but i will just test

solar blaze
#

Hey all, so I'm having a problem with CMC and Client Prediction. What I'm trying to do is a jump with a buffer with the game running on 60fps.
The way it works is if you release jump within a time frame, 5 frames in this case, you would do a low jump at the 5th frame. If you don't release in that time frame you normal jump at the 5th frame.
Currently whenever I jump, regardless of the type, it will hit the 5 frame mark on the client, but never reach the server and stay on frame 4 so no jump and client corrected.
I haven't tried using a timer yet (though I may have too) because I want it all in tick.

#

any help would be greatly appreciated

subtle veldt
#

Is there a good tutorial on advanced sessions Find Sessions

#

What is the simplest way to let two people on internet connect for 1v1. Do I need to setup an amazon gamelift (or similar)

#

I am wonder how this works at a high level. For example, does Epic or Steam run a free server everyone can connect to. Otherwise how do you do p2p even without specifying IP addresses

meager spade
#

use Steam Lobbies or EOS Lobbies

#

Steam Lobbies are easy, and steam does nat punchthrough

#

i don't know much yet about EOS.

small tartan
#

why it is needed?

#

do something like this

small tartan
#

what information from the player is needed? just add those to events parameters

#

My question about NetChecksumMismatch seems to be asked here several times, but not a single answer 😦

#

why it is need to know?

#

for scores?

#

why just not destroy sword and then create one ?

rose pilot
#

Hi, I am using wheeled vehicle and they seems to jitter when playing multiplayer. One possible solution is smoothly interping the location and rotation when new replicated movement is received to the client. So is there a function which I can override to do this stuff before the movement is updated on the client?

#

There is a virtual function called PostNetReceiveLocationAndRotation() but is not called for simulating physics. Is there an alternative ?

#

He is a wheeled vehicle

#

That's not my issue.

kindred silo
#

Is this node true on the server too or it is true only on owning client/autonomous proxy.

subtle veldt
#

local multiplayer how to make second xbox 360 controller attach to second create player

rose pilot
rose pilot
subtle veldt
#

I followed this tutorial https://youtu.be/3lN2eZIgAQ0 to spawn two players

UE4 / Unreal Engine 4 Multiplayer Playlist:
In this collection of videos, we will cover setting up a project for both local and networked multiplayer projects.

This Video:
In this video, we create a flexible player spawning system for local multiplayer games.

Links:
Udemy Game Prototype Course Coupon: https://www.udemy.com/unreal-engine-4-lear...

▶ Play video
#

It spawns two players. However, only one of my two xbox controllers works

#

for local multiplayer - two player actors controlled by two xbox controllers

subtle veldt
#

actually it's really weird if i alt+tab back and forth then it works

gaunt cliff
#
/**
    * [server] adds a projectile to inventory
    * @param ProjectileClass    Projectile to add
    */
    void AddProjectile(TSubclassOf<ARPGProjectile> Projectile);

    /**
    * [client] used exclusively to broadcast Projectile Addition to Inventory
    * @param ProjectileClass Projectile to add
    */
    UFUNCTION(NetMulticast, Reliable)
    void BroadcastProjectileAdded(TSubclassOf<ARPGProjectile> Projectile);
#

cpp:

void ARPGCharacter::AddProjectile(TSubclassOf<ARPGProjectile> Projectile)
{
    if (Projectile && GetLocalRole() == ROLE_Authority)
    {
        Inventory.AddUnique(Projectile);
        
    }
    BroadcastProjectileAdded(Projectile);
}

void ARPGCharacter::BroadcastProjectileAdded_Implementation(TSubclassOf<ARPGProjectile> Projectile)
{
    OnProjectileAdded.Broadcast(LoadProjectileDataFromClass(Projectile));
}

void ARPGCharacter::RemoveProjectile(TSubclassOf<ARPGProjectile> Projectile)
{
    if (Projectile && GetLocalRole() == ROLE_Authority)
    {
        Inventory.RemoveSingle(Projectile);
        BroadcastProjectileRemoved(Projectile);
    }
}
#

@violet sentinel sorry for the ping, just making sure you're here 🙂

violet sentinel
#

so your broadcast_impl is not called on clients?

gaunt cliff
#

nope its not, only on server

violet sentinel
#

set breakpoint there, check if the method is being executed twice (one on server, second on client)

#

also broadcasts must be called from server too so you can move it under authority check in AddProjectile

gaunt cliff
#

Add_Projectile is called from SpawnDefaultInventory(); which is server only function

violet sentinel
#

then why authority check there?

#

make check(HasAuthority());

gaunt cliff
#
    void SpawnDefaultInventory();
void ARPGCharacter::SpawnDefaultInventory()
{
    if (!HasAuthority())
    {
        return;
    }

    int32 NumProjectileClasses = Projectiles.Num();
    for (int32 i = 0; i < NumProjectileClasses; i++)
    {
        if (TSubclassOf<ARPGProjectile> NewProjectile = Projectiles[i])
        {
            AddProjectile(NewProjectile);
        }
    }

    // equip first projectile in inventory
    if (Inventory.Num() > 0)
    {
        EquipProjectile(Inventory[0]);
    }
}

violet sentinel
#

is it called early?

#

there may be the scenario

server spawns actor
server makes inventory
server broadcasts inventory
client yet to create actor so nothing happen
client spawns client actor
...

#

thats why broadcasts are bad choice for that

#

making field replicated would be preferred

#

with FFastArraySerializer if it is a complex struct

gaunt cliff
#

its called on BeginPlay

violet sentinel
#

doesn't matter

#

client would initialize much later

#

never trust beginplay in mp

#

you can add a log in beginplay to see when client actor is created

#

and in server init inventory

#

you would most likely see server:onconstruction server:beginplay server:spawninventory client:onconstruction client:beginplay

gaunt cliff
#

just to be clear, I plainly use UE_LOG and it will prepend server/client right ?

violet sentinel
#

yeah you can

#

i do own helpers for current world name or you can use Kismet PrintString that has instance name automatically added

gaunt cliff
#
LogTemp: Warning: Construct
LogTemp: Warning: Begin Play
LogTemp: Warning: Spawn Default Inventory
LogNet: Join succeeded: DESKTOP-XXXX
LogTemp: Warning: Construct
LogTemp: Warning: Construct
LogTemp: Warning: Begin Play
LogTemp: Warning: Spawn Default Inventory
LogTemp: Warning: Begin Play
LogTemp: Warning: Spawn Default Inventory
#

I suspected the first 3 messages are server, the other messages are client 1 and 2

#

so you are most likely right

violet sentinel
#

tldr: use Replication for sending STATE, use Broadcasts for sending EVENTS / Actions

#

and inventory is obv a state

gaunt cliff
#

hummmm

#

Okay let's go to a different part of the code where the issue is the same

#

however it has no relation to events happening in begin play or not

#
void ARPGCharacter::ServerHandleCooldown_Implementation(TSubclassOf<ARPGProjectile> Projectile)
{
    // if neither LastFired OR Cooldown is set, just return true and it will be set after projectile is shot
    if (!LastFired.Contains(Projectile) || !Cooldowns.Contains(Projectile))
    {
        bCanShoot = true;
        return;
    }
    float ProjectileLastFired = LastFired[Projectile];
    float ProjectileCooldown = Cooldowns[Projectile];


    if (GetWorld()->TimeSeconds > ProjectileLastFired + ProjectileCooldown)
    {
        bCanShoot = true;

        OnProjectileCooldownEnd.Broadcast(Projectile);
        return;
    }


    bCanShoot = false;
}
#

OnProjectileCooldownEnd is never broadcasted to clients

#

which is an action/event by your definition, so this use case of delegates is correct

violet sentinel
#

whats the declaration of method / ufunc

gaunt cliff
#
UFUNCTION(Server, Reliable)

🤦

violet sentinel
#

are cooldowns long?

gaunt cliff
#

I tried 2-5 seconds

violet sentinel
#

well, you found why it is not called on clients i assume

#

but if I was making it i'd have it on both client and server:
on client side as cosmetic timer that locks use button or whatever (check cooldowns on server on attack action)
on server: if shot set server timer that locks the action and trigger client cooldown via broadcast or direct RPC

or/and by replicating bool bCanShoot

gaunt cliff
#

cooldown works perfectly, jsut the broadcast event to not being fired

#

or atleast

violet sentinel
#

well. the event is called on server

gaunt cliff
#

it prints Server: Hello

violet sentinel
#

and you need for client to do same?

gaunt cliff
#

yes I suppose

#

I think I'll need to rethink the whole system from bottom up

violet sentinel
#
ufunction(client,reiable)
void ClientNotifyCooldownEnd(TSubclassOf<ARPGProjectile> Projectile);

ClientNotifyCooldownEnd_Impl(TSubclassOf<ARPGProjectile> Projectile) {  bCanShoot =true; OnProjectileCooldownEnd.Broadcast(Projectile);  }

after 
 OnProjectileCooldownEnd.Broadcast(Projectile); // this would be the regular server call
add 
 ClientNotifyCooldownEnd(Projectile); // this will call on that client
#

so that exact client will receive notify

#

instead of broadcast that will go to every client

gaunt cliff
#

I will try that and post back

#

thank you for your time and help ❤️

gaunt cliff
#

playing around with it it seems that other broadcasts are working

#

the only issue is the one with begin play

#

where would I call SpawnDefaultInventory to avoid the issue ?

violet sentinel
#

nowhere, make the inventory replicated property

granite berry
#

I am using the Possess node from my player controller to allow a player to take possession of an already spawned ship. Running a custom event that executes on server. It allows my player to possess the new pawn and move around but none of the other clients see the new pawn move. The ship pawn is set to replicate.
It's a pretty simple setup and there seems to be a lot of arguments out there about the right way to do this.

violet sentinel
#

is it spawned correctly from server?

granite berry
#

Well it is placed in the level from the start and other clients can see it. They just never see it move when the first client takes possession

violet sentinel
#

does the pawn have "replicate movement" checked? what movementcomponent it using?

granite berry
#

Yes it does

#

and it's using the movement component from the default pawn

violet sentinel
#

so FloatingMovementComponent ? it does not have replication support afaik

#

you need to implement it

granite berry
#

Oh... well that's unfortunate. Also, not mentioned anywhere I could find

violet sentinel
#

or get a plugin with implemented replication for FMC

#

or github

granite berry
#

Weird. It seems like a very common thing to want to do.

violet sentinel
#

pretty much always implement own movement component for anything other than Characters

granite berry
#

Sounds like a lot of work I did not want to be doing.

#

thanks a lot for the info

violet sentinel
#

it isn't really much

#

either that or try using Controller location/rotation

#

or make user input handlers send rpcs to server with movement commands (depends what game is)

granite berry
#

Well I'm not that well versed in Unreal so it might be more work for me 🙂

#

To be fair, the movement controller wasn't really doing it anyway. I am having the player control a spaceship but I want the movement to use acceleration

#

I'll try to look into rpcs and controller location/rotation

violet sentinel
#

then you definetly need movement component

granite berry
#

Which does not support replication?

#

Or is that just the movement component from the defaultPawn?

vivid seal
#

is PostNetReceive called before or after replicated properties are set

cyan bane
#

I think I found a jitter issue with all rotating replicated movement physics objects. Is anyone able to confirm this?

kindred widget
#

Physics isn't deterministic. So client will almost never be identical to server. So if server replicates a new state often, it'll make the client look like it's jittering.

cyan bane
#

I know, but it shouldn't be getting out of sync a couple times a second just by rotating

#

There's no jitter when it's just moving forward

kindred widget
#

If you're really intent on replicating physics objects, then make a struct of Location, Rotation, Angular Velocity, and Linear Velocity. Interpolate these values from client's current to the server set replicated values on tick. If it's too close, set it explicitly instead of interpolating. Doing this will allow you to replicate less changes, even as low as maybe 5-10 times a second, and will keep client pretty much in sync of with server.

#

This will give the client a visually similar experience to the server, though it'll still lag behind of course. You can optimize by disabling tick on the objects that aren't moving, and enable tick in the OnRep.

cyan bane
#

I've actually got that working as my backup solution, it's just not ideal as it really does lag behind enough that it's noticeable when pushing objects

#

At least with the way I've coded it, as it uses a short buffer so there's no stutter

kindred widget
#

Realistically, you'll probably have slightly better gameplay code with a projectile component.

cyan bane
#

I hadn't thought of that

kindred widget
#

It can be pushed and bounce in a similar manner to a physics object.

limber gyro
#

Is there a way to set how long it takes for the client to timeout from the server?

kindred widget
#

Semi sure that's an ini file setting somewhere.

#

Vague google search says to set the ConnectionTimeout value in DefaultEngine.ini. So the following for 10 seconds I think?

[/Script/OnlineSubsystemUtils.IpNetDriver]
 ConnectionTimeout=10.0
limber gyro
limber gyro
#

im trying to debug some timeout issues and a thread says that you need "networking" and "sockets" as dependencies added, i understand networking but isnt sockets suposed to be included with the "networking"? i mean, u cant have networking without sockets, would not add the "sockets" dependecie make a diference?

molten matrix
#

What happens if I try to move/rotate a replicated actor on the client-side? Will it do nothing or will it just update on that client until it gets overridden by the replication from the server?

I have a replicated actor that is turning towards a target angle using a RInterpConstantTo. Seems to work fine on the server but on the client it seems to be really choppy. I'm running the RInterpConstantTo code both on the server and the client, so I'm thinking that maybe the reason for this is that the SetActorRotation does nothing on the client, and I'm just seeing the angle update when the rotation replicates from the server.

limber gyro
limber gyro
#

if its not working there are some variables that you can set that might help

#

but those are on a movement component and you didnt specify what your trying to move even has a movement component

#

if it does try: bIgnoreClientMovementErrorChecksAndCorrection = false

#

also

#

bServerAcceptClientAuthoritativePosition

molten matrix
#

Hmm interesting. I'm using a PawnMovementComponent so it doesn't have those properties.

If I disable my code from running on the server too, everything works fine. So it seems to be some kind of interference from the server that is messing with the client-side prediction.

hoary lark
#

saw your graph in #cpp it looks like your rotations are incrementing in 1.4 degree increments (360/256) so my first guess is that you or the engine are simply compressing rotation values down into bytes (I would expect the server is likely to do this before it replicates actor transform to clients), i don't know how or where it does that automatically though

#

@molten matrix change AActor->ReplicatedMovement->RotationQuantizationLevel

molten matrix
#

Interesting, I’ll try that! I was thinking the replication was happening when it jumped by ~1.4, but maybe it’s replicating a lot faster and it’s compressed down so it can’t change on the client side until it jumps up by 1.4

molten matrix
#

Beautiful! @hoary lark , that solved the issue. Thanks so much 🙂

pearl moon
#

If I spawn an actor from a client, and the actor has replication enabled, will that same actor spawn on the server, so I can immediately start calling RPC's and stuff?
(answered by google, short answer is no spawning on client side if you want replication)

steady cape
#

You'll have to send a RPC to server and spawn it there

pearl moon
#

yeah, looks like it's not generally a good idea to spawn actors from the client due to cheating concerns

oak oracle
#

hey , guys i got quick one . I want to display username of each player as Render Text . but some how all players displaying username of current playing client

#

here is a code

#

why is that happening ?

random nymph
#

Is there some simple way to allow character on client to smoothly follow the server location when server updates character location on tick?

#

I tried fiddling around with MaxSmoothUpdateDistance and NoSmoothUpdateDistance in the character controller but those settings don't seem to have any effect on the movement

#

What I want is to move my character on the server along a curve and to replicate that movement smoothly to the client

twin juniper
#

Interpolation ?

random nymph
#

Hoping to find something that is more built in to the charactermovementcomponent

random nymph
#

Is there a way to clear the movement inputs sent to the server if player is adding movement input while movement replication is off?

patent spruce
#

hey guys

#

for a local multiplayer shooting game with 2 people, would you use TCP or UDP?

kindred widget
edgy junco
#

is there any network professional here i can ask him few questions in private about UE4 project ?

rose pilot
#

Hi, when I was playing multiplayer PIE, then when I possess the vehicle on the client, the vehicle IsLocallyControlled returns true on client and false on server which is the expected behaviour and everything works fine. But now when I packaged the dedicated server and hosted it locally and joined by using open 127.0.0.1, then after possessing the vehicle, IsLocallyControlled for the vehicle returns true for both server and client!!!!! It is really unexpected. Can anyone help me with why this happening?

#

Because of this my net cull distance is not working properly. Can any one tell why IsLocallyControlled returning true on both server and client when playing over dedicated server hosted locally? On the other hand, PIE as a normal client works all well.

#

On debugging I found that on local the vehicle is possessed by the correct player controller but on server it remains possessed by the AIController.

#

I assume the aicontroller should have been automatically unpossessed as I am possessing the vehicle pawn on server only.

twilit anvil
rose pilot
#

Play as clients starts a separate independent server behind the scenes.

twilit anvil
#

but you still play it on the same computer, ie the same ip\

kindred widget
#

You would think that it would still return differently. Since they're two separate applications.

#

Cause even on the same computer, there are two different pawns, one in the server application, one in the game application.

twilit anvil
#

im not sure, its been a while since I've done any multiplayer

rose pilot
twilit anvil
#

I still think that is true, but anyway, also respect the time of other ppl and don't ask anyone directly

rose pilot
twilit anvil
#

maybe, yet you're the one struggling

rose pilot
rose pilot
twilit anvil
#

id really appreciate if you could stop pinging me, also don't make any assumptions about me

rose pilot
#

So don't put your butt in when you are not sure about anything. Good day Mr.

kindred widget
#

Guys. Really. This has nothing to do with Multiplayer anymore. #lounge it, or something.

vernal cobalt
#

why do the connected clients keep trying to send the ServerRestartPlayer RPC to the server?

graceful flame
# rose pilot Hi, when I was playing multiplayer PIE, then when I possess the vehicle on the c...

If you’re running a packaged game on your computer to test it’s starting in standalone and when you connect to the server it’s running over lan, but since it’s the exact same IP it’s like a listen server. You need to test with two separate computers using two different IP addresses. Maybe a VPN would be useful here. Also two different steam accounts if you have steam integration.

vernal holly
#

does anyone know how to call a client function from the server? for example, I want clients to show a menu when HandleMatchIsWaitingToStart is called, but im not sure how to reciprocate that in the clients

kindred widget
#

Initially sounds like something you'd multicast from GameState.

#

That or setting the matchwaiting as an OnRep is probably better. Letting client's GameState handle that in the OnRep.

vernal holly
#

got it ty

woeful schooner
#

hello, when I press the event, I try to notify the server and notify the interaction from the server, so I will ride the wolf, but it does not work, where am I making a mistake?

balmy gazelle
#

can be staticmesh components replicated on network individually ?

#

their transform* ? if they are physics based

peak sentinel
peak sentinel
#

You need to possess or do other known tricks to control another pawn

woeful schooner
peak sentinel
#

Games like Squad (military milsim) just control the vehicle in the player's pawn/character, driver and passengers just attached to the seats and some of their inputs are disabled for movement

#

When driver pawn presses WASD, the movement input sent to vehicle instead of CharacterMovementController

peak sentinel
#

Multicast is redundant there, you also need an OnRep instead if you want to have persisent state

#

A late joiner will not see the player is attached to wolf because multicasts are "fire and forget"

#

But OnRep variables are persistent

woeful schooner
#

no i can already do them

#

but it doesn't work in multiplayer, it works in flat connection

peak sentinel
#

When you mean 'flat connection' does it mean "offline" or "listen-server without clients"?

woeful schooner
peak sentinel
#

Do you have the crash log?

#

If you want, we can continue on DMs too by the way

woeful schooner
soft dawn
#

I'm wondering about best practices around updating reference variables on the server that need to be used on the client. For example, I have a character reference in my controller which I use to configure render targets, some controls, etc on possession/respawn. This gets updated via RepNotify to the client. If there is latency or flow doesn't go as expected than things break. Its very brittle obviously. So I added validations for the references I rely on in the client and IsNotValid results delay 0.1 sec and then it retries validation. Only after these validations pass do I do anything relying on the Character ref. This seems to help but also seems hacky. So is there a "proper" way to do this to avoid shooting myself in the foot in the future?

kindred widget
#

They delays are probably unnecessary. A pointer won't OnRep until it's resolved on the client. Doing this all you need to do is call a single function whenever any of them OnReps. Check validity of all, if one fails, do nothing, if they all succeed, run your setup.

soft dawn
#

Well the refs become invalid because the actors they refer to get destroyed or the player should no longer possess them - like during a respawn where they get a new character and weapon.

#

They become "pending kill" or something

#

So the RepNotify updates multiple times during a respawn event for instance

rotund onyx
#

Having a problem where when I try to open a level with listen in options, it immediately closes and returns me to the previous level. Anyone know what causes this? It only happens in Standalone or Packaged formats

pseudo schooner
#

Hey, I'm new to UE, I had multiplayer spawning working perfectly, and then I made a few seemingly unrelated changes, but now it looks like the multiplayer clients and server are sharing the same controller. The game mode has not been heavily modified, nor have I overwritten any defaults except choose player start. Event OnPostLogin has the correct player controller, but it is not being assigned to the client. Is there an easy fix?

dark edge
pseudo schooner
#

@dark edge Well I guess I don't know 100% they are, but when I print the name of the controller from a local only function, the same name returns. Also killing one player respawns the other one, and puts the killed player in a state where it's missing a character. The debug panel also shows 4 player controllers, but only two of them (_Player and _Player on server) are displaying much action in the debug

dark edge
#

Every client only has one player controller object existing, only the server has everybodys

pseudo schooner
#

That's what I thought, but I'm mighty confused as to how both the client and the listen server are printing the same controller name from a local function. I've done something wrong, clearly. I'm currently writing a spawner off the postlogin function to see if I can fix the issue

pseudo schooner
#

@dark edge Am I taking crazy pills here or do I just completely not understand how Self works? I've tried printing this in functions that run on owning client and functions that don't replicate. There are two different controller names when OnPostLogin is triggered

#

Maybe the display name is just returning the name of the class itself, but if I use the same function on the incoming controller from EventPostLogin it returns different names

dark edge
#

The names probably get synced up after onpostlogin or something like that. Don't rely on the friendly object names for anything.

pseudo schooner
#

Gotcha, is there a better name I can track for debugging?

hollow eagle
#

also, packet loss is measured in %... 40 will obviously be absolute hell because you're dropping 40% of packets. No (realtime) game should expect to be playable under those circumstances.

peak sentinel
#

I test with pktloss %1-3

peak sentinel
#

netpktlag is ~250

#

But I expect my players to have lesser than 150ping in the game

#

netpktlag != ping value

peak sentinel
#

someone should correct my values though, i might be wrong

vernal holly
#

should multicast functions be defined on the server?

vernal holly
#

can someone explain how I call a function on a playercontroller from the server?

dark edge
#

Run on owning client event

vernal holly
#

okay but what if i want it to be triggered by a server function

#

like the gamemode transitioning to HandleMatchWaitingToStart

pseudo schooner
#

Can you not pass a character reference to a run on server event? I'm passing a character reference and it's coming out blank in the event

sinful tree
pseudo schooner
#

Spawned on the server

sinful tree
#

Then it should technically work.

sinful tree
pseudo schooner
#

If someone is willing to screen share for a few minutes and help me understand why this multiplayer spawn isn't working I'll send $20 via paypal. I've been banging my head against the wall for hours. I'm apparently doing something incorrectly but I cannot seem to identify what that is

#

I'll post there

toxic lion
#

I'm not able to set visibility correctly here on the clients

#

I'm trying to spawn an item on a player's FP mesh and hide it for all other players

#

currently with this setup, the server replicates correctly to all clients, however clients do not replicate correctly to other clients, or to the server

balmy gazelle
peak sentinel
#

No problem 🙂

royal vault
#
{
    if (GetLocalRole() != ROLE_Authority) {
        ServerDash();
        return;
    }
    if (!bIsDashing && GetMovementComponent()->IsFalling() != true) {
        //If we havent dashed yet, and were not in the air then we can dash
        bIsDashing = true;

        ClientDash();

        //Stop dashing after our dash montages length ends
        GetWorld()->GetTimerManager().SetTimer(DashHandle, this, &ASCharacter::StopDashing, DashMontages[0]->SequenceLength / DashSpeed, false);
    }
}

void ASCharacter::StopDashing()
{
    bIsDashing = false;
    GetWorld()->GetTimerManager().ClearTimer(DashHandle);
}


void ASCharacter::ServerDash_Implementation()
{
    Dash();
}

bool ASCharacter::ServerDash_Validate()
{
    return true;
}


void ASCharacter::ClientDash_Implementation()
{ 
    APlayerController* PC = Cast<APlayerController>(GetController());

    if (PC) {
        if (PC->IsInputKeyDown("W")) {
            DashDirection = 0;
        }
        else if (PC->IsInputKeyDown("D")) {
            DashDirection = 1;
        }
        else if (PC->IsInputKeyDown("A")) {
            DashDirection = 2;
        }
        else if (PC->IsInputKeyDown("S")) {
            DashDirection = 3;
        }
        else {
            DashDirection = 0;
        }
    }

    GetMesh()->GetAnimInstance()->Montage_Play(DashMontages[DashDirection], DashSpeed);
    
    
}```
#

Hi i have this dash animation code

#

dash direction is an int that can choose which animation to play

#

the server is fine

#

but the client can only dash forwards

#

dash direction = 0

#

when it tries to dash any other direction

#

it glitches and stutters but still dashes forward

#

dash direction is replicated

#

without dash direction everything works fine server and clinet can see each other dash

#

any ideas

royal vault
#

help

tropic snow
#

There a way to speed up RPC calls or this is depending on client ping?

royal vault
#

if anyone is wondering i was able to get it working by calling using a bunch of overloads ```
void ASCharacter::Dash()
{
APlayerController* PC = Cast<APlayerController>(GetController());

int DashDirection = 0;

if (PC) {
    if (PC->IsInputKeyDown("W")) {
        DashDirection = 0;
    }
    else if (PC->IsInputKeyDown("D")) {
        DashDirection = 1;
    }
    else if (PC->IsInputKeyDown("A")) {
        DashDirection = 2;
    }
    else if (PC->IsInputKeyDown("S")) {
        DashDirection = 3;
    }
    else {
        DashDirection = 0;
    }
}

ServerDash(DashDirection);

}

void ASCharacter::StopDashing()
{
bIsDashing = false;
GetWorld()->GetTimerManager().ClearTimer(DashHandle);
}

void ASCharacter::ServerDash_Implementation(int Direction)
{
if (!bIsDashing && GetMovementComponent()->IsFalling() != true) {
//If we havent dashed yet, and were not in the air then we can dash
bIsDashing = true;

    ClientDash(Direction);

    //Stop dashing after our dash montages length ends
    GetWorld()->GetTimerManager().SetTimer(DashHandle, this, &ASCharacter::StopDashing, DashMontages[0]->SequenceLength / DashSpeed, false);
}

}

bool ASCharacter::ServerDash_Validate(int Direction)
{
return true;
}

void ASCharacter::ClientDash_Implementation(int Direction)
{

UE_LOG(LogTemp, Warning, TEXT("Direction were dashing is %d"), Direction)

GetMesh()->GetAnimInstance()->Montage_Play(DashMontages[Direction], DashSpeed);

}

bool ASCharacter::ClientDash_Validate(int Direction)
{
return true;
}

pallid moat
#

hello, I have a fast array property and set the array item value at editor window, but when game start, it will not replicate this item if changed at runtime

#

so , does fast array can only replicate items that are generated at runtime?

sweet pilot
#

Hi guys! When a replicated actor is spawned on the client, all the replicated values will be available before the client fires begin play, does a replicated component do the same? I'm having some trouble accessing replicated values when the component fires begin play

kindred widget
# sweet pilot Hi guys! When a replicated actor is spawned on the client, all the replicated va...

Don't rely on stuff being available or not at beginplay. Beginplay is just an event that runs on the machine when the actor is ready for play. On clients this can run on the same actor multiple times based on relevancy. Replication can happen long before or long after Beginplay for a bunch of reasons. If you have things that need to do things when they're ready, just make a function to handle that based on whether it's ready and valid. Call that on Beginplay and OnRep. Now no matter which event happens first, your thing will be ready.

peak sentinel
#

That way you dont pass anything with server rpc

#

Since velocity variable is already replicated

#

Velocity also calculated based on player input

fossil merlin
#

Wondering if anyone can help shed some light on replicated moving platforms - I've got an elevator - and all the replicated features work, however I had to do a lot of voodoo to prevent the character from jittering all over while riding it. Now they just slowly sink towards the floor, and then back up again towards the later half of the ride.

TLDR; Is there a good way to sync the movement of a moving platform and the clients?

sharp kestrel
#

I'm not certain for Unreal Engine as this is something I want to look into... but I believe there is something called "early mover physics"? I'm not sure if its a general term but I've heard it used in Halo modding videos to explain why everything is so smooth on things like gondolas, elephants and scarabs.

#

I've heard people in Unity just setting the larger moving object to be the smaller ones parent... so like if a player steps onto a moving platform, the player is set as a child of said platform. Could try that?

#

I have no idea how effective that would be for replication though.

fossil merlin
#

I'd have to make sure that the parenting/de-parenting is pretty seamless in order to not make it obvious - but I can certainly try it. I also thought about simply attaching the pawn to the elevator car as well

molten matrix
#

I have a slightly abstract question around start-of-game logic/setup. Here's what I want:

  • When the game starts, it sets up some stuff around the level dynamically for two teams, creating actors appropriately and linking things between them.
  • When a player joins, they will be assigned to a team and they should ideally figure out the references between the previously created actors. Hypothetical example: Each client should know of the dynamically created rooms, and each client should know of the traps in each room.

I have a solution right now that semi-works. In BeginPlay on my GameMode subclass, I set up the level and create the actors. As part of this process, I also set up the references between objects correctly. Instead of having these references calculated on the client too, I replicate them. On PostLogin, I calculate the team and assign it to the player.

This has two major issue that I've encountered so far:

  1. Replicating these references is a bit silly. They never really change and every time I add things to this startup process, it usually fails for a while because I forget that I need to make sure it's replicated. It could just all be done deterministically done on the client.
  2. If I switch from using a standalone server to using a listen-server, the game breaks. This seems to happen because in a listen-server PostLogin is called before BeginPlay on the GameMode. This is an issue because assigning the player to a team relies on some things that are being set up in BeginPlay.

So I guess what I'm wondering is: What is the best way to set this up. I think maybe I'm looking for two things:

  1. A place to put initialization logic that will run before PostLogin for a listen-server.
  2. A good way to kick off the "Figure out how things are connected in this dynamically created level". I could send an RPC in PostLogin, but I'm worried that the actors haven't been replicated down to the client yet at that point, and I don't want to create a race condition.
kindred widget
#

They should. It'd be the same thing as a replicated StaticMesh asset.

verbal tendon
molten matrix
#

@verbal tendon , regarding the RPCs: Sending an RPC on BeginPlay wouldn't necessarily mean that the client knows about all the created actors. The flow goes something like this:

  1. Game starts
  2. Server creates a bunch of actors
  3. Once all the actors have successfully replicated over to the client, the client calculates some stuff.

I'm not sure how to properly have the client wait until all the things have been replicated over.

verbal tendon
#

Those are two potential approaches, there are others. The best solution depends on the specifics of your setup.

molten matrix
#

That's really useful, thank you!

#

I'm interested to hear more about the manager use-case you mentioned. I'm not concerned about the actor references, but maybe I should be? It's essentially just references like: Room A has a property with the list of e.g Traps in that room. Each trap has a reference to the room it's in.

verbal tendon
#

Will your game support hotjoining or save/load for play sessions?

clever plinth
#

If I have a TArray that is replicated, and each element is a USTRUCT, and I am not using fast array replication, will each element struct be sent completely (all members) whenever any of its members is modified?

molten matrix
royal vault
#

hi calling restart player from gamemode is duplicating my ui how do i fix this

short arrow
royal vault
#

ok so

#

i have this code

#

my health bar and inventory remove from parent

#

everything works and replicates

#

however

#

the client gets duplicated ui

#

the server does not

#

whats happening

#

the clients ui doesnt seem to be destroying

#

how can i do that

short arrow
#

If the call to remove from parent is running on server then that's probably the issue

#

Tell the client to also remove the UI

#

The server shouldn't really be doing anything UI related anyways unless it's locally controlled

royal vault
#

ty that guided me i got it working with a client rpc

twin juniper
#

Guys what is the ideal ping for lan dedicated servers in ordet to deploy it to aws??.Recently I hosted a free tier server on aws and it was laggy.On editor testing the ping says it is 10 ms for lan dedicated servers.Is it ideal??

#

Plz tag me if you are answering.Thank you

kindred silo
#

Hi. I am implementing a feature where if players get frozen, they can mesh keys to get unfrozen. Each key click will reduce the freezing time by 0.1s of otherwise 5s. Should I send RPC for every click? What could be a better approach?

stone vault
#

Hello folks, has anyone been able to package a dedicated server in UE5 EA, and if so, could I ask some questions of you? I've been having an issue with it. I made the cs file for the target (ProjectServer.Target.cs and changed the info accordingly to set to server, did the same thing for client (ProjectClient.Target.cs). Regenerated project files, then did a build for each (Windows>Development>Server and Windows>Development>Client). Client packaged properly, but server is just giving me the generic project single-player packaging.

#

Seems to be an issue other people were having. I can't find an up-to-date workaround. Someone had gotten it to work by altering some engine code, but when I looked at that code on my version it was totally different. I'm wary of changing engine code unless I can get a walk-through.

verbal tendon
oak oracle
#

Hey guys . ASAP !!! my project manager will beat my ass!!

#

When player presses T button . i want to widget popup and depending on which button player pressed , charcater needs to play animation and every other client must see it

#

Even if i am changing animation variables on Server side . animation gets played only on client side and not replicated to another clients . Why?

#

here is my stupid code

shell flax
#

Hey guys, I am fairly new to UE4. I was working on a small multiplayer game when I faced this issue where I am able to press movement controls from client, nothing happens in the client but the client player on the server screen moves. Not sure what's causing this and the error I am getting is "LogPawn: Error: EnableInput can only be specified on a Pawn for its Controller". Didn't find anything on the internet that helps with blueprints.

rapid bronze
fathom aspen
finite goblet
#

replicated UObject or AInfo?

dark edge
#

@oak oracle wait why are you trying to do networking inside a widget. Don't do that

#

Do the networking inside the character or PlayerController.

#

ServerPlayAnimationOnce or something like that.

fossil merlin
#

Is there a better way to sync the movement of a moving platform and the client's pawn? I've smoothed it out the best that I can, but still sinks/rises until the destination is reached. Previously they were just jittering everywhere.

dark edge
fossil merlin
# dark edge That's all dependent on how you're moving the platform and pawn around.

Currently - the elevator itself is using a 'move component to' as it allows me to dynamically set the time based on the distance between floors. It all works, as far as moving and replication, there's just some odd behavior from the clients perspective during the move. I've tried several things to get the pawn to move along with the elevator, to no avail. Oddly, in some of my tests, the pawn ends up on top of the elevator and, during that ride, none of the aforementioned glitches seem to be apparent - just when they are inside. I checked the collision, and all seems good there.

#

The pawn logic for moving it while inside is what I'm trying to work out now to get rid of the sink/rising behavior while the elevator is in motion.

pastel escarp
#

I have 2 players , 1 host 1 client, I want my client to join with its preselected stuff, Weapon , color .. etc , How is this made ?

meager spade
#

@pastel escarp that is a very broad question, and there are 100's of ways to do it.

pastel escarp
rose pilot
#

hi the default player limit for multiplayer is 16. I read in forums to add in game under the script tag maxPlayers = required value, but it didn't help.

#

I restarted the editor but didn't compiled it. Do I have to rebuild from solution after changing config file? Or simply is adding that line to defaultgame.ini enough to increase the default max 16 player for dedicated server?

meager spade
#

no

#

but it could be overriden

#

in your gamesession

#

or via a CVar

#

static TAutoConsoleVariable<int32> CVarMaxPlayersOverride( TEXT( "net.MaxPlayersOverride" ), 0, TEXT( "If greater than 0, will override the standard max players count. Useful for testing full servers." ) );

leaden moss
#

Someone here who is working on a multiplayer game in unreal c++?
I have some trouble with the pitch replication from my fps player.

If I look down and then up again it will turn around to the other side, but not locally only in other player sessions

I use the decompress formula

If I use instead

RemoteViewPitch × 360.0f / 254.5f
It works...

And if I use the decompress function from FRotator... It is going crazy if I look down.

(The decompress function use / 256.0f ..... Why?)

I also tried with clamp... I took a look into the unreal tournament source code. They also used clamp (-89, 89)

I was using 0,360
So I will try this later, but can anyone explain me what is going on?

muted perch
#

Would anybody be willing to hop in a VC to help me with my problem?

#

I need help transferring arrays from player character to player state.

haughty shadow
#

Someone can help with one simple question:
According to the guide, I created binds for building cubes relative to the character and because of this, in multiplayer, other players do not see my cubes, and I do not see their cubes. The problem is that the cubes are created relative to the client. I want to ask where I can drag all this to work in multiplayer?

#

I took ThirdPersonCharacter and in EventGraph I did all this, in a single-player game the cubes appear and I can even touch them, but in online the cubes are phantom and the server does not see them

rapid bronze
#

Show the spawn code

molten matrix
#

Not sure if anyone has seen this before, or if it's too vague. I'm trying out running my game from the editor with 2 players. However the PIE player gets stuck as a spectator.

Digging into why this is happening, I can see that ClientRestart_Implementation gets called for both players but it seems the first time it gets called for each player, NewPawn is null because it hasn't been replicated over yet. This causes it to retry and at this point, it works for the other player but not the PIE player. It seems to call ClientRestart again and the NewPawn is still null, so it fails and doesn't retry.

Sometimes when debugging with breakpoints, it seems to work. Probably because I'm putting the breakpoint in such a way that the replication has time to finish before the retry.

I haven't messed around that much with the beginning-of-game networking stuff, so I'm not sure what I could've done to make this happen. Wondering if it's something that others have run into as well.

#

Actually, it seems like it keeps retrying again and again and again, even minutes after. I see it calling ClientRetryClientRestart(GetPawn()); on the server, at which point GetPawn() is properly defined. But when it hits ClientRetryClientRestart_Implementation(), the pawn parameter is null. I'm guessing that means it's not getting replicated over for some reason? Not sure why the pawn would successfully replicate for one client but not the other?

meager spade
#

thats server corrections

#

meaning the server and client are fighting for position

#

client is not where server thinks it should be

verbal tendon
#

There's a cvar that you can change to have it draw debug capsules so you can see when corrections happen

#

p.netshowcorrections 1

verbal tendon
#

Uhm. I always just use the editor console tbh. But I'm pretty sure can add the cvars as part of program startup arguments ( I also don't have Rider 😄 )

#

But you can also just use the config files if you need something on more permanently and don't want to fiddle with it too often. It matters which file you put them in, so it's a little more hassle to set up

winter perch
#

Hi, in a listen server with only one client (the listen server) the remote path of switch has authority is not called. Is that the correct behavior? My thoughts were that the listen server acted as a server and a client, so that both paths would be called.

molten matrix
winter perch
#

that is indeed what I am seeing.

molten matrix
#

That's why it's labeled authority/remote rather than server/client.

winter perch
#

ok, so I need to test for server or client instead of that node then

soft dawn
#

When ChangeName is run in the gamemode, on PostLogin for instance, does that update the playerstate in gamestate's playerarray for that player?

#

I'm having a tough time verifying its actually getting updated because i'm not seeing any printstrings from the server process in my output

#

and my client's player state doesn't seem to be getting updated

leaden moss
soft dawn
#

My understanding is that GameMode can update GameState, including PlayerState which is in GameState's PlayerArray. GameState is replicated to all clients so they should be able to look at PlayerArray to get current PlayerState of themselves as well for all other players

verbal tendon
#

Yes correct

kindred widget
soft dawn
#

so if server changes PlayerState of a player I'd need to handle that manually?

kindred widget
#

Changes in what way?

soft dawn
#

When I run ChangeName gamemode function during PostLogon event

kindred widget
#

Oh, that should be automatic. PostLogin is server so it'll replicate to clients through the PlayerState.

soft dawn
#

ok, ill keep hammering away - something else must be going on

kindred widget
#

@soft dawnI call mine in HandleStartingNewPlayer_Implementation Override. I'm also creating the AI there though. Just waited for PlayerState to be created and called SetPlayerName on the playerstate.

soft dawn
#

ah, maybe I'm trying to update PlayerState before its created.. I don't get any errors but ill try to validate that before changing name.

#

Thanks for the help

#

Do you happen to know if its possible to get OptionsString of a connecting client? Client uses Open Level to connect to server and sends some parameters. I don't know how to actually access these on the server though. OptionsString inside GameMode is what the server started with so only helpful when using Open Level on server.

kindred widget
#

@soft dawn Uh. That's a good question. Trying to track that down. If I'm not mistaken, you might be able to call GetWorld()->URL

#

Only sort of sure that's set on clients..

#

Or wait. I'm not sure how I ended up on that.

#

Ah. URL.Map seems to be the string passed in to the OptionsString.

meager spade
#

if the actor has not replicated in time

#

then it will be nullptr

#

we used FastArrays to get around this

meager spade
#

should be

#

if the actor is replicated

#

maybe they are not relevant (too far away from player?)

#

maybe try setting them always relevant

#

to see if they show up

#

who

#

whoa

#

why you using NewObject on an actor?

hollow eagle
#

Actors should never be created via NewObject.

#

That'd certainly explain why it isn't being replicated.

meager spade
#

GetWorld()->SpawnActor

#

but that is not how it works

hollow eagle
#

Actors exist in the world, period. Trying to work around that by using NewObject will result in all kinds of issues, including the actor not replicating because the world doesn't know about it.

gleaming kite
#

When using Steam Sessions and Advanced Sessions with a packaged game, its works fine in the editor standalone and when building with the shipping configuration but doesn't work when I select the development configuration. I have no idea what's causing this and have tried a couple fixes online. Any help would be greatly appreciated.

stone vault
# verbal tendon Dedicated Server Builds aren't supported yet. My advice would be to wait until t...

Funny enough I figured out how to make it work! If anyone is curious I can share.

Edit: I had made a reddit post about it and then resolved the issue myself and broke it down here:
https://www.reddit.com/r/unrealengine/comments/rr2hw8/cant_build_dedicated_server_in_ue5_early_access/

shell flax
sweet pilot
#

Hi guys! I see that push model requires enabling through setting the CVar. Is there a way to permanently set it to true?

hazy slate
#

Hi all, I would like to make a online fps game on mobile with Unreal Engine. I have good knowledge about Java and Cpp for game server. But in unreal engine, I saw another dev using Steam. What should I choose for my game to get better performance ?

fathom aspen
#

How is it possible to call an interface function that is running on the server(say a GameInsatnce), called by a client(a Widget). How is it possible without using RPCs?

#

Yep, I already tested that and it works. Though I'm amazed

verbal tendon
fathom aspen
#

Yes I think this is working because I'm on a listen-server. Thanks guys!

abstract sundial
#

this is exactly what Run Configurations are for ;) you can clone them and tweak their arguments in Program arguments field. Or, you can use EzArgs plugin for that. it'll add program arguments field to your toolbar

coral wing
#
kindred widget
heady python
#

I set a variable to replicate initial only but it seems to be replicating every frame as if the condition isnt working. am I doing something wrong?

kindred widget
#

What is the code setting that value on server?

heady python
#

just interps from 1 point to another and sets location

kindred widget
#

That's odd. There may be BP fuckery involved. It's weird with OnRep stuff. Lemme test.

heady python
#

i remember asking a question about initial only and you answered it as well. it worked as you explained but its not working now. . . . using the same UE version and what seems to be the same debug method.

woeful schooner
kindred widget
#

Still testing. But random fun fact I just noted. BP OnRep doesn't actually fire on Server when variable is changed in an increment node. Only calls on Server when you use the Set /w Notify node. 😄

heady python
coral wing
woeful schooner
kindred widget
#

@heady python Your client is not ticking right? The Tick is set off by default? That's what I'm assuming from your beginplay.

woeful schooner
#

When the server doesn't see your changes, it crashes and crashes.

coral wing
heady python
woeful schooner
coral wing
#

What you mean by that?

kindred widget
#

@heady python Odd. I don't know. I made a pretty simple test of an integer incrementing on tick on server. Client only prints once and never again in the OnRep.

heady python
#

hmm. guess its a weird bug in the engine? ill just restart and tamper with it until it works

kindred widget
#

Should logically be the same as your tick being disabled on Clients.

woeful schooner
woeful schooner
kindred widget
#

Not following?

woeful schooner
#

Auhority -> multicast remove -> Run on server Run on Server -> multicast multicast-> Now Yes 0

heady python
#

i guess ill manually RPC the values to any clients that join the game

kindred widget
woeful schooner
#

sorry i might have misunderstood then :)

rough kestrel
#

Any tips on how I can replicate VR pickups on multiplayer? The positions have to be the same for all players (approx 4). I have tried sending location every 0.01 seconds but I see a lot of stutter on clients

coral wing
#

have you enabled replicate movement on the actor?

short arrow
#

You guys know any popular databases for storing information like players champions owned, skins, etc? I'm assuming mySQL is used a lot?

#

Don't know where to ask this question tbh

verbal tendon
#

If you have no experience with databases then you need to start learning one of them. SQL databases are probably easiest to get into for a beginner, rather than NoSQL databases

#

And if you're going down that route I would advise to look into MariaDB, it's basically the open source fork from MySQL, which happened due to corporate shenanigans

#

@short arrow , forgot to hit reply, so here's your ping :p

woeful schooner
#

i am using mysql

verbal tendon
#

I'm like 99% sure XAMPP comes with phpmyadmin for you to easily look at your database and manage it, play around with it. It's been many years since I last ran it

verbal tendon
#

Though I do not know how you're going to go about hooking this up with a UE game, I have never used the two in combination

verbal tendon
#

You're going to have to investigate a little or get advice from someone who knows 🙂

woeful schooner
verbal tendon
#

🙏 of course. My database days feel like a lifetime away. I did all of that stuff for a decade, but also haven't used it in day-to-day for half that time since 😁

short arrow
#

yeah I'm pretty sure there's nodes for connecting databses with ue right?

#

and some plugins

#

but thanks for the guidance guys!

verbal tendon
#

But also if you're new to UE and new to databases, take things slowly, one step at a time. Don't try to do everything at once

woeful schooner
#

Sql plugin , mysql plugin , varest plugin , and socket.io plugin

verbal tendon
#

It's easy enough to play around with PHP and learn SQL while doing this

#

So I'd advise playing around with PHP+MySQL and UE+BP/C++ separately

#

and then once you master both over time, and you learn where to combine them then start on that

woeful schooner
#

To use mysql in ue, you must either work with c++ or use varest, mysql plugins. I am currently using a plug-in that I wrote with socket io and node js support.

short arrow
#

Yeah I've got some solid years with UE. It's my full time job :) just trying to learn everything I can

verbal tendon
#

For the basics when you create a table you always want one auto_increment primary key, int of some sort. The "ID" basically

#

you gotta read about keys, indexes, how you gotta index tables once you need to cross reference data, like if you have an items table where you have an ItemID but also you need it indexed because you're looking up items for players by player_id that is a column in your table

short arrow
#

Youre scaring me 😨

rough kestrel
coral wing
verbal tendon
rough kestrel
coral wing
#

I don't know much about photon

rough kestrel
kindred silo
#

Hi. Spawning Actor on Server does not spawn Actor in Client. Bug I get following in the logs. What could this mean.
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: None, Channel: 2

#

I am running PIE.

kindred silo
#

Actor is spawned for some time and then destroyed. Both in cpp. If I understood your question correctly.

dark edge
#

I mean how big is the some time?

kindred silo
#

https://pastebin.com/se6jt6hT https://pastebin.com/5AnnNEPL
Above are the links. Actor and AsyncTask are both declared in the same file. On client side task calls Actor function to send the rpc to the server. Where the actor on server then calls the task function. Because async tasks do not support replication, I choose this way. Because I needed to provide some functionality to blueprints. Though other methods may work too. But I am facing this error. And I am thinking this is happening just because I am running it in editor. It will not happen in packaged build. Any help will be appreciated.

heady python
#

@kindred widget i got the InitialOnly working. Turns out if your actors NetDormancy is Dormant to that client, the RepCondition doesnt work properly. After switching it from DormantAll to Awake, the RepCondition works fine. Im assuming this is a bug but maybe theres a network concept thats going over my head?

kindred widget
#

That's.. Odd Sounds like it was just continually registering as the actor becoming relevent on client.

clever plinth
#

Is there a way to create a replicated object on both client and server, and then connect them after the fact? I know the usual alternative is to spawn a fake object on client, then replace it once the server equivalent arrives. In my case I have something a bit different where I want to transfer a large-ish amount of data up front, spawn several things from it on the client, and then indicate which objects on the server they correspond to.

kindred widget
#

@clever plinth I've never personally done it, but there is a way of name stably spawning an actor on both server and client.

woeful schooner
#

Hello sir, is there a way to use the destroy session on the dedicated server, now let me be more descriptive.

#

If the client gets on an animal and ends his session, that is, if he leaves the game, the character of the client stops, but the character or the animal disappears. I can connect the function I wrote to get off the animal to the destroy session, but first I need to check the session of the session.

deep shore
#

Hello, and happy new year to everyone. I have read in the past that listen servers are limited to eight players in UE4, but a few internet searches are giving conflicting information. Is this the absolute limit, or is eight the recommended max for performance reasons?

tacit bough
hollow eagle
#

There is no hard limit, there is no recommended amount either because it is entirely dependent on your game.

#

Anyone saying "8 is the max" is either talking about a specific game or just doesn't know what they're talking about.

tacit bough
#

Quick duckdebugging question:
Linetracing and projectile spawning works fine for my server.
The client's linetrace is being "ignored" and I can't figure out why that is.
The client's control rotation is taken into account but not the look rotation.

#

Projectile spawning:

hollow eagle
#

What do you mean by "ignored"?

tacit bough
#

oh let me make a quick gif

deep shore
#

thank you all for the information. 👍

tacit bough
#

Left: client
Right: server

#

more accurate would be to say: the client's pitch is not taken into account when the projectile is spawned in.

hollow eagle
#

probably because you're not replicating the client's pitch

tacit bough
#

other than that the projectile replicates just fine

#

oh

#

Isn't that part of the control rotation?

#

I thought that that'd be replicated by default anyway

#

how would I go about replicating the player's pitch?

#

seems like this is what I want

kindred widget
#

ControlRotation is a client local variable. When dealing with it in a multiplayer context you usually want to use GetBaseAimRotation.

tacit bough
#

it's said to be replicated by default and to be the method used in Unreal's ShooterGame template

#

I was using the camera's rotation up until now

kindred widget
#

Pitch is replicated, but yaw is usually not. Yaw is usually guessed from the pawn's current world Yaw value. Roll is pretty much never used by shooters, so Pitch is the only network traffic required instead of the whole rotator.

molten matrix
#

Rephrasing a question from yesterday: Does anyone have any good ideas on how to debug an actor replication issue with a player's start pawn? I can see it existing on the server side but when the server does a client RPC to ClientRestart_Implementation, the pawn parameter is null.

I'm spawning a bunch of actors in PostLogin on the server and it seems like if I don't do that, I don't hit this pawn replication issue.

I'm out of ideas, and I'm open to suggestions even if it's something like: "Try putting a breakpoint in this method in the engine and go from there"

verbal tendon
molten matrix
#

Yeah that’s my understanding as well. This is all engine code though and I see guards for this in the code. If it’s null on the client side, it retries the RPC again and again. At least yesterday when I was debugging, it seemed like the pawn never replicated to the client and it just retried forever

verbal tendon
molten matrix
#

Right. Is there a good place/way to debug that? I was initially digging into ReplicationGraph.cpp, but I realized I'm not using the ReplicationGraph plugin so that's probably unrelated.

verbal tendon
#

The first place would be to look at is where you're spawning the actor. Is it BP or C++? Essentially if you spawn the actor on the server and it is set to replicate, then it should be replicating on the client. There's no need to dig in the engine source code for that if you haven't made any modifications that might interfere

molten matrix
#

This is the default pawn that gets spawned automatically by the engine based on the DefaultPawnClass in my game mode. So the SpawnActor call is somewhere in the engine code. I'm working in C++.

The first player that joins gets their pawn spawned just fine. The second player's pawn does not replicate over in time.

verbal tendon
#

Because sometimes you can run into issues with player spawn due to collision if you're just using the default, if they collide it won't spawn the 2nd player's pawn

#

Other easy checkmark is to make sure the class you have is set to replicate properly

#

You could test if there's an issue with your particular class by simply spawning one after the 2nd player joins and see if it's a general issue with that class or something with the player spawning

#

That'd be my first goto checklist for eliminating potential causes

molten matrix
#

Yeah it spawns properly on the server. Actually, maybe I'm completely misunderstanding what's happening. Here's kind of the progressive symptoms of what I noticed:

  1. The camera/control is messed up for the player and is just stuck at (0,0,0)
  2. That's because the player's controller is set to spectating.
  3. The player controller is set to spectating (I think) because it never acknowledged the possession of the pawn. AcknowledgedPawn is null, but Pawn in AController is defined.

So the pawn has been replicated since it's in the Pawn property for the controller. But for some reason I'm still seeing it retry forever because the RPC parameter turns into null on the client side.

Is there a good way to "correlate" actors between the server and client? Do they have some net ID or name that I can check to make sure they match?

verbal tendon
molten matrix
#

Nope

verbal tendon
#

Alright. If it's nothing on the easy checklist, can you make a reproduction scenario from scratch?

#

Create an empty/default project, try to reproduce the issue ( I mean obviously time is a factor here, I dont know how complex your setup is )

molten matrix
#

I'll try

verbal tendon
#

I'm sorry I haven't run across the symptoms before beyond what I've asked clarification on, I wish I could be of more help

#

When tracking down those issues, it helps to break things into smaller steps. Forget the controller and forget the RPC, those are all for later. Your pawn isn't replicating, that's the base step. Why?

#

Once you figure that out, after pawn spawning comes controller possession, and after that comes RPC

molten matrix
#

Just as a concrete example of what I'm seeing: Even minutes after starting my game, I see breakpoints getting hit in both SafeRetryClientRestart in PlayerController.cpp and in ClientRetryClientRestart_Implementation (also in PlayerController.cpp). On the server side, it's passing in GetPawn() which is defined. On the client-side, the input is null. However I can see that the playercontroller on the client side has a pawn of the expected type so I would expect the RPC to properly deserialize the pawn, unless that's a different pawn.

#

I'll try making a sample project and see where that takes me

woeful schooner
#

hello, when I use delay in the replication process, I can't get positive results. How can I deal with it. The animation works well for me, but it is transmitted late to the client and server or I cannot transmit regularly.

unkempt walrus
#

I've got an interesting issue that I am seemingly unable (Or too tired to clearly think) to resolve.

Chaos Vehicle - Multiplayer (Player controls the driver seat, which has access to input that should drive the vehicle)

Problem at hand:
Chaos Vehicle Controller, no longer seems to react to input given to it.

What I have tried thus far;

  • Tried reverting to a singleplayer-control scheme of directly passing Forward/Turning axis inputs to the respective Throttle and turning methods of the vehicle controller
  • Debugged to ensure values were being returned and that it was passed to something that wasn't Null or 0 (Turning/forward all provide their respective values)
  • Checked whether client was triggering anything or not, or something was possibly overriding the values passed to the server (By adding a branch to check if value is not 0, so that I could manually see whether an input was given or not)
  • Confirmed that all events are triggered via button presses and nothing isn't reaching its end target.

What it currently is set to within the blueprint and what the expected result currently is:
We grab from the client the WheeledVehicle(Chaos controller) that is the parent of the driver that the client is possessing
We pass that component along with the input axis to the server request to replicate along all other clients
Result should be that the vehicle begins to move forward, however nothing happens at all.

Assumption?

  • Possibly the Chaos Controller itself? As everything else so far connects and has a result, but the chaos controller doesn't produce anything.
  • Maybe the way the vehicle or passenger/pawns were spawned in? Shrugs
woeful schooner
unkempt walrus
#

Hhm.. I'll give that a shot ^_^

woeful schooner
#

you know i faced the same problem 🙂you know anyway

unkempt walrus
#

Still unable to get it to work, though it might be me not applying what you're saying correctly XD

woeful schooner
#

one minute

unkempt walrus
#

As currently my understanding of what I've got is that the client is providing inputs, that get relayed to the server via the "Run on Server" and then "Multicast" in which the multicast gets the input from the client kinda thing

#

What makes matters even more funny is that an older version of the vehicle I've got does work, as that directly feeds the input to the controller (Which makes me possibly think that it's acquiring the wrong controller? idk)

woeful schooner
#

If you do not notify the server, it will not work, you must first forward it to the server and then to everyone.

unkempt walrus
#

That's what I thought I was doing, with the custom event call replicating on "Run On Server"

#

As the command to turn the engine on does work correctly

woeful schooner
#

or

#

replicates multicas

unkempt walrus
#

That's what I have currently;
Client Input (float) -> Run On Server (command) with float from Client -> Multicast (Command) with float from client -> Input to Chaos Vehicle Method

unkempt walrus
#

Nope

#

Which is what's confusing me

#

Hence I thought it'll possibly be to do with the ChaosVehicle component, or how I am acquiring it kinda thing

woeful schooner
#

well, did you check the values ​​with print, does it return float?

unkempt walrus
#

Yup

#

I've done all that, I checked to see if it returns the value I want (a.k.a a 1 or -1)
I've checked whether all clients on the network receive the command from the server when I press any of the keys and they do

#

It's just that the value seems to just go into the ChaosController and nothing happens, hence the assumption it might be with that

woeful schooner
#

I don't speak English, I don't understand much, but check in repnotify if it works, float is not replicated

unkempt walrus
#

You're all good, at least I know that it's not the inputs and how my method is setup that is the issue ^_^

#

So I'll continue debugging it further and see if I can figure it out xD

woeful schooner
#

sorry i hope you can solve it i wish i could help i am working on vehicle but my project is a bit complicated since it is mobile oriented

unkempt walrus
#

I appreciate it, you've helped as much as you could already 😄
And I'm currently just messing around with Unreal, it's my 4th? Day so far now and working on a multi-crew vehicle system and it works so far, but then I had the stupid idea of making it multiplayer XD

woeful schooner
#

multiplayer is simple 🙂 and nice, I'm working on dedicated, no problems so far

unkempt walrus
#

I am definitely enjoying how multiplayer works on Unreal compared to Unity so much easier

woeful schooner
#

unity waste of time 😄

unkempt walrus
#

Haha, it was alright decent for 2D projects

woeful schooner
#

2 years wasted, thanks to him, it's none of my business, it's not improving

unkempt walrus
#

Hmm just remember issue might be with the fact I am spawning the pawns (driver, turret controller) on runtime, which might be an issue as I dunno if I actually do it properly or now so I will try that tomorrow 🤣 (1:27AM here)

tacit bough
#

Setting GodMode doesn't replicate as I'd expect it to. Only the server is invincible. I have the GodMode bool set to replicate and run an event as Multicast but that's probably not right. Any pointers?

#

LMAO nevermind! I just have to add a short safety-delay before calling the event since I gotta wait for all players to login

woeful schooner
#

GameMod is something only the server sees

tacit bough
#

this is weird

#

this is my quick and dirty (working) fix

#

and I thought, well I could just do my initializations everytime a new player joins the session like so

#

but when I remove the Delay the stuff doesn't get applied for some reason. Any logical explanation as to why that is?

unkempt walrus
#

Possibly the player array might not be filled yet? I'm not sure so I'm just throwing something

tacit bough
#

that's very possible!

unkempt walrus
#

As you said initially only the server was god mode, but the delay would mean the list has more things

#

Try see what the player array count is when the delay is there and isn't there

tacit bough
#

maybe a .2 delay after the array append should fix that

#

well the player count will be correct at some point because they're being added via onPostLogin. The problem as you indicated could be that it takes more time to fill the array with the new user than to execute the Init... event.

#

@unkempt walrus you were exactly right! Also, adding a grace period of .5 fixes the problem (hopefully reliably enough)

unkempt walrus
#

That "Might" fix it for now, how many clients are you testing that with

tacit bough
#

the game will only ever be at 2 players max per session

unkempt walrus
#

Then that'll do 😂

tacit bough
#

xD

#

IKR

#

I'

unkempt walrus
#

Was thinking if it was like 64 then it might be more than .5

#

But hey, if it works it works, optimization and stuff can come later when everything is there KEKLEO

tacit bough
#

d love to make the next MMO but ehm... as a solo developer I don't think I hate myself enough to have goals like that lmao

unkempt walrus
#

Pfhahah, yeah 🤣

tacit bough
#

yeah most bugs are features anyway amiright

unkempt walrus
#

Exactly xD

#

But glad that you at least found what the issue was then or supposedly :)

plush otter
#

Hello guys I have a basic question about destroying actors in multiplayer.

#

An actor is calling destroying(self) upon overlap with the player. Why can all clients and server receive this information without telling the server to destroy the actor?

#

If I call DestroyActor from the Player then I need to call a run on server event to get the same result

plush otter
#

Oh nvm I think it's the ActorBeginOverlap event that does some notification job

hoary lark
#

i don't understand the question myself. thing is going to move, server is going to detect/run beginoverlap, server runs destroyactor, actor goes away. are you seeing something different happen?

#

(at roughly the same time, maybe sooner, the client is going to detect/run beginoverlap, and run destroyactor, but it's not going to do anything because the client doesn't have authority)

plush otter
#

Yeah I understand now

#

Thanks!

kindred silo
#

What is the RemoteRole for Authoritative Character on ListenServer

bitter oriole
abstract estuary
bitter oriole
#

Physics behave different between devices, and usually most code behaves slightly different too because of varying delta times, etc

#

So generally speaking you need to have independent simulation on each device (prediction) and then when authoritative server data comes back you rollback to that state and then rewind changes

#

You can also correct smoothly toward the server data

#

Somewhat painful stuff, but it's unavoidable

unkempt walrus
#

I'm wondering, is there any potential issue(s) when it comes to spawning in an actor that's then attatched to a parent actor on runtime within a server?
(Currently, i've got a vehicle that spawns their 'seat actors' once it itself is spawned. However, there might be an issue with how I am grabbing the movement component from a parent object)

unkempt walrus
#

Soo.. My current issue:

ChaosVehicleComponent, whenever an input is passed to their respective methods (Throttle/steering/handbreak) none seem to result in anything working.

What's the expected result?
Result should be a server-authorative control

Client Input (InputAxis Turning, provides float value)
-> Sends a request to server to turn the vehicle
-> Server receives the value + reference to controller it should influence
-> Server Multicasts with reference to the controller that it should 'Turn' with value passed from initial client request (The float from InputAxis Turning)

What is wrong?
While the float value does arrive correctly and it all seems to go fine from a networking perspective and giving data
The ChaosVehicleMovementComponent does not do anything with the value given. Is this due to the component not being "Possessed" Directly?

Does the ChaosVehicleMovementComponent have to be possessed for it to work, or can it be done as it is currently set up?

How is it setup currently?
Parent Actor = Vehicle + ChaosVehicleMovementComponent
Child Actor = Driver (Spawned on run time and attached to Parent Actor)
^ Child actor gets reference of their parent's ChaosVehicleMovementComponent to manipulate

Any input would be greatly appreciated, stuck on this and I have no idea whether it's maybe a networking issue, where grabbing a component from a parent that you don't "Possess" is a bad idea or something alike ._.

#

And apologies for the long post XD

twin juniper
#

Guys can anyone explain how net cull update frequency work??.I am spawning guns on server.When I am far away they are not getting spawned but when I go near them they are getting spawned which is fine.But if I went far again they are getting disappeared again??.what is this mean??

rapid bronze
#

Pretty sure that's caused by Net Cull Distance

twin juniper
#

Why it is disappearing??.Once it is spawned what is the need to disappear again??.It does not make any sense??

rapid bronze
#

Cause it culls it?

It's not relevant for you anymore

twin juniper
#

So but don't you think it should cull only replication instead of visual elements??

rapid bronze
#

Try it out, lower the cull distance and see what happens

twin juniper
#

Yeah it is working properly with proper net cull.But it is somewhat not relevant.Thanks for response

dawn marten
#

from my lobby widget i call this when the user changes some settings

#

in the game state, this is my server-side "gameDetails" updating logic

#

the first print "setting game details" is called both from the client and server instance
BUT the second print, "setting game details on server" is only called if the host/server of the game clicked on the button.

#

can anyone tell me why my lobby widget cant trigger a BPI->custom event that runs on server?

kindred widget
#

First, you should really use base classes instead of an interface in this manner. It's much cleaner. But that's irrelevant. Actual reason is GameState is a server owned actor. Client can only RPC through ClientOwned Actors.

dawn marten
#

please could you provide me with an example?
eg. click button -> getPlayerController-> custom event on server -> updates uhhh..?

kindred widget
#

By default only three actors are Client Owned. That's PlayerState, PlayerPawn, and their Owner which is PlayerController. To set an object's Ownership to a client, you have to have a reference to a ClientOwned actor on the server, and call SetOwner on the actor that you want the client to have ownership of. You shouldn't do this with GameState though, since it's the Game's State and should only be a Server Owned Actor. To Allow a client to interact with Server Owned Actors authoritively, you need to let them RPC through an Owned Actor. PlayerController for instance. Then on the server's version of that player's PlayerController you would GetGameState->SetGameDetails.

dawn marten
#

ohhhh

#

oh i thought you could interface pretty much anywhere to anywhere

kindred widget
#

On the same machine, yes. This doesn't have anything to do with interfaces.

#

Interfaces are just another method of member access of an instance on the same machine.

dawn marten
#

alright - generally i thought that if i can reference something i can call it

kindred widget
#

They're a lot less useful than most BP tutorials will lead you to believe.

dawn marten
#

i guess not

#

ok

#

so any UI user input needs to ( if relevant for replication ) needs to go through a PlayerState, PlayerPawn or PlayerController. is that correct?

#

(for an RPC to a server owned actor to have an effect)

kindred widget
#

Correct.

dawn marten
#

thanks a lot! i thought for some reason gamestate was fair game for anything

#

so im calling this in my widget instead now

#

which calls this which calls a server-side controller method, which then finally updates a gameState variable

#

it works!

#

😄

#

if this doesn't sound correct please let me know

dawn marten
#

my game is relatively flexible - players can choose keyboard caps, layouts, gamestyles(eg.basketball), elevations(changes to keyboard elevation), modifiers (loads of random unique changes to match logic) and probably more things in future. To "simplify things" i created an AllGameDetails struct which stores all of these different parameters in one place instead of having scattered and randomly named variables everywhere
my question now is what would you recommend in terms of code design
I'm thinking for example, one option is on my "SetGameDetails" node i can pass in which field(s) changed, so that the game state can handle changing the world accordingly after updating the state - so as well as having a centralised state object, i could also centralised my logic which responds to state changes.

The alternative to this i guess is"before/after every time i call setGameDetails, ill also write the logic to change the game according to the new state, wherever im calling setGameDetails from in my code" (eg. actively changing/spawing/destroying something)

#

for some things i will "read directly from getGameDetails for more passive things that are checking things in a tick" for example (eg. constantly lerping in tick to offset determined by a value in the gameDetails)

so question boils down to, should i centralise all my logic that deals with "active changes" (spawn, destroy) in the same gamestate method that updates the state object itself? This is how we'd do things in the web generally, a centralised store that all your stuff can read from, and when it is updated optionally suscribed things can get triggered to change/create/delete/whatever

#

im realising what i said about the web wasn't totally true 😄 we do respond locally to state changes locally in whichever component is interested in the change

#

i guess i'm looking for general advice on centralised/decentralised state management in ue

unkempt walrus
twilit flint
#

On death I call UnPossess() and so on, start timer and which function I should call to restart player when timer is finished ?

kindred widget
#

@twilit flint Usually ServerRestartPlayer in Player Controller I believe.

twilit flint
#

thx

tacit bough
#

I'm working with the Character class.
I do not call Destroy Actor when a player dies. I simply deactivate input.
My game is round-based and I want to reset all player's location and rotation to match the corresponding Player Starts.
I've got everything figured out except actually setting the location and rotation.

#

Currently I try to do this via the SetActorLocationAndRotation node but nothing happens. Not on the server and not on the client. Yes I verified that the event is called.

#

The default nodes are not useful for my case because they all require the player to have been despawned

kindred widget
#

Restart Player should not require the character to be null?

#

Oh, wait, no it does. My bad.

tacit bough
#

@kindred widget ? I'm not using Restart Player at all.

#

yeye

kindred widget
#

Er. Well, it'll leave it.

tacit bough
#

uhm, apart from that. Why is the SetActorRotationAndLocation node not working as expected?

kindred widget
#

Where is this being called from?

tacit bough
#

GameMode

#

it's a Multicast event.

#

this then calls...

kindred widget
#

Hmm. Odd amount of rerouting here. Client definitely shouldn't try to tell the server to call that again. Should just run on server explicitly. Thought that is a minor issue. Only reason I could see this not working is if your array of pawns is invalid.

#

Are you testing with a Listenserver by chance?

#

Or Dedicated?

#

I could see an issue with this in Dedicated, there's a CMC issue. Listenserver, the host player should see the location update immediately.

tacit bough
#

The game won't support dedicated servers

kindred widget
#

In Dedicated the client would need to move the character first or server would have to call a force update to the position. Setting location on server won't immediately replicate to a non moving client until client tries to move.

tacit bough
#

so I just figured out how exactly I want to rotate and translate the players

#

would this just be called as a regular function from within the gamemode?

#

*for the players

kindred widget
#

Control Rotation is local. To affect that correctly, you need to do a ClientRPC

tacit bough
#

I'm actually just really dumb. All this time I thought I was setting the rotation etc. on the Pawn but instead I was doing that on the Player Controller .........

kindred widget
#

Haha. Yeah that'll get you.

tacit bough
#

changes var name from Players to PlayerControllers

kindred widget
#

On a side note, saving references like that is okay, but somewhat unnecessary. It's very easy to create functions that parse the GameState's PlayerArray for PlayerStates of valid players. PlayerState can always access that player's Controller from GetOwner->CastToPlayerController, and access their pawn from the PawnPrivate variable.

tacit bough
#

yeah I haven't worked with PlayerStates at all up until now and the players are added to the GameMode and not even the GameState so I'm really not doing things the idiomatic way haha

#

Does the GameState class have native nodes/functions to get all currently connected players etc.?

#

this would mean that I don't have to do stuff like this anymore:

kindred widget
#

I have a vague memory that non connected players are removed from the PlayerArray. But yeah, you can avoid that. You can get the same thing with this... And to be fair this looks much nicer in C++. 😄

tacit bough
#

or this approach that I used to handle player death:

#

honestly my understanding of Replication with when and how to combine Multicast and Run on Server etc. is shaky at best.

verbal tendon
#

It's rather simple. If you're calling something from client ( e.g. Widget UI click ), Run On Server called from client, is sent to the server to execute there from client

#

if you're running the logic on the server that you want everyone to get you do a Multicast

#

The way to think about it with a bridge is simple: If you are on Server, do Multicast if you are on client do Run On Server followed by Multicast

#

if you have something that needs to get to all clients

#

So you're -always- doing a Multicast and when your logic originates on Client you're prefacing it with a Run On Server

tacit bough
#

Thanks! I'll make that a poster and hang it on my wall LMAO

verbal tendon
#

Once you have those basics in the head. You'll have scenarios where you dnot want a multicast, but you'll have RunOnServer which sets some replicated variable, the engine's replication of that variable to all clients replaces your otherwise Multicast RPC

#

it's all about knowing the building blocks and how to put them together! 🙂

tacit bough
#

Can i call myself UE Replication Expert? lmao feels like all the questions I have and others do could be answered by the notes you just provided.

verbal tendon
#

No there's more to learn but this is the basics 😛

#

I'm sure you'll get there some day! 🙌

tacit bough
#

@verbal tendon just to make sure I got it right by following an example:

I've got a Reset Player event that replicates on Server and is part of my player Blueprint.

#

My GameMode does some checks and passes in the relevant info

verbal tendon
#

ControlRotation isn't replicated. The two things you want to change for the player is their pawn's location & rotation, not the controller's control rotation

#

The node you already have in that screenshot has a rotation input

tacit bough
#

This logic is inside a regular event inside the GameMode. The event Reset Players
Reset Players is called as part of an event inside GameMode called InitPreroundPhase which is a Multicast event.

#

would this be the idiomatic solution?

verbal tendon
#

( GameMode is only on server, so a RunToServer RPC is kind of pointless, regardless of that yes it'll run on server, if you ever need to use it to send from client, so that's technically fine )

#

There's no screenshot for what ResetPlayers does

tacit bough
verbal tendon
#

But I dont like the sound of it 😄

tacit bough
verbal tendon
#

Not the same thing, your arrow is pointing to a ResetPlayers node

tacit bough
#

oh well all it'll do is reset the player's health and position etc.
I'm replicated the way VALORANT handles it (not technically but the idea of it).
So players play in rounds against each other and once the winning condition has been met they're reset to the inital starting points, a timer starts etc...

verbal tendon
#

The snippet you posted earlier that has Players[1]->ResetPlayer also looks questionable, since it's cut off there isnt more info to go on, but I'd wonder why you're doing that

tacit bough
#

sorry didn't mean to omit.

#

the game will only ever feature two players per session.

verbal tendon
#

Oh boy 😄

tacit bough
#

uhhhhm

#

is it thaaat bad? xD

verbal tendon
#

There's a lot to mention here, I'm gonna miss stuff

#

First of all high level. You have a server that's resetting players

#

generally speaking theres no need for client RPCs in this scenario

#

The server evaluate when to reset players ( game mode - server logic )

#

it may involve multicasts for sending things to the clients but that's about it. I'll get into details from things I noticed on screenshots

tacit bough
#

if you'd like to I could summarize the current flow more succintly so you don't have to look at the screens as much @verbal tendon

verbal tendon
#

And then all your branches go away, all the code duplication goes away and you're left with a loop that does Players[ Spawn->PlayerIndex ]->ResetPlayer

#

single logic flow

#

And yeah I noticed the update screenshot on the rotation, looks good

#

You always want to duplicate as little logic as possible ( none is ideal ) if you find yourself duplicating things like there you can probably do it an easier way

#

that makes your logic easier to overview: less bugs, easier to maintain

tacit bough
#

wow

verbal tendon
#

An actual integer instead of the start tag is next, not a string 😛 then you're there

#

as the variable type

tacit bough
#

well I mean the default PlayerStart comes with it as a string so idk

verbal tendon
#

so you don't need to do have the conversions 😉

tacit bough
#

but I agree xD

verbal tendon
#

It doenst matter you just add your own integer and use that

kindred widget
#

@tacit bough Not sure what all I missed, but in general Server can tell a ClientOwned actor to ClientRPC, sends the event only to that client if the client owns it. Server can Multicast from any actor regardless of ownership, this sends the event to that instance of the actor on all machines.

Replication deserves it's own mention since it's very different than RPC usage, Replicated values set on a replicated actor on server will replicate. Setting those on client only changes it locally.

As for clients, a client can only ever ServerRPC, they have zero other networking capabilities.

tacit bough
kindred widget
#

Charts where each RPC invoked from an actor with each ownership, from which machine type will end up.

tacit bough
#

uhm

#

I'm trying to apply all this info to my current situation.
Right now Reset Players doesn't do anything.

To test it I've got a keyboard button set to call Reset Players from the GameMode inside my PlayerBP

#

Reset Players is a function inside my GameMode

#

all that Reset Players does is call Reset Player on every currently connected PlayerBP

#

@verbal tendon Would I have to set any RPC etc. stuff with this set up? I mean since the GameMode lives on the server I don't really need it, right? Or do I O.O

verbal tendon
#

Input events are on the client. So where you have an input event like that, you want to do a RunOnServer

tacit bough
#

but is the Reset Player event then RunOnServer or should the event that sits on the GameMode be RunOnServer?

#

e.g. in GameMode:

verbal tendon
#

you're mixing things

#

yes call ServerResetPlayers from your 'R' input

#

and that shouldnt be on gamemode because gamemode doenst exist on client

#

so that RPC needs to be where your owning actor is. in the Character class or the controller class

tacit bough
#

I'd only press R while on the host while testing for example.

#

in the end only the GameMode itself would call Reset Players

verbal tendon
#

if you're developing a multiplayer game you'll be testing from both server and client

#

its good to have one way of doing things and keep in that structure

tacit bough
#

but not if it's just a function that'll later run on the server only right?

verbal tendon
#

Correct, so your "ServerREsetPlayers" in this case is the "testing function"

#

and whatever logic calls it

#

"Reset Players" is what's more integrated into your core logic and not part of the testing

#

ServerResetPlayers needs to be in character or controller, and that's what should be called from Input

tacit bough
#

oh

#

gotcha

verbal tendon
#

Again, it cant be on the game mode

#

the client has no gamemode

tacit bough
#

oh right

verbal tendon
#

ServerReset players needs to be on character or controller, that exists on client

tacit bough
verbal tendon
#

Yup

tacit bough
#

so here's the really confusing part for me. What kind of RPC setting do I set in the Server Reset Players event on the Player?
The GameMode executes Reset Players which executes Reset Player on every Player anyway.

#

Do I have to have any RPC setting for Server Reset Players with this in mind?

#

E.g. RunOnServer because only the server has the GameMode actually running on it.

#

because whatever I do inside GameMode is automatically a Multicast if I manually do stuff on all players, right?

#

also, does ResetPlayer have to be replicated in some way or again not because we call it from the GameMode?

#

ngl I'm super lost again now. More than before maybe. Since what I had before didn't do anything at all anymore,

I've done this inside my playerBP:

#

And Reset Players inside GameMode now does this:

#

but still I can't get the server to reset all players.
Individually players can reset themselves but that's not the goal.

#

@verbal tendon I do appreciate all the tips and tricks you've shared with me already but tbh I still do not know exactly as to how to apply that knowledge to my specific situation.

#

to summarize what I want to do (removing the debugging help stuff)
I want the **server **to **change **an attribute on every player

That's it. Nothing else. No events that are invokable from any client (or player for that matter). The GameMode is the only executing entity for this.

#

so my idea is to create an Event in GameMode that performs the action on all players without using anything like Mutlicast, RunOnServer etc.

#

in my mind the players shouldn't have any implementation details in them as far as the reset logic is concerned.

#

welp. figured it out. I can literally do everything of this inside the GameMode. No need for any replicated events at all.

woeful schooner
#

the player got on the wolf in the game successfully...
player left the game or lost connection or lower f4 pulled closed server is not separating the two I need a solution to make this separation process

kindred widget
#

@woeful schooner Try overriding APlayerController::PawnLeavingGame()

#

By default it calls GetPawn()->Destroy();

woeful schooner
kindred widget
#

Is this a BP only project?

woeful schooner
kindred widget
#

Not sure. The events for that are likely all in C++. I don't think you'll have much luck with that without overriding some virtual C++ functions.

woeful schooner
#

bp is possible because I've seen it in games made with bleprint before but I don't know how to do it

woeful schooner
woeful schooner
kindred widget
#

You need a C++ PlayerController class that your project is using. Just implement the function in it.

.h
virtual void PawnLeavingGame() override;

.cpp
void AMyPlayerControllerClass::PawnLeavingGame()
{
  Super::PawnLeavingGame();
}
#

Calling Super destroys the current pawn. So more or less just remove the Super call and only destroy the player's actual pawn instead of the currently possessed one.

woeful schooner
#

i don't understand but i'll give it a try as far as i understand

kindred widget
#

@woeful schooner They virtual override needs to go inside of the Class's brackets. Put // in front of the Super:: call.

#

Try those changes, and if the wolf stops despawning, you can finish the function to despawn the player's actual pawn.

woeful schooner
#

Fill out your copyright notice in the Description page of Project Settings.

#include "MyPlayerController.h"

void AMyPlayerControllerClass::PawnLeavingGame()
{
Super::PawnLeavingGame();
}

#

cpp

#

#pragma once

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

/**
*
*/
UCLASS()
class JURASURVIVALMOBIL_API AMyPlayerController : public APlayerController
{
GENERATED_BODY()
virtual void K2_DestroyActor() override;
};

#

h.

#

sorry 😦

gleaming kite
#

Forgive me if this is the wrong channel for this but is there any folks here knowledgeable in AWS? Im using gamelift for my game but would like to have cognito authenticated with steam instead of forcing users to make their own account. I couldn't find much on google so Im asking here, thanks in advance.

pallid canyon
#

he also has a discord that you can join where he answers q's

gleaming kite
pallid canyon
#

Does anyone know how to appropriately replicate an HMDs rotation when locking the camera to it?

plush otter
#

From the player's blueprint, I tried to set the value of a repNotify variable in PlayerState from server, then do a multicast to print the changed variable on each client. Why is the result in multicast always seem to desynchronize with the copy on the server?

#

If I don't use PlayerState and just put the repNotify variable for example in player's blueprint and do the same thing, all clients synchronized perfectly.

grizzled stirrup
#

When doing client authoritative movement, would there be any reason that calling GetCharacterMovement()->Velocity = SomeVector; always calls correctly on the client but only applies the new velocity about 80% of the time, the other 20% carrying over the velocity from before? Seems like some replication race condition but I'm not sure what since I've all the CMC clientside settings set up

#

I of course have GetCharacterMovement()->bIgnoreClientMovementErrorChecksAndCorrection = true; and any movement where I'm not directly setting the Velocity property works fine

kindred widget
#

@plush otter Don't multicast. RPC will reach the client before a replication in a lot of cases. When you set replicated variables, use the OnRep function to check them.

plush otter
#

So if I want to use the new value after the update, OnRep function should be the right place to go.

#

Thanks!

grizzled stirrup
#

It's the only way I could get it to work correctly on the client, strange!

plush otter
#

@kindred widgetJust want to verify my understanding. Say there's a Health variable in the player and a little hp bar above its head. After altering the value of Health from a server only action (take some damage), I should call update UI with repNotify instead of multicast?

kindred widget
#

Correct. Usually you do this by calling a delegate in the OnRep function. bind the delegate in the UI.

plush otter
#

OK cool

#

Just started learning these concepts and many online tutorial videos start doing things like this with multicast. I guess it's just easier to start with but definitely gets me into trouble with visual desync.

cyan bane
#

Hi, possessing a vehicle as a client is detaching the pawn i've attached to it, any ideas?

twin juniper
#

Hello.I set net dormancy of an actor to dormant all.But when i am spawning the actor on server i can see it spawning on other clients as well.WHat is the problem??.I am using blueprints for this..

#

Please help

#

what do you want to acheive??.You want to play sound on other player??

gleaming kite
#

What's the best way to replicate physics smoothly so it looks smooth for all clients?

bitter swift
#

When I try to add a new element to a Replicated TArray, I get error. The call only runs on server. It works if I play on standalone, but not when there's also a client.
Does anyone know how to Add to a Replicated Array?

#

I have another quesiton.
When I use AddDynamic to bind a Button to a method, is there a way I can have that always called on Server? It doesn't work on client.
I already tried to make the method itself call on Server, but I think because it's accessed through a Button by a Client, it wont run on Server.

subtle veldt
#

any idea why my spawned actor does not replicate

fading birch
molten mango
#

for local mp, both using either same keyboard (for test), or any combo of keyboard/gamepad, do you need to make separate playercontroller bps? i already have my primary char setup, and by default the game isuign my player controller, but now trying to set up p2, unsure if i need a second player controller, and if so, how to assign it to p2

#

im wondering if it would be smarter to put all my controls in the actual char blueprint instead of the playercontroller bp

fading birch
#

No, the engine handles that for you.

subtle veldt
#

The server has to spawn it?

#

But how can the server spawn it. For example, I have a client that wants to spawn a bomb

hollow eagle
#

You run a server RPC and have the server spawn it.

gleaming kite
boreal wadi
#

Has anyone experienced a weird bug where when using the Asset Manager in a multiplayer environment one of the players doesn't load the assets? I've tested this only on one PC but both with "Run Under One Process" toggled on and off. With it toggled off one player loads all the assets and the other only loads one. Is this something thats happening because I'm using the same PC to test multiplayer?

subtle veldt
#

oh I guess switch has authority helped

gentle pagoda
#

If I have to run my server build on digital ocean and want to connect clients to it how can I do that.?

#

One more question what are the other option then AWS to run my dedicated server on cloud.?

swift turret
#

ok, so i have a problem, im making a split screen game, how can i detect what kind of "controller" (gamepad or keyboard and mouse) is "player controller" using? i want to show key tips based on what kind of controller player uses, im using build in split screen system, im not doing anything more than "Create Player"

twin juniper
#

What I am trying to achieve is in that chat too, but people in that chat told me to come into this one as someone here might be able to help with my issue.

spare cobalt
#

Hello guys!
Im looking for methods to multiplayer phone game, where one of the players can host the game.
Is there any method to create a game like described below, without buying or hosting on my computer any server? As i read using the same Wi-Fi can help this, my another question is, that is there a way to play this from different network connection (but the people still stay next to each other, just everyone using his own mobile network or something like that.
I want to make a little party game with 5-10 players on mobile. It would be a social role-playing, card based game, without any very complicated functions, just start the game on the phone, everyone gets the roles, some counter works rounds, until the gang finish the game and close the app, no need to save anything.
Thanks for the answers and Happy New Year!

steep wolf
#

what is analogous to APlayerController that is replicated?