#multiplayer

1 messages · Page 651 of 1

stuck marsh
#

But I just can't make it working

#

This is my first project that is multiplayer and I can't say what and where I am doing something wrong

#

I have this function to know where is which variable

#

if is the server or the client

#

then I send them both in the game character with index 0, that means the server, right?

#

I set the variables

#

and check if both are set, I did a simple logic gate and it is always false, which means that one variable isn't setting, but after testing both should be set

stuck marsh
rich ridge
#

What is alternative for OnRep_PlayerState() of Character class when using PIE in standalone.

#

OnRep_PlayerState is not called in stand alone mode, because in stand alone mode its server.

#

and other alternative function which simulates same effect

winged badger
#

search for what sets the APawn::PlayerState and override that @rich ridge

rich ridge
#

@winged badger only 3 functions calling SetPlayerState

  1. UnPossessed
  2. Possessed -> but called on server.
  3. onRep_PlayerState

and SetPlayerState is not virtual

#
{
    if (PlayerState && PlayerState->GetPawn() == this)
    {
        FSetPlayerStatePawn(PlayerState, nullptr);
    }
    PlayerState = NewPlayerState;
    if (PlayerState)
    {
        FSetPlayerStatePawn(PlayerState, this);
    }
}```
winged badger
#

that is awkward

#

but all functions that call SetPlayerState are virtual

#

so you can just make your own wrapper and override all 3 😦

rich ridge
#

that may do the trick

cosmic badge
#

likely isnt a straight forward way to do this, but I figured I'd ask, is there a way to ensure a message has been received by clients, sent by an actor, before destroying said actor, right now its kinda hit or miss, the only method I can think of to solve this is to either disable the actor for a long time after and clean it up later, or send a message back from the clients to ack the message back to the server to allow it to clean up at that point

#

the delay while seeming a little sloppy makes the most sense, disable+hide, wait 10 seconds, clean it up.

thin stratus
#

Depends. Does it matter to people that didn't manage to receive the message for 10 seconds?

#

Eithet way, look into TearOff and TornOff. TornOff is the callback to the server calling tearoff. Probably c++ only though.

#

@cosmic badge

cosmic badge
#

its highly unlikely they wouldnt have received it after 10 seconds, that much of a delay there likely to disconnect at that point, but I'll look at TearOff, thanks for the hint 🙂 @thin stratus

wanton sleet
#

How can I add widget to a specific players viewport ?

neon kindle
#

Hello guys
What technologies are needed to make an online multiplayer game?
what should I learn to be able to make a n online multiplayer game?

neon kindle
sharp kestrel
#

The document itself mostly goes over how different classes interact with networks and how you would send information over with things like replication and RPCs. Also some later parts discuss managing servers. Can't really say much beyond the technology required as that will be unique to your setup.

#

You should also look up how the online subsystem modules work. They're basically different services that would "host" your multiplayer, so like Steam for example... they usually cost to run though and each has different functions you can use.

neon kindle
#

Thanks for explanations. 🙏

graceful flame
#

Since I began implementing a server authoritative approach to multiplayer all of my logic using "Get Player Controller" suddenly stopped working. I'm not sure what I'm doing wrong here. Does the index of Get Player Controller relate to the client?

rapid bronze
#

On a server, Player Controller 0 is always the first player

graceful flame
#

So the code I'm trying to run is on an actor, but I guess right now its hardcoded to branch based on Player Controller 0. I'm missing a key piece of functionality here to know which is the current player controller. How would I go about setting that up and where? Would that be part of Game mode? Game State? Game instance?

dark edge
graceful flame
#

In standalone, I had a working on event tick self actor vs player pawn vector distance measurement to display a material outline to indicate this item can be picked up.

#

In my game mode I have an Event On Post Login which adds to a player controller list and sets the player controller ID, but I guess what I'm struggling with here is how to implement that list into the various actors that need to know which player is interacting with them.

dark edge
#

Your interaction interface should pass over the pawn or player state that is doing the interaction, maybe even controller if you need to. Do it like that

graceful flame
#

Clear as mud lol

#

I don't have any player state or interfaces yet.

#

I think I need to start moving blueprint code out of my player pawn and into player state is that the correct path to start heading down?

dark edge
#

I keep everything in the pawn so interactions between the player pawn and NPCs or between NPCs is all handled the same way.

#

What type of interaction are you talking about here?

graceful flame
#

It's like I dont understand that first key step to start wrapping my head around dealing with multiple controllers.

dark edge
#

The controller shouldn't even come into question here. That's the whole point. It should be at Pawn to pawn interaction

#

What type of interactions are you trying to do here?

graceful flame
#

I have a handful of interactive items which I presume will follow a very similar structure so once I get one working I can adjust the rest. The use case for your sake would be when my player is within a certain distance of an item he can pickup, the item material changes.

#

and it works fine with standalone and with client 1, but client 2 is all broken

thin stratus
#

The first key step is to barely use the GetPlayerController node

#

If at all locally when you know you are working with the correct pc

dark edge
#

All right for that I would have an interaction interface or an interaction component, I use components in my project, and the pawn should detect which items are nearby, and tell them to update their state. Specifically, to get nearby things to glow, I would have a overlap sphere attached to the pawn, on overlap, get interaction component, set is nearby to true, and then call update material.

thin stratus
#

All other times you should work relatively to the actor you are on

#

Pawns have Get Controller, PlayerStates have the Owner etc

dark edge
#

To make it to where you only see items glowing that are near your pawn and not near another player's pawn, I would have a switch somewhere in the logic chain the only does the glowing if the pawn is locally controlled

thin stratus
#

If a player interacts and you call things from the pawn, pass it along and use GetController if you need it. +- the fact they don't exist on simulated clients

grizzled flicker
#

blueprint interfaces. enough said.

dark edge
grizzled flicker
#

im nearly positive devaddict has a yt video out there specifically showing how to do item pickups with interfaces

#

multiplayer* item pickups

red salmon
#

Is there a way to send information from a menu to a session ( I want to allow players to select their name in the main menu then the server that they join to pick up that information and use it for the player name

slender totem
#

Hey guys, ive been working on and off on an online multiplayer project, and ive been struggling with transferring player data between scenes (trying to allow them to pick a color and have it load their character in a new level with said color). Would anyone be able to jump into a call sometime to break down the process of transferring player data between scenes? If not, any resources would be appreciated for a lobby system with player settings.

distant talon
#

if you have seamless transition then the player controller will persist between levels so you can save it there. if not, the game instance exists when the game is launched until it is exited, so that is also a good place to store it

#

@slender totem

slender totem
#

I was having issues with the colors getting mixed up when I used the game instance the other day, and tried to use save data instead, but it started getting convoluted.

wide pasture
#

One message removed from a suspended account.

eternal canyon
#

and if it equals the total amount then play

#

just make sure someone cant press it twice

#

through verification on the server

distant talon
slender totem
calm bison
#

The best feeling ever is when your replication works perfectly as intended

dark edge
glad otter
#

hey guys when I start a server and try to join it all I get is a black screen with these two warnings: Warning: OSS: No game present to join for session (GameSession) , LogNavigation: Warning: NavData RegistrationFailed_DataPendingKill.

#

what must I do ? I'm totally new to networking so I'm lost..

#

and these two are the commands I'm using.

glad otter
#

oh nvm I solved it!

vivid seal
#

why, when playing as a listen server, is RemoteRole set to autonomous proxy on the server?

potent token
#

@meager spade how to prevent pawn being destroyed when player disconnect?

#

i saw older post you talk about it

rapid bronze
#

iirc there should be a GameMode function override that handles what happens when someone disconnects

final quest
#

do you need a dedicated server to create a multiplayer system like fortnite

rapid bronze
#

Well, yeah

Only other alternative is a Listen Server

Go for Dedicated

final quest
#

Thanks!!

fierce oriole
#

Hey if a player is in a vehicle (either possessing or passenger), how can I: damage the unposessed driver and passengers, allow drivers/passengers to have limited control of their seated characters (ie shoot out windows). Would the possession system still work for this?

final quest
#

How do i create a dedicated server for ue4 multiplayer?

bitter oriole
#

Get the engine source, build as dedicated server

#

Then rent a bunch of dedicated servers to host your dedis

final quest
#

Thanks!!

viscid monolith
#

Hi, guys, i wanted to ask, what can be used to make online multiplayer game, with session matches, if i don't have money for buying a lot of dedicated servers?

silent valley
#

Listen server means one of the players hosts the session.

#

If you can make your game design work like this then zero server costs.

viscid monolith
#

Yes, i know, but what is this player leave?

silent valley
#

The session ends 🙂
It's possible (but not easy) to build Host Migration support so the session will continue with another player taking over.

#

Someone made a plugin or something to help with this...

viscid monolith
#

I have a website and API to handle my games' services

#

I had this concept

#

But you still can't escape lags when host leaves, before server transfers

#

Also, there is a chance of timeout

#

And to handle server you need to sacrifice some performance, also cheats are harder to fight

silent valley
#

yes, these are all valid points

viscid monolith
#

It's still the best way for me at this point, i will use it

#

But these problems sadly still exist, so i think i may find some way to make it at least better

silent valley
#

dedicated is best but can be expensive, and is a constant drain on cash to keep the game live.
you may be able to ship the dedicated server and get community to host, depends on your game etc.

viscid monolith
#

Community games are good concept

#

If im right, Listen Server model is used by Overwatch's workshop games

#

Owner hosts the whole game, and if he leaves, ownership is transferred to next player in list

#

And BF4 has community games, so players host their servers

silent valley
#

It would be a LOT of work to recreate the Overwatch workshop system in Unreal IMO
BF4 community games is a good model imo

viscid monolith
#

Agreed

silent valley
#

that's the model we're taking at the moment: operate a few Official servers, and ship the dedicated server so community can host / mod server etc.

viscid monolith
#

At this point i ran alpha build within my team, using Amazon's server

#

Overall it's good

#

But costs money if i order more servers

silent valley
#

yeah, same - costs add up for sure. Out of interest - what machine type are you using?

viscid monolith
#

We are using standard Amazon EC2 if im right

silent valley
#

I mean the specific type - we're using 'c5.large' at the moment but I've not profiled at all

#

hoping we can save some money by reducing this as we get nearer to release

viscid monolith
#

C3.medium

#

Our game is not heavy actually

#

It's basic 8vs8 shooter in futuristic apocalyptic world, it's something Battlefield inspired

#

I spent 3 minutes to type APOCALYPTIC

silent valley
#

hehe

#

sounds cool 👍

viscid monolith
#

Actually we made this setting before BF2042 were revealed >:(

#

Thanks!

silent valley
#

I think a few official servers + community hosted is a good move in that case - anticipating you'll be starting small anyway, early access etc.

#

and it saves a lot of headaches re: listen servers etc.

viscid monolith
#

Yep, it's not gonna be that big, i want to get scale of interest at this point

#

We gonna start beta in September on PC and XBox only

#

If it will take interests of people, we are gonna release on PC, XO, XSX, PS4, PS5

silent valley
#

Nice! Console release is no small feat 👍

viscid monolith
#

Yep, it's hard to get here, but we believe in the project, so we are gonna try and promote it!

silent valley
#

Best of luck to you and your team

viscid monolith
#

Thank you very much!

final quest
#

How do you create a dedicated server ue4 for world wide online multiplayer?

split pivot
#

Hi everyone! I was wondering if any of you came across a similar problem when running the Collab Viewer template from UE.
If Playing In Editor (PIE) a client machine fails to join a game from a host machine throwing a TravelFailure error:

#

To avoid getting the error I had to duplicate the map giving it the name it was looking for (prepending the UEDPIE_0_ string as PIE does)

grizzled flicker
#

anyone know the difference between gamelift and AWS?

#

they appear to be the same concept to me

silent valley
#

Gamelift is basically a layer on top of AWS that is responsible for provisioning servers based on demand. It does a lot more than that, but raw AWS you have to spin up/shut down servers yourself.

fervent spoke
#

how do i replicate to server if not owning client? right now I'm trying to allow the player to target an NPC, press a button, and then the NPC faces the player (replicated). but afaik I can't use a "replicated to server" event on the NPC because it's dropped if the client doesn't own the actor

grizzled flicker
#

ty noggs

fervent spoke
#

i guess i have to replicate to server on the player character and then from there communicate with the NPC blueprint. seems weird but i assume there's some kind of security or stability reason

silent valley
grizzled flicker
#

is there a point to steam keys if ur game is free or are they only to protect paid games?

bitter oriole
lost inlet
#

if they're release override keys then there definitely is a point when it's f2p

vivid seal
#

asked this last night but nobody saw cuz it was late.
can someone explain RemoteRole? My understanding was that it told you how much control a remote machine had over the actor. This would imply to me that any actor spawned on the server and owned by the server would have SimulatedProxy as remoterole. However, ListenServer players have a remote role of autonomous proxy, even though there is no other client machine controlling them.

meager spade
#

that is just a side effect of Listen server

#

as it is techinically autonomous, and other systems use the RemoteRole to decide things, so its more of a hack

vivid seal
#

weird

#

so my understanding of what remote role is supposed to mean is correct, except there's a weird exception for listen servers?

meager spade
#

yeah so remote role indicated what role that actor has based on the object. So connected client player controller will be on the client side "LocalRole == Autonomous Proxy", "RemoteRole == Authority", on the server side, that player controller will be, "LocalRole == Authority", "RemoteRole == AutonomousProxy"

#

@vivid seal

#

ListenServer just has a weird exception

vivid seal
#

yeah that makes sense, i just thought that logically on a listen server it would be LocalRole == Authority and RemoteRole == SimulatedProxy

#

okay thanks

vivid seal
#

okay i'm trying to use ResetReplicatedLifetimeProperty to change the replication condition of a variable in a child class. the variable is protected, but I'm getting "member is inaccessible" errors trying to pass it into the function (I also tried using the RESET_REPLIFETIME_PROPERTY macro, which basically just calls this function).

#

specifically the GET_MEMBER_NAME_CHECKED macro does not let me pass it the protected variable

foggy rain
#

Has anyone worked with the Replay system?
Is it possible to record the whole session + display instant kills (killcams)?
When the killcam is played, the session recording stops.

final quest
#

Hi! How do i setup login/register in ue4?

fading birch
final quest
fading birch
#

what backend are you using?

final quest
#

I don't use one

fading birch
#

you need one for a login system

final quest
#

I have Firebase

fading birch
#

either a custom made backend, using w/e framework you want. AWS Cognito, Steam authentication, Epic Online Services, etc.

final quest
#

Can i use Firebase to?

fading birch
#

yes

#

you'll have to configure all of that yourself though as that's outside of the purview of this discord

eternal canyon
#

pretty sure they show off a KillCam

fading birch
#

Replays are annoying

#

it essentially runs all your code back

#

executes the exact same function calls that took place

eternal canyon
#

yea

#

but from I remember from the Documentation you can play replays without leavbing the current session

fading birch
#

correct you can

#

but your code needs to be constructed in a way to handle that

eternal canyon
#

ah

fading birch
#

most normal tutorials for simple multiplayer games don't write their code in a way that allows it to handle replays.

#

and the documentation for replays in woefully lacking, even in the engine

eternal canyon
#

but also most normal tutorials use a multicast for spawning actors😂

fading birch
#

I did use UT for learning it

#

and it was "helpful"

#

to a degree

eternal canyon
#

lol

cerulean wolf
#

Hey people!
This might be a simple question, but how do i get the player state of an other player?

dark edge
cerulean wolf
dark edge
#

@cerulean wolf also, if you have a Pawn reference, you can get its player state. Just drag off the pawn reference and get player state.

#

What exactly are you trying to do here?

cerulean wolf
foggy rain
# eternal canyon pretty sure they show off a KillCam

I know how to play a KillCam, but what I do not know is how to have KillCams + the record of the whole gameplay. For now I recording the whole gameplay and on death replay last few seconds. But this stops the whole gameplay recording.

foggy rain
fading birch
#

Most of it is fine but the replay system is just ???

foggy rain
fading birch
#

Thats the intended way afaik

#

Stuff changes too quickly for documentation to keep up

gray zinc
#

I've got some components that only exist in editor that I use as gizmos to drag around and determine things in an actor on the scenary, for some reason these components aren't on the correct location in multiplayer, does this sound familiar?

foggy rain
fading birch
#

Anything is possible.

fading birch
foggy rain
#

I just never played UT, so asking :)

gray zinc
#

Gonna try it anyway, thanks for the idea

fading birch
foggy rain
fading birch
#

it's been awhile since I looked at it, but essentially you have the server record. You have the player transfer to the servers recording server, play back X seconds with w/e viewpoint, then transfer them back.

#

in the meantime, the recording is still going on in the game server.

foggy rain
fading birch
#

you don't need to stream it all the time

#

again, it's been over a year since i've looked at this stuff

#

but essentially you start up a recording playback server

#

and the game server is responsible for streaming the replay to the replay server.

#

you just have the client connect to that when playing the replay

#

that's as far as I was able to understand it

#

and the amount of refactor it would have taken to make our code jive with UE's replay system was too far out of scope

foggy rain
#

Oh, got it. So you used a separate server for replays, right?

fading birch
#

sort of

#

it's still the "same" server

#

it's just running in parallel

foggy rain
fading birch
#

no

#

it's in the replay code

#

i'm nowhere near an expert on this stuff

#

so unfortunately I can't really help much further than this

foggy rain
#

Oh got it, we always have two NetDriver classes. One for replication and the other for replays. This is how it works by default. And you recording the whole gameplay on the server and then plays only a few seconds for KillCam?

fading birch
#

you can set it to record only the last X seconds

#

and just constantly be playing that a bit delayed on the replay server

foggy rain
foggy rain
fading birch
#

not off the top of my head, no sorry

foggy rain
fading birch
#

no worries, best of luck!

heavy marlin
#

anyone here know of an example of dynamically created (+replicated) components within the engine or sample project?

#

I can get them spawning on both the server and client, but no property replication

winged badger
#

c++?

#

check for missing Super calls

heavy marlin
#

yeah c++

#

nope i got supers all over, in the constructor i have both SetIsReplicatedByDefault(true) and SetIsReplicated(true)

#

SetIsReplicated is also set for the newly spawned component

#

and GetLifetimeReplicatedProps is actually hit

winged badger
#

GeLlifetimeReplicatesProps has super too?

heavy marlin
#

yeah

#

maybe its cause im replicating a custom struct - its never been a problem before though, ill try an int or whatever

winged badger
#

generally

#

there is nothing to it, spawn a replicated component on replicated actor

#

and it works

#

only UPROPERTY members that are not NotReplicated of a UPROPERTY struct can be replicated

#

struct member needs to be marked Replicated, and added to GetLifetimeReplicatedProps

heavy marlin
#

Yeah I thought the same

winged badger
#

there are few other ways to fuck it up

#

like

#

using a derived class that doesn't call Super

#

making a mistake overriding NetSerialize on the struct

heavy marlin
#

damn, no go on an int either

kindred widget
#

What does your property declaration look like?

heavy marlin
#

I take it this should work on actor components, not just scene components

kindred widget
#

It's all the same.

heavy marlin
#
    UPROPERTY(BlueprintReadWrite, ReplicatedUsing=OnRep_SomeInt, Category="Test")
    int32 SomeInt;
kindred widget
#

It's also worth asking if you're hotreloading?

heavy marlin
#

then set without any conditions

#

yeah i tested that - did an actual restart of engine

#

it has to be something in the host actor

winged badger
#

well, its time to decide not to trust you you created the component right 😄

heavy marlin
#
            UDTSensorDataComponent* SensorDataComponent = NewObject<UDTSensorDataComponent>(InPlayerController);
            InPlayerController->AddOwnedComponent(SensorDataComponent);
            SensorDataComponent->RegisterComponent();
            SensorDataComponent->SensorActor = Cast<AActor>(Sensor.GetObject());            
            SensorDataComponent->InitializeForPlayer(InPlayerController);
winged badger
#

that is run where?

heavy marlin
#

from er

#

a GameInstance subsystem that hooks into OnPostLogin

#

i confirmed they spawn on client by logging a message in BeginPlay that only fires on the client

winged badger
#

you confirm client creation

#

by putting a breakpoint in AActor::OnSubobjectCreatedFromReplication

heavy marlin
#
void UDTSensorDataComponent::BeginPlay()
{
    Super::BeginPlay();

    if(GetNetMode() != NM_Client)
    {
        // ...
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("UDTSensorDataComponent::BeginPlay"));
    }
}
#

hmm, ok ill take a look at that

#

yep im getting that subobject created hit

#
[2021.07.20-00.26.18:877][199]LogNet: Warning: UActorChannel::ProcessBunch: ReadContentBlockPayload failed to find/create object. RepObj: NULL, Channel: 2
#

that's a new one, i added SetNetAddressable()

#

will implement ReplicateSubobjects and report back

#

nothin 😦

summer tide
#

Does server function replication requires a _Implementation

heavy marlin
#

yes and Validate

summer tide
#
    void SimulateRangeAttack();
    void SimulateRangeAttack_Validate();```
