#multiplayer

1 messages Β· Page 354 of 1

thin stratus
#

Which is a bit more advanced

lime rover
#

so first option is place them into the scene and set auto possess by player?

#

what happens when there is a player start already in the scene

#

and I select 2 players..

thin stratus
#

It will use that for every player and try to spawn them there

#

And it might be that the second one fails

#

idk how the spawn settings for defualt pawns are

#

There is usually a spawn setting for "What happens if I'm blocked by something?"

#

You can also set the default class to NONE and get the "OnPostLogin" event

#

That calls for each player and gives you their playercontroller

#

There you can call "SpawnActor"

#

where you spawn your pawn/character

lime rover
#

okay,,

thin stratus
#

and possess it with the passed controller

lime rover
#

i tried something like that.. lemme find my code..

thin stratus
#

BeginPlay is not suited for this

#

It calls only once and probably by that time only for the server

lime rover
#

oh,..okay

thin stratus
#

Well

#

Of course only once for the server, it's Server only class

#

Check OnPostLogin

lime rover
#

sure to check that outπŸ‘

#

rest of the code looks okay?

thin stratus
#

Not exactly

#

"GetPawn" is a local thing

#

It would get the pawn of the server

#

(Makes even less sense if you use dedicated servers)

#

Such code always needs to be relative to a player

#

Ah wait a second

#

You are in the PlayerController

#

I thought you are still in the GameMode

lime rover
#

yup

thin stratus
#

EEEEEhm lemme see

#
  1. You need to limit this to the Server. Only he is allowed to spawn and possess!
  2. Use Possess on that spawned Pawn
  3. No need for a deffered spawning here
#

So the commented version is the one that should work

lime rover
#

oh..okay

thin stratus
#

given you limit it to the server

lime rover
#

coolπŸ‘

#

so I should setpawn as well, right?

thin stratus
#

That happens in the possess already

#

Spawn + Possess is enough

lime rover
#

oh.. okay

#

thanks for the help man!πŸ‘

#

I will look up the rest of the stuff you told me to..

#

also, I checked out the third person template.. I see that when we add more players there, it spawns at different locations. How do they do that?

thin stratus
#

I haven't looked into that template for the past 2 years or so :D

lime rover
#

oh..hehe

#

thanks againπŸ™‚

shy nymph
#

So someone ever worked with advanced session plugin for steam online subsystem. On packaging i get an onknown error, trying to build the enginge source works but trying to rebuild by project in VS i get a lot of errors, do i need to implement the plugin into the VS project somehow?

shy nymph
thin stratus
#

Did you add the plugin to the Build.cs?

shy nymph
#

no, so far only build the unreal engine source and my project after adding the plugin i couldnt get my project to build anymore, where would i need to do that? And what would that do? I mean when i build my project it is building the advanced session isn't it cause that screen is from the output of the build process

#

the plugin folder doenst even show in VS is that a problem?

thin stratus
#

Kinda

#

Did you regenerate project files after adding the plugin?

#

Otherwise it won't register the source files for it

#

So you technically never build it

shy nymph
#

yea im kind of understanding it now, i regenerated the Engine files now and the plugin showed up, will rebuild everything now and see if it works now, thanks needed that little thinking notch πŸ˜„

rare cloud
#

someone already try to replicate an instanced static mesh component ?

shy nymph
#

But do i need to add any code to the build.cs of my prject itself?

thin stratus
#

Might be needed for later packaging

#

And if you use c++ code of that plugin in your own code

shy nymph
#

i do not for now, but if its needed it would go in there "PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore"});" right?

calm zenith
#

anybody knows why steam subsystem would not return any sessions after upgrade to 4.18?

#

it returns with search success, yet empty

#

using the spacewars app ID, subsystem starts and hosts the server successfully

thin stratus
#

Maybe just too crowded?

#

Too many results that got thrown away cause from other games?

calm zenith
#

unsure about it, put query maximum results to insane values, still no results

shy nymph
#

@thin stratus i get the same comiler errors now when i build the engine x.x even though the plugin now showed up in the solution

#

it seems for some reason the plugin wont even let it self build

thin stratus
#

The errors you posted were from packagin though

shy nymph
#

well just realised that the german error texts arent really helping arent they? xD

thin stratus
#

For me it's fine

#

Can you move the plugin from engine level to plugin level?

shy nymph
#

i will try that next yes

#

need to wait for finished engine build though now x.x

thin stratus
#

Yeah it makes no sense to build your plugin with the engine

#

It's totally enough to build it via a project

#

You can always move the sucessfully build plugin to engine level

#

And then no need to rebuild

shy nymph
#

nah it throws the same errors everywhere, put the plugin now under the project folder and regenerated the project files, the plugin showed ub in VS under the project itself but it wont build giving all the same errors everytime x.x

#

it seems to me like the plugins just broken but that doesnt sound right...

#

i mean it even shows up in the error list liklle some syntax error -.-

thin stratus
#

Don't use the output log

#

Ehj

#

Don't use the errorlist

#

use the output log

#

What ever they are called >.>

shy nymph
#

yea shows the same errors

shy nymph
#

it can't be version mismatch can it? I mean 4.18 and 4.18.1

thin stratus
#

Na

#

Can you show the code it brings you to

#

if you double click the first error

#

@shy nymph

shy nymph
#

Sure gimme a sec

#

dude.... im literally flipping my table right now... it just worked... i did NOTHING else then re created the plugins folder added the plugin recreated the project files and rebuild the project in VS... like the same shit i have done since early in the morning today... i have absolutly no freaking idea what happened...

worn nymph
#

Unreal voodoo

stark dome
#

does anyone have any information on how to use net dormancy? i can't seem to find any documentation on how its supposed to be used

shy nymph
#

@thin stratus well thanks anyhow mate really appreciated your help

elder sable
#

replication send data on every tick ?

#

or just when the value change ?

jolly siren
#

when the value changes

cerulean rapids
#

Hey guys, i know. IDK with another problem :D. well it stems off of my last issue and im pretty sure i know why its not working, was just wondering if any1 knew a quick way i could do it. so my scroll bar for chat works on clients, but not on the host, which im assuming is because some sort of layering issue due to how things are spawned in, i was just wondering if any1 knew a quick way to bring the chat window to the front? πŸ˜„

stark dome
#

@cerulean rapids what do you have blocking it

cerulean rapids
#

the only thing it could really be is kind of itself

#

the chat is embedded in the lobby UI

#

and it spawns chat text widgets inside of it

hidden thorn
#

Hello guys, I just started doing multiplayer (For my uni project) and I wanted to replicated the animation of the characters over the network. It works for the server but no for the client.

#

// .h File

public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = Movement)
float MovingLeftRight;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = Movement)
float MovingForwBack;

UPROPERTY(VisibleAnywhere, Replicated, Category = Movement)
bool isRunning;

UPROPERTY(VisibleAnywhere, Replicated, Category = Movement)
bool isJogging;

protected:
/** Marks the properties we wish to replicate */
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

// .cpp file

//This is just one method to show you how I update the value
void ARPGProjectCharacter::MoveRight(float Value)
{
    if (Value != 0.0f)
    {
        // add movement in that direction
        AddMovementInput(GetActorRightVector(), Value);
    }

    MovingLeftRight = Value;
}

void ARPGProjectCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    //Tell the engine to call the OnRep_Health and OnRep_BombCount each time
    //a variable changes

    DOREPLIFETIME(ARPGProjectCharacter, MovingForwBack);
    DOREPLIFETIME(ARPGProjectCharacter, MovingLeftRight);
    DOREPLIFETIME(ARPGProjectCharacter, isJogging);
    DOREPLIFETIME(ARPGProjectCharacter, isRunning);
}
#

Any ideas why that is?

#

in SP and on the server the animations work fine and the clients can see the servers animation but the values don't updated on the client.

thin stratus
#

Where are you setting the values

#

And is the character replicated?

hidden thorn
#

For example in MoveRight I have -> MovingLeftRight = Value;

#

That is a value that is being replicated

#

Also I am using the First Person Template so I think the character is being replicated.

thin stratus
#

Input is processed locally

#

You need to do a serverRPC

hidden thorn
#

Oh ok

#

Is that by using UFUNCTION(Client) -> called on the server, but executed on the client,

#

I think its the other one, called on the client but executed on the server

thin stratus
#

Yop

#

Client->Server

#

And only if you are on a client

hidden thorn
#

Also by this "And only if you are on a client" you mean check for ROLE_Authority?

thin stratus
#

Yop

hidden thorn
#

So would it be like this?

#

// .h File

protected:
    UFUNCTION(Server, Reliable, WithValidation)
    void Walk(float value);
    void Walk_Implementation(float value);
    bool Walk_Validate(float value);

// .cpp file

