#multiplayer

1 messages · Page 638 of 1

chrome bay
#

Also for the containers that are replicated, they are usually so small that the difference in lookup time is nothing. Just wrapping an array in a struct and providing an accessor is easier

upper lynx
#

hey - sorry, work got in the way...

#

I've tried replicated everything already, and still can't get this to work

#

but don't stress. I'm gonna go watch a few more tutorials and maybe grab a udemy course quick

#

this guy explains it really well - just used BP mostly, so maybe I can learn something there

pastel marlin
#

I don't know if you have it but when you have a rpc call from client to server in cpp you need to have a validate function matching

#

forget about it you have no rpc from client to server

upper lynx
#

hmmmm

#

good point

#

let me see quick

foggy idol
#

does FindSession automatically remove sessions that are full ?

foggy idol
upper lynx
#

yes it is

#

ATeam : public AActor

foggy idol
#

does it just track what team a certain player is on ?

foggy idol
upper lynx
#

yes

#

So GameMode has TArray<ATeam*> Teams; which is a list of all the teams in the game

foggy idol
#

then why is it an actor

upper lynx
#

I've had it as an Info object too

#

but info objects don't replicate

foggy idol
#

if its just for tracking teams you could just make it an int

#

then represent that int differently on UI based on the number

#

or an Enum

meager spade
#

i have a TeamActor

foggy idol
meager spade
#

holds all team related stuff (like a TeamPlayerState)

foggy idol
#

its the first im hearing of it

foggy idol
upper lynx
#

correct. The Team Object holds the team name, colour, index, an array for all the players in the team

meager spade
#

yeah and its only replicated to the team (no other team)

foggy idol
#

im not even going to ask why

#

seems this is beyond me

thin stratus
#

Yeah, exactly like a PlayerState for Teams. Unreal Tournament has that too

#

Fortnite probably too :D

meager spade
#

Fortnite does

foggy idol
#

or in this case a player state

thin stratus
#

I would assume by utilizing IsNetRelevantFor

meager spade
#

in IsNetRelevantFor

#

or using ReplicationGraph

foggy idol
foggy idol
foggy idol
meager spade
#

PlayerState replicates to all

eternal canyon
#

like kills

#

or deaths

#

or when the main character isnt possessed

#

and your possessing a spectator

upper lynx
#

so is my thinking fine on the process?

#

PlayerController calls GameMode -> GameMode assigns PlayerController to a team. GameMode then tells PlayerController which team he belongs to.

PlayerController then tells PlayerState which team he belongs to.

#

then there's something wrong with my URPOPERTIES or something

eternal canyon
#

I would just have the server set the team var in the player state

#

probably from the gamemode

upper lynx
#

cause in BP, if I output PlayerState->Team, it returns null on Clients but Team1 and Team2 on server

eternal canyon
#

but you dont need anything to do with the controller

thin stratus
#

Well keep in mind that the PlayerController doesn't exist on other clients.

eternal canyon
#

yup

thin stratus
#

So you can work with Controllers in the TeamObject, but if you need some sort of replicated PlayerList then you will also have to utilize the PlayerState

eternal canyon
#

yup

silk abyss
#

Yeah, only server have all the copies

upper lynx
#

so should the PlayerState ask the GM to assign the team, and the GM then update the PlayerState?

thin stratus
#

The GameMode should process the Team stuff when the Player Joins I assume

#

At least the initial one

upper lynx
#

yes

#
{
    Super::InitGame(MapName, Options, ErrorMessage);

    if (TeamClass == NULL)
    {
        TeamClass = ATeam::StaticClass();
    }

    for (int32 Index = 0; Index < NumberOfTeams; Index++)
    {
        UE_LOG(LogTemp, Warning, TEXT("Creating Team!"));
        ATeam* NewTeam = GetWorld()->SpawnActor<ATeam>(TeamClass);
        NewTeam->TeamIndex = Index;
        Teams.Add(NewTeam);
    }
    
}```
thin stratus
#

You should have access to the PlayerState via Login or PostLogin, as wenn as HandleStartingNewPlayer.

thin stratus
#

The code looks fine

upper lynx
#

then this is what I did before with PlayerController

#
{
    Super::BeginPlay();

    AGameModeTitan* GM = GetWorld()->GetAuthGameMode<AGameModeTitan>();
    if (GM)
    {
        GM->AddPlayerToTeam(this);
    }
    
}```
thin stratus
#

That's theoretically also fine. This will only succeed on the Server

upper lynx
#

then back on the GameMode

#
{
    if (CharacterController)
    {
        int32 Index = 0;
        if (Teams[0]->GetTeamMembers().Num() > Teams[1]->GetTeamMembers().Num())
        {
            Index = 1;
        }

        Teams[Index]->AddPlayerToTeam(CharacterController);
        CharacterController->SetTeam(Teams[Index]);
    }
}```
#

that tries to keep the teams level

foggy idol
#

is it possible to just put the teamState in the player state since the teamState is only relevant to specific clients

#

and that way can be accessed from game state ?

thin stratus
#

Despite the fact that this ignores all teams with index 2 to NumberOfTeams-1, that's also okay

upper lynx
#

well, there will only be 2 teams

#

0 or 1

#

for now

thin stratus
#

Right

upper lynx
#

then back on the controller:

{
    ACharacterState* CS = GetPlayerState<ACharacterState>();
    if (CS)
    {
        CS->SetTeam(Team);
    }
}```
thin stratus
#

ATeam is marked as replicate, right?

#

You also have to keep in mind that it might take some time for the Actor to actually be spawned replicated

#

If you need to react to that, then you need to utilize OnRep

winged badger
#

that is all a little bit fragile though

#

its more complex then it needs to be

#

and is ready fairly late (BeginPlay)

thin stratus
#

Yeah, but it should either way work, at least in theory

upper lynx
#

I just want to get it to work, before I optimize it really

#

😉

thin stratus
#

As long as the Actor and the Variable in the PlayerState are marked as replicated, the Client should be able to access it once it's replicated.

winged badger
#

i'd assign teams prior to Super::HandleStartingNewPlayer

#

that way they can take advantage of team ID for spawn position

#

and i wouldn't need another hook

upper lynx
#

that is true

upper lynx
#

set in the constructor

thin stratus
#

And the Team Variable in the PlayerState is replicated?

upper lynx
#

and on PlayerState I have

    ATeam* Team;```
thin stratus
#

When do you try to access it on the Client?

upper lynx
#

ignore the fact that its edit and read all over the place - I'm debugging like crazy here

thin stratus
#

I would try it with ReplicatedUsing=OnRep_Team and check with OnRep_Team() when it's replicated.

#

If you try to access it too early, it might still not be replicated down to the client

#

You should also mark the Team as always relevant as long as you don't override the IsNetRelevantFor

#

Just to make sure it's not out of relevancy range

upper lynx
#

so...:

    ATeam* Team;

UFUNCTION()
    void OnRep_Team();```
#

let me go read up some more on ReplicatedUsing quick

stray oxide
#

I am having an issue displaying widgets from the client side on the gamestate. So basically I am displaying widgets in between waves of a horde spawning type of game mode. I am using an enum to determine the wave state and then when it is starting the next wave, it should display a widget. I am using a Client RPC on my player controller and if I call it OnPostLogin from the game mode then it works on client and server but if I call it in a custom function on the gamestate then it only works on the server and not the client. It also works on both if I assign it to an action input for testing. Anybody know if I am missing something on the gamestate?

upper lynx
#

It appears to be working

#

I have NO idea why

#

lol

#

Q: What's worse that your code not working and you have no idea why?
A: Your code working, and you have no idea why.

#

Thanks everyone for your help @thin stratus @winged badger @foggy idol @eternal canyon@pastel marlin

upper lynx
#

meh, it's semi working

#

is this right?

#

.h file

    ATeam* Team;

    void SetTeam(ATeam* NewTeam);

    UFUNCTION()
    void OnRep_Team() {}

    UFUNCTION(reliable, server, WithValidation)
    void Server_SetTeam(ATeam* NewTeam);```
#

.cpp file

{
    Server_SetTeam_Implementation(NewTeam);
}

void ACharacterState::Server_SetTeam_Implementation(ATeam* NewTeam)
{
    UE_LOG(LogClass, Warning, TEXT("Setting Team on Server/State! %s, %i"), *GetName(), NewTeam->TeamIndex);
    this->Team = NewTeam;
    OnRep_Team();
}

bool ACharacterState::Server_SetTeam_Validate(ATeam* NewTeam)
{
    return true;
}```
#

reason I think it's not working is cause when I run it :

#

that's the TeamIndex var is printing out

#

yet in the console I see two instances:

#

going to 0 and 1

kindred widget
#

@upper lynx You've macroed it in GetLifetimeReplicatedProps?

upper lynx
#

yip

#
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(ACharacterState, Team);
}
kindred widget
#

Where is the kismet library print coming from?

upper lynx
#

the what what now?

kindred widget
#

The blue prints.

#

They look like blueprint PrintStrings, or UKismetSystemLibrary::PrintString()

upper lynx
kindred widget
#

Where is TeamIndex set and coming from?

upper lynx
#

TeamIndex is a int32 variable in the ATeam object

#

that gets set by the GM when the game starts

#

you'll see it there

kindred widget
#

But it isn't replicated.

#

You're getting the default property from a replicated object. So even though game mode is setting it on server, clients will always have a default value.

upper lynx
#

well no, the default for TeamIndex = -1

#

the GM is updating it

kindred widget
#

How is it updating clients though?

#

It won't update on clients if you're just simply setting it on the server in the team object.

upper lynx
#

once a new player joins the game, the HandleStartingNewPlayer method runs. I then add the controller to the Team

#
        ACharacterState* CS = Cast<ACharacterState>(CharacterController->PlayerState);
        if (CS)
        {
            CS->SetTeam(Teams[Index]);
        }```
#

I then call the PlayerState associated with that controller, and call SetTeam

#

when it hits SetTeam, this logic is followed

#

SetTeam calls ServerSetTeam, which sets the Team, and that in turn calls OnRepTeam

#

I'm most likely wrong with that logic

#

but I need to know why

kindred widget
#

Right. But this is all related to the Team object. Your clients will get the object fine. But your TeamIndex integer isn't set to replicate. So unless you're RPCing that data from somewhere else, a client will never get updated about what their TeamIndex is.

upper lynx
#

wait you're right....

#

hang ten, testing something quick

#

as soon as I make TeamIndex replicated, I'm unable to read it from BP

kindred widget
#

How is your UPROPERTY for it marked?

#

Should see it fine with a UPROPERTY(BlueprintReadOnly, Replicated)

upper lynx
#

cool, trying that quick

#
    int32 TeamIndex = -1;```