heavy marlin
#
UFUNCTION(BlueprintCallable, Reliable, Server)
void SimulateRangeAttack();
void SimulateRangeAttach_Implementation();
bool SimulateRangeAttack_Validate();
#

alright i've sort of gotten somewhere - the property replicates if it's changed in tick, but not where i'm changing it (in response to an event)

#

Is there a way to manually mark a property as needing sync?

summer tide
heavy marlin
#

yes, and just return true for validate for now

summer tide
#

Got it thanks

storm lily
#

how do i make physics objects to be in sync on multiplayer server and replicate

unkempt tiger
#

watch that @storm lily

red salmon
#

How do I get a specific player's game instance?

chrome bay
storm lily
#

and the cube goes out of sync almost from the beginning

unkempt tiger
#

usually its not pie related, but a quick restart for sanity's sake never hurts

storm lily
#

also the cube is set to height that it falls, and it does on the server, and on the client

#

but on the client it should be already on the ground

chrome bay
#

Problem you have is if the client simulation moves the cube, but it's stationary on the server, then the client will go out of sync until the object moves server-side.

storm lily
#

so something needs to be disabled?, i searched for something related to the client

chrome bay
#

For persistent physics, or player-controlled physics - it's a hugely complex problem.

#

Well, you can disable physics simulation on the client (though you'll need to do this constantly, because replicated movement will overrule that) - but then the objects will just "snap" between positions.

bitter oriole
#

Wonder how Chaos fares on determinism now

chrome bay
#

Yeah I wonder that too. The async ticking probably helps, but I wonder how it copes with objects being inserted into the scene at different times etc.

#

Supposedly Chaos is meant to address all this stuff though, despite being so damn slow compared to PhysX

unkempt tiger
#

i'd like to see it first handle a basic rigid body stacking usecase without the stack eroding to the ground

chrome bay
#

yeah some level of stability would be nice first 😄

#

I feel kinda bad for Epic 😄 Myself and a few others went to town a bit on Epic in the official Chaos thread on the forums.

#

But I honestly don't know how they can seriously be considering deprecating PhysX with Chaos in it's current form.

unkempt tiger
#

I'm staying on UE4 if they're gonna push it down our throats for UE5, and I LOVE real time lighting

bitter oriole
#

They have a year of work until they actually do

chrome bay
#

yeah

bitter oriole
#

And I suspect many games will work perfectly fine on Chaos

#

I've heard that nvidia devs are kind of weirded out by Epic as well

#

As in they don't believe Chaos is going to be better than PhysX5

chrome bay
#

Yeah I think Zeb linked to a Github thread where they basically said "we aren't going to maintain a PhysX build of UE5", something about the abstraction layer not being particularly great.

unkempt tiger
#

my two cents are: Epic really wanted vehicles to work in a deterministic 100% their-own-code way for fortnite. They embark on the Chaos journey, they market the shit out of it, literally years pass and it's turning out to be way harder than they thought, but they already promised, so it's all being forced in a weird, awkward way

#

that's how it feels like at least

bitter oriole
#

My feeling is that multiplayer physics is a really really big box to check on the engine feature list

#

Having essentially nothing on that in the engine has been a problem

chrome bay
#

yeah definitely

unkempt tiger
#

their effort to make it predictable is salute-able

storm lily
bitter oriole
#

PhysX being entirely unable (apparently even in newer versions ?) to support multiplayer means they need to get rid of it

chrome bay
unkempt tiger
#

btw @chrome bay remember me wondering about snapshot interpolation like over a year ago? I got it working flawlessly, it's 100% jitter free now

chrome bay
#

I gave up 😄

unkempt tiger
storm lily
unkempt tiger
#

but that can be worked around with a little bit of validated client authority

chrome bay
#

What do you plan to do with the implementation atm?

unkempt tiger
#

use it in a first person shooter I'm working on

#

with a lot of physics based mechanics

chrome bay
#

roger, I wasn't sure if it was just for a proof-of-concept or self-punishment sort of thing 😄

unkempt tiger
#

i think definitely a little of both ^^

nova wasp
#

UE5's network prediction plugin makes physics replication much nicer

#

It's still very experimental

chrome bay
#

Hasn't been updated for a while AFAIK, but yeah that's supposed to be a solution for player-controlled physics.

nova wasp
#

Updated on main a month ago

#

It's slow going though

chrome bay
#

Yeah AFAIK it's only Dave working on it. It'll be interesting to see how well it scales with Physics. Last time I checked in with the physics portion it has to send a continuous update stream about every physics object to avoid desyncs.

nova wasp
#

Ideally stuff like this is deterministic

chrome bay
#

I don't think it ever will be

#

But allowing physics to at least tick with a fixed timestep is a step closer to it

nova wasp
#

The plugin actually has to disable bandwidth limits

#

It's definitely cpu time oriented for now

chrome bay
#

Yeah looks like they're only working on it in UE5 now too.. urgh. Expected that though.

nova wasp
#

Probably even more ue5 dependant with the new fixed thread

#

I'm just praying for CMC 2.0

chrome bay
#

I think they've already started on that one

#

CMC via that plugin

#

They'll probably keep the legacy ones for backward compat, but I wonder if they'll restructure it

storm lily
#

is smooth sync plugin worth to look at?

unkempt tiger
#

depends, what are your project's needs?

storm lily
#

i am basically referring to the simple physics i was experimenting before, actually i dont have plan for any extensive use of physics in my project, but i would like just to know if that plugin is good for solving issues that engine itself doesn't solve

bitter oriole
#

It doesn't solve much, it'll just put objects vaguely in the same spot

#

If you need player interaction with physics it might not work well

glad otter
#

hello here I'm checking whether it is the server that is overlaping a trigger volume, but even with the client this check still returns true why is that ?if (HasAuthority()) { FString CompName = FString::Printf(TEXT("OnOverlapbegin called!%s"), *OtherComp->GetName()); if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, CompName); }

bitter oriole
#

Maybe it's not replicated.

glad otter
#

the player ?

bitter oriole
#

The class this code belongs to

#

Also, if you test in PIE, AddOnScreenDebugMessage adds on all windows IIRC

fossil veldt
#

Is there a way I can make a specific client authoritative over an actors movement?

bitter oriole
#

(in single process mode)

bitter oriole
fossil veldt
#

wait you mean UPlayer?

bitter oriole
#

Nah

#

You want to "make a specific client authoritative over an actors movement"

chrome bay
#

Is it for a character or any random actor we're talking?

fossil veldt
#

random actor

chrome bay
#

Character does have a method to turn off corrections

#

Ah kk

fossil veldt
#

I wanna be able to "pickup" and build with an actor and have the server take the clients account of it

bitter oriole
#

Assuming that's a random actor, just replicate the actor the way you want to

#

There's no built-in actor movement

fossil veldt
#

I could do some kinda server move RPC but dunno if that's good practice

bitter oriole
#

So it's entirely up to you

chrome bay
#

For a pickup, just attach it to the character IMO

#

server-side

fossil veldt
#

it's server authoritative

chrome bay
#

The attachment will replicate by itself so long as you've enabled replicate movement on it

bitter oriole
fossil veldt
#

well the only issue is that i'm doing some manual location manipulation, It's not really just "attaching"

chrome bay
#

Hmm in which case, you'd have to RPC the transform to the server

fossil veldt
#

I kinda thought that way in the past, Do I just throw a "Server Move" rpc and lerp it manually then?

bitter oriole
#

It will simply teleport the actor every few frames without actual movement, it'll look terrible in any real-world situation with non-zero lag

chrome bay
#

yeah

fossil veldt
#

ah fair, good to know

bitter oriole
#

For actual movement this gets a shitload more complex

fossil veldt
#

ty guys!

#

yah I could do character movement myself, just wasn't sure if similar concepts were the way to go

glad otter
fossil veldt
#

I try to work with the engine where possible

#

but I guess this just calls for some DIY

#

all gud! thanks so much

bitter oriole
#

Basically for moving actors you need movement on tick on clients and server ; the authoritative movement source needs to RPC the server if it's a client ; and the server needs to tell the other players about the new transform

#

Remote clients will need to interpolate

#

Since you'll get like, one network update every 5 or 10 video frames

#

And more probably a packet of 3 updates every 20 frames

fossil veldt
#

yea

glad otter
#

could it be because client and server character are using the same characters ? because if I don't check for authority it is getting fired twice

bitter oriole
#

"has authority" means "is on server" (for the most part), not "is locally controlled"

glad otter
#

no, its not that. I have a pressurePad and when I step on it with either server or the client. it is being fired twice

#

if I have three players it gets fired three times no matter with which one I try it

bitter oriole
#

Dunno then but make sure to confirm it's actually called multiple times on the server with authority - play on editor can be confusing with that

chrome bay
#

Also where are you checking HasAuthority? The pressure pad or the character?

#

If the pressure pad is placed in the level and not replicated, clients will have authority over it.

glad otter
#

PressurePad and in OverLapBegin function

#

its not about authority

#

if I check for authority it is only called once, no matter how many players I have nor on which client I overlap that pressure pad

chrome bay
#

If the pressure pad isn't replicated, then that sounds correct.

#

Each client will move the character onto their own local copy of the pressure pad, so you'll get three overlap event printouts - one for each instance.

glad otter
#

if I don't check, it gets called for as many players as I have

chrome bay
#

Sounds right then

#

Assuming the pressure pad is a replicated actor and only the therefore Server has authority, only the servers' instance will print the message if you branch based on that.

#

If you don't branch, since every client is overlapping the pad in their local instance of the game - you get three messages.

#

One on each

glad otter
#

the thing is I get three on each

#

and one on each when I check authority

#

and the PressurePad is replicated

chrome bay
#

How do you know it's three on each?

glad otter
#

the messages appear on all of them

bitter oriole
#

Like I said, that doesn't mean much

chrome bay
#

Yeah, doesn't mean anything really. Messages go into all the viewports sometimes

#

A better way to verify it would be to log the message instead

bitter oriole
#

In PIE single process, pretty sure every message goes everywhere

chrome bay
#

yeah

glad otter
#

ok gonna try logging it

hallow acorn
#

hi guys 🙂 i'm trying to force a player movement by invalidating his input and adding forcing movement input but for some reason the client that is being forced sometimes stutters.. like it moves, then stops, then moves again and so on.. so wanted to ask if you guys got any advice or a better way to do it.. thanks 💙

stuck marsh
#

Hey guys, can anyone help me with find sessions blueprint?

#

I have an issue that I can only find sessions in my own computer, opening the game twice, and I managed to join from another computer but in the same network

#

The lan function is set as false, and anyone from another computer cannot join, not make a lobby which I could join

twin juniper
#

If I execute a custom event which runs on server, and in this custom event I do a 'set with notify' for a variable, and this 'with notify' has a lot of logic attached, is the 'with notify' logic guaranteed to run on server?

kindred widget
#

@twin juniper Yes and no. Semi complicated topic since the functionality differs in Blueprint and C++. In C++, no. You purposely have to call the OnRep yourself after setting the value, which is why a lot of onrep variables are set with a wrapper function that also calls the functions the server needs to update it's own state, be that bindings or the OnRep function itself. In blueprint, this is different because the OnRep will get called for the server automatically whenever that variable is set. I don't remember if the value needed to be actually changed in Blueprint for the onrep to run.

twin juniper
#

ok thanks

cosmic trail
#

What algorithm do people use to handle lots of inconsistent network speed, like consistent lag spikes, where latency varies a lot? Say a range of 50 ping to 200 ping. When this happens, character movement component doesn't compensate for this inconsistency, so it will keep see sawing back and forth. But the information to account for this is there, the server time vs. the client time. The delta between these two times would be inconsistent. So say the server and client are pretty in sync, say at a high latency of 200 ms, then the network is better, so suddenly the client seems behind the server, and tries to catch up, but then the network reverts to 200 ms latency and then the client is too far ahead. I've managed to make it a bit smoother by looking at the delta changes of the server time and client time, but I suspect the algorithm I did can improve a lot.

obsidian plume
#

Just wondering, is it possible to created a server game like Rust, same server design as where someone could join the same server over and over again and have their inventory/base there

hollow eagle
#

yes

obsidian plume
#

Okay thanks

trail hill
#

How would I best count the number of players currently connected to my server? I tried NumPlayers of GameMode but it doesnt seem to update once a player quits.

split siren
#

What is the rule for storing data in FSavedMove_Character as a variable (such as uint32 bPressedJump:1;) and when to store data in the uint8 compressed flags? (such as bPressedJump)

fading birch
storm lily
#

i want to implement in my project such feature that, when player gets disconnected from the server, it will stay on the same map that it was before so it's like it became host of singleplayer game, what should i look into to make this happen?

thin stratus
#

Pretty sure without bigger engine changes you will always have some loading involved into this

#

Idk if you can even stop the engine from throwing you back into the level you originally came from without adjusting source code

storm lily
#

is it truly not possible to prevent it from throwing? im curious what's the logic behind getting disconnected, is it always last level , or last streamed level?

thin stratus
#

I think it's the url you came from. But keep in mind even if you get this to be the level you were on, all your classes despite the gameinstance will be created from scratch

#

Nothing survives the hard travel that a disconnect is

storm lily
#

it's possible to save necessary state and recreate that, but the need to reopen level bothers me, if this is performance hit or that it could flicker or something else

thin stratus
#

It's a loadingscreen situation

#

It won't be seamless

#

Even if you directly go from multiplayer to the same level disconnected

hallow acorn
#

hello again 💙 i'm forcing a client's player movement via "SimpleMoveToLocation" and on every other client the movement looks fluid except for the one that is being forced.. it looks choppy.. any ideas on how to deal with that? 🙂

storm lily
#

i will try to perform experiment now, with getting kicked and reopening level immediately, there is event onclientwaskicked, but i dont see where i could get something like clientwasdisconnected

thin stratus
#

GameInstance has calledbacks it listens to for BPs

#

Should be some global delegates or so

#

Travel and network failure

#

They will call when this happens

#

If you need it to be seamless then you might need to exchange the whole network stuff of ue4 with something custom or thirdparty

storm lily
#

in blueprints there is travelerror and networkerror

thin stratus
#

Yeah

#

Just check how they work in cpp

storm lily
#

i hooked up quickly to both nodes, printtext, and when host decides to close server, network error fires

#

and it does two times, first is connection lost, and second , failure received

#

interestingly enough calling openlevel there does nothing

thin stratus
#

Might be too early

#

Might be before even traveling away from the first map

storm lily
#

that's the only reasonable explanation

#

what's better digging where i could hook it deeper in the engine, or maybe just set flag there , and do it on other event?

#

rn i just did that on gamemode's event tick, put there widget placeholder that simulates loading screen, and it kinda works, like any other transition to level

fading birch
#

We wanted to drive some UI in that instance

fading birch
#

right, but i meant more is that constantly being broadcast somewhere?

#

I can always just look in the code, was just wondering off hand

storm lily
#

these events are accessible from game instance

fading birch
#

those aren't events, they're enums

#

they're broadcast in HandleNetworkFailure from UEngine. You can override it there or use HandleNetworkError which is a BP only event (which seems silly)

storm lily
#

by silly, do you mean for example that enums are not that good in bp?

fading birch
#

no, i mean that there's no place to hook into it from C++ in the game instance. You have to create a child of UGameEngine in order to hook into it.

#

that's what's silly.

storm lily
#

not the only thing silly in this engine

#

how does it work, cant you just override handlenetworkerror, im not so good at this?

fading birch
#

correct

#

call super ofc

#

and then put your own logic there

storm lily
#

but the engine version is more extended

tribal yarrow
#

Can anyone give me some advice? Something is just not clicking for me..

I've got an actor spawning in my GameMode's BeginPlay Event (this means the actor is spawned on the server right?)

In that actor's BP, I have it spawning other more actors on a timer and it's using a custom event on multicast. I also have the spawned actors set to Replicates.

I'm seeing that the object is apparently spawned on the server and I can also see that it is ticking through spawn events, but I don't see any items spawn on my clients.

fading birch
severe tendon
#

This is a really weird issue
Anyone know why a Client would be able to send a value to a client hosted server but the server wouldn't be able to send it back

Eg Chat:
Its all the same code
Client sends a String "WASD" and the server gets it and can see it
Server sends "WASD" back but it never gets to the client

sinful tree
severe tendon
#

Server > Multicast RPC
Sending it on the actor that is spawned on both server and client.
It looks like it was an issue with checks I put in place to stop spamming empty/same values from the client to server to optimize the code a bit, im about to test now

sinful tree
#

So you have an actor that is spawned separately on the server and the client? Ie. Calling Spawn Actor on server and then on client (via multicast or otherwise?)

thin stratus
severe tendon
#

Spawn is called on the server which spawns the actor on both ends

fading birch
severe tendon
sinful tree
severe tendon
#

Yeah

thin stratus
severe tendon
#

The Client actor owned and controlled by the client is working as expected

#

the server one isn't

thin stratus
#

So you can bin in any BP to them. Maybe i misremember

thin stratus
fading birch
#

ced

#

can you respond to them all at once please?

#

❤️

thin stratus
#

I just woke up. PE_PandaCoffee

fading birch
#

drink more coffee

#

or tea

#

w/e

fading birch
#

yeah, just checked again, it's just calling this in UnrealEngine.cpp

thin stratus
#

Will have a look ince I'm awake and at my pc

fading birch
#

UEngine::HandleNetworkFailure

#

that's the function I checked

#

if that's the case, that's really weird

sinful tree
#

Output:

#

So long as client 1 and client 2 are within range of one another. If they're distanced then net culling may be occuring.

severe tendon
#

Yeah

#

They're basically standing infront of eachother at all times but thats a good point, I might disable culling

#

Its really weird because there's a component that crashes if it exists on the server I create it on your own local character only (IsLocallyControlled) and then get its values and pass them through to the Player Pawn on Owning Character then parse that through to the actual networked component that I'm having issues with, but it does work, its backwards as heck and I don't like it but at this point I don't need to like it

severe tendon
#

Ignore the PacketID stuff, thats just to stop visemes appearing in random order
and the 2nd one was just a quick screw around to see what would happen if it passed the order

novel bison
#

how do i I get the current locally controlled player controller on each client?

#

every time I run getPlayerController it returns the same one

trail hill
fading birch
#

@trail hill are you updating it when someone leaves?

trail hill
#

@fading birch no i dont touch it but the engine should update it when someone leaves

fading birch
#

No I mean are you listening for the update.

#

How often are you checking it?

trail hill
#

I update it in tick

#

so should be fine

#

@fading birch Thats all I am doing in the tick of my widget And the GerConnectedPlayerCount simply returns NumPlayers. I also tried PlayerArray.Num() but had the same result. When someone joins the game the count increases correclty. But when I Alt+F4 to quit it doesnt decrease

#

So i suspect that Logout isnt called on AltF4 maybe?

#

Because in the Logout of the gamemode the cpunts are decreased

fading birch
#

Try waiting a bit. If someone alt f4s that's not a clean exit. Iirc a server will hang on to their player state for a bit so if they rejoin they don't lose their attributes.

#

It's something like 30s or so

#

It's customizable

trail hill
#

Yeah the playerstates stay on the server for 300 sec by default

fading birch
#

Sounds about right.

trail hill
#

But they are moved to an inactivePlayerArray

#

As soon as the player quits

fading birch
#

Correct.

#

I'm not at my pc right now but I'm not sure if the player array is actually updated when they're moved.

trail hill
#

I could set the value to 0 but then I can't have fancy reconnects in the future

#

This is called in the logout

fading birch
#

Logout may not be called when they alt f4 immediately

trail hill
#

Yeah thats my guess too. But its hard to test as I have to deploy the server everytime I want to try something :/

fading birch
#

No?

#

Just launch your project with -server

#

I usually make a config to do that from my ide

#

And a shortcut for non debugging

trail hill
#

Hmm I am kinda new to networking in Unreal. How would i then connect to the server?

#

Is there some documentation or guide on that?

#

Would love to have a better workflow

fading birch
#

How do you connect now?

#

Sessions?

trail hill
#

No sessions yet

#

For now a hardcoded ip to the dev server

fading birch
#

Ah

#

Same thing then

#

Just type open 127.0.0.1 in the console.

trail hill
#

I build the server and client everytime I need to test something server specific and have to deploy. Its a pain

fading birch
#

Yeah thats not necessary lol

sinful tree
#

Noooo

fading birch
#

You can launch client using -game

trail hill
#

Where do I append this flag?

#

In the launch config of the ide?

fading birch
#

You can add -log as well

#

Yeah you can. Generally I make a shortcut from my uproject file.

trail hill
#

Ohh wait nevermind I remember why I dont do this

#

Server is on linux

#

But I could add a windows config for testing stuff

fading birch
#

It's like:

"Full engine path\ue4editor.exe" "full project path\projectname.uproject" - server -log

trail hill
#

Thank you

fading birch
#

Swap -server for -game to open a client.

trail hill
#

I will give it a try

#

Will also add a Windows server target for easier testing. Otherwise I still would have to deploy

fading birch
#

You don't even need to build your server binary. It'll use your windows build of dev editor just fine.

trail hill
#

Wait what

fading birch
#

No need

trail hill
#

this works

fading birch
#

Yup

#

You may need to add a server target. I'm not 100% sure

trail hill
#

I will give it a try. Thanks for all the helpful tips. Its really hard to find any best practices on multiplayer workflows and I would never have found this without you 🙂

fading birch
#

I honestly stumbled across it in some random YouTube video 3 years ago lol

#

There is documentation for it let me find a link.

grand kestrel
#

Is APlayerState::ExactPing or APlayerState::ExactPingV2 more accurate? Seems like ExactPing is averaged but ExactPingV2 isn't?

#

I'm replicating a time (for date/time system) from the server to ensure that player's time stays in sync, and when I do so I add their ping to the time to compensate for the difference in latency to get as precise a match as possible, just not sure which one is best for that

fossil veldt
#

Anybody know if there's a better way to set ownership from a client on an actor than just doing a server RPC with Actor->SetOwner(NewOwner);

#

I have NetTakeOwnership RPC on my Player Controller but it seems like a pretty dirty way to do things

trail hill
#

@fading birch Thank you so much! I just tried your commands for launching the server and client locally and it works like a charm. You can imagine how much time you just saved us as we no longer have to package and deploy to a remote server for testing server specific stuff 🙂

strong sail
#

This doesn't seem to replicate to other clients running on dedicated server can't for life of me get it to spawn

sinful tree
strong sail
#

yeah

#

and then spawn_cube is in my thirdpersoncharacter blueprint

sinful tree
#

2 things:

  1. Clients can't multicast to other clients - only server can multicast.
  2. You shouldn't necessarily be spawning on all clients, as then each client has their own client-only version of the object you're spawning which may not necessarily be what you want.

What you need to do:
Your button click would need to call an "Executes on Server" event that exists on the character or player controller. The server should then do the spawning.
If you want each client to have their own client-only version of the object, then from the "Executes on Server" event, you can do an "Executes on All" event to spawn the cube for each client.

strong sail
#

awesome so like this instead

twin juniper
#

does changing a replicated variable on the server automatically flush dormancy?

trail hill
#

@fading birch And I also figured out why logout wasn't called for me. I forgot to call the Super::Begin in my playercontroller. I found a post on someone else having the same problem and now everything works. Interesting how such an unrelated thing doesnt cause any issues anywhere but on the logout.

prisma aurora
#

how do i get the player id for players?

twin juniper
#

I think my issue is that I don't have weapon reference in client side, so it's not calling the fire function

#

How do I get it on client?

#

I spawn actor and set the output to a variable

thin stratus
#

Usually by making sure your actor is marked for replication and the variable is too

chrome quest
#

I have a couple of questions please.
I'm using a replicated variable to set actor rotation. It doesn't work without replication and I don't want to use RPCs.
I notice that there is a very slight discrepancy between server's value of the variable and those of the clients. (I'm talking about orders of 3rd or 4th decimal place). It's not any issue for me. The difference is not even noticeable.
I'm just wondering if this is normal since there may be other situations where it might become an issue).