void ARPGProjectCharacter::Walking(float Value)
{
    if (Value != 0.0f)
    {
        // add movement in that direction
        if (isJogging == false && isRunning == false)
        {
            if(Role == ROLE_Authority)
                Walk(Value);

            if (charMovement != nullptr)
                charMovement->MaxWalkSpeed = 120;

            MovementState = EMovementState::MV_WALK;
        }

        AddMovementInput(GetActorForwardVector(), Value);
    }
    else
    {
        if (Role == ROLE_Authority)
            Walk(0);
    }
}

void ARPGProjectCharacter::Walk_Implementation(float value)
{
    MovingForwBack = value;
}

bool ARPGProjectCharacter::Walk_Validate(float value)
{
    return true;
}
sterile pebble
#

anyone run into issue with OnRep with dedicated server setup? It looks like for some reason they dont work when I enable dedicated server, but works fine if I'm playing from listen server...

#

and yes, I'm checking it from client view πŸ˜ƒ

hidden thorn
#

Cause is says there I don't need to declare the _Implementation and _Validate methods yet in my project I get an error.

#

I am using 4.18.1

sterile pebble
#

yep, this is valid

#

what are the errors?

hidden thorn
#

Let me check again

#

Says that <ProjectName> has no member of "Walk_Validate"

#

same for _Implementation

elder sable
#

what s the difference between bOnlyRelevantToOwner (in actor) and COND_OwnerOnly (in GetLifetimeReplicatedProps) ?

rare cloud
#

Relevancy depend of the distance between an actor and the player (owner) but you can set it to only relevant for some case, COND_OwnerOnly mean if the actor is relevant to you and you are the owner replicate this property to you @elder sable

elder sable
#

isn t bOnlyRelevantToOwner the same ?

rare cloud
#

no

#

Relevancy depend of your distance view with this actor in the world

#

COND_OwnerOnly will be true if you are relevant to this actor and you are the owner

brittle sinew
#

@hidden thorn could you show your header, your attempted implementation, and the errors thrown? The implementations must have the exact signature needed; you don't have any wiggle room

#

AFAIK, that information is still valid.

rare cloud
#

if you set bOnlyRelevantToOwner to true and you have a property with COND_OwnerOnly, even if you are really far of this actor the property will be replicated

#

@elder sable

hidden thorn
#

@brittle sinew I managed to get it to work, but VS still kept saying it's an error

elder sable
#

ah ok thx @rare cloud

#

i don't understand ReplicatedUsing. when is called the function abd by who ?

rare cloud
#

the engine do it for you using the UHT (Unreal Header Tool) generate some magic code on generted.h and link the passed function to the network stuff

#

I don't know exactly how it work, simply the general idea

elder sable
#

in examples, they call the function

#

so i dont understand what s the point using it

rare cloud
#

oh ok

#

if you change weapon for example, you have a WeaponID

#

you declare your RepNotify

#

and it's fired when the player change weapon you can spawn fx or whatever

elder sable
#

it's called client side ?

rare cloud
#

yup

#

it can be call server side if you call it explicitely

#

also IIRC you can add a parameter to your RepNotify function to get the previous value

#

if you need to make some check or diff

elder sable
#

and if not, it's called client side when the value change ?

rare cloud
#

yeah and only if the value is different than the previous

#

you can declare a COND_REPNOTIFY

elder sable
#

ahhh ok, maybe that s why i didn t see anything

rare cloud
#

or something like this to force to always be call

#
DOREPLIFETIME_CONDITION_NOTIFY(UMyObject, MyObject, COND_None, REPNOTIFY_Always);
#

inside the GetLifetimeReplicatedProps

elder sable
#

mhh my function is called server side only

#

I tried this

void server_connected()
    {
        if (!IsRunningDedicatedServer()) return;
        connected = true;
        on_connect();
    }

    UFUNCTION()
    void on_connect()
    {
        UE_LOG(LogTemp, Warning, TEXT("on_connect "));
    }

    UPROPERTY(ReplicatedUsing = on_connect)
    bool connected = false;
#

ah it works

#

thanks πŸ˜ƒ

rare cloud
#

np

tacit hazel
#

im changing the static mesh of an actor in a server rpc, and the actor is replicated, but the clients do not see the new static mesh

cursive oasis
#

Yo, I'm using blueprints to start a server with "open mapname?listen"

it works in the editor but does nothing in the packaged game. what am I doing wrong?

#

do I have to, like, include the level in the package, somehow?

tacit hazel
#

yes

#

make sure the map is in the package

#

there is an option for additional items to include in the project settings

#

just search for "packaging"

cursive oasis
#

will do, thanks!

tacit hazel
#

no problem

tacit hazel
#

argh... this still isn't replicating

tacit hazel
#

ok so is there a way to make sure that something is replicating

#

because I have a Static Mesh the refuses to replicate and it makes me question if evn the parent is replicating

stark dome
#

Is the actor set to replicate @tacit hazel

twin juniper
#

how can i use open level so all players in session open that map and still remain in session

#

when i try open level normally from authority client quits session

#

and when i try multicasting it same

fossil spoke
#

@twin juniper Is your GameMode set to Seamless Travel?

#

Call UWorld->ServerTravel() ?

twin juniper
#

I don't use cpp

#

I use blueprints

cursive oasis
#

Yo, quick question

#

Let's say I wish to implement teams for my multiplayer game.

#

Should I implement that in the Controller for each player?

#

I know I shouldn't code teams in the pawns because they can get destroyed and I can't use the gamemode either because that only exists in the server

heady scroll
#

Hey, uh, I'm running into some replication problems with this actor I need accurately on both sides. BUttery smooth on the host, really jittery movement on the client. Any ways of getting around that?

thin stratus
#

You changing MovementSpeed and didn't do that on everyone?

#

Cause that doesn't replicate

#

@cursive oasis I have Teams in 3 places

#

PlayerController, as the main, persistent class, that the Server can push the team on and use for spawning etc.
PlayerCharacter, for several graphic things, like team color, text, maybe even gameplay related things, like hitting and enemy or overlapping something
PlayerState, for other clients to see and display the player information relative to the team, scoreboard for example

cursive oasis
#

That makes sense.

thin stratus
#

PlayerController and PlayerState are set when the Player joins.
Only on the Server and set to Replicate

#

PlayerState could have RepNotify depending on your use

#

PlayerCharacter gets it in the "Possessed" event

#

It is server only, gets called when the PlayerController possess the character and passes teh controller

#

Easy way to grab the team FROM the controller and set it on the Character

heady scroll
#

Was the movementspeed thing at me?

thin stratus
#

Character's team is RepNotify

#

@Mr4Goosey#8437 Yes

heady scroll
#

Well, I'm not using a character or anything like that, so no

thin stratus
#

Physics?

cursive oasis
#

So, if I wish to make a widget to pick the teams, i take it should go in the playercontroller in order to assign the PlayerController's team and pass it along to other classes, right?

thin stratus
#

Basically, yes

cursive oasis
#

Okay, that makes sense.

#

I'm still learning how UE's architecture works

thin stratus
#

Widget -> ServerRPC on PlayerController -> SetTeam (-> SetTeam on PlayerState too)

heady scroll
#

My own pathfinding stuff. The main thing is that I'm just crap at networking. I need the host to have complete authority, and for the meshes to just be visible on the client

#

That's really about it

thin stratus
#

Hm, is replicate movement ticked then? Or what exactly are you modifying there?

#

Are you just setting location ?

heady scroll
#

I'm just setting location every frame

thin stratus
#

Is the Actor set to replicate movement then?

#

It sounds like the Client is fighting the movement replication

#

You also might want to, instead of Setting movement, maybe replicating a Location Vector

#

And letting the Cient Interp from old to new location

#

Makes it smoother

heady scroll
#

Well, I'm pretty sure that I'm just missing Replication 101

thin stratus
#

Hard to tell atm

heady scroll
#

What I'm currently doing is having the actor be spawned on the client, and just not running any logic

#

(Before all the logic I threw in an "if server" thing)

cursive oasis
#

BTW, what's the difference between PlayerController and PlayerState? aren't they the same thing?

#

an invisible abstraction of the player itself, disconnected from the pawn that it is currently possessing?

#

oh my god my internet is dying on me.

thin stratus
#

@Mr4Goosey#8437 Spawning the actor on the client?

#

Replicated Actors should be spawned on the Server

heady scroll
#

Right, no, I'm being an idiot

#

Poor wording, not used to this

#

I'm spawning it on the host, and then I'm replicating it

#

But since I don't know crap about replication, I don't know what that specifically means, which probably means it's doing lots of things I don't know about

thin stratus
#

@cursive oasis No, PlayerController is the actual "Player" if you want to say so.
A PlayerController is only known to the Local Client and the Server.
A local client CAN'T access other players PlayerControllers (Only the server has all of them).

heady scroll
thin stratus
#

Furthermore, the PlayerController is used to control the Pawns and process Input @cursive oasis