#

yeah I don't see it

#

If I pull off Team, there's no TeamIndex or "Team Index" or even Index for that matter

kindred widget
#

Your syntax looks fine. You're closing the editor to compile?

upper lynx
#

let me do that to confiirm

#

son of a

#

well that worked

#

ok, let me run it quick

kindred widget
#

Haha. Be careful with hot reloading.

upper lynx
#

hmmm, Team is still not valid

kindred widget
#

What kind of object is Team?

#

Or what does it directly inherit from?

upper lynx
#

AInfo (which I know doesn't replicate)

#

I changed it to AActor now to see if that helps

#

argh, have to restart editor

#

so, how's unity (facepalm)

kindred widget
#

AInfo should replicate fine. That's their whole purpose is to be a replicating object that has an actor channel.

upper lynx
#

meh - AActor also still returns invalid object

#

it's fine. I think I'm gonna call it a night

#

23:20 here

kindred widget
#

Make sure that you're setting these in your constructor.

#

SetReplicates(true);
bAlwaysRelevant = true;

upper lynx
#

yip, doing that too 😉

#

thanks @kindred widget

#

appreciate the help

#

I'll dig around some more tomorrow to see what I'm doing wrong

#

quick Q, before I go

#

so replicating the object variable is not enough? you need to replicate the variables within that object too?

#

ie: not only replicate the Team object on the PlayerState, but also replicate the TeamName and TeamIndex variables within ATeam too?

kindred widget
#

Hmm. So first you need to make the object itself replicated. This makes it replicate to clients. Then you can make that object replicate it's values that you set to replicate.

#

But like in the case of your pointer on the playerstate. You're just replicating the pointer, not the object there. The playerstate itself is a replicated object with that replicated pointer that points to a replicated object.

#

If all set correctly, clients will get a valid object from that pointer too when the object is relevant to the client.

upper lynx
#

ok, thanks

#

I think

#

🙂

#

I'll read that again tomorrow when I'm not passing out

kindred widget
#

Haha. It gets much easier to wrap your head around with some practice.

upper lynx
#

cool - thanks again

#

have a good evening

kindred widget
#

You too.

upper lynx
#

HOLY CRAP!!! ITS WORKING!!!!

#

WHOOOOOOOOOOOOOOOP

#

closed the editor a few times and did a few build clicks

#

now it's working

#

hooray!!!!

#

awesome, thanks guys!!

#

ok, going to bed

#

g'night

mild lynx
#

I just randomly got the bug of my textures being all blurry and unloaded on only the Server Host. The client's textures all load in. Tested with multiple people. I only noticed this after adding a plugin called Smooth Sync to my project. Anybody know what is going on or how I can find help?

barren patrol
#

is anyone using a proxy AIController to posses their player character, in order to skip all the complexity of client-side prediction that comes with the character class and gameplay ability system?

#

If so, what is the proper way to deal with owner-only variables vs things that are generally safe to replicate to everyone? for example, inventory should be replicated to the owner only.

#

I was using the OwnerOnly replication condition on my character for this previously. But trying to experiment with moving away from PlayerController directly possessing the character.

jolly berry
#

Does anyone know if the “Strip Animation Data on Dedicated Server” flag causes you to lose AnimMontage notifies on server?

lost inlet
#

likely yes, but you'll probably want to cache the timings on save or something

#

so the dedicated server doesn't need the notifies

jolly berry
#

@lost inlet I’m debating for my multiplayer project to leverage the PlayMontageAndWaitForEvent nodes with GAS. The idea being some gameplay events would be triggered based on their placement in the anim montage.

However I also want to be optimized and strip anim track data from the server, so I’m unsure if these goals conflict.

I will say however, it appears the only section in code that uses that flag ‘bStripAnimationDataOnDedicatedServer’ is ‘UAnimSequence::Serialize’. ‘UAnimMontage’ inherits from ‘UAnimSequenceBase’, not the child ‘UAnimSequence’. This leads me to think Anim Montages will still serialize everything like normal since there is no inheritance path in an UAnimMontage that causes us to hit that flag. I’m feeling like the assumption that is sensible is that notifies on the anim sequence won’t trigger, but notifies on the montage will.

#

Any thoughts on that? Like possible I’m missing something.

lost inlet
#

yeah but tying gameplay to animation is just something I'd advise against anyway, saves having to load them on dedicated

#

our game just caches a bunch of stuff in PreSave for timing purposes

jolly berry
#

No I’m with you. Where I come from we decouple animation and gameplay hard in production. Was debating if setting things up this way was like a cool new UE4 feature I should utilize or if sticking to roots is better.

#

I come from UE3 so there weren’t really gameplay notifies with animation.

lost inlet
#

this seems a more shouldn't than couldn't

jolly berry
#

Appreciate the help

silent valley
#

@jolly berry exactly right. Use anim notifies for client only FX, but you can rely on AnimMontage triggering notified on server and clients.
I read a post somewhere that this is the behaviour Fortnite rely on too.

jolly berry
#

@silent valley Good to know, I appreciate the confirmation. I’d be curious to read the post if you had it but figure you prolly don’t have that lying around 😅

#

I’m still in general agreeance that keeping gameplay events decoupled is ultimately still more sound and scalable, but I’m much happier knowing I have the option to do anim montage notify stuff if I needed.

silent valley
#

Yeah it's a convenience feature I guess. It's nice to be able to build the functionality in the Montages.

jolly berry
#

You think this was what you read?

silent valley
#

No, I think it was on UDN and also regarding Gameplay Ability system.

jolly berry
#

👍

scarlet cypress
#

Is this a good way to get around the (if owning client) thing?

winged badger
#

no

#

unless client owns the VendingMachine

#

nothing happens

#

and even if it did, you just called a RPC from an RPC

#

both of them server

scarlet cypress
#

I think you misunderstood it..

#

It executes the "ServerSpawnItem" on the character wich is owned by the client and the return event is not an rpc just a normal event (to get back on the unowned actor but now on the server)

potent cradle
#

If I make an HISM component replicated, that would only replicate the actual component right? Not the state of its instances.

#

Thinking it might still be useful to set it to replicated, as I could then keep a reference to the component and separately replicate their instances and still know which component they belong to

#

(multiple components on same actor)

terse iris
#

hej everyone, i'm trying to fix a problem with doors i'm having replicated in clients and server.
the mesh of the door moves perfectly both in clients and in the listening server.

however, it seems like the actual server is still having some instance of the door in the original location non rotated.
because the interact button works only on the original rotation, not on the newly rotated location UNLESS you are the listening server.

The way i've set it up is the event that gives the rotation values from the mouse is running on the server, and then the door rotation is replicated and being set on the mesh as set relative rotation.

#

anyone has an idea on what i could be doing wrong?

empty axle
# scarlet cypress Is this a good way to get around the (if owning client) thing?

This should work, but to make it more generic I would probably go with something different.

  1. Interact with HasAuthority check. If authority call spawnItem method if not call ServerInteract on passed character and also pass self as an argument.
  2. The ServerInteract method on Character would accept objects implementing Interact interface as argument and inside the method you would just call Interact on that object.
  3. Now the HasAuthority check in VendingMachine interact will pass and we will spawn the object.
    The profit with that approach is that you don't have to add anything new to the character blueprint if you add some new objects implementing Interact interface.
distant wave
#

I did something way cooler. I basically remade the physics constraint, copied and pasted the PhysicsConstraintComponent.cpp and h into my own Physics Constraint Component. Next, I replicated the Constraint Instance struct variable. (FConstraintInstance ConstraintInstance). However, the angular force still seems to not be synced across the network. For example, the constraint breaks for the server, but the client still sees it as being intact. Do you have any advice on this?

pastel marlin
#

Anyone used the damage system already available in ue4 ? (applyDamage, applyPointDamage ...)

dark edge
pastel marlin
#

I was pondering to use it but i have a few worry about it so maybe you have the same use case

#

the first one is how it work out for high frequency damage

meager spade
#

i use it for guns firing 900 rounds per minute

#

works fine

pastel marlin
#

not too much net usage ?

meager spade
#

net usage is the least of your worries tho

#

if they can use it in Fortnite (100 player battle royale) i am sure net usage is fine 😄

pastel marlin
#

well in fortnite they use the network graph (i think its called like that)

meager spade
#

and that is only for replicated actors

pastel marlin
#

but yeah if you use it at high frequency and it work good enough for me too

meager spade
#

not GAS

pastel marlin
#

GAS ?

meager spade
#

Gameplay Ability System

pastel marlin
#

second question is it use visibility channel

#

is it possible to alter that ?

meager spade
#

visibility channel?

pastel marlin
#

for applyRadialDamage

meager spade
#

not sure what trace channel has to do with anything

#

those functions are kinda garbage tbh

pastel marlin
#

i answered my own second question

#

why ?

meager spade
#

cause they don;'t allow any fine tuning

#

all my damage functions are custom made, so i have full control over what they do

pastel marlin
#

I made mine to but found out they were pretty similar to the base one for now so was wondering if it was worth to make the switch

#

anyway thanks for the info i think i will stick to my own function for now so i can more easily modify them if need be

meager spade
#

having your own damage system/functions will serve you better

peak sentinel
#

What happens when you use a Server RPC if you are already authority?

#

Any bandwith usage?

meager spade
#

@peak sentinel why would it send the rpc of the network if its local?

peak sentinel
#

It wouldnt, right? Just trying to learn whats happening on the background

meager spade
#

it is invoked locally

scarlet cypress
#

Clients can't join anymore when a host left a session they were in what's the problem there?

#

I guess it's a common thing?

peak sentinel
#

Afaik when a host leaves session is closed

scarlet cypress
#

And how do you repair it?

peak sentinel
#

If a session is destroyed its normal that they can not join again because session is not valid anymore

#

Host needs to create another session and invite clients there

scarlet cypress
#

Yeah yeah i know, but if there is a new session they can't join that anymore

peak sentinel
#

I remember I had this problem when using Advanced Sessions plugin but dont know any fix, sorry

scarlet cypress
#

ok

lament sinew
#

you probably need to use a dedicated server at that point instead of a listen server
if you want to keep the session running

craggy void
dense narwhal
#

I have an issue with passing a struct from game-mode to player controller onPostLogin. It seems to not update when passed.

I tried with a simple string and it got passed to the client just fine. But the struct, no sir. anyone got this?

eternal briar
#

When I do seamless travel on my dedicated server, it is not calling OnPostLogin or OnSwapPlayerControllers, has anyone had this issue?

dusty bluff
#

hey, i'm desperately trying to replicate an array of UObjects the last couple of days (ultimately array of interface instances but for now I'm trying UObjects). I use this array in an InventoryComponent and found a couple of posts where they managed to get this done. However nothing works for me and I don't know if it is my implementation for the UObject replication or the setup of replicated variables and RPCs (I'm new to UE). I do not want to use Structs (reason Inheritance, Polymorphism) nor do I want to use Actors (reason memory overhead and flexibility). Also for the purpose of understanding how all this replication works behind the curtain I want to get it right with UObjects.
I would appreciate if someone could take a look on the project in a video-call with me.