#

Secondly, which is more taxing on the server/consumes more bandwidth.
Using replicated variables or using RPC functions? I understand each has their place but I just want to know what choice I should be making if I have to choose between the two.

chrome bay
#

For stateful changes you should use replicated variables

#

It's not necessarily about which is faster, it's more about which is more suitable

chrome quest
chrome bay
#

Speed changes are difficult, the controlling client needs to be able to "predict" those changes as part of it's predicted character movement, which means changing it on the client first, then telling the Server what the new speed is rather than the Server changing it.

chrome quest
meager spade
#

i heard fortnite does not really predict speed changes

#

not even sure how they handle sprint, cause they said in a UDN post they dont do anything special for speed changes

chrome bay
#

tbh we just do the same thing as shootergame and that seems to work fine for us

thin stratus
#

How does one react to a jump on a simulated client? Seems like the JumpCurrentCount and all of that is all non-existent on Simulated Clients.

random verge
#

Anyone here ever play around with custom quantizing vectors down to 16-bit components (or 8-bit even though it'd be wildly inaccurate in most cases outside of unit vectors)?

meager spade
#

FVector_NetQuantize?

random verge
#

that goes down to 20 bits

#

per component

meager spade
#

normal goes to 16

random verge
#

oh nice

chrome bay
#

Could just roll your own too

random verge
#

thats whay I'm asking

#

hoping someone else did the heavy lifting already lol

meager spade
#

tho, depends what your needing to do, i find 20 just fine for most usecases

#

16bit only makes sense for normals (-1 to 1)

novel bison
#

I probably need a refresher on network concepts but I’m having some trouble assigning teams to characters on spawn

#

I can assign them to Player Controllers just fine

#

And spawn at a given location based on team

#

But I want to change some parameters on the character as well on both server and client

#

And it’s throwing me for a loop

#

On post login I get the player controller and assign it a team based on a rudimentary balancer

#

And then I need to pass that team all the way down to the character that’s going to be possessed by this controller

#

But there doesn’t seem to be a reliable point where I can grab this team ID and give it to the character

#

I’m assuming I need to handle this on server and multicast

#

Is there a way to get the spawn point of a character before they spawn?

pastel marlin
#

more generally, use rpc for event and replicated properties for states

kindred widget
#

Might also be worth noting that something like Team should likely be on the PlayerState instead of the character. Characters are often throwaway actors. Keeping team state on them would be a hassle versus keeping it on their Playerstate and using it from there.

novel bison
#

Yeah that makes sense

#

I have it assigning to a TeamID variable on the player and that actually works fine

#

The next step would be to grab it and change the color/mesh of the character before the player spawns

#

and that's where I'm lost

novel bison
peak sentinel
#

Can Unreal compress pointers in RPC parameters?

#

And it says with 32-bit computers its 4 bytes, with 64-bit computers its 8 bytes, does it differ in UE too? thinkmanny

eternal canyon
#

they dont send the pointer

#

from my understanding

#

hence net guid

#

🙃

normal violet
#

anyone online with a good understanding of movement replication (rotating a child static mesh of a character, which has the camera (players viewport) attached to it)? It's jittery on the client and smooth on the listen server. @thin stratus told me I am missing the client side prediction part, but no idea on where to start fixing that 😅 . Could someone point me in the right direction? I am working in Blueprints, but if it's a quick fix / much easier option to do it in C++ that's fine too.

peak sentinel
#

Whats the size of the GUIDs though?

#

Anything significant?

hallow summit
#

I have a randomly generated actor spawning. When i do multiplayer the actor is different for every player. How would i replicate it so every character sees it the same?

sinful tree
sinful tree
hallow summit
sinful tree
#

So you have two options:

  1. replicate the state of each variable that is being set by the randomness using "OnRep" variables. On the OnRep functions, you make the variable modify the part of the actor it's supposed to.

  2. Look into random from stream - this can allow you to replicate a single OnRep variable and on that onRep you generate all your values from that "stream". Think of it as a "seed" system where you only need to distribute the seed value and then all clients can generate the actor on their end without having to replicate all the values.

normal violet
#

Ok thanks will start to read it

pastel marlin
#

Its cover the whole thing but you can just implement the interpolation part to begin

normal violet
#

ok thanks will look into it. But it's going to be a CPP party then 😦

grand lance
#

I'm having replication issues with animations. My blendspace has blend by bool(used for third person ADS). The remote clients send RPC to say bIsAiming, the anim instance gets the replicated variable and updates the blendspace. however, this isn't working for simulated proxies

#

rather i bIsAiming as replicated or onrep

gritty pelican
#

If I have a LobbySteamID, can I connect to server using p2p?

#

for example: Lobby leader call open L_Game?listen and after members will call open steam.LobbySteamID, but it not work, members can't connect to server

grand lance
#

been a few years since i messed with online subsystem. but i remember using GetSteamGameSession and connect using the ip

thin stratus
dark edge
grand lance
#

It's only replicating to remote clients if I'm a client with authority(listen). The server rpc doesn't even register when the remote client sends the rpc

#

Like the function on the server never gets executed when remote client sends it

#

Does the have to anything to do with the actor sending server rpcs if it doesn't have correct ownership?

#

I'm gonna try something different when I get back home

#

Instead of the weapon actor sending the rpc, have the weapon return Boolean to ACharacter and send rpc from character

bitter oriole
#

Actors that aren't locally owned cannot RPC to the server

#

Only possessed pawns, player controller can

grand lance
#

Ah, there's probably my issue

#

The weapon I spawned isn't possesses but does have owner and instigator

#

@bitter oriole thanks

feral glacier
#

quick question. I'm trying to do multiplayer with AI enemies. I'm using AI tree to drive behavior. Where is the best place to call damaging a player from? the AI tree, the AI controller, or the pawn?

grand lance
#

From its controller or its character

#

I topically make my ai behavior trees as read-only. I never set data to the actually character. If I need to send data, I use events

#

So ai character receives damage taken, sets a Boolean or enum to dead if health is zero. Behavior tree can read the isdead variable

feral glacier
#

yeah thats what I was thinking

#

so right now the AI tree calls this on the pawn

#

the controller calls a server event to get asny players in a range in front of the enemy and apply damage

grand lance
#

i dont think AI need to called server functions do they?

dark edge
grand lance
#

oh wait thats attack. i was thinking damage

feral glacier
#

right. so right now the AI tree calls the animation but the controller actually figures out who to damage and how much

dark edge
#

I mean it depends on your design, but the AI controller should just call DoAttack or DoAttackToActor, that's it. It shouldn't be manually playing animations.

feral glacier
#

right. it calls the melee attack interface which causes the pawn to do the blue print I pasted above

#

then when the montage hits the right point it has the controller apply damage to the correct area around it

dark edge
#

The controller should not be applying damage.

#

All the controllers should do is trigger the attack, everything else should be handled in the pawn.

Think of it this way, design your pawn such that it doesn't matter if a PlayerController or AIController is driving it. All they are doing is giving control inputs.

Designing in this way also makes development much better as you can manually control any of your pawns for testing.

feral glacier
#

ok so

#

this is my current damage players setup. Just move this to the pawn?

dark edge
feral glacier
#

got it. that makes sense. thank you

#

so now when my enemy gets to 0 health how do I let my ai tree know?

#

do I pass to the controller and have it tell the Behavior Tree?

peak star
#

I am trying to make a dedixated server for the first time. I used the blockout tools plugin to build my level. When I try to build the dedixated server it fails due to "unable to find" blockout tools plugin error

#

It says I need to install it or remove it from the required plugins list. Where is this required plugins list? And if it remove it will that break my game since my game actually uses actors from that plugin?

#

If i build development editor from 4.25 then it finds that plugin just fine. Why suddenly cant it find the plugin when I build development server from source?

#

Hmm I see the source based engine doesnt have the Marketplace folder nor the block out tools plugin within that folder but my editor engine does. I copied marketplace folder over to the source folder and it seems to be doing better so far....

fading birch
#

that's generally what I do when dragging over marketplace plugins

#

unless I install them in my root folder

#

you should be using source for both client and server if you're using a source build though.

#

will save your build times too

fading birch
feral glacier
#

ah thank you

next falcon
#

Hello,
Is it possible (and if so: how?) to Transfer an Array<UObject> by a RPC without having this UObjects in a Replicated Array with "ReplicateSubObjects" ? Like only transfer the UObjects once on a Event ?

peak star
#

@fading birch thanks I see that copying it over fixed the problem and server build works now

#

I will try and make sure the client code uses the same engine

fading birch
#

it should, from the sounds of it, you're changing your engine version when you swap builds?

peak star
#

Yep. So once i get this built and working, how do i get my clients to find a session on the dedicated server? Or is that the wrong question and I should just hardcode the dedicated server's IP address into the clients? Or something else?

fading birch
#

but it depends on which online subsystem you're using

peak star
#

Currently using onlinesubsystemNull and playing on my home LAN to test playing between android and PC (which works by the way)

fading birch
#

yeah that'll work for a local network

peak star
#

But it is coded to expect listen server

fading birch
peak star
#

So the host is a player. Okay

hallow summit
#

my projectile is replicating but the trajectory is jittery on the client, what can i do to fix? I have the spawn projectile run on server, and the actor set to replicate

tribal yarrow
#

hey I'm trying to do item pick ups.I have the item currently set up with an input task and it will add a player controller to the actor's input when a player gets near. the task calls a server rpc which is linked to a repnotify to destroy the objects. Am I thinking about that the correct way? Right now it's getting stuck at the server rpc because it's saying the object doesn't have an owning connection.. I've tried to research but I'm coming up short

strong vapor
#

@tribal yarrowyes owning connection is a thing.. you have to sort of "dial up" from something that that player controller does own

#

like itself.. or the pawn

#

and then once you're on the server version of the pawn or player controller

tribal yarrow
#

any recommendations on how to keep that clean? I was really hoping to keep the logic for that on the item itself

strong vapor
#

you tap over to your world BP

#

yeaaaa it would be so sweet wouldnt it..

#

no i dont really know a great way to keep it clean

#

interface?

#

maybe use an integer or an enum to keep track of what state you're trying to provoke

#

you can pass that to your world actor and maybe it can nkow what to do with it

#

ya.. an interface with an enum might be kinda clean

tribal yarrow
#

the enums being different things you could interact with or something?

#

doors, chests, items on the ground, levers, etc?

strong vapor
#

well.. i had this issue when i was trying to do multiplayer dialogue choices

#

for the player to interact with NPC's with

#

and its like.. i dont wanna write 7 diffenret functions to trigger on that NPC

#

but however you do it... owning connection is an important thing

#

a player controller on the client side.. can't just call up a server event on some actor in the world

#

even if it is has a reference to it

#

what are you trying to do exactly?

tribal yarrow
#

I actually figured out a way to get around it, did end up using interfaces but I'm still not super happy with it

#

just trying to destroy an object for everyone

dark edge
#

Specifically we do it like this.

  1. Button input (E)
  2. RPC to server in Pawn
  3. Call TryInteractWithClosest.
  4. If thing we're interacting with is an Item, call EquipItem on Self.
  5. EquipItem does its thing
wary vine
#

Hey everyone! I was wondering if someone could help me. I am working on a multiplayer game. I'm trying to do a spectate mode for players when they die. I using PlayerController->SetViewTarget(Character); I am calling this on the client and server. This works, but it is very choppy / laggy for the person spectating. I am using the template third person character setup. It appears the problem is the camera is dancing around. The actual character movement replication is pretty smooth. Any ideas?

severe tendon
#

Interp between the server and client position to get a relatively smoothed movement?

#

or just create a spectator camera and force its rotation/location to the targeted client camera position

severe tendon
#

Does anyone know of any reason why a server would be forcing their morph target values on the client to 0?
Clients morph targets are moving perfectly on the server, but servers are really struggling on the client

nocturne iron
#

How would i go about doing this: I have a Pawn class in my GameInstance, i need to move and replicate it from client GameInstance to client PlayerState before GetDefaultPawnClassForController_Implementation is called on the server?

chrome bay
#

My first Q would be why does it live in the game instance

#

If it's replicated and/or gameplay relevant it probably belongs somewhere else

#

But probably the most important part is you can't replicate anything in the GI

#

Presumably this is for choosing a pawn to spawn with, so I would just RPC the chosen pawn to the server when you initially join, then have the server make sure it's okay and use that when calling GetDefaultPawnClassForController_Implementation(). PlayerState is a reasonable place to keep the pawn class, or player controller if other players don't need to know.

nocturne iron
#

It lives in the game instance since it is set in the main menu and needed in all other scenes; i know GameInstance can't replicate, that's why i want to copy it to PlayerState.

chrome bay
#

If you want the server to spawn you as that pawn, then you need to RPC the chosen class to the Server when joining it.

#

And add some custom logic to the game mode to not spawn the player until the server receives a pawn.

nocturne iron
chrome bay
#

You'll need to customise the GameMode to not spawn the player until they are ready

#

You could also send the pawn via the "options" string during join, but that can make the options string quite long and cause problems.

#

It's quite common to have a "Client_OnJoin" function in a player controller that get's called from PostLogin

nocturne iron
#

If i just mark my PawnClass variable in PlayerState as replicated, is there a way to force replication since all players might not have joined at the time of the replication? or does the value automatically get replicated to new players?

chrome bay
#

Replicated properties will automatically be updated for late-joiners

#

That's why you should always use them for state/persistent vars

nocturne iron
#

So that it?

#

just mark PawnClass as replicated?

#

and set PawnClass in PostLogin

chrome bay
#

Well it depends, how are you going to know what pawn class they want during postlogin?

nocturne iron
#

That will be selected in the main menu and stored in the GameInstance.

#

On the client

chrome bay
#

Yeah, but the server won't have that information on PostLogin

#

You'll need to tell the client, to tell the server what it is

nocturne iron
#

Oh, that's right....

chrome bay
#

Something like this.

{
    Controller->Client_OnInitJoin()
}

Controller::Client_InitJoin_Implementation()
{
    Server_RequestPawnClass(ThePawnClass);
}

Controller::Server_RequestPawnClass_Implementation(Class)
{
    if (CheckClientClass(Class))
    {
        GameMode->SetPlayerPawnClass(this, Class);
    }
}

GameMode::SetPlayerPawnClass(Controller, Class)
{
    Controller->PlayerState->SetPawnClass(Class);
    RestartPlayer(Controller);
}```
#

Psuedo-code but you get the idea

#

And override PlayerCanRestart in the GameMode to not spawn them until the PawnClass is set.

nocturne iron
#

That makes sense!

#

Thx!

nocturne iron
#

Also GetDefaultPawnClassForController_Implementation seems to be called before PostLogin? For some reason?

chrome bay
#

You'll have to step through it I'm not 100% sure, but yeah you'll need it for DelayedStart too, for late-joins when the match is already in progress.

nocturne iron
#

GetDefaultPawnClassForController_Implementation is called before PostLogin, can i somehow assign the pawn manually without the GetDefaultPawnClassForController_Implementation function?

chrome bay
#

If it's calling it then presumably it's trying to spawn

nocturne iron
#

But it's called before PostLogin??

#

I figured out

twin juniper
#

how do i ither enable so i can type console commands via the running dedicated server or use a client via a bp tell server to server travel ?

dim minnow
#

Hello folks. I have a bit of a question regarding replication of a variable:
I have a float that I would like to keep synchronised between server and client. I can either replicate it 10 times a second or give the client and server the means to calculate the value ten times a second independently (and then - somehow - only synchronise the actual float every now and then to discourage cheating).
Direct changes to the value itself can only happen on the server, the client at best has some indirect influence.
Is it ok to have such a "high traffic" replicated variable? Would it be ok to have a few of them per client? Or should I do whatever I can to avoid this situation?

#

That's good to hear. Although there is probably a limit to how many of these floats a game can handle with this approach. Any idea where that might be?

#

That looks like an extremely useful tool for later! I'll try to just update my value really often and rely on the engine to be able to handle it for now. Thank you!

chrome bay
#

Also bear in mind variable replication is lossy, just because you change it at 10 times a second does not necessarily mean the client gets all of those changes, just the eventual state. They almost certainly won't arrive in equal intervals either.

gloomy tiger
#

Hey guys - question. What's the current state of testing Steam features in the Editor? Such as Authentication, Achievements, etc.

#

I'm also talking about Multiplayer. Like, testing two Steam accounts etc.

#

My last gig around Steam + Multiplayer was like a burden.

chrome bay
#

For multiplayer you need two PC's or at least a VM

#

Steam doesn't allow you to have multiple connections from one machine

#

You can test the game-level stuff in editor, for OSS-level the only true way to test is package, distribute and test.

dark edge
chrome bay
#

Yeah true, though presumably you want them all on the same version

dark edge
#

Yeah we always have everything in sync through perforce.

chrome bay
#

Did Epic fix Standalone launching from editor yet?

#

Or is that still FUBAR?

peak star
#

When i want to test multiplayer from editor then I use PowerShell or command line and execute UE4Editor.exe with my uproject as the argument, and do that for as many players as I want to join plus the host they will join to.

#

Works better than standalone

woven sinew
#

Anyone have big steam patches when you submit a new build, even though not much actually changed ?

bitter oriole
#

Check in Steam's Builds page for the patch size of each build

woven sinew
#

yeah they're always >200MB even for small changes

bitter oriole
#

Code changes with the PDB file included ?

#

Lighting bakes ?

woven sinew
#

everything

bitter oriole
#

I'm suggesting causes for that issue

#

Either of these is likely

woven sinew
#

yeah pdb shows >1 GB changed

#

idk what to do with that

bitter oriole
#

PDBs are completely recreated any time you compile

meager spade
#

dont upload that to steam?

bitter oriole
#

And they're not useful

#

Well they are vital, to you, not the player

meager spade
#

you can exclude it in your steam uploader file

#

put that last line in your Depotbuild.vdf file

woven sinew
#

thanks

#

it says >1GB changed for that file but the update is not that big though

#

so I can't really trust the depot_build log

#

nevermind the x changed is just the file's size lol

bitter oriole
#

Yeah was going to point out that the next changed size will be the PDB size

woven sinew
#

but why ?

bitter oriole
#

Because you removed it

#

Download size should be 0 though

woven sinew
#

but it doesn't diff against a local version right ?

bitter oriole
#

The tool might tell you the changed size ; the build page will tell you the exact download size for the update

severe tendon
#

Gonna be a pain and repost this because I'm hoping someone has dealt with this before.

Does anyone know of any reason why a server would be forcing their morph target values on a client to 0?
The clients morph targets are moving perfectly on the server, but servers are really struggling on the client and it's both on release builds and in editor

dark edge
severe tendon
#

Sending values across the network based on user inputs

#

Just via RPCs

dark edge
#

Why are you not just using an RPC to get to the server and then replicating a value back out?

severe tendon
#

The values are clientside and being sent to the server via a locally spawned actor.
We can't spawn the actor on the server as it crashes due to the plugin we need for it all to run
So the case is currently
Local actor gets input > sends to Pawn as Owning Client RPC > Sends to server to send to Multicast to tell everyone who doesn't own this pawn to update the pawns skeletal mesh with the morph values

dark edge
#

That sounds all sorts of f***** up

severe tendon
#

Yeah it's fun

#

It's the Oculus LipSync Plugin

#

Which crashes a client the moment it touches the server

#

So it's skirting around jank by building up more jank

#

I just don't understand why the server is happily receiving variables from the client but the client isn't getting the servers vars.
It's really odd

tranquil yoke
#

Is it possible, that i spawn something on Client first, then spawn on Server which will replicate to other clients, but i want to keep the client copy who initiated the spawning ?

severe tendon
#

The client copy will only spawn on the client

#

If you want it to spawn for everyone you have to spawn it on the server, you can then "Get Instigator" to get the player

hollow eagle
#

I assume the question is about doing a predictive spawn on a client. The common solution is to spawn on the client, call an RPC to spawn on the server as usual. When the server's version is spawned locally it should delete the client-owned version and reconcile whatever state with whatever the server sent.

kind ember
#

Does anyone know how does Battlefield do hit detection?
Since they don't use instant hit trace, hit rewind would sound very expensive.
Or is the server catch up to client's bullet based on round trip time? Would still missed if there isn't some sort of hit rewind to compensate lag.

chrome bay
#

most shooters do rewind. Keep a short buffer of player positions on the server, interpolate back in time by the shooters' RTT when verifying hits.

#

For hitscan, sometimes just a larger bounds check is sufficient.

#

Depends on ping and how much you're worried about cheaters

nova wasp
#

sounds like the player hitbox rewinding moving would be much more expensive than anything the bullets themselves are doing

chrome bay
#

It's extremely cheap, you don't actually move the players - it's just data.

#

We can simulate thousands of bullets and impacts, the main cost comes from RPC's to check hit validity.

fading birch
#

is there an example of that somewhere?

chrome bay
#

Not that I know of

#

maybe in UT?

#

though they use hitscan for most things

kind ember
#

Also did Fortnite uses rewind?

chrome bay
#

Not sure if they've ever said one way or the other,

kind ember
#

Ok

fading birch
#

I had thought they used the internal version of GAS for everything

#

maybe that's just building stuff?

fading birch
thin stratus
#

When dealing with things that modify the Players Location from outside the Timestamp flow (so not via ServerRPC etc.), how does one resolve corrections on start and end of those actions?

#

E.g. applying an upwards Velocity while being in a volume.

#

It's smooth while inside, but Server and Client enter and exit the volume on different timestamps it seems, causing corrections.

#

Or simpler: A Launchpad, where stepping on it launches you.
If that velocity value is high and the Client steps on earlier or later than the server, you will get a teleport correction.

#

And only doing it on Authority will cause a correction anyway

#

I can't come up with any other way than making this stuff client authoritive, by letting the client send the server the additional force. But that's not how competitive shooters would solve it

#

I assume that in theory you should not have to deal with any issues here, as when the Characters move correctly, they end up on the Launchpad at the same timestamp PE_PandaThink

pearl pollen
#

Is there a simple (even not secure) way of passing some data to the server when you try to connect to it via OpenLevel? Something like CharacterID or similar

#

Input server IP, input character ID, click connect and the server receives the character ID that you requested

dark edge
pearl pollen
#

I don't seem to be able to even load a value from the game instance and replicate it to the server so I figured I need some other approach

pastel marlin
dark edge
pearl pollen
#

1 sec then

#

This is in a simplified login screen widget

#

And this is my controller's begin play

#

And unfortunately it's not being set properly

#

I even tried replicating it to the server after joining but still 0

#

Okay nevermind managed to fix it! 😄 Thanks for your doubts

shut gyro
#

Can you not store FUniqueNetIdRepls in a map as a key? Everytime I do it, I get a Pair != nullptr after implementing the hash, compare and equals method

novel bison
#

Is this expected? What am I doing wrong?

#

this is the first spawned character and im trying to get playerstate

#

but this cast always fails

#

im trying to set some defaults for these guys

#

if i run the functions from the event tick it works for all clients

#

anything else ive tried fails either for all clients or a few, seemingly random

kind ember
kind ember
shut gyro
novel bison
#

i got around it by doing a delay after beginplay

kind ember
novel bison
#

but feels shitty

kind ember
novel bison
#

oh sweet ok

#

thanks

#

another quick question, how do i check if a playerstart is unoccupied?

meager spade
#

you need to keep track of them

novel bison
#

ah cool

#

that's how i was doing it but didnt know if there was a better way

kind ember
cedar finch
#

I'm trying to teleport a player to a set location and rotation when an AI catches him. It works most of the time but for clients I can't seem to fully stop them from moving and rotating. So they sometimes wind up rotated incorrectly or not in the right location. How do I instantly stop the clients from moving so I can teleport them to the correct spot with no inconsistencies? Currently I've tried using a Server event and a multicast to "stop movement immediately", "disable input", and "disable movement". Neither seems to work. I execute this logic inside the AI that catches the player so IDK if that makes a difference. I just need clients to not be able to move. Any ideas?

meager spade
#

multicast?

#

that will affect all players

novel bison
#

Current mode is more like SND so players only spawn once

#

So choosePlayerStart doesn’t happen after on post login?

meager spade
#

it does

novel bison
#

Trying to choose spawns based on team and my player states don’t have teams when the game mode hits that

#

I’m assigning team at onPostLogin

meager spade
#

100 percent sure it does

novel bison
#

Seems like it should right

#

Lemme see if I’m doing something else wrong

#

New to UE4 so could be anything lol

meager spade
#

FindPLayerStart gets called

#

that calls ChoosePlayerStart

#

that gets called from InitNewPlayer

#

which gets called from Login

#

which is before post loign

#

sooo, you need to do it in PreLogin

#

or you do what i do, spawn them hidden, at a neutral playerstart, then teleport them over to the correct one

#

this happens same frame, so player does not even see it

novel bison
#

omg thank you

#

that's very helpful

cedar finch
#

Yea I tried disabling movement on server first but that didn't seem to work so I've been trying everything from multicast to owningClient, etc.

#

If I stand sill it works fine. But if I'm moving aka walking, then it's like it teleports me to the correct location but I keep walking even if I let off the keyboard. I can't seem to stop the client from accelerating

slow hornet
#

i am new to multiplayer can someone give me some hints here?
I am calling ClientTravel on a specific player controller to a new map (but it should stay connected on the current server), however i see a bunch of warnings on the output ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction and then it suddently crashes the client, can someone give me some help or hints on what I might be doing wrong? Thanks a lot

stuck marsh
#

Hey

#

can anyone help me with something silly, I can't manage to get work the find session blueprint, it only works for the machines in the same wifi, but I cannot manage to connect anyone from another wifi

#

I have the lan set as false

#

any ideas?

dark edge
stuck marsh
#

None

stuck marsh
hallow summit
#

Can someone give me a basic understanding on how putting my game on a dedicated server works so online people can connect

kind ember
stuck marsh
#

And I can host the game on one phone and join from another

#

however, this can only happen in the same wifi

#

I cannot find the server when it is on another wifi

kind ember
#

Because it doesn't work like that.
Does steam overlay shows up tho?

stuck marsh
#

nope

#

I used the plugin called advanse sessions

#

But I haven't used the steam features

kind ember
#

Yup it doesn't work, even if it does, the host has to open their port, which most of player port are closed.

stuck marsh
#

I haven't followed the thing related to steam at all

stuck marsh
#

?

slow hornet
#

guys is it true that seamless travel dont work with PIE ?

kind ember
kind ember
stuck marsh
#

Since I would like to test the game with some people to change few settings before launching it

slow hornet
#

okay so let me put the question on another way:

  • is it possible to have 2 players in different levels? player 1 is in level 1 and player 2 at some point moves to level 2 using seamless travel?
#

while player 1 staying in level 1

kind ember
stuck marsh
kind ember
slow hornet
#

yeap kinda of, but really in baby steps still learning a lot about multiplayer, seems hard, thanks a lot man, I will test in standalone then