cursive oasis
#

Ah, I think I get it now

thin stratus
#

The PlayerState is just what its name says, the state of the player

cursive oasis
#

State would have shit like Score

#

K/D

thin stratus
#

It's replicated to all users and can be retrieved from the PlayerArray in the GameState (For everyone)

cursive oasis
#

things that other players might want to see

heady scroll
#

It's like the client thing is conflicting with the host, but I don't get what the client would be doing to cause conflicts

thin stratus
#

Or from PlayerCharacter (if Possessed), PlayerController on Local Player and Server @cursive oasis

cursive oasis
#

Now it makes sense!

thin stratus
#

@Mr4Goosey#8437 OwnerRelevancy, why?

cursive oasis
#

Thanks for the explanation, Cedric. It has helped me understand how UE handles things.

heady scroll
#

Because I was playing with settings and wondered what it did

#

x3

thin stratus
#

@cursive oasis Might want to read my compendium

#

Cause I'm basically repeating what I already wrote down

cursive oasis
#

oh, really?

heady scroll
#

Isn't it lovely to help noobs~

cursive oasis
#

Shit, i'd love to have a manual about this stuff!

thin stratus
#

That's what I do for the past 3 years. ANd it's beginners, not noobs

#

Noobs are the guys failing in CS for the past 12 years

cursive oasis
#

lol

#

word.

thin stratus
#

Check the channels pinned messages

heady scroll
#

Guess you're already a step ahead if you're failing out of CS?

thin stratus
#

Yeah, divine noob upgrade

heady scroll
#

I'll go read that as well, when I have time

cursive oasis
#

omg a 100 page pdf about multiplayer.

thin stratus
#

It doesn't tackle that kind of issue though @Mr4Goosey#8437 but maybe it's something fundamental

cursive oasis
#

ohhhh shit this is like a god damn multiplayer bible. i love you already.

heady scroll
#

What I've got at this point is an actor that jumps around every .1 seconds or so, instead of smoothly moving

cursive oasis
#

i just wish my crappy internet connection would let me download this.

thin stratus
#

:P another believer born

heady scroll
#

Which is, I think, different from what I had before

#

What does the owner relevancy stuff actually do?

thin stratus
#

It basically lets the owner decide if the actor is relevant or not

heady scroll
#

Yeah, so it seems like the client isn't conflicting anymore, it's just being really slow

#

So then that interpolation you talked about would probably be useful, but, ya know... πŸ˜›

#

Don't know where to start with that

thin stratus
#
bool AActor::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
    if (bAlwaysRelevant || IsOwnedBy(ViewTarget) || IsOwnedBy(RealViewer) || this == ViewTarget || ViewTarget == Instigator)
    {
        return true;
    }
    else if ( bNetUseOwnerRelevancy && Owner)
    {
        return Owner->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
    }
    else if ( bOnlyRelevantToOwner )
    {
        return false;
    }
    else if ( RootComponent && RootComponent->GetAttachParent() && RootComponent->GetAttachParent()->GetOwner() && (Cast<USkeletalMeshComponent>(RootComponent->GetAttachParent()) || (RootComponent->GetAttachParent()->GetOwner() == Owner)) )
    {
        return RootComponent->GetAttachParent()->GetOwner()->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
    }
    else if( bHidden && (!RootComponent || !RootComponent->IsCollisionEnabled()) )
    {
        return false;
    }

    if (!RootComponent)
    {
        UE_LOG(LogNet, Warning, TEXT("Actor %s / %s has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)"), *GetClass()->GetName(), *GetName() );
        return false;
    }

    return !GetDefault<AGameNetworkManager>()->bUseDistanceBasedRelevancy ||
            IsWithinNetRelevancyDistance(SrcLocation);
}
#

NetRelevant means "Should this be replicated for the viewer?"

cursive oasis
#

oh my god ue4 has built in client side prediction for the base character.

heady scroll
#

Is that possible in BP or is it one of those lovely CPP only things?

thin stratus
#

The stuff I posted?

heady scroll
#

Yeah

thin stratus
#

You can only override that in C++.
However I simply wanted to show you what the booleans do

heady scroll
#

Ah

thin stratus
#
 else if ( bNetUseOwnerRelevancy && Owner)
    {
        return Owner->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
    }
#

That's the one in questions

#

It lets the owner decide

heady scroll
#

Yup, I see

cursive oasis
#

BTW Cedric, quick question: is it possible to make a simple multiplayer football game with blueprints alone or am I going to run into some kind of issue?

thin stratus
#

You can do a lot in BP alone

#

However there are things you will run into at some point that might need c++

heady scroll
#

I've done custom pathfinding in BP alone, so I'm pretty sure you can

thin stratus
#

or plugins

#

Specially if you start using Subsystems like steam

cursive oasis
#

I see

heady scroll
#

THings can be easier with C++ at times, and yeah, stuff like steam... πŸ˜›

#

But most, if not all, of the gameplay stuff can be done in BP

cursive oasis
#

I guess I'll just make my game with BPs and worry about C++ later on when I actually need it

heady scroll
#

That's also my mindset with it x3

cursive oasis
#

awesome.

thin stratus
#

Only thing I would advice you to is learning how to make structs in c++

#

Simply header file and putting your structs in there

#

Had too many projects break from corrupted BP structs

heady scroll
#

What's wrong with the BP struct syste-

#

Kinda expected that answer

#

x

#

x3*

cursive oasis
#

that's

#

scary.

thin stratus
#

Certainly is if you have an RPG or so that has tons of them

#

Layered

#

ANd they break

cursive oasis
#

ouch.

thin stratus
#

You have to recreate them all and swap them by hand

#

Not gonna touch BP structs anymore

heady scroll
#

;-;

thin stratus
#

It's way too easy to just havea simple header file with them

#

Even beginners can copy paste the wiki code

heady scroll
#

Anyway, I'm off. I'd really appreciate it if someone could explain how I can get the server data to be interpolated on the client ❀

#

(Will read chatlog when I can)

cursive oasis
#

later!

worn nymph
#

@thin stratus what you make one header that contains all your structs ?

#

Or you include each structure as needed in the individual classes?

cursive oasis
#

yo, quick question

#

From the game state, I can get an array with all of the player states.

#

how do I, the server, know I'm getting the right player state for a specific playercontroller?

#

oh wait, PlayerController has a PlayerState node.

#

lol

thin stratus
#

@worn nymph structs that are used in all classes are in a special header. And for simple blueprint exposure it's also enough to put them into a header

cursive oasis
#

so far, so good! PlayerController and PlayerState both have the team set accordingly, replicated too

#

now, do I spawn the pawn in the GameMode or in the PlayerController (as the server)?

thin stratus
#

Usually gamemode

cursive oasis
#

does it matter where I spawn it, as long as I do it as the server?

thin stratus
#

No

cursive oasis
#

Aight. I'll do it on the gamemode because it makes more sense

thin stratus
#

But game mode has OnPostLogin

cursive oasis
#

OnPostLogin? But my game doesn't use any sort of... login

thin stratus
#

Which calls for each connecting client

#

It doea

cursive oasis
#

it does? :0

thin stratus
#

It's ue4 native

cursive oasis
#

oooh.

thin stratus
#

Not with password etc

cursive oasis
#

I see.

thin stratus
#

More like a network login

#

Can also call it OnPostJoin if you want

#

In cpp you can use prelogin and login to deny the player

cursive oasis
#

Yeah, but I need my players to pick their teams first through my widget

thin stratus
#

For xy reasons

cursive oasis
#

so I can't spawn the pawns there

thin stratus
#

Fair enough

cursive oasis
#

But that may come in handy

thin stratus
#

Then just a simple event that spawns depend ing on team

#

And widget - > server rpc on playercontroller and then getting gamemode and respawning

cursive oasis
#

yep!

thin stratus
#