#

Is it that common in UE to store the whole Actor if all you need is the data? If you had hundreds of items that would be quite the overhead. Also I read that it is quite inperformant to have all those actors hidden in the world.

eternal briar
bitter oriole
#

Actors are heavier in memory but memory is usually not a problem

#

Make that three actors, actually

#

PlayerController, PlayerState, HUD

#

Erm, HUD is client side only, nevermind

#

Yeah I was making the larger point that Fortnite has 200 invisible actors on server

dusty bluff
#

Ok, I guess that isn't an issue then. Unfortunately for my purpose/architecture I still might need the UObject (need to reevaluate). I have an interface ILootable which can be attached to any ItemObject you want. Ultimately the inventory would be array<ILootable>. Do you know if this is possible to replicate for interfaces?

bitter oriole
#

Interfaces are purely virtual objects

#

They don't actually exist

#

The actor implementing the interface would be replicating

#

And if that's what you're asking, the actor would be replicating the interface data

dusty bluff
#

Yes this might work, will try to replace my UObject Items with actors and see if they get replicated. Thanks

#

But still intrigued to get replication with UObjects working 🙂

bitter oriole
#

Well it's not that hard

#

You still need an actor though

#

Implement ReplicateSubobjects and use Channel->ReplicateSubobject

#

Should be lots of examples in engine code

dense narwhal
#

So, anyone have had problem passing stuff from server to client onPostLogin? Still having this issue.. String works fine tho.

winged badger
#

i would not try to pass any object pointers, unless its pointing to an actor thats loaded from the package

#