(it's basically respawning)

cursive oasis
#

wait, respawning?

#

i mean

#

oh wait nvm i think i got it

#

Let's see

#

Okay, it works. Now I need to set spawnpoints for each team, how do I grab a reference to objects in my level through my gamemode?

#

am I supposed to make a separate blueprint responsible for the spawnpoints and get a static reference to that instead?

thin stratus
#

For example

#

Here it's totally fine to just use GetAllActors once

#

To gether your spawnpoints

#

And then looping over the array, filtering by team

cursive oasis
#

hmmm, but isn't that bad?

thin stratus
#

Yes and no. You only do it once on begin play of the gamemode

#

Doesn't hurt that much

#

You could also have them get rhe gamemode on beginplay and add themselves to an array

#

(the spawnpoints beginplay)

cursive oasis
#

I see. That will do the trick, but what if I want to grab a reference to my designated spawnpoints anyway, without having to iterate through all actors currently in the level?

#

is there an easier way that doesn't involve creating a separate blueprint for that?

#

i'm curious

thin stratus
#

Making sure you filter the beginplay with a switch

#

As said, spawnpoints themselves can register themselves on beginplay at the gamemode

#

That's one way

#

You need your own spawnpoint class anyway cause of teams

cursive oasis
#

oooh, of course!

thin stratus
#

Switch HasAuthority on beginplay though

#

So clients don't call that

#

Brb ooo

cursive oasis
#

lmao sleep deprivation is messing my head up. I could just make simple actors for spawnpoints and have them inform the gamemode that they exist

#

thanks! that cleared things up

worn nymph
#

@thin stratus ah thought so and can you forward declare structs?

cursive oasis
#

is there any shortcut to quickly open a blueprint class?

thin stratus
#

@worn nymph Nope you can't

#

That's the main reason why I put the structs that are used a lot in different classes in a simple header file

#

Isntead of putting them into a class head of some other class

#

Cause I don't want to include a class header into some other class header

#

@cursive oasis ?

cursive oasis
#

Let's say I want to quickly open another blueprint

#

is there a shortcut to quickly search for another blueprint?

thin stratus
#

WEll the content browser has a searchbar

cursive oasis
#

BTW, is the Possessed Event called on all machines or only on the server & owning client?

thin stratus
#

Only on Server

#

Not even owning client

cursive oasis
#

mmk. so if I want to change my pawn's color according to its playercontroller's team, i'm going to need to add a replicated var to the pawn (int TeamIndex) and feed that value from the server, right after spawning the pawn.

is that correct?

#

I was thinking about getting the value straight from the pawn's playerstate, without having to add another var

thin stratus
#

Variable in Pawn is better

#

You can't be sure if the Variable in teh PlayerState is already replicated

cursive oasis
#

makes sense

thin stratus
#
  • you can make the variable in the pawn OnRep
#

Which gives you a function that calls if the value is replicated

cursive oasis
#

so that it calls a method whenever it rep-

thin stratus
#

(In BP that calls on Server too)

cursive oasis
#

awesome. i think im getting the hang of this!

#

huh, I can't seem to drag my var's OnRep node to the blueprint graph.

#

says here that this function was not marked as blueprint callable.

thin stratus
#

OnRep aren't callable

#

Just double click it

cursive oasis
#

oh lol.

indigo nacelle
#

The errors in the above pic happen only once

thin stratus
#

Did you package your project and put the server exe into the binaries folder?

indigo nacelle
#

Yes

thin stratus
#

Did you make sure that your Lobby Map is properly packaged?

indigo nacelle
#

How do I make sure of that?

thin stratus
#

Adding it to the maps taht should be packed in the project settings

#

For example

indigo nacelle
#

I had no maps added to be packed for that build. I am atm making another build, with the used maps added

thin stratus
#

It also seems like you are traveling to the lobby map?

#

Even though you are already on that map

indigo nacelle
#

Maybe that is it?

thin stratus
#

That shouldn't be there

#

The Server starts on the map you specify in the Maps and Nodes settings or via command line argument

indigo nacelle
#

I am sure I set the server to start on that map in the Maps and Nodes

#

Atm trying to verify

#

The Level BP beginPlay node is set to "Open Level" on my real internet IP. There is no map name set as "Level Name", it is my IP

#

What would the intended use of that function be by the tutorial guy? He simply said "put it there"

thin stratus
#

I have 0 idea

worn nymph
#

@indigo nacelle I wrote the guide

thin stratus
#

it would connect to the IP

worn nymph
#

The first error is a engine bug you need to go into settings and turn off event loading

thin stratus
#

I assume it's not for the lobby map but for the mainmenu

indigo nacelle
#

Ok I will turn it off to see if it works, building my project takes quite a long time though so I will not see results within the hour :/

worn nymph
#

Also you need to add your maps to the packaged maps array in the packaging settings

#

And finally the begin play open level was because in the setup I was using was for a lobby and traveling to a map.

So you start out in the lobby map then it loads and calls begin play to travel to the server map

indigo nacelle
#

Ah, I see.
So if I want to connect to the server, I use the "openLevel" function?
Like I could go:
Main Menu -> press join game -> Calls Open Level (myIP) -> and then I am connected to the server, and am on the servers map?

worn nymph
#

Yes if you use local ip it would be as if you were on a lan match if you use real ip it will be live over Internet but you will have to forward ports and most likely setup a static ip address or external networks won't be able to connect

indigo nacelle
#

Hmm... I am using the Steam subsystem though, is it compatible with this method? πŸ˜ƒ

worn nymph
#

Nope did you not read he very first line of text on the disclaimer lol

#

Not for steam right at the top lol

indigo nacelle
#

Oh shit no I did not notice xD

#

Is that a whole another can of worms? xD

worn nymph
#

Yeah

#

Steam with listen servers is OK. Steam with dedicated servers is hard work . Best scenario right now is to use u works plugin or advanced sessions plugin

indigo nacelle
#

I will check it out, but since I have come this far I might as well get one of these non-steam servers working ^^

#

Thank you immensely @worn nymph for writing your tutorial and this advice! It was very easy to read as you understand that good pictures tell more than words. Also thank you @thin stratus for the bullet-fast responses πŸ˜ƒ

worn nymph
#

No worries . I wrote it months ago and had planned to expand on it more and tidy it up but I got sidetracked into other things lol.

If you need any more help feel free to pm me . If you can't get it working I can always upload a working version for you to play around with

indigo nacelle
#

I really appreciate it!

heady scroll
#

No ideas on smoothing out my actor movement? 3:

tacit hazel
elder sable
#

what do i need to spawn an actor from server on all clients ? my actor has bReplicates = true; and i spawn it in game mode but can't see anything client side

thin stratus
#

That should be all

#

@tacit hazel Meshes aren't replicated

#

If you want them to change on all players, you have to RPC or RepNotify

elder sable
#

so just with GetWorld()->SpawnActor<Astation>(FVector(100, 100, 100)); it should spawn on clients ?

tacit hazel
#

I need to make a NetMulticast RPC? @thin stratus

chrome bay
#

Why wouldn't you just make a Blueprint of 'AItem' and spawn that instead?

#

@elder sable If the actor is replicated, then yeah, clients will spawn their local copy too

elder sable
#

mhh

stark dome
#

is it better to destroy a dormant actor or set a flag on it indicating that its destroyed

#

it seems like destroying the actor notifies all connected clients of the destruction even though it's not relevant to them

thin stratus
#

It notifies them as it gets removed on them too

tacit hazel
#

I idd make a blueprint of it and spawn it

thin stratus
#

If you don't do it every frame, you can easily just destroy them

tacit hazel
#

I just had to chagne the static mesh

thin stratus
#

otherwise do pooling ,yes

tacit hazel
#

but I had to spawn a default Item because it just wasn't spawning at all when I tried to dynamically load the correct Item

#

I tried to just LoadObject and then spawn it for the correct Item, but now I have a subclass of AItem in my .h thats just a defuault Item and thne I setup its propertys like the static mesh

#

@stark dome

#

ok im gonna try to do what my original plan was and load in the blueprint of the Item that needs to spawn, but I cant even get it to compile

tacit hazel
#

How would I go about getting the blueprint in code? I can staticLoad it, but I don't know what type it is, so how do I store it?

elder sable
#

when we replicate an actor, data are sent on network just when server spawn it ?

next falcon
#

Guys u know how to save The Data of a player on server ?
like health so i can leave and join with the same amount ?

thin stratus
#

You technically can't

#

At least not in the basic version of UE4

#

It would need you to either have a persistent, unique ID

#

Like SteamID

#

or a Database in the background

#

The other way would be betting on the "OnOverideWith" and "OnCopyProperties" or what ever the playerState functions are called

#

That are responsible for players reconnecting

#

However that's more for someone having a short disconnect

next falcon
#

and if i have the steam id ?

stark dome
#

does anyone know how fortnite deals with replicating destruction of a wall on a house

#

i assume that the wall is an actor with its dormancy set to DORM_Initial and an hp value that's replicated

#

i'm curious as to whether or not they actually destroy the actor when its hp reaches 0 or if they just destroy it on relevant clients

#

destroying the actor on the server seems to destroy it everywhere regardless of relevancy

next falcon
#

@thin stratus i tried nearly Everything with the SteamID How would u do it ?

thin stratus
#

When the Player Disconnects, you get his SteamID his Health and save it in a TMap or Struct Array (depending on your engine version)

#

When he reconnects you check array or tmap for the steamID and set their health with that

next falcon
#

And if the server goes offline like for a restart ?

stark dome
#

you would need some sort of database to store that info in that case

thin stratus
#

Yeah if it goes offline you need to save it in a database

#

SQL stuff

next falcon
#

can i create one in the project or do i need to create on something else?

thin stratus
#

That's outside UE4

#

Has technically nothing to do with UE4

#

There are probably tons of tutorials on how to do that

#

And probably free plugins to communicate with the database

next falcon
#

okay thanks ill try that
if i create A struct for that can i just save the struct ?

#

in the database ?

cursive oasis
#

yo, where's the best place to hook my HUD widget to?

#

the Pawn? the Player Controller?

#

better yet, is there a client-side callback in the player controller for when I possess a pawn?

#

something like "yo, here's your brand new pawn. go nuts."

next falcon
#

In my Project my multiplayer works fine but if i package it in shipping the map won't load if i create a session..

#

what could it be ?

muted sigil
#

Is there any way, with BP, to have different spawn points for each player?

#

No 2 players should spawn at the same point, but other than that, the specific spawn point isn't too important.

grizzled quartz
#

@muted sigil maybe if you add a collision for that spawn point, and if anyone is overlapping it then set boolean "is taken" so other players would only use the free slots

#

on end overlap the spawn point becomes "free"

muted sigil
#

I see, I'll try that, thanks

thin stratus
#

@muted sigil just set a boolean on the spawn point if it's taken

#

And check that when spawning

#

@cursive oasis no, but a simple client rpc on possessed would do it

hidden thorn
#

Any reason why the MovingForwBack is not set inside Jogging but it is inside Walking?

#
void ARPGProjectCharacter::Walking(float Value)
{
    if (Value != 0.0f)
    {
        if (isJogging == false && isRunning == false)
            Walk(Value);
    }
    else
        Walk(0);
}

void ARPGProjectCharacter::Walk_Implementation(float Value)
{
    MovingForwBack = Value;
}

bool ARPGProjectCharacter::Walk_Validate(float Value)
{
    return true;
}

void ARPGProjectCharacter::Jogging()
{
    if (MovingForwBack != -1)
    {
        Jog(!isJogging);

        if (isJogging)
            Walk(2);
        else
            Walk(1);
    }
}
#

I added some DebugMessages and it seems like the value should change but it doesn't for some reason.

#

isJogging is set to true (I double checked) so the Walk inside Walking shouldn't be called.

stark dome
#

On the server or client

#

@hidden thorn

hidden thorn
#

Well the value doesn't change on the server or I think it does but it goes back to 1 in an instant

#

Could it be this

#
    PlayerInputComponent->BindAction("Jogging", EInputEvent::IE_Pressed, this, &ARPGProjectCharacter::Jogging);

    PlayerInputComponent->BindAction("Running", EInputEvent::IE_Pressed, this, &ARPGProjectCharacter::Running);
    PlayerInputComponent->BindAction("Running", EInputEvent::IE_Released, this, &ARPGProjectCharacter::Running);

    // Bind movement events
    PlayerInputComponent->BindAxis("Walking", this, &ARPGProjectCharacter::Walking);
cursive oasis
#

Yo, quick question

#

is it possible to replicate a ragdoll?

hidden thorn
#

From what I know it is, not 100% sure

#

"Going along with the previous tip, don't replicate objects that don't need to be. Explosions, sounds, ragdolls, and particle effects don't need to be marked as replicated"

cursive oasis
#

I understand, however replicating a ragdoll is somewhat important in my game. The pawn can be knocked down (ragdolled) and the player's movement component must move to the pawn's position

hidden thorn
#

Well based on what they are saying is that you can replicate it but they suggest not to

cursive oasis
#

Actually, I got a better idea

#

is there a way to "drag" my ragdoll by a bone?

#

can I do something like

pseudocode
Ragdoll.GrabBone(Pelvis).SetPosition(myNewPosition);

?

#

Maybe there's a way to setup a physics constraint with bones/sockets?

hidden thorn
#

I am quiet new to UE4 so not sure

#

I never used ragdolls sorry

cursive oasis
#

No prob.

regal hazel
#

@cursive oasis did this for a game last year that heavily revolved around ragdolls. As were using CMC, from memory, I basically swapped the root capsule for the mesh during a ragdoll and swapped it back after the ragdoll had finished (was a little bit more complicated then that, but thats the gist of it).

Benefit was it used CMC prediction and replays but we still had physics based ragdolls.

cursive oasis
#

huh

#

but is that going to replicate properly?

regal hazel
#

yep, did for us anyway

tacit hazel
#

uhm help, one of my .cpp's wont open now

#

even when I ricght clcik open with vs2015, it opens in notepad as blank

#

idk what happened

#

hmm.. well I guess good thing I have a backup

thin stratus
#

When you start reading and the user removes his post

#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

indigo nacelle
#

Oh sorry xD I just found that I might be able to find the solution myself

#

Apparently it is pretty much a must to use an external hosting service to get your public IP address

thin stratus
#

Yus

#

I did that few months ago

#

And ran into the same

indigo nacelle
#

Your computer itself does not know anything about it. And since Epic does not have a hosting service, they do not have functions to get your IP

thin stratus
#

HTTP Request to some outside host to get the IP

#

Well you could technically host your own little script somewhere

#

if you are afraid the one you contact gets shutdown someday

indigo nacelle
#

It is a http request

#

I am intrigued by your "little script somewhere" idΓ©a

#

What would that entail? Me hosting a website?

thin stratus
#

It's the same idea

#

HTTP Request to your Server

#

Just that you are not relying on some other host

#

And that Server replies with the IP

past bear
#

Had to spawn my player starts at run time, because child actor components cause all manner of horrible problems due to being buggy as feck

#

New problem: Actor begin play is happening on the client after the character is spawned

#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

#

Fundamental problem with UE4's login logic, I think

#

actor replicated properties for actors that already exist in the game world should be replicated before the client is allowed to spawn their character

#

this is important, because replicated properties could be critically important with regard to the game state

#

but because the character / pawn is spawned before the world state has been replicated anything could happen

dusty sleet
#

Anyone ever seen this error? Getting it in 4.18 everytime I try and test in editor with two players (in VR) single process.
Crashes EVERY time the possess runs. Works just fine in 4.17

Assertion failed: Component != nullptr [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\HeadMountedDisplay\Private\LateUpdateManager.cpp] [Line: 75]

thin stratus
#

@past bear To be fair, you have full control over when and how you spawn the pawn of your Character

#

@dusty sleet That's just the generic report of an assert failed. We would need the call stack

past bear
#

if the game is in progress, the player is just spawned in immediately

#

gonna have to prod someone on the native side to possibly make changes to that - I don't have control over it

#

'cos the problem is that the spawn point is chosen during the login process - before the client has recieved the replicated events for the actual spawn points

dusty sleet
thin stratus
#

It's trying to get a Component for LateUpdatePrimitives

#

Or you doing anything special with your VR components?

dusty sleet
#

not really anything special yet. its a fresh BP project. was testing some stuff before deciding whether to switch to 4.18. i just made a basic character with two motion controllers and camera with the "hmd lock to" checked.

desert dagger
#

I am spawning an actor on server
It's breplicated is set to true
Still I cant see it in editor
Any idea why this thing happening?

thin stratus
#

Can be a lot of reasons

#

I once had it because someone was calling an RPC on Tick and marked it reliable

#

Which caused the Spawn event never to reach the client

next falcon
#

When i join my session my secound player spawn in spectator or something like that how can i fix that ?

past bear
#

@thin stratus - do you know if the client or server is authorative with respect to spawning a pawn?

#

it seems to me like the client is responsible for spawning the pawn

thin stratus
#

Always the Server

#

Server has to spawn Replicated Actors and Possess is also a Server-only function

past bear
#

that's what I'd expect

next falcon
#

How do i spawn a Actor in multiplayer? like all others can see it too ?

thin stratus
#

Mark as replicated, spawn from Server

#

that's all

next falcon
#

doesn't work

#

do i have to set owner when i spawn it ?

wise depot
#

Hey guys, so i have a really strange bug going on. During game play when a player finishes we spawn an AI controller to possess the player's pawn and take over control, now, the host sets the pawn's role's correctly, everyone else see's the role change correctly except the local player who was controlling the pawn previously, their role seems to stay stuck on Role_Autonomous and as a result doesn't recieve updates correctly that are behind role checks.

The stranger thing is that I can't actually find in the engine where clients would even handle switching role & remote role around if they get changed during runtime since they're just replicated values from the host that don't have an OnRep function

#

anyone else had anything similar to this or have any suggestions on places to start looking?

#

the only places i can see where it calls ExchangeNetRoles for clients is on PostLoad

#

Sorry, PostSpawnInitialize

#

and this only happens in shipping builds too

thin stratus
#

@next falcon No, you just have to Spawn it. Setting owner is another story

next falcon
#

but if i do that my client can't see it..

thin stratus
#

Maybe you spawn it at the wrong place?

#

Do you have any RPCs on tick?

wise depot
#

it has to be marked as replicated during its construction

thin stratus
#

@wise depot Hard to tell what the issue is

#

You simply call posses with the AI on the Pawn?

wise depot
#

yes, but we override the Posses function on the controller as the default AI controller doesn't call OnPossessed on the pawn which is what sets its role

next falcon
#

no i guess not.. do i need it?

wise depot
#

before we did that no clients got told the role changed, once we implemented that they all get told the role changes, and this works just fine playing from the editor in standalone too, however as soon as we use a shipping build it never seems to update the role for the local client but works fine as intended for everybody else connected, the host lets the AI take over, everyone else sees the AI doing its job except for the player who was previously controlling that pawn

#

at this point i'm starting to think this may just be an issue with UE4.14, as its really odd that the ai controller itself doesn't call the functions to update the pawn's role on possesed

#

player controller does but the base AIController class doesn't, atleast not until we overrode it

#

at this point i'm almost tempted to just put in a really hacky fix along the lines of
if(Pawn->Controller == nullptr && Role = Role_AutonomousProxy) Role = Role_SimulatedProxy;

#

because the controller does become a null reference on the pawn, as you would expect

#

also, @next falcon if an actor isn't marked to be replicated then it won't be replicated to all connected clients when it is spawned at runtime

next falcon
#

and if it replicated but still doesn't spawn for all ?

wise depot
#

and if you have a lot of things you need to set up BEFORE sending the new actor to all clients then look into deferred spawning (i can't remember the function name)

#

then i'm not sure, we use deferred spawning for pretty much all of our runtime spawnables, and they all work as intended over a network game

next falcon
#

wait i need to set it to replicated before i spawn that actor ?

wise depot
#

the actor should jsut be set to replicate in its blueprint really, or on its construct

hidden thorn
#

Any reason why both DebugMessages are being displayed on the client but MovingForwBack isn't being changed.

#
void ARPGProjectCharacter::Walking(float Value)
{
    if (HasAuthority())
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, TEXT("All Good"));
        Walk(1);
    }
}

void ARPGProjectCharacter::Walk_Implementation(float Value)
{
    GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, TEXT("WALK"));
    MovingForwBack = Value;
}
#

It works just fine if I remove HasAuthority()

#

I tried it with the server and 2 clients and everything looked ok.

brittle sinew
#

Is Walk a server RPC?

#

And is MovingForwBack replicated?

#

@hidden thorn

hidden thorn
#

Yes to both

#

Like if I take out HasAuthority it works just fine.

brittle sinew
#

How are you handling your pawn spawning?

#

Are you doing it manually?

hidden thorn
#

No I just click play and ue spawns it for me

#

But isn't HasAuthority used to check if we are the server?

#

Or is it used to check if we own the object/pawn?

grand kestrel
#

IsLocallyControlled() checks if it owns the object/pawn, Role == ROLE_Authority checks if it's server, it's a bit odd to handle movement via RPCs, thats what AddMovementInput is for, movement doesn't work well if replicated, it needs to be predicted, AddMovementInput modifies Acceleration which is predicted out of the box

#

@hidden thorn

#

Also you're checking if it's the server then calling a server RPC

#

You want the client to call the server RPC right?

#

Not the server to call a server RPC, that's entirely redundant

next falcon
#

When i join a session i start at the player start but without a character and can fly around ? what went wrong ?