those need to replicate on their own, as actors for the passed NetGUID to be resolved (unless loaded - then NetGUID is static and you're fine)

barren patrol
#

Anyone here using a proxy AIController to control their character instead of possession directly from the PlayerController?

#

I have seen it in some example projects. The client-side prediction of Character and GAS is pretty complex, this model would simplify it (but you lose client side prediction ofc)

winged badger
#

we do

#

takes some setting up

barren patrol
#

Setup doesn't seem too bad. Was the simplicity worth it when you lose the client side prediction?

winged badger
#

as CMC is tightly coupled to Character and PlayerController, and assumes PC is possessing Character directly

barren patrol
#

I guess it depends on the game

winged badger
#

we didn't lose the client side prediction

barren patrol
#

interesting.

winged badger
#

but we did have to override a fair chunk of CMC + APlayerController:TickPlayer and few other things

#

assign roles manually

barren patrol
#

The built in Character and GAS stuff seems to change behavior depending on whether you were an autonomous proxy (PC possess) or not (server AIController posses)

winged badger
#

and so on

barren patrol
#

ahhh you really picked it apart

winged badger
#

in the end, PathfollowingComponent moving the player ends up in AddMoveInput as well

dusty bluff
#

After reconsideration I will go with actors. But wouldn't it be useful if they would provide a UNetworkObject : UObject which could be used for UObject replication without an actor? Maybe even AActor could inherit from it? I don't see a downside (limited knowledge though 🙂 )
thx @bitter oriole @winged badger @twin juniper

winged badger
#

as long as you manage to avoid all the obstacles for it being called

#

you'll have client side prediction

barren patrol
#

can a player add movement input to a character they dont possess?

#

isn't that tightly coupled with ownership?

winged badger
#

it needs to RPC

#

we also needed to replicate the AIController

#

allow for client side nav mesh generation

barren patrol
#

I was thinking of a dead simple model of RPCing down commands and letting the server pass those to the AIController controlled char

#

yeah, i've been in that land. I did figure out client-side pathfinding with a directly possessed character. getting the navmesh on client and following the path on client side with moveinputs.

winged badger
#

you're better off uncoupling the CMC from PC/Character combo

barren patrol
#

This model would be way simpler. Just pass the target location in an RPC and let server handle it.

winged badger
#

or implementing path following on the PC

#

then inventing a path #3

barren patrol
#

Doesn't the Character and CMC work fine for fully AIControlled characters tho? It seems to be used widely for bots/NPCs as well. In this model, responding to RPC'd commands and responding to Behavior Tree commands is not much different from the Character class perspective.

winged badger
#

prediction won't work out of the box

#

there are several Casts in the CMC

#

and it also expects ROLE_AutonomousPRoxy

barren patrol
#

yeah, thats my big debate. am I willing to gain simplicity and lose prediction capability.

winged badger
#

only if its a hobby project

#

no prediction does feel clunky

barren patrol
#

There is a hobby project called League of Legends that has no prediction 😛

winged badger
#

so for commercial you don't really have a choice

barren patrol
#

I think there is some maximum tolerable latency which can turn it into an infrastructure problem

dense narwhal
winged badger
#

if you're comfortable with c++

#

its a 4 hours "hack"

#

to do either option that allows for prediction

barren patrol
#

you are just talking about movement prediction right?

winged badger
#

yes

barren patrol
#

yeah, for sure

#

League has an option for that too

#

it's the GAS ability stuff where I question the value vs complexity

#

I've implemented a few abilities now with the autonomous proxy model and it's... a lot to reason about correctly.

winged badger
#

@dense narwhal just flatten the map for replication, works fine

barren patrol
#

I see the power but I wonder if it's worth the bugs/complexity/effort...

winged badger
#

FMyNormalStruct has a Map and a constructor that takes FMyReplicatedStruct, which has the Map flattened into key and value array for example, and a constructor that takes FMyNormalStruct

barren patrol
#

for something RPG-ish, anyway

winged badger
#

makes for a very simple way of using those interchangeably

dense narwhal
#

I want to use FIND instead of foreachWithBreak when finding stuff tho.

#

Also, why is actors loading before gamemode * 😂

barren patrol
#

Hey Zlo, how are you handling the replication of private state if you don't possess it directly anymore? I've been using OwnerOnly replication with the PC possession model, which wouldn't work in that model.

#

For something like inventory of the character

#

Are you just putting that into PlayerState?

meager spade
#

yes playerstate

#

player controller just handles inputs, forwards them to the AI controller for the player

#

we use client side movement of ai, with the cmc so player moves instantly when clicking, without waiting for the server to move them

barren patrol
#

you did the same changes as Zlo?

#

cool

meager spade
#

i did those changes..

barren patrol
#

haha

#

I see, you guys work on the same project?

meager spade
#

yes

barren patrol
#

cool

#

do you also use GAS?

meager spade
#

no we use our own system

barren patrol
#

ah I see

#

does it have prediction as well?

#

for abilities

meager spade
#

not as powerful as GAS, but kinda

dark edge
hoary lark
#

pathfinding is an AI feature

dark edge
#

@hoary lark not if you were a masochist

#

Makes sense.

meager spade
#

actually player controllers can path :

#

but we relalized this 2 years after we started and meh, no going back

hoary lark
#

orly. can they move the character autonomously too? 😄

golden fulcrum
#

I just got told that networked movement prediction is a thing? I might be kind of stupid here but can anyone point me to some docs or examples about it?

meager spade
#

@hoary lark no

hoary lark
#

well... have you ever noticed in an online game when your character moves instantly when you press W, i.e. you don't have to wait for the signal to go to the server and come back for your character to move? have you ever noticed the server correcting your position?

severe tendon
#

Does anyone know anything about sessions?
We've got a session going via Oculus but players aren't replicating and only the session creator gets transitioned to the new map with a Server RPC console command for ServerTravel

golden fulcrum
#

@hoary lark I did some more digging about it and i realize that was a really bad question.

#

I guess what i'm really looking for is feedback on my current strategy
Currently what happens is

  1. Client selects a character and selects a position in the world
  2. This position gets sent to the server via an rpc call to the actor's "NavToDest" function.
    3 Server performs the custom pathfinding i implemented and sets a vector of positions.
    3 an RPC Multicast is issued to all clients, these perform the same pathfinding but only uses it to draw some debug info right now.
  3. Server moves the character along path using getaicontroller -> MoveToLocation.

It works great but I've noticed that when i test this with a good amount of ping like 200-300ms it feels sluggish and not at snappy.

What i'm interested in achieving is say something like what you're describing @hoary lark where the moment i click as a laggy client my character starts moving right away. I don't mind a bit of rubber banding or correcting that happens after.

So obviously because in this case no prediction is happening because I'm sending a request to the server and having the server perform the navigation but what if I didn't want to do that? If i wanted to have the client drive the movement? could i just directly use the movement component on the client and would unreal automatically do the appropriate network prediction and rubberbanding? or is there more that I have to do for that?

dark edge
#

I would probably prefer pathfinding to be local but it depends on the game design. All the server would see is "Moving X direction"

regal maple
#

Does the client need to share a port in the router later in the packaged game when I use "Listening server"?

barren patrol
#

@golden fulcrum this is similar to what I was discussing before. When you possess a Character class with the PlayerController, it will do client-side prediction of movement. The only issue is that Character movement is based on input vectors, so you have to do some custom work to make it use pathfinding.

#

What I did was add a PathFollowingComponent to my Character subclass, and then re-implemented some of what the MoveToLocation was doing.

#

But the trick is to enable navmesh on clients (a project setting) and then grab the path on the client and follow it using movement vectors. So from the server perspective, it just receives the movment vectors, no different than using a joystick movement (which is what UE4 has clearly been originally made for, FPS game with WASD or joystick movement).

#

Unfortunately I'm not sure how well that works if you can change your selected character or select multiple characters.

vivid seal
#

so BlueprintAuthorityOnly doesn't actually seem to do anything, I just got a bug where a static function marked as such was being called on clients as well

#

or maybe it just doesn't work for static functions?

split shard
#

hey guys could anyone help me with this error please
[2021.05.14-05.28.05:511][ 1]LogOnline: Warning: OSS: Async task 'FOnlineAsyncTaskSteamCreateServer bWasSuccessful: 0' failed in 34.560883 seconds
[2021.05.14-05.28.05:514][ 1]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 34.52, Realtime: 34.53. SteamNetDriver_2147482479

finite goblet
#

Do replication conditions make replication itself any more efficient at all or is it just for convenience?

thin stratus
#

Well if only the owner needs the data, why sending it to everyone? :P

gaunt cliff
#

why does replication not work when using the topdown template ?

#

I even started a new project from blank template and worked towards multiplayer, however player pawn isn't replicated (same as topdown template as shown above)

#

turns out not a single template supports replication, that's not how the tutorials show it to be

bitter talon
#

He it's "baguette" 🥐
Need help :

I'm trying to host a dedicated server on AWS EC2 but I can't join the server.
[2021.05.14-09.18.41:733][755]LogOnline: STEAM: Adding P2P connection information with user 765611...77401397 (Name: UNKNOWN [0x143BF77F2E0])

The server disconnect client
[2021.05.14-09.18.56:770][204]LogOnline: STEAM: Removing P2P Session Id: UNKNOWN [0x143BF775E30], Channel: -1, IdleTime: 14.977
[2021.05.14-09.19.11:712][204]LogOnline: STEAM: Closing all communications with user 765611...77401397
[2021.05.14-09.19.11:717][204]LogOnline: STEAM: 765611...77401397 has been removed.
[2021.05.14-09.19.11:727][204]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 14.95, Realtime: 14.96. SteamNetDriver_2147482144

This dedicated server works when I host it on my computer with distant clients but not on aws
I already tryed to open all UDP / TCP ports "free for all" on AWS firewall and on my EC2 instance firewall

Any idea?

gaunt cliff
#

never mind I was playing on standalone 🤦🏼‍♂️

silent valley
bitter talon
#

Windows for now

#

Just testing

silent valley
#

ok probably something similar then.
Try installing Steam client on the instance

bitter talon
#

I've uploaded :

  • a server package
  • a client package
silent valley
#

so you already have Steam installed on the server to download and install the exe?

bitter talon
#

?

#

Should I install steam? XD

#

on the instance?

silent valley
#

yes

#

yes

bitter talon
#

oh my bad lol

#

ok thank you I try this

#

but => instance will need a steam account??

silent valley
#

no I don't think so

#

I'm not sure about this, but I think the instance needs to have some Steam DLLs installed for it to work.

bitter talon
#

Arf I just realised that I already had steam installed

#

I try to connect to an account

bitter talon
#

Ok I just found the solution: I had a bad port config. Ports were opened but not for all ips 😋 it's fine now thank you for your help when you told me to install steam I tryed to connect it to a steam account and realised the firewall where blocking 🙂

finite goblet
stray gull
#

I'm trying to update the steam SDK to the latest (1.51) but ue4 is still trying to find 1.47

#

i have updated the Steamworks.build.cs

bitter oriole
#

Is it a source engine build ? Pretty sure you need that to use custom SDKs

#

(updating Steam SDK is not a requirement for nay feature that I know of)

stray gull
#

ive just checked the release notes for 4.26 and i dont think they support 1.51 yet, says 1.47 so i guess that might be it

bitter oriole
#

But why do you need 1.51

stray gull
#

no particular reason, i was just updating things

#

the sdk is loading however this is now the issue

bitter oriole
#

Just leave the engine as it is, it comes with a valid Steam SDK that needs no updating at all

vast forum
#

Hello 👋

#

I'm running into one of those nasty situations where I am tempted to add "delay 0.1" to avoid a replication race-condition.

#

I have a server + n clients relationship. I want the server to wait until the value has been replicated to all clients.

#

I'm calling like:
child.setFlag() //which is DOREPLIFETIME
do something

I want the do something to wait until the flag is synced up on all clients.

#

I guess this is what RPCs are for?

lament sinew
#

what you mean by this 'child.setFlag() //which is DOREPLIFETIME'?

#

child is replicated ?

vast forum
#

I have a parent with children

child contains flag.

From server, I want to set flag for all children (on all clients), before continuing logic.

#

Bah I think I'm talking nonsense.

#

The first time I run, the flag isn't set yet. If I run additional times, the flag is set. So I know its just a race-condition.

lament sinew
#

why don't u set the flag at begin play or something if its known for clients?
while waiting for them to replicate

vast forum
#

Flag is dynamic.

#

But I think an RPC is maybe correct...?

#

So instead of using DOREPLIFETIME in the child flag, I can set the setFlag to client reliable

empty axle
#

It would have to be reliable multicast

vast forum
#

To ensure the server gets it as well?

lament sinew
#

the server will run it anyway

empty axle
#

To broadcast the change to all clients

lament sinew
#

if multicast

vast forum
#

And the RPC will delay the thread, right?

#

i.e., it will prevent continuation of the current function until all clients are syced up?

empty axle
#

no

#

no way

#

this is not possible out of the box. I think you would need to do server RPC from every client to the server to ack that you already received that flag

#

and only after that execute whatever you want on the server

vast forum
#

Hmm interesting

#

Seems like such a common use-case, but I know that multiplayer can be complicated.

#

In this case there is sort of a secondary possibility, which relies on each CLIENT waiting to recieve flag before continuing. I just have to add additional logic so that it can keep retrying until it knows for sure its flag.

lament sinew
#

maybe onrep flag call a server rpc
if the flag is going to be modified onetime

#

so it doesn't spam rpc's

empty axle
#

Do you really need to wait for the sync on clients?

vast forum
#

Yes, I guess so at least.

#

Its a graph traversal situation.

#

One graph sets a flag on its edges, so determine flow.

#

During flow, the edges don't have an updated state yet, so its impossible to continue.

#

Thats why I wanted "wait for sync up" kind of situation.

silent valley
#

The only way clients can report back to the server is via an Actor that they own (e.g. Pawn, PlayerState).
What you're asking is tricky but I managed to make it work for my multiplayer testing framework.
Server creates one actor for each client, owned by that client. This actor is used to implement a WaitForAllClients type scenario.

#

The client owned actor has a reliable Server RPC that the client calls when it reaches a specific node (or int32 id)

#

Server associates the node value with that client, and it can then reason about where each client is up to.

#

Unreal is not really designed to work like this though, so you might be better off redesigning your system if possible.

winged badger
#

extra actor seems like overcomplicating the situation

#

can be as simple as setting a flag in GameState with OnRep

#

having the clients after receiving it and when ready just RPC via PlayerState and set its Acknovledged flag value

silent valley
#

yes that's better if you can intrusively modify Player/Gamestate

winged badger
#

then condition to continue is simply !PlayerArray.ContainsByPredicate([this](const APlayerState* PS) { return CurrentState != PS->AcknowledgetState; });

vast forum
#

Bah its just annoying, because it makes me so tempted to just add wait 0.5 and hope clients sync up :/

winged badger
#

pseudocoded, since i don't bother casting the PS there

#

its literally 1 OnRep variable in GS, 2 functions in GS/GM, 1 variable in PS and 1 server RPC in PS to make it work

#

so you have CurrentState with OnRep in GS

#

OnRep function finds the local PS and sends the ServerAcknowledgeState(State) RPC

#

the RPC sets the Acknowledged state in PS, and calls TryCompleteState on the GameMode

#

GS has CanCompleteState function that uses the above condition, to return true

#

and TryCompleteState just calls GS->CanCompleteState to see if it can exec its logic

#

it will go through with it only when all clients sent an ACk

#

if listen server you don't need to treat the host any different from clients here

empty axle
#

only if you need your thing decoupled from the main project you might want to spawn separate actor/component to do that as noogs already suggested

golden fulcrum
iron spruce
#

Hey guys, im trying to run the function 'Fire' on the server from my main character pawn, but for some reason, whenever i try to do that on the client side it doesnt fire the event, any ideas?

empty axle
iron spruce
#

nevermind, think i got it, thx!

#

wait, I think the problem is that im trying to run an event on a class that is not owned by a player controller, although i set it to replicates the event is still only being called when the server is the one calling it, why is that @empty axle

winged badger
#

either by deriving a custom CMC and uncoupling the Character-PC-CMC triangle and setting the Autonomous_Proxy role manually

#

or by implementing pathfollowing on the PC

#

Pathfollowing move also ends up in AddMovementInput call, just like controlling your character with WASD does

dense narwhal
#

Can I somehow delay the clients joining my dedicated server in editor-mode?

scarlet cypress
#

What is the right way to solve this example and similar cases?

I have a vending machine actor placed in the world, nobody spawned it and nobody owns it. But on the vending machine there is logic that has to be done on the server. The item that the vending machine drops needs to be spawned on the server. However since nobody will return (is owning client) as true, there seems to be no way to run the logic on the server without doing it on the character or sketchy things like that.

How do y’all professionals handle that?

pastel marlin
#

@scarlet cypress No professionals here but I don't think its possible to send a RPC to the server if you don't own the Acotr, for your use case one solution which was proposed on a similar question was to handle the item transfer from the vendor to the player inventory on the inventory side

craggy void
craggy void
# scarlet cypress What is the right way to solve this example and similar cases? I have a vending...

No professional here either, but I can hazard a guess. I'd assume there's something like a player interacting with the vending machine for there to even be a need to RPC anything? Then just have the interact action on the player RPC to the server with a reference to the vending machine being interacted with, and have the server function call the method on the vending machine that does all the spawning logic

#

And if you want more than just vending machines the player can interact with, make an interface with an Interact method which the vending machine class implements, and call the Interact interface method from the serverside method in the player

charred pebble
#

So I’m having some issues with a character select widget I have created, below I will add screenshots of nodes but for context I’ll type here: controller has the pawn to spawn function inside of it which is then spawned with the gamemode, for the new pawns from character select I’ve set it as a variable inside the game instance, when I load the game the pawn doesn’t spawn from selection and there is no control in game what so ever.
Originally the pawn to spawn variable was set as a perm local variable

#

Controller before

#

Controller after

#

Game instance variable

#

Widget

craggy void
#

GetActorOfClass looks for a spawned actor in the game world, which I'm guessing isn't there at that point

#

Just use the class directly, if all you're using it for is GetClass?

charred pebble
#

Hmm let me test that out

craggy void
#

So just remove that GetActorOfClass and GetClass node, and set the class in the PawnToSpawn setter to the one you had in GetActorOfClass

charred pebble
#

Hmm the characters still don’t spawn in

#

I’m thinking it’s something with the controller logic

#

There’s still that perm local variable connected and the cast to game instance is connected to game instance which I’m not sure if that’s correct

safe trench
#

Hi! I remember that steam multiplayer was working only on the 4.24 version or something like that, is that the case still?

#

Like can you get steam multiplayer as easily working on the newest version or do I remember something wrong?

craggy void
craggy void
tepid ivy
#

Hello does anyone know a tutorial to learn how to save the variables of a character in the dedicated server? for example with playfab?

winged badger
#

dedicated servers just run a game instance when instructed to, they don't hold data

#

for that you need a separate server

odd iron
#

Hello .. if i did the replication on dedicated server can i run listen server normallly or i have to change the replication again

twin sable
#

Hi guys, I'm finding when my client walks into another character ai it constantly rubber bands backwards. Does anyone know what could cause this? Maybe the client and server have slightly different understandings of where the player and the ai are but I'm using a fairly typical setup so I would have thought this wouldn't be such a big problem

bitter oriole
#

The AI probably doesn't have the same location on server and clients

twin juniper
#

I'm changing a variable that should have impact on IsNetRelevantFor but it takes too long to take effect. Is there something I can do about it?

silent valley
kindred widget
#

@odd iron Dedicated doesn't have anything to do with RPC or replication difference. Literally the only difference between a listenserver and dedicated is that in listenserver, the server also has a HUD, can spawn widgets, and has a player. If you're doing your programming correctly, your game can run on either dedicated or listenserver. Server code will be the same for both, and client code will work the same.

kindred widget
#

Not sure I follow?

odd iron
#

Sorry my replication works super except Screen effects

kindred widget
#

What kind of screen effects? Usually that kind of stuff gets triggered client side via certain conditional replication, or stuff that happens on the client anyhow.

odd iron
#

@kindred widget its Fear or glitch its working on dedicated for each client but it firing for all players on Listen

kindred widget
#

Sounds like you're setting the value oddly. That sounds like the server should be setting a value on the server version of a player's pawn. That state value gets replicated. Then each client can do with it what they want. Other clients can see that pawn as feared with an effect or something around them, and the owning client can play camera effects and such.

twin juniper
#

For a MOBA-like game, how would I go about making the server for it? preferably without needing a source code build of ue4

kindred widget
#

I don't believe you can do a dedicated server without a source build.

twin juniper
#

How about epic online services?

meager spade
#

that wont make a server

#

that is just a provider system (like steam)

twin juniper
#

alright thanks

#

So if I have a project that relies on an UE version downloaded from the Epic Store, how would I make the switch to a source code build? Since I'm working on a team I don't know what other people would have to do in order to use the same engine version, would they have to download the source code and build it too in order to use it?

meager spade
#

no

#

just one person needs to build the dedicated server

#

the rest can use the same version but launcher edition

shy hill
#

Hi everyone, I'm new to multiplayer and I have a very basic set-up. I have 2 player starts in the scene, and I'm simply trying to get the client and the server to move their player character.
While it works fine with basic templates like the ThirdPerson, it breaks with my own gamemode / pawn. It sometimes works in the client, by as the server, the inputs and the camera rotation seem to be broken.
Any idea how to fix it ?

distant wave
#

Did anybody manage to replicate a Physics Constraint Component?

I tried making my own Phsyics Constraint Component by literally copying and pasting everything from the original cpp and h.

Then, I replicated the Constraint Instance which contains all the settings for the constraint. However, the angular force seems to not be in sync between the server and the client.

I still have some things left to try, but I am not being so optimistic about this, if anybody could help, I would highly appreciate it.

grizzled stirrup
#

If you need to get the local player regardless of if you are a listen server host or a client, will GetWorld()->GetFirstPlayerController() always return the local controller (the current local machine)?

winged badger
#

not always

#

you'd be better off with GetFirstLocalPlayerController

#

during seamless travel, client controller can end up at [0] on the listen server

golden fulcrum
#

Hey guys i just want to make sure i understand this correctly
from the unreal engine docs

Any replicated actor can be replicated as a reference

Does this actually mean that pointers to replicated actors will be properly replicated across the network?

eg If in my game state class if i keep a reference to an array of actors spawned at run time, that array of actors will properly be replicated?

thin stratus
#

Without taking everything into account, yes

#

Important things are:

  • The Actor Class is marked as "Replicated".
  • The Array in the GameState is marked as "Replicated".
  • The Actors are relevant for the Player, which by default is distance based.
  • The Server spawned those Actors.
golden fulcrum
thin stratus
#

It works with unique IDs.

golden fulcrum
#

yeah i found the page that talks about it in depth

#

im pleasantly surprised XD

empty bluff
#

given a 3rd person char that wants to interact with a chest to access it's content, by pressing an interact key (E). Would you guys let the char call the chest or let the playercontroller call the chest? (hope the question makes sense?)

normal jacinth
#

If I want to set a variable on each client's GameInstance, what's the best way of doing that? Multicast from GameState?

#

@empty bluff I've been doing it from the Character which works fine but I'm not sure if it's the correct way. The Character sends a message through a Blueprint Interface to the object

empty bluff
normal jacinth
#

Seems fine to me but I'm a bit of an amateur 🙂

kindred widget
#

I'm not really sure there is a correct way to handle that so much as whatever fits your game style. For instance some people put inventories on their Playerstate. Allows other users to see them and persists death. Some on the controller. Persists death, but other players won't see it. On the character it allows you to leave behind items on death.

#

Mostly pointing that out, because whatever you have the inventory on should probably be what is initiating the interaction with the other inventory.

empty bluff
kindred widget
#

Inventory should always be stored on the server. Server should have authority over all real data.

empty bluff
#

yeah, i've heard that... but how about games like Terraria and Valheim? they don't seem to keep player inventory on the server they connect to

kindred widget
#

For instance, I use a single actor component class for all of mine. The component gets attached to things that can hold items. My character has a function that does the interaction line trace, iterates over the hit actor's components, if they have an inventory component, it calls the local hud, and sends that component through along with the character's own inventory component to populate and open up a transfer widget. Widget uses the component on the character to RPC to the server version of the component to do actual transfer logic.

#

And I can't speak for those games specifically because they aren't made in Unreal, but if you were going to do that, you'd probably just have client data that gets uploaded to the server when a client connects. Then the server can replicate this back as it changes. On log out, request the actual state and let the client overwrite it locally.

#

At least as far as Valheim is concerned. Haven't played Terraria.

empty bluff
#

I was considering the last scenario as a posibility too rather than keeping it on the client entirely... anyway, still learning how to design this multiplayer stuff... so much to learn

kindred widget
#

While in a game, server should have authority and control of data. It's the simplest way to avoid inconsistent states and odd glitches, or bad bugs where the player expects one thing and another happens.

empty bluff
#

btw what i do right now when i approach a chest, then i have a Interactorcomponent that has logic for detecting interactables. it has responsibility for highlighting the relevant interactable and also has a server_interact method that i can call with reference to the interactable

#

is that potentially bad on the client, to fetch the reference to the interactable, then call the server with that reference and do the transfer logic on the server?

#

once i hit the server, i "lock" it as occupied by playercontroller, and only allow it to be interacted with if it's not "locked"

kindred widget
#

I designed mine to avoid the locking. But the concept is similar. In mine, I have to send a bit of extra data through the RPC to let server check if the client is moving the correct object, so that two people don't try to move the same thing before server is able to replicate state back. In general, clients should just see what the server's current state is. Then RPC to server to have the server move stuff around.

zinc kindle
#

Hello everyone, I'm very confused. I've created a pawn and added custom movement without the Movement component just with variables, because I have no idea how to make it work with PawnMovement component. I use a third person template and the replication works there, but as soon as I load another map where you fly an airplane, it doesn't replicate.

silk abyss
shy hill
#

(trying again today) Hi everyone, I'm new to multiplayer and I have a very basic set-up. I have 2 player starts in the scene, and I'm simply trying to get the client and the server to possess & move their player character.
While it works fine with basic templates like the ThirdPerson, it breaks with my own gamemode / pawn. It sometimes works in the client, but as the server, the inputs and the camera rotation seem to be broken.
Any idea how to fix it ?

viscid monolith
#

Hi, in which side should i repossess player to different pawn in multiplayer? Is it client or server thing? Can server possess player controller, and will it work if i possess it on client side?

#

Also, HUD only exists on Client Side, so i think, PlayerController's GetHUD will fail on server side?

#

Logically yes

dusty bluff
#

hey, is it true that an interface variable cannot be replicated? at least for me it's not working, using object references is fine though

heady scarab
#

I'm looking for the right method in GameMode to start doing stuff when all the players have joined. BeginPlay() executes before any of the remote clients are in the game (if I start an editor game with 2 players in client mode, GetNumPlayers() is 0 in BeginPlay...) Does GameMode even know how many players it expects to join?

teal rose
#

postlogin event

#

i think @heady scarab

heady scarab
#

Yeah, now that I think about it, it makes sense... the game mode doesn't know how many players are coming (at least not the number on the slider when you launch from editor), so best it can do is count them on PostLogin

barren patrol
#

Hey @winged badger @meager spade regarding our convo earlier. How are you guys handling replication of your OwnerOnly type variables when you are possessing the character with an AIController?

#

Or perhaps for anyone here who is using an AIController proxy to control their characters (rather than possessing the character directly). I'd like to avoid replicating the ASC, inventory, etc to all players for obvious gameplay/cheat related reasons.

winged badger
#

we usually don't use those, but skip owner

barren patrol
#

your game doesn't have any variables you only want to share with the owning player?

silk abyss
#

I don't think ai controller is replicated to clients.

#

So as long as you don't save data on the pawn itself and replicate those properties. Basically on controller is pretty safe.

winged badger
#

it isn't unless you configure it to replicate

silk abyss
#

But is there actual reason to replicate AI controller to clients?

barren patrol
#

I have data on the pawn itself, in the ASC (for Gameplay Ability System).

#

cooldowns, etc

silk abyss
#

You can say, separate those, cause really the only things that needs to be done on clients are like effects(particles etc) spawns and movement.

twin juniper
#

I'm overriding IsNetRelevantFor on an actor, but it takes like 5 seconds for the actor to stop being relevant when IsNetRelevantFor should return false, is there a way I can fix this? I tried using "ForceNetUpdate" but that didn't work.

silk abyss
#

So local data is garbage if people peeked.

tough gyro
#

is there any plain english explanation for the replication flow of shooter game weapons? The example project

#

I keep getting lost in the code and I'm having really hard time figuring it out 😄

silk abyss
#

which part you get lost? pick up? firing? updating remaining ammos? spawning effects?

#

basically, replication go from server to clients.

leaden atlas
#

has anyone here tried to do predictive actor spawning? im looking over the code for UTProjectile in unreal tournament

#

it looks kinda arcane, especially how it matches up the server projectile to the client projectile using

#

the velocity direction?

#

very strange

#

also i dont understand the PlayerController->GetPredictionTime() stuff

viscid monolith
#

Why can my HUD class spawn only on one side?

#

Joke is that it spawns only on listen server, but not on client

silent valley
leaden atlas
viscid monolith
#

How can i fix it? Im just complete newbie in networking, so im facing a lot of issues atm

leaden atlas
#

how do you know they dont spawn on clients?

viscid monolith
#

My HUD class is spawning widgets on BeginPlay event

silent valley
#

Which code? The projectile mgr I have is 500 lines long 🙂

viscid monolith
silent valley
#

this is my hash function if that's what you want to see

static int32 HashPosDir(FVector_NetQuantize const& pos, FVector_NetQuantizeNormal const& dir)
{
    // hash it!
    int32 hash = HashCombine(0x8235626b, GetTypeHash(pos));
    hash = HashCombine(hash, GetTypeHash(dir));
    return hash;
}
leaden atlas
#

hmmm

hoary lark
#

i'm curious, what do you do with this hash? (and what happens when two projectiles are shot in the same direction from the same position?)

silk abyss
#

My guess is that if the hash matches one that's already in the table of spawned projectiles, you just don't spawn, instead interpolate (or whatever your client side prediction/server matching) the current one

silent valley
#

yeah it's a way for clients and server to know they are talking about the same projectile.
If player launches from same pos/dir then yes it would be a problem and I've not looked at that yet.

silk abyss
#

Cause it's extremely unlikely to have same location/rotation

silent valley
#

it's almost impossible in real situation

hoary lark
#

ah I see

chrome bay
#

If you're new to multiplayer - predictive projectile spawning is probably not a wise first thing to tackle, it can get complex quickly.

silent valley
#

yeah lots of edge cases for sure. Like when RPCs arrive in different orders or the hit rpc arrives before the launch rpc 🙃

silk abyss
#

I agree, also it's not that important factor other than competition arena type of shooting games.

#

Most player would not play anything above like 100ping already.

chrome bay
#

Yeah that too, for a simple bow and arrow I wouldn't even bother using a replicated projectile for the local player, just predict the whole thing. It's almost certainly going to be deterministic in nature.

#

Just replicate the projectile for third-party viewers or even just the start position and direction and have them spawn one locally

peak sentinel
#

Do you guys use projectiles too in automatic rifles or anything that spawn projectiles too frequently?

bitter oriole
#

Usually no

#

That's regular hitscan stuff

peak sentinel
#

I see, probably there isnt much way to predict it too since the travel time of the projectile is lesser than RPC travel time

#

Actually rather than RPC travel time its about timers because you just use one timer RPC to start firing

#

You only have start/stop trigger

silent valley
#

I have projectile based rapid fire plasma gun which is why I use the manager and hash approach, rather than a replicated actor per shot.

chrome bay
#

Everything in HLL is a projectile but we aren't using actors. Would be bandwidth-suicide.

#

But also, since bullets are SMOL, it doesn't matter if you don't see all of them so we can replicate them "lazily"

#

Sci-Fi big-boi plasma guns are probably another ball game

peak sentinel
#

I'm developing a top-down shooter and couldnt find any optimal solutions for projectile-only weapons

hoary lark
#

if you're doing things like an MG42 you might just do what jambax said... spawn it locally per machine (with pooling of course), no need to replicate the flight path. you can make all the bouncing/penetration randomization the same across all clients, there's just a chance it might hit differently on certain clients so other players might occasionally see a weird hit, this is where "trust the client" and "server shoould sanity-check the client" come into play 😄

chrome bay
#

It's all very situational which is why it's hard to find solutions that cover all bases, I don't think there are any really

hoary lark
#

yeah definitely, there's several ways to do things with strengths & weaknesses

chrome bay
#

Also tbh players will forgive the occasional miss-prediction but they won't like a gun that feels permanently laggy 😄

silent valley
#

If it's a spray bullet type game you might be able to do start/stop firing message, but usually you'll need at least 1 RPC per shot.

peak sentinel
#

I also have another RPC to stop the timer

hoary lark
#

bonus points if you can build in a bug that games like Rainbow Six Vegas 2 had (sometimes the "stop firing" signal never got broadcast properly, and you would have to spend the rest of the mission listening to the other player's gun firing sound)

peak sentinel
#

Ah I remember that bug 😄 Thanks for pointing out

hoary lark
#

shouldn't be an issue if you're using reliable RPCs here anyway... I'm sure Ubisoft just pulled an Ubisoft on that job 😄

chrome bay
#

lol we had that for a while 😄

hoary lark
peak sentinel
#

I'm literally enlightened and now understand why @silent valley use hashes , thanks 😄

bronze arch
#

Guys is there way to edit source code for that execute on client RPC?
I having trouble about Client RPC's are running on server when a player leaves. (characters shouldnt destroy as like MOBA games, so i edited it from playercontroller to block destroying character, and thats work)
but when player leaved, that character owner switches to server as expected. so execute on client RPC's are running on server too.
The way i want to add: **is dedicated server boolean ** at the run on client RPC's. so it wont run on server and wont make lot bugs also cpu resource which is widget things.
where is that run on client RPC at the UE4 source? anyone know?

meager spade
#

anyone know why dormant actors (marked dormant all) would still be in the active list and not actually dormant

#

[2021.05.16-21.15.34:671][471]LogSolsticeCheats: Actor: AmmoExplosivePickup_C_2147430494 (AmmoExplosivePickup_C) - Next Update: 254.564468, LastNetReplicateTime: 64.312965, OptimalNetUpdateDelta: 1.000000, PendingNetupdate? 0, ForceRelevantFrame? 0, Dormant Connections: 0

#

tho this actor is marked "Dormant all"

bronze arch
winged badger
#

you should definitely not be trying to edit engine source code for this, its a terrible idea

bronze arch
#

so it wont fire on server that client rpcs

#

there lot of client rpc that send attack, animation, KDA or audio etc. also not only on one character, there'll be 30 or more characters for MOBA. that requires lot times to add with branch on BP

winged badger
#

if you want to do 30 player game and do your networking in BP

#

that game will never work

#

4, maybe 6

bronze arch
#

no its not player,im talkin about characters

winged badger
#

or NetMode

bronze arch
#

still runs client widget nodes from server. not work

winged badger
#

or not even compiling the body of the function for the server target

bronze arch
#

because that character owning are switched to server

#

since player leaved from match

bronze arch
# winged badger 4, maybe 6

this a 5v5 MOBA game match, so players choose one of 30 characters and enter the game.
not about 30 players entering this match lol

#

you know how do you make owner without owner for avoiding run client rpcs on server?

#

no that actor owner is still on server.
still will run on server

#

how can i have authority without the game?
if i switch owner to another player then clientrpcs will run on that player and that makes more bugs within double rpc

#

the way that i want; disabling execute on client rpc event fires on server

#

runs on server after leaved from game

#

even that says execute on owning client

#

yeah but i dont want it

#

character parent(base, main one) not only created from character. its includes towers, minions so i cant add character things even they are not connected each other(like different animation, behaviour etc)

#

why? let me know then

sage gate
#

Scratching my head on this one, trying to get the number of players in the game but it doesnt seem to return the number properly for the player coming in. It only seems to update when someone else joins in

bronze arch
#

yes its easy without source edits, but requires a lot time to do checking with all of 30 characters per 10 ~ client rpcs

sage gate
#

doing this for when the player joins in

#

and then i have this interface that i setup to a billboard which updates the number of players when the player joins in

bronze arch
#

i didnt understand

#

what do you mean

sage gate
#

it doesnt even fire on the Client Thinky

#

the server got it but not the client, i add a bit of a delay and it picks it up but ideally i dont want to add a delay

bronze arch
#

what you would suggest? make all them on one parent?

#

but minions, towers and characters are too different. minions are not even having client rpcs. and they using AI controller and AI behaviours within same parent.
at the parent there's have some damage calculation, CC(crowd control) coming from player to minion or tower or to enemy character. and some basics that need on everything minions and player characters too.

#

well not 3 class i guess its just sample

#

inhibitors, base guardians, mining guardians etc

#

which is connected each other for damage calculation armor lifesteal etc

#

nope, it wont fire that rpc event. so i dont need to add branch or bool if i do changes on engine.

#

like imagine:

executerpcbp(exec,some structs etc);

this is firing the RPC events on blueprint from C++ engine

if i would change like that

if(!isdedicatedserver) executerpcbp(exec,some structs etc);

it wont fire RPC event on blueprint if it is on server. only fires if its client

#

since i dont know where is this RPC event firing so i gave example with one string

#

exec is :

#

so this white thing wont do anything on server within client rpc.

#

so it affect all client rpcs and i dont need to add brach, bool check etc on all characters bp's

bronze arch
#

you can try onrep replication on that variable. after client get it changes asap then you can fire that node without multicast

bronze arch
#

even why UE developers didnt add that checking, dunno
who need running client rpcs on the server even there is run on server rpc tho

meager spade
#

which is why you use composition over inheritance

#

put a component on them

#

damn laggy discord

gilded vapor
#

Anyone know the correct way of locally predicting MoveComponentTo?

mild lynx
#

Anybody use Advanced Sessions and know how to close a game instance to create another game. My problem is I can Host, but I don't know how to properly go back to main menu without using Open Level. When I try to host again or join another session, it fails unless I restart the game.

sage gate
#

So the Rep Notify is basically a message that gets set to the Clients and its literally like

#

"Do this when you can?"

thin jacinth
#

Hello, got an Intresting question. I've seen 3 main game hosting servers being used, which are: Gamelift, photon and SpacialOs.

So between these 3 which one do you guys think is the best overall?

No, which suits my needs or anything just your own opinions.

placid flame
#

why if this is into my character the print node says server? and the sum value is correct, but if I try to print it it says 0

#

oh I think I solved but the value is not right

plucky sigil
#

does anyone know why play as client with 1 player spawns two characters

sage gate
#

Ah yeah that's true. That makes sense in my situation as well

silver glen
#

I've started my Server joining and all that other stuff setup so hopefully I can get this all working. Wish me luck -_-'

sage gate
#

Random thing, anyway to test players leaving the server I hit exit and it exits all the windows deku_cry

sage gate
#

Ah just noticed you can run them as separate processes, instead of sharing the same process.

sage gate
#

Is there anything built it into the player state (like the ping) to get if the player is running on a wired or a wireless connection?

silk abyss
sage gate
silk abyss
#

I think the fastest way is just run windows command and then save the output into a text file. Save and parse and save to a config somewhere.

#

You are essentially relying on people don't manually change their connection names.

thin jacinth
#

Just how complicated would it be to make a simpler version of the CoD game lobby ? Like a base simple version of it

bitter oriole
# thin jacinth Just how complicated would it be to make a simpler version of the CoD game lobby...

It's difficult to answer because CoD is a giant AAA game and has a different architecture than you probably do. For example, the players likely aren't connected together during the lobby, and each player gets the other player's state from the server that stores which skin you've equipped and so on. Assuming you're not doing a game-as-a-service with extensive always-online services, you probably don't want to do that, so you can simply have people join the game, and then make the lobby a special state of the game with a lobby menus and camera, and then start the game.

thin jacinth
#

Yeah that sounds intresting thanks for your answer. I'll look into it more 😄

smoky crag
#

Hi guys, quick question, is that possible that ue4 could support 500 characters replication? like 4 players with 500 AI characters.

bitter oriole
#

No

smoky crag
#

I noticed that there are bandwidth for networking, only 100 characters movement replication works OK, beyond that number, it is extremely lag. Is that possible to do some optimization for 500 characters movement replication?

bitter oriole
#

Did you test for 100 characters in real-world conditions with two machines some hundred of miles apart ?

smoky crag
#

Yes, its OK. I tried to increase the bandwidth in config file, it could work for 300 characters but its like 200kb/s for client download which is too high

mighty rain
#

Is there even remote multiplayer games with that large amount of character replication?

CoD Warzone being the largest BR game has 150 simultaneous players, no NPCs.

bitter oriole
#

Because that's surprising

smoky crag
#

Yeah. but I changed the config to increase the limit of networking bandwidth

bitter oriole
#

Anyway, assuming you have 4 players, just replicate the player data and have whatever logic drives characters simulated locally

#

Deterministically, of course

smoky crag
#

OK, so for replicate 500 character's movement is not possible right?

mighty rain
bitter oriole
#

I doubt 300 actually works in real world, but you're telling me it does, so...

smoky crag
#

I was wondering it there anything I could do on it maybe adding some custom networking data sending

bitter oriole
#

Yeah sure: don't use character and roll your own pawn class instead

smoky crag
mighty rain
#

Theoretically it could be done if all that's going through the netcode is just player input every 1/128 seconds, not accounting for accurate collision detection.

bitter oriole
#

Character is a full-featured AAA player class, it's as heavy as it gets, if you're using it for simple player controlled AI it's pointless. Roll your own class instead - and like I said, it needs no replication at all if players aren't driving it directly. Replicate the actual high level player commands, and ensure your custom pawns react deterministically to these commands. For example you can replicate pathfinding commands.

mighty rain
#

For reference, Doom's ancient netcode only sends out input data, and people tried to go past 160 simultaneous player with resounding success.

smoky crag
#

I c thanks guys, I think one way could be making own character class from pawn and custom character movement class from pawn movement. Deal with custom networking would be possible right

bitter oriole
#

There is no need for anything custom, just don't use Character for this

smoky crag
#

Got it, make sense.

winged badger
#

@smoky crag the bandwidth is not your chokepoint, the CPU is

#

very few people actually had bandwidth issues, before their server CPU died evaluating actors for replication, or just running 300+ CMCs on the GT

#

and 100 players is not possible, unless you have a very experienced team with you

kindred widget
#

Yeah. That's why games like Apex and Fornite are the way they are. You might have a ton of players in one server. But the local client performance and server performance are greatly enhanced by the fact that most times people never see all of those other players fully replicated. You see like 20-30 max in most games, and an average of 10. Server still has to consider the replication, but it can be highly optimized via a few factors. Clients aren't constantly simulating a hundred character movements since they only care about the few the server says are important, etc.

viscid monolith
#

Does HUD class spawn automatically for each client?

bitter oriole
#

Yes

#

Locally

viscid monolith
#

But for some reason HUD calls BeginPlay event on Listen Server's Client, but not on other clients

#

I don't know how it all works, just started working with networking

viscid monolith
#

Fixed it

#

What about RPC functions, i have a Server function, that is being called by my Widget when i press a button. But when i press button on client, it doesn't call a function, it works only with Listen Server

#

Server Function is located in GameState class, and being called by Widget

#

GameState is not null, i checked

#

I guess, maybe i should use something another for this call, actually

#

AGameState is owned by server i guess?

#

Oh, i guess it's bad idea to call Server RPC function from Widget

#

What side owns APlayerState?

tough gyro
#

copy pasting from #cpp to here:
Is a replicated component based weapon system a stupid idea?
At first I tried to just have a component where the "fire" function checks if the component owner is the authority, calls "server fire" if not authorty, replicates it to server and finally from server back to clients for playing the firing effects and so on.
But then I realized that RPCs are a thing for actor's only, and not actor components? Does that mean it's impossible to encapsulate the replication flow inside the component? Should I instead just do a weapon actor that can do RPCs? I'm kinda lost here 😄

lean river
#

voting for actor based weapon system 😄
technically component based weapon system could work but can be pain in the ass when inheritance / high level scripts / explosed events / data storage / runtime comp creation / subcomp requirements comes in.
actor solves all this issue, makes easy to use, designer friendly etc. also with some "new" systems like replication graph its way cheaper to replicate cuz' you can filter,sort via class or replicate as depedency with the character etc.

south rampart
#

Hello, we use Advanced Sessions and I want to Find Sessions Advanced on a dedicated server but it doesn't seem to work without a player controller. Anyway to get around this?

bitter oriole
#

Dunno what the PC is used for, but you can look into the AdvancedSessions source code to understand why

#

AS is a Blueprint layer on top of the online susbsystem, which doesn't need PCs, so it's probably only used for context

south rampart
#

Very weird that they would have made the choice to make a player controller mandatory

bitter oriole
#

It's not that weird, really

#

Advanced sessions is basically "easy matchmaking in Blueprints", so it's not exactly tailored for AAA type games

#

Take a peek at the source and see if you can get rid of it

#

For the most part it seems like it's running GetUniqueId on the player state, which may not be needed in a dedi context

#

But that code is finding sessions, which is just weird for a dedicated server, anyway

#

You'd expect the server to be joining an explicit session by ID, or be the one creating the session

south rampart
midnight karma
#

Does anyone had problem with current number of players when u find server and want to join. It correctly show max players but current players is always 1. Idk why

distant wave
#

are there any special techniques or something when calling an RPC from a replicated scene component?

#

except for GetOwnerRole() are there any extra steps

#

?

lament sinew
distant wave
#

Actually a client can have authority over something he owns

lament sinew
#

Well if you really don't need the client to run the code you could check for :
GetNetMode() < NM_Client
or ! IsNetMode(NM_Client)

brittle tulip
#

anyone got any resources for extending the character movement component not really sure I need to do to add a custom movement?

ashen bobcat
#

do you want to know how to add a custom movement?

brittle tulip
#

Well I just want to add a networked sprint and in the future want to do some stuff like flying, the best way seems to be changing the movement component

brittle tulip
south rampart
#

Anyone have experience with this Create Advanced Session?
Create Advanced Session Dedicated works, the standard Create Session also works (albeit with a limitation).

But when we use Create Advanced Session nobody is able to see the session/server.

It also has a lot more options than the Dedicated session, such as the Presence options. What do the Presence options mean?

smoky crag
#

I'm thinking to create my own character class in order to reduce cpu and do a better networking replication.

winged badger
#

as Stranger mentioned, doing it with CMC is not feasible

#

we can only run 200ish, before the average gaming computers have performance problems

smoky crag
#

YES, the current cmc cost really high cpu, need to have my own one

winged badger
#

and we stripped out everything we didn't absolutely need, its still CMC tho

smoky crag
#

I totally agree, I did the same thing, but 300 character is at most with 30 FPS.

winged badger
#

there are methods for smoke&mirrors

#

any characters you're not actually interacting with can be faked with niagara

smoky crag
#

I think creating a custom character class with custom CMC and doing the custom networking part for this is the only choice for me.

winged badger
#

it will move, and run animations

smoky crag
#

Yeah, I read through the indro of niagara characters. But for a 500 character battle group, nothing could be ignored as running as niagara, that's my concern

#

BTW, I saw a game called conqueror's blade, it could support 30 players, and each player could control 40 around soldiers, which really surprised me.

winged badger
#

nothing there will work out of the box though

smoky crag
#

what do you mean about the box? I just wondering if creating a custom character class with custom CMC and doing the custom networking part would be the best way for 500 characters replication.

winged badger
#

it wouldn't

#

the 500 characters is also not a small number

#

to evaluate and replicate, also CPU cost

#

you'd be better off splitting them into units

#

reduce the number of Actors involved

smoky crag
#

I c, like making 20 characters as a group instead of individual right?

winged badger
#

yes

#

your unit can run 20 skeletal mesh components and all that

smoky crag
#

I think this is really what I needs, yeah trying to group up the characters.

#

Thanks Zlo this really helps me

silk abyss
smoky crag
#

I c thanks, only delay the replication for character that far away of all players right? This won't affect any character behavior like fighting each other right?

silk abyss
#

yeah, you can delay any that aren't in immediate action area.

#

(like they can even tick slower for AI, etc, etc)

#

basically, you hide the fact they have slower update rate with different/staggered actions. as it's so chaotic all around you won't really notice that hey this couple is playing the same animation twice for the past 5 secs

#

especially if they are like 50 meters away hiding behind foreground characters.

smoky crag
#

I c, if I don't want them to have different behavior when fighting, only reduce the rendering and networking ticks, also even reduce animation but keep the animation notifies since they are used for fighting.

silk abyss
#

yeah, doesn't matter how you approach it, the basic idea stays the same. ie. playing the animation is pretty much local, while update the action usually is from server to client.

#

you can keep the logics to like dead simple value for far away AIs. like just play the fighting animation until the system get to you.

#

so your anim blueprint needs to be able to handle that instead of returning back to idle once a cycle is done.

#

also, if possible, you should see ways to interpolate one action to another with an offset per character

#

say, we go from running to the in place fighting animation

#

your AI anim blueprint should be able to blend from running into any part of that cycle fighting animation

#

once you figure that part out it's a lot easier to stagger out animation even if the event/replication happen to tell them to do the same action at the same time. As they are interpolating to different part of the same animation cycle.

#

@smoky crag see above

smoky crag
#

Thanks, that's really helpful

finite nebula
#

Does UE4 only use port 7777? What if I want to host multiple instances of my game on a single server/ip?

native wren
#

I want moving platforms in my multplayer game. I added a box and animated it using the level sequencer. The players glitch through it.
What should I have done instead? 🙂

#

hmm, maybe I should stop being lazy and just create an actor blueprint. One where I set up replication and then only start the level sequence on the server? Is that how I should have done it?

bitter oriole
#

Moving, player-colliding platforms, in multiplayers, are not easy at all

#

You need them to be exactly at the same spot everywhere on all clients (so some sort of replication is needed, if only the shared world time)

#

You also need to be wary of pushing players into eachother or into walls, etc

native wren
#

I think I got it to work, sort of.
How I'm doing it right now, that I have only playtested for a minute or two, is that I created a BP_MovingPlatform where I clicked replicates and replicate movement.
I start the level sequence in the level blueprint if is has authority.
My two clients seems to agree where everything is, and nobody has so far glitched through the platform! Have not tested with walls yet.

#

The platform feels a little bit choppy though. Guess that's to be expected due to it not being played on the clients...

#

But if I play it on the clients then they start to glitch through it again. 🙂
Not really a must have feature. I should probably try and concentrate on the rest of the game. 😛

silk abyss
#

When you move the players I mean.

native wren
#

It's not a pawn and it is moved in the level sequencer.

#

ah the players!

silk abyss
#

Yeah, but I mean your player pawn.

native wren
#

Yes, sorry.
The players is just the standard 3rd person template mannequin

#

And I don't know what it uses

silk abyss
#

Hmmm... So probably more velocity based.

#

My idea is, if the pawn is acceleration/force based. You wont be able to change direction that quickly, but now you are open to ambient velocity.

#

Like the Albert Einstein relativity, if you are on platform, your ambient velocity just matches the platform.

#

Compare to say, 0 velocity and want to let friction of collision to make you match platform speed.

#

Which is where the choppy coming from I think

native wren
#

It is? I thought it was because of the replication, and that it probably would increase if it was played over the internet and not on the same computer?

#

The platform looked a bit choppy from an observer that was not on the platform. 🙂

#

but just a tiny bit.

silk abyss
#

Yeah, that as well since physics are in the server, and you also need some sort of interpolation if too out of sync.

native wren
#

yep

#

I think I will leave it as is, and start implementing the actual game now. 😄

silk abyss
#

Yeah, good call actually

#

Core mechanic is more important

finite nebula
#

I asked thus question an hour ago with no response, Does UE4 only use port 7777? What if I want to host multiple instances of my game on a single server/ip?

bitter oriole
#

No, it uses 7777 and up

bitter oriole
#

open ip:port, assuming you are somehow not using any session system

finite nebula
#

Some posts on the unreal forum said you can't pass the port

native wren
#

This is your chance to try it out and prove them wrong once and for all!

finite nebula
#

I don't currently have a project setup

native wren
#

This is your chance to whip up a small proof of concept and prove them wrong once and for all!

finite nebula
#

I'm very busy with exams...

native wren
#

This is your chance to study really hard and learn a lot of stuff and kick ass at the exams and get a good grade or whatever it is kids these days gets except STDs and prove them wrong once and for all! (OK, I will stop now, this is getting silly, it's 11pm, and I have work tomorrow...)

bitter oriole
finite nebula
#

So I would just type 127.0.0.1:7778 in the level name, and it should work fine?

#

Wait it says editor play settings, do I have to change something there?

#

Thats dumb then bc you can't change the port after compiling the game

bitter oriole
#

This is just an excerpt from the source to show you that this syntax is indeed expected to work

#

If you are not using any modern session system such as Steam, then you would pass the port to specify which server you want

finite nebula
#

k ty

warped berry
#

when do I really want to make a call to StartSession ?, is it when the game really begins or just once joining a lobby ? or depends on my logic?

#

I'm using steam online subsystem

low helm
short arrow
#

I know there's a way to make only 1 client print out a string instead of all clients but I can't remember the method. Does anyone know how?

deft oar
#

anyone familiar with networking?
wondering why my server owner can shoot but my client can not

#

the simple idea is that it checks whether the weapon fired is hitscan or not and if it is it will do this

#

using strings to test it gets right up to fire hitscan server and then doesnt procede

#

for the client

sinful tree
#

Simple answer is you're using Get Player Character 0.

#

You shouldn't be using that within multiplayer.

deft oar
#

ive been using it a lot and it hasnt caused me issues

#

whats a better one?

sinful tree
#

The actual reference to the character you're concerned with.

deft oar
#

oh i see yeah, because its a multicast i need to be more specific

#

i dont know how to get the reference though

sinful tree
#

In multiplayer, Get Player Character 0 doesn't specifically reference the character that you may want to actually fire the weapon on the client, server and other clients. If your FireHitScan event is on the character, then getting a reference to self would suffice. If the event is on a weapon that is attached to a character, then you can use something like Get Attach Parent Actor.

You also want to avoid having the client tell too much to the server on what to do as this opens up avenues for clients to cheat/exploit. As an example, if I hijacked my client, I could pass invalid information back to the server about my character's location, so then I'm able to shoot people from anywhere I want without even having to move my character at all. In otherwords, you want your clients making requests only to the server and the server checking its values of where the character is, and what the player is aiming at, if the character is "alive" and only when the server has verified everything should it proceed with what the client requested. You can still send data from the client to the server, but generally it should be minimal information, like a reference to a specific character, or an index of something the player is wanting to interact with.

And... If you're not sure about how to get a reference, you may want to start with that before trying to figure out multiplayer as multiplayer makes the concept even harder to follow as you're now dealing with multiple references to the same thing on different computers.

deft oar
#

Ive been working on this for a bit, i have animations and weapons being shared accross computers

#

thank you for the advice

#

i tried Get Parent Actor but i didnt know about this seperate one

silk abyss
#

I think @deft oar needs to go through the basics of Content Example->Network_Features first.

deft oar
#

dammnn

#

nice

#

thanks

#

wow

#

👏

silk abyss
#

no offense, but your question is very typical starter issue. which means you are lacking basic knowledge about networking with UE4.

deft oar
#

well their solution didnt work either, getting the attach parent actor and then getting this camera by its class still works only on the listen server owner and not the client

silk abyss
#

there is even a UE4 networking compendium written by a very nice guy that shares essential info you must digest.

#

it's in the pin, so please read it.

#

basically, UE4 gives you a lot of controls over networking, thus you need to know at lease some basic terminology and know that multiplayer is very hard to do well.

deft oar
#

not the gush but its mostly an experiment to test with my friends, i was stumped on one thing and decided to ask i dont know why you have to be so pretentious about it

#

because you are

silk abyss
#

usually, you can't expect to develop a prototype with everything written without considering multiplayer from the get go and expect to hit a switch on your events then it's multiplayer ready.

#

you NEED to develop the project with multiplayer in mind from the very beginning.

deft oar
#

my entire prototype considers multiplayer

silk abyss
#

yes, so go read the pin compendium, study the Network_Features case by case.

#

when you go through those feel free to ask question

karmic briar
deft oar
#

ive mostly been learning through tutorial and commenting because thats my preffered way of learning i dont think ill be able to wade through all of it

silk abyss
#

yeah, it doesn't really work that way though with multiplayer. a very simple analogy would be, I want to develop a network chat program but I don't know how to program sockets or understand how the protocol works.

#

the concept is very simple to send and receive text you typed in a text field

#

but you can't develop a chat program without the knowledge of how the networking part works.

#

there is a reason why like 95%+ indie game aren't multiplayer games. if they do they have people that really understand it well to pull it off.

#

if you are solo dev it's your responsibility to understand how it works, it's rewarding to study that part of UE4 to be honest.

sinful tree
#

That's why you develop your chat program in JS 🙃 npm i sockets.io-chat

silk abyss
#

XD

#

but yeah, seriously, it tooks me like almost 2 weeks? roughly to understand the spawning process for a client join that spawns to a random starting spawn point.

#

compare to that the fire projectile is so easy once you go through the network_features example map

#

I did entire project from scratch instead of inheriting the multiplayer shooter one.( using custom movement component helps big time as well as you will be responsible to handle the replication of movements, instead of using the character movement component.)

#

omg, I can't believe the wiki I wrote still alive here.

#

version 4.1.0 lol

#

facepalm on my events all have RELIABLE on. facepalmdouble

severe tendon
#

Anyone worked with morph targets across a network?
Trying to get Oculus' lip sync tool to work and the only thing the server is getting is Morph Target name and Value but the server won't replicate any face movements at all

silk abyss
#

the sentence of "server won't replicate any face movements at all" tell me you don't know that replication only goes server to client.

#

@severe tendon so if you want something that happens on client to happen on server, try search for project that does remote collaboration, or even VR multiplayer setups.

#

that should get you started on how to efficiently drive replication to "other" clients

severe tendon
#

Let me rephrase that
The values are being sent from the client to the server, the server then multi-casts it to all other clients in the session minus the owner of the actor

#

Client Calls Server RPC and hands off Mesh, Name and Float > Server calls Multicast RPC and hands off the same info > Each client updates based on that value
We aren't making a game so cheating isn't an issue

#

Only problem is no ones updating. But they are for the hand tracking using the same method

silk abyss
#

cool, let's make it simpler. you can have one actor that are replicated and just keep looping morph target A to B and back

#

make that work first

sinful tree
#

Not using a map variable are you?

silk abyss
#

lol, probably is

severe tendon
#

No

silk abyss
#

cool, then just make a simplified version like I mentioned.

#

ohhh...wait

severe tendon
#

Oculus Lip-Sync gives us an array so we just check if the values are the same as the ones that have already been sent and if they have we don't send them

#

Yes?

silk abyss
#

you mentioned. " hands off Mesh, Name and Float", are you passing the mesh reference?

severe tendon
#

Yes

silk abyss
#

so the funny thing is you can't pass reference cause server will have it's own thing

#

and you can't guarantee that they are the same

#

say, you have face O shape on server and client

#

they can be in totally different address space, orders in memory etc

#

so the only way to tell is that your server pawn and client pawn both owns the same mesh(data wise)

#

sorry gotta brush my son's teeth, come back later.

severe tendon
#

I have no idea whats happening anymore

silk abyss
#

imagine this

#

you have a dedicated server, does it need to load the mesh for each pawn? or does it just need to know which mesh a pawn owns?

#

dedicated server don't run any skeleton mesh or pretty much any rendering mesh at all.

#

so that's why passing a reference to a mesh is meaningless.

severe tendon
#

Strangely it works with the hands