#

what should i change ?

fossil spoke
#

@next falcon Did you set your GameMode to spawn players as Spectators?

next falcon
#

no but i find out that only the controller spawns but without character

#

@fossil spoke how can i fix that ?

grizzled quartz
#

@next falcon had the same problem with my old project, i managed to fix it this way. http://prntscr.com/heh670 might not be ideal for you, but an idea on what to do. strangely enough it was working fine before, but something happened and i had to add this

Lightshot

Captured with Lightshot

grand kestrel
#

So recoil in multiplayer shooters, mine works great currently, but the concern I'm having is that while the shooting is fully server authoratitive I think the recoil might be easily hackable because it's only applied client-side and I'm not sure how to apply it in a way that the server can enforce it

#

Spread is a lot easier because the projectile is spawned by the server and then replicated to clients

#

But because recoil is pushing the camera around and doesn't affect the actual round being fired, I'm not sure how to approach a solution

hidden thorn
#

@grand kestrel Atleast now I know not to use ROLE_Authority, also I am not replicating the movement. What I am doing I am simply setting MovingForwBack from -1 up to 3 which is used inside the BlendSpace to display the correct animation.

#

The movement it self is still using AddMovementInput() the only other thing that I am doing I am using ServerRPC call to change the MaxSpeedWalk cpp void ARPGProjectCharacter::SetSpeed_Implementation(float Value) { charMovement->MaxWalkSpeed = Value; }

grand kestrel
#

@hidden thorn charactermovementcomponent has a virtual method GetMaxSpeed that you can override. The proper way to do it

hidden thorn
#

Is there a follow up as in what is the proper way to do it or is GetMaxSpeed the proper way to do it?

thin stratus
#

@hidden thorn you are only setting maxwalkspeed on the server?

hidden thorn
#

Well from my understanding what I am doing is I am asking the server to set the maxwalkspeed on the client

thin stratus
#

Maxwalkspeed is not replicated

hidden thorn
#

Huh

thin stratus
#

Well yeah, you have to set it on everyone

#

Otherwise only your server runs at different speed and your local client will jitter

#

Idk if that has anything todo with the conversation, but wanted to add that as i saw your rpc

hidden thorn
#

So ServerRPC are used to call a method from the client on the server telling the server to do something which will then updated on all the clients?

#

Because when I am setting MaxWalkSpeed using SetSpeed it works just fine and I spawned 2 net clients and it works on both

#

The speed changing can be seen on both of them

zenith yarrow
#

Is there a way I can find out on client pawn if it is possessed/owned by a network PlayerController or the localPlayerController ?. I only want to send RPC's from it if my local PC possesses it

#

would fetching GetNetOwner() and comparing it with local player controller work in this case ?

hidden thorn
#

Maybe this would help IsLocallyControlled() checks if it owns the object/pawn

#

@thin stratus To set MaxWalkSpeed to Replicated those that mean I need to get the source? As the file is locked.

thin stratus
#

You rpc the change

#

No need to modify the source

#

@hidden thorn Well as far as I know, and i've been around for a while, the MaxWalkSpeed is not replicated.
A ServerRPC doesn't mean it's updated on all clients. It just means that it executes on the Server.

#

If what ever you change is not marked replicated, it won't update

hidden thorn
#

I see also I just checked the definition of MaxWalkSpeed and it isn't Replicated.

thin stratus
#

95% of the time someone asks "Why is my client jittery", it's because they only set the walkspeed on the server

#

So I still believe it does not update

#

Means, either you Multicast from the Server RPC

#

However, only good if you have no late joiners

#

If you have late joiners, make sure to use your own Speed variable that is marked RepNotify

#

and in the RepNotify function, you set the walkspeed

#

(+ on the server RPC, as RepNotify doesn't call on Server in c++)

inner iris
#

@grand kestrel couldn’t the recoil also be called from server? If that’s the only thing that is clientside, it won’t work great in a situation with latency unless you are accounting for it in some other way.

grand kestrel
#

It would likely feel horrible, but it might be the only viable solution @inner iris

#

Maybe sub 50ms it'll be OK, gotta test

inner iris
#

I’d recommend have the recoil, gunshot start fx and clientside projectile spawn instantly clientside and then do the same on server / compare. I don’t think any recent game has fully serverside shooting atm- it just is too slow other than for one off projectiles like rockets that you can mask the latency with an animation

#

You can even have a spread value different on the client than the server but count the servers one- the clientside shot can just be an approximation

grand kestrel
#

I sync the random seed between server/client for that

inner iris
#

Ah yeah since there is travel time you can do that

grand kestrel
#

It actually feels fine to spawn the projectile on the server, the way I do it is that the FX play immediately but the server spawns and replicates the projectile and it's movement, at 50ms you barely notice it, even 80ms is fine

inner iris
#

Do a 200ms test with someone running back and forth horizontally

grand kestrel
#

Like you shoot 5x, you'll play the FX, but the bullets appear moments later (almost unnoticeable depending on latency)

inner iris
#

You’ll have to shoot ahead of him depending on the latency

#

Results in a very inconsistent experience

grand kestrel
#

We offset it with prediction

#

Storing positions when shooting etc

inner iris
#

Ok if you have prediction then it’s probably fine

grand kestrel
#

Can't share a lot more info though

inner iris
#

Do try that out though because consistent hit feedback is really important

#

And most games I’ve seen favour the clientside shot and verify it on server by comparing timestamps

#

Of course there are pros and cons to both, but I think in the end, responsiveness wins

grand kestrel
#

Ah it's been tested

#

It's just recoil that I'm stuck on

#

Ours is a bit more like OWs

#

I guess

inner iris
#

Well yeah in that case just add the pitch / yaw inputs in sync with the server fire bullet I’d say?

#

The downside is that it can change depending on latency so players might find it hard to time their shots

grand kestrel
#

Might just leave it client-side and hope the hackers don't notice πŸ˜› jk

#

Guess I have to play with it 😦

inner iris
#

I wonder if you use a random float in range to add the recoil clientside- is it possible for the hackers to counter that value on the same frame?

grand kestrel
#

Wouldn't know really

#

Our recoil isn't jump from A->B

#

It interpolates smoothly, then returns smoothly

#

But we do use randomization for it

#

Similar to spread when calculating it really

#

On an entirely off-topic note, my god I really hate coding in Python

#

Making a hair strand generator

rare cloud
#

I recently made an UActorComponent to attach to my game state to replicate data

#

but strangely my RPC isn't call

#

here how I create it inside the CDO of my gamestate:

NetworkComponent = CreateDefaultSubobject<UNetworkComponent>(TEXT("NetworkComponent"));
NetworkComponent->SetIsReplicated(true);

and how my RPC function are declared:

UFUNCTION(Reliable, Server, WithValidation)
void ServerCheckRegion(const FVector& RegionCoordinates, const FDateTime& LastUpdate);

UFUNCTION(Reliable, Client)
void ClientSendRegion(const FVector& RegionCoordinates, const TArray<uint8>& Data);
#

did I miss something ?

#

my .cpp has ServerCheckRegion_Implementation / _Validate and ClientSendRegion_Implementation

thin stratus
#

Simple fact that you can't call serverRPCs in a ServerOwned Actor

#

As well as Client, as that doesn't reach any client

#

@rare cloud

rare cloud
#

oh ok

#

what actor can send server RPC ?

#

Character ?

#

Controller

#

Ok thanks ! I will change my design πŸ˜„

#

I was thinking since GameState is replicated with all no problem can happen

#

I was wrong

austere lintel
#

On answerhub people say to avoid this, is it useless?

worthy wasp
#

ok here's where i'm confused on UE4's networking structure:

I have an RPC chain setup -
1: Client raytrace to hit target
2: Server Raytrace (Passed args for start/end locs) (VERIFICATION + application of damage on successful hit)

Now... i need to interject into the Server raytrace - but I need to run a multicast function on the HIT ACTOR..... Due ot the fact that i'm in ServerAuth at this point - this wont bappen because of ownership issues.... my FIRING actor (the player) doesnt own the HitActor (enemy).... how can I get back to a CLIENT local funciton level on the HitActor (enemy) from a server function (the verified raytrace)?

Do I have to RPC back to Client on my firing actor (the player) ?

brittle sinew
#

If you're on the server, you have authority over all replicated objects, even those that aren't owned by the server's PlayerController.

#

You can only call multicasts from the server, as a matter of fact πŸ˜‰

#

(multicasts don't work from the client, even with an owning connection)

worthy wasp
#

right but my actor cant call a SERVER RPC against something it doesnt own....

#

?

brittle sinew
#

Sure, but I thought you were already on the server in the explanation?

worthy wasp
#

it'll error out in the OUtputLog

brittle sinew
#

Maybe I misread

worthy wasp
#

ok lemme try make this clearer (sorry)

#

My Characte rfires

#

it hits the enemy

#

(raytrace)

#

my character then runs a server RPC to do the same thing

#

raytrace verifrication

#

now

#

at this point - i'm in RoleAuthority on my player

#

i need to run a function on the HIT ENEMY

#

ultimately (as stated) a NetMulticast

#

but i'll have Ownership isseues....

#

wont I?

brittle sinew
#

So we're already on the server in this example?

worthy wasp
#

maybe i should also state

#

thi sis a Peer 2 Peer networkign model

#

NOT dedicated

#

to my knowledge - YES we would be on server (via RPC) ?

brittle sinew
#

Uhh, do you mean listen server?

worthy wasp
#

yes sorry

#

listen server

brittle sinew
#

That's still the same network model as dedicated πŸ˜›

#

It's just somebody hosts the server; inside of the game everything is the same

#

But yeah, if you're on the server ownership really isn't an issue.

#

The server has authority over all replicated objects.

worthy wasp
#

ok - i guess i'm just jumping the gun sorry

#

i should have coded this - seen if i had errors - and then try ti diagnose

stark dome
#

does anyone have information on net dormancy?

worthy wasp
stark dome
#

@worthy wasp thanks for the link, already read it though. wish there was some more info

elder sable
#

replication send data only when the replicated value change ?

rare cloud
#

@elder sable, yes

elder sable
#

ok thanks

worthy wasp
#

Another networkign oddity i dont understand..... ListenServer -> BeginPlay and Tick are supposed to run as both RoleAuthority & Role_AutonomousProxy..... but yet when I do a If(HasAuthority()) branch on BeginPlay - my CLIENTS dont runt his code..... telling me i need to RPC it i guess?

brittle sinew
#

What exactly are you asking there? Yes, those events run on both server and client, but if you add an authority check to one of them, it's obviously only going to run on the authority (server for replicated objects)

worthy wasp
#

maybe i'm not fully undesrtanding listen server

#

the SERVER role is assigned to 1 client right?

#

does that client play as JUST SERVER?

#

or is he Server and Client?

#

or - is the SERVER ROLE - an instanced role that is running on his machine - but he plays as a client ?

brittle sinew
#

It's mostly just a server, but things get a little more complicated than that, because you also have things like the HUD on a listen server which are usually only for clients

worthy wasp
#

so then how do I AUTHENTICATE ont his guy?

#

in this model - (LISTEN SERVER) - the SERVER client could hack/cheat all day long?

#

if he were to write script - no?

brittle sinew
#

Yes.

#

That's a big downfall of the listen server architecture.

worthy wasp
#

ok

#

so i do undestand it correctly then

#

thats how i was developing this in mind

#

so then

#

all CLIENTS - never have authority - even in BeginPlay or Tick - correct? @brittle sinew

brittle sinew
#

On replicated objects, no.

#

If a client spawns a non-replicated actor on that client only, however, they have authority on that object Technically it wouldn't be authority, it's just that they have the ability to make changes on it since it's a non-replicated actor

worthy wasp
#

oy vey lol ok

#

so if i have a subobject/component/variable - replicated.... then they have no authority to it

#

understood

#

and that would require RPC to make changes to the component/variables of tha treplicated object

brittle sinew
#

And well, actually, it would probably return as being not replicated 🀦

#

Yeah, ownership and authority are somewhat related but different concepts

raven viper
#

Heey! Anyone can help a tiny bit? We got a "slight" issue.

#

Been working on a game for a while, and all of a sudden, after the players log in, they get automatically disconnected

#

Like

Event Post Login -> Cast to Controller -> Spawn Pawn -> Possess with said controller

#

Worked all good. Now We start the game, the character spawns, a print string runs after the possess, saying that it has possessed the pawn, then 2-3 seconds later the player just vanishes, gets back to the level it was on before, and the server prints the "Event On Logout" text that we have added.

#

Okay, finally got log, I don1t know why it did not show up before

thin stratus
#

@raven viper Maybe perform a Multicast on the PlayerController that is reliable?

#

Can technically be all sorts of things

#

The log would be help ful (from both sides)

raven viper
#

Sorry, the problem was simply the fact that there were too many reliable events, so instead of dropping the requests, it just basically disconnects the player.

#

Question related: I cannot find anywhere, where to set the maximum number of reliable event calls.

cursive oasis
#

Yo, quick question

#

I'm using UE's standard character controller.

#

let's say I want to, upon left click, fire my pawn's gun.

#

do I need to use a custom replicated event for that?

#

Client tells Server he wants to shoot his gun
Server multicasts gun shooting function

#

is that it?

brittle sinew
#

That would work, yeah.

#

If you want to make it feel better, you might want to look at client-side prediction for events like that, but that might be outside the scope of what you're trying to do

hot hearth
#

are there good multiplayer guides/references for ue4 that you guys can recommend?

twin juniper
#

hwow do i fix this RPC failing for the following reason
[2017.11.25-07.49.31:724][234]LogNet: Warning: UIpNetDriver::ProcesRemoteFunction: No owning connection for actor MyMixamoChar1_C_0. Function ServerShowCharacterSelection will not be processed.
i did some custom player character spawning and possession with ai controller prior to this
please mention me if you have an answer, i gotta go

inner iris
#

Is it true that you have to make a new copy of a map for each different GameMode?

#

So you can’t have one map and play different game modes on it?

stark dome
#

@inner iris you can pass the game mode in with the options when loading a map

inner iris
#

Ok cool was just looking at a tutorial that specified a new copy of the map was needed for each GM which would be a nightmare to maintain

#

Thanks!

twin juniper
#

guys, I have some issues with replication

#

Basically, I'm using a function to aim and a function to fire

#

*event

#

This is how I aim

#

This is how I fire

#

The problem is that while the server spawns the projectiles fine, and the client sees them fine

#

when the client shoots, it shoots straight forward

#

it doesn't take into account "Weapon Left" and "Weapon Right" rotation

dusty sleet
#

is AimWeapons event a replicated event at all?

twin juniper
#

It's not, if I replicate it, for some reason I have to click + drag to aim

dusty sleet
#

Not sure what you mean by that.. but you dont necessarily need to repliacte the AimWeapons event.. but maybe try creating a new event called SetAimRot_server and run that on server... then have that run another even called SetAimRot_mc. make inputs on both and after doing the set world rotation locally.. pipe the new rotation into the inputs on the new events and then do a set world rotation in the mc event as well

#

mc being multicast

twin juniper
#

Ah, I see.

#

I'll try that, thanks!

dusty sleet
#

cuz right now youre only doing the rotation on the one machine. the others dont know it ever happened. so their copies of the actor never rotated from their point of view

twin juniper
#

yeah, that makes sense

#

Sometimes you're in so deep in something, a fresh pair of eyes really helps

#

πŸ˜ƒ

dusty sleet
#

yep. its hard to tell from just the snippet but hopefully that works

brittle sinew
#

@twin juniper to call a server RPC on an object, that object needs to be either directly or indirectly (somewhere in the chain) owned by the local PlayerController.

#

That's what an owning connection is referring to

twin juniper
#

ok, wait a sec

#

let's discuss this

#

this is what i've done

#

it seems that possessing removes the ownership

#

how do i regain it?

#

@brittle sinew

brittle sinew
#

Set Owner

twin juniper
#

and the owner would be player controller?

brittle sinew
#

The PlayerController of the client whom you want to be able to call a server RPC on the actor, yes

twin juniper
#

so basically something like this could work, this is onPostLogin event

brittle sinew
#

Theoretically yeah, or you could just feed it in on the SpawnActor node itself

twin juniper
#

@brittle sinew i'm not getting the message any more but the RPC is still not executed

#

😦

brittle sinew
#

Hmm, are you sure the RPC isn't executing, and that you're just not getting the expected result from it?

twin juniper
#

maybe i'm not referencing a correct character

#

how would i reference it from client?

#

currently i'm replicating the reference to the character through a controller variable

#

maybe that's not the correct way

#

but if i try to use get controlled pawn, null, is returned on the client

#

hmmm, perhaps a timing issue?

#

trying to get controlled pawn before set owner is propagated to the client

brittle sinew
#

Possession and ownership aren't the same thing.

twin juniper
#

i understand that

brittle sinew
#

Your pawn is controlled/possessed by the AIController, but owned by your PlayerController

#

Well, you said that you're trying to get the controlled pawn before set owner is propagated

#

Those are effectively unrelated in this situation

#

Just to think about it though: does it make sense that an AI is owned by one of the clients?

twin juniper
#

i'm trying to make a player character that can use ai move to

brittle sinew
#

I should've talked about this earlier, but it seems a little weird that an AI is specifically owned by one client, and not others

twin juniper
#

like i said, i need ai move to functionality on my player character

brittle sinew
#

And?

twin juniper
#

because simple move to doesn't fit my eneds

brittle sinew
#

Oh, I see what you're going for, sorry

twin juniper
#

i've been trying to set this up for days, but it seems i'm running into obstacles all the time

#

now with this RPC 😦

#

this thread claims it is possible

brittle sinew
#

Okay, so how are you currently trying to call it? I know you said you were possibly having issues getting the character, but I'm not really sure exactly how you're doing it

twin juniper
#

I'm replicating a variable on the controller, which is a reference of the character

brittle sinew
#

Okay, so it definitely is very possible that it's a timing issue

#

Have you checked to see if that variable is valid?

#

(and/or the one you actually want?)

twin juniper
#

yes, i understand what you mean, trying to figure that out atm

#

but i was wondering, do i need to replicate the variable? shouldn't "get controlled pawn" return what i want

brittle sinew
#

Your PlayerController isn't controlling the pawn, though.

#

The AIController is.

twin juniper
#

ah, ok! is there some way to get the reference of the pawn the controller is owning.... something opposite of "get owner"

brittle sinew
#

Nope, as any actor can own a (theoretically) infinite amount of actors

twin juniper
#

so the replication thing is the only way?

#

to obtain the reference

brittle sinew
#

If you don't want to do things within the character itself on the client, it's probably the easiest

twin juniper
#

this is the server side, where is setup the character reference

#

client part where i call the RPC, everything seems pretty straight forward

brittle sinew
#

And you don't get any errors from null accesses or anything?

twin juniper
#

nothing

#

that's the fun part

brittle sinew
#

Is the RPC reliable?

twin juniper
#

nope, should it be?

brittle sinew
#

If you want the event to always get sent over the network, definitely.

#

Non-reliable RPCs basically say "you can drop this if the network is busy, I don't mind"

twin juniper
#

i'm going to set it to be reliable, but i don't think it'll change anything

#

is there some thing i can do to debug this

brittle sinew
#

Networked debugging is a little tough, but you still might be able to use breakpoints if you're keen about what windows they're being executed on and things like that

twin juniper
#

it just doesn't get sent 😦 how would i debug it 😦

brittle sinew
#

You set it to reliable?

twin juniper
#

yes

brittle sinew
#

And you're definitely sure the RPC isn't coming in on the other end?

#

Have you tried print stringing/breakpointing it?

twin juniper
#

errr

#

here is the output from client and server, server should write hello

ancient ruin
#

seems to me that you are not the owner of the rpc target or it is just not valid on the server

twin juniper
#

how would i fix that?

ancient ruin
#

what does this function return ?

twin juniper
#

it returns a replicated refrence to character

#

and it is set on server in this script

#

this script spawns a charcters, sets a refrence on the player controller, gets the character possesed by an ai controller, and then returns ownership to player controller

#

ok, guys, i need to go, thanks for your help. if you get any idea how to fix it, please mention me

elder sable
#

can we use "run dedicated server" in editor without using any online subsystem ? My map is not loading and i have a "invalid userId"

rare cloud
#

this message is spammed when I spawn an actor client and server without replication:
could not resolve the new relative movement base actor, ignoring server correction!
There is a way to avoid this message for procedural collision ?

hexed rose
#

i have a weird bug where i cant use my WASD camera after i use my Middle Click Camera :|
the print string says it should be working... but it isnt.

any thoughts?

#

it starts working AFTER i alt tab though

worthy wasp
#

@hexed rose - i maybe wrong - but if your movement is = 0 .... the bool will be false - which will lock you out of being able to use your middle mouse button to pan around

hexed rose
#

middle button still works <.<

worthy wasp
#

i dont know how - your branch would be false from movement all the time while you are standing still

hexed rose
#

the idea is... when the player is still then can pan the camera with middle... but then if they are using WASD the camera movement enables (the WASD is where the bugg happens)

worthy wasp
#

sorry - i'm durptarded ... the OR logic would pickup the middle mouse being clicked..... which makes the movement logic kind of backwards though

#

errr

#

i'm gonna si tthis one out - i just stuck my foot in mouth

#

lol

#

you'd WANT the move logic to be NOT - because if you're moving you want to have yaw/pitch input from controller..... my bad

#

was overhtinking this

#

now question

#

i assuem server works fine for htis - but clients dont?

#

it looks as though the MouseAllowsCamRot isnt replicated

hexed rose
#

<. <

worthy wasp
#

is that the case?

hexed rose
#

no idea

worthy wasp
#

ok well one thing i DONT understand is the alt-tab thing

#

whats that have to do with anything?

thin stratus
#

It's all local

#

So I doubt it's actually a problem with Multiplayer?

#

@hexed rose Do I get it right that you only want the MMB to work if they nearly stand still?

#

Sorry for repeating that question, but both your discussion made it vague for me

hexed rose
#

i only want the Middle mouse button to Work when standing still... then latter add it in for the click movement

thin stratus
#

then latter add it in for the click movement that part I don't understand

hexed rose
#

dw about that part now

#

im planning on having WASD and Click to move

thin stratus
#

Alright, so what you code currently does is this:

Pressing MMB will enabled the Boolean at the bottom right, making it true

#

Which will enable the Turn and LoopUp on the bottom left

#

No matter if you stand still or not

hexed rose
#

which it does

thin stratus
#

Code on the top right is checking if either of the two AxisValues is nearly 0.
If it is, the node returns true, which gets "NOT" into a false and then checked on an OR

#

Which, if standing still, will def set "MoveAllowsCamRot" to false

#

Which is the opposite of what you asked for, or?

hexed rose
#

<.< i think so

thin stratus
#

Try removing the NOTs

#

And changing the OR to an AND

#

Then you are getting "MoveAllowsCamRot" as TRUE, if both axis values are nearly 0

#

maybe that fixes your issue

hexed rose
#

nope

#

actually inverts the issue <.<