#multiplayer

1 messages Β· Page 456 of 1

past rain
#

calculations happen inside the weapon class

bitter oriole
#

You could do your own separate SetAim() RPC method before firing

past rain
#

so the player calls setAim, which calculates

#

then calls the Fire function

#

is that what you were thinking?

bitter oriole
#

Yeah.

#

You're going to want the pawns to know where each player is aiming anyway, for animation

#

Might as well continuously tell each other that.

past rain
#

One moment, let me try

#

Does the setAim function have to be RPC?

bitter oriole
#

Well, yeah.

#

Only way a client can talk to a server

past rain
#

pretty sure Im doing something wrong

#

(ignore the red lines intellisense is stupid)

#

I was thinking, dont we want to do these calculations client-side?

#

So I probably shouldnt just run the calculations server side like Im doing in the picture

bitter oriole
#

Yeah, you would calculate the hit location outside SetAIm

#

SetAim would just store it for the next Fire() call

past rain
#

uhm.. you mean calculate hitlocation at the start of the function?

#

outside the role check

bitter oriole
#

No, outside the method.

#

SetAim will run on server too, here

past rain
#

Then my question is where do I calculate it, because its calculated only when I press my left mouse button

#

Currently SetAim is called when I press the left mouse button

bitter oriole
#

Just do that

#

I'm just saying pass HitLocation to SetAIm

#

And calculate it before calling it

past rain
#

The issue is that Im calling SetAim from the character class, while the calculations are happening here in the weapon class

#

so set aim is called in a different class

#

Im probably misunderstanding you, sorry

#

Perhaps you mean pass it an empty Vector, which it can then use to store the hitlocation?

#

An empty vector that I create in my character class when clicking my mouse

#

Im so confused πŸ˜•

bitter oriole
#
{
    Fvector HitLocation;
    return GetCrossHairHitLocation(HitLocation);
}

void Weapon::SetAim(FVector HitLocation)
{
    // if role autonomous proxy then call server etc

    CurrentAimLocation = HitLocation;
}```
#

Then in Tick

#
StAim(HitLocation);```
#

Then when you fire

#

Fire();

#

Fire would use CurrentAimLocation internally

#

ServerSetAim would be like you made it earlier

past rain
#

GetLookVectorHitLocation uses Out parameter

#

so I wouldnt have to return anything would I?

#

in my CalculateAim

bitter oriole
#

Yeah sure

past rain
#

@bitter oriole this is what I cooked up, Im sure Ive done something wrong

bitter oriole
#

Looks fine

past rain
#

I wish it worked though πŸ˜„

#

Guess Im restarting the editor

#

Doesnt work, Im getting this warning - LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor Rifle_BP_C_1. Function ServerSetAim will not be processed.

#

Rifle_BP_C_1 is the servers weapon

bitter oriole
#

Well, right now the remote simulated weapon for the server, on the client's machine, is trying to set aim on server

#

add if role == autonomous proxy on tick

#

Erm

#

if role != simulated

past rain
#

like this?

bitter oriole
#

Yup

#

The error meant that you can't RPC from simulated

#

Which is correct

past rain
#

No more warnings, but still going to servers crosshair 😦

bitter oriole
#

So what does Fire do now ?

past rain
#

Im using current aim location, which is a vector in the weapon class

#

So the code in SetAim, where we do CurrentAimLocation = HitLocation is somehow still the servers

#

Which is true

#

because we only reach that piece of code if we are the server

bitter oriole
#

I still see GetCrosshairHitLcoation here

#

Instead of using CurrentAimLocation

past rain
#

shit

bitter oriole
#

You don't want to set CurrentAimLocation with GetCrosshair

#

Just use that as a (client-provided) result

past rain
#

Okay removed, still doesnt work πŸ˜„

#

thats all the relevant code on pastebin, incase you dont want to keep looking at pictures

twin vault
#

any way to play in multiple processes without one connecting to the other?

#

Disabling Use Single Process only allows selecting Play as Client and Play as Listen Server

#

then it breaks stuff cuz it tries to connect

bitter oriole
#

Dunno @past rain should work like that

past rain
#

Damn :/ I really want to get this to work, then I'll spend the entire weekend studying hwo it works

#

Any chance you'd look over it via screenshare?

bitter oriole
#

No, sorry

past rain
#

Sucks to get this far and not finish it : <

#

@bitter oriole Didnt notice this at first, but now the clients works perfectly

#

however, now its the server which projectiles just go to a fixed position

#

basically towards origin

#

So the roles have kinda switched where the clients work, but hte server doesnt now

bitter oriole
#

Sounds like CurrentAimLocation isn't well set on server

past rain
#

ah nvm this is because I cahnged it from Role != Proxy to ==

#

Its still the issue of CurrentAimLocation being that of the servers, even when the client is shooting

glacial pollen
#

Nice to see someone took over helping while I was gone

past rain
#

We got somewhere evo

#

but it still isnt working πŸ˜„

#

Basically trying to calculate the linetracing on the client side

#

and passing it to the server

glacial pollen
#

Yes, well.. you kinda just jumped into networking face first

past rain
#

yeah I did

#

I promised once I get this specific part done, to study it well

#

before moving on

glacial pollen
#

First and foremost. You just need to do everying on the server for right now

#

Linetrace on the server

#

add input on the server

#

shoot on the server

#

bullet count on the server

#

ect

#

Once you have that down, you can spread out

past rain
#

I did have it down

#

Well, you helped me get it there

#

where all of that is only on the server

glacial pollen
past rain
#

thats what me and stranger tried

glacial pollen
#

ah

past rain
#

but hte way I had it before, was all on server

#

however the issue was since the linetracing was on the server, it line traced from the servers camera position

glacial pollen
#

Okay, something else you need to pay attention to

#

So check this

#

remember how we had to check the entire chain of ownership to make sure we are replicating the correct player/server?

past rain
#

I remember

glacial pollen
#

Alright, well

#

Functions are the same way

#

You need to start at the first part of the chain

#

and follow it

#

Beginplay is the start of one chain

#

keyboard/mouse input is another chain

#

overlap/hit events

#

ect

#

if any part of that chain, is mis-matched. the rest of the chain wont fire correctly

#

So

#

check:
Mousebuttondown (client) -> Fire(server)

#

Fire: Linetrace, spawn bullet, set owner of bullet to player's controller

#

Open bullet BP

#

make sure everything is set to replicate

#

ALSO Fire() should be taking a player's controller as input

#

wtf

#

hold up

past rain
#

what

glacial pollen
#

what calls this:

#

void ACS_Weapon::Fire()

past rain
#

The character

glacial pollen
#

show me

#

mouse button down?

glacial pollen
#

Okay, which is a client only event right?

past rain
#

yes correct

#

client only

glacial pollen
#

Ever seen the server press a mouse button?

past rain
#

I havent

glacial pollen
past rain
#

We still enter that function, Ive logged shit in it

glacial pollen
#

Don't care

#

not valid

past rain
#

But

glacial pollen
#

ever

past rain
#

Client1 = Server

#

Client 2 is not server

glacial pollen
#

dude

#

just move all of this

#

if (Role == ROLE_Authority)
{
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;

    SpawnedProjectile = Cast<AProjectile>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, Projectile, FTransform::Identity));

    SpawnedProjectile->Instigator = Instigator;
    SpawnedProjectile->SetOwner(this);

    FVector MuzzleLocation = WeaponMesh->GetSocketLocation("Muzzle");

    FTransform SpawnTransform;
    SpawnTransform.SetLocation(MuzzleLocation);

    FVector Location = CurrentAimLocation - MuzzleLocation;
    SpawnedProjectile->InitVelocity(Location);

    UGameplayStatics::FinishSpawningActor(SpawnedProjectile, SpawnTransform);

    CurrentAmountOfBulletsInMagazine--;
}

}

#

to

#

inside of this

#

ServerFire();

past rain
#

ServerFire_Implementation?

glacial pollen
#

Just because client 1 has authority, does not mean you need to program that way

#

you want to make a bunch of if's for player 2?

past rain
#

no

glacial pollen
#

pretend its all dedicated server

#

Fire() : Role < Auth, should still be true

#

for a single player listen server

#

it will fire twice

past rain
#

Isnt the though that, if Role < Auth is true, it calls ServerFire, ServerFire then calls Fire as a server?

glacial pollen
#

yes...

past rain
#

Thats how it used to be

glacial pollen
#

no

#

i missed that from the beginning

#

I don't play with listen servers much

#

Honestly, I don't believe you need to program differently, between a listen server and a dedicated server

#

that makes no sense

past rain
#

I did what you told me, now the server/client cant shoot at all, and the client2 still goes towards server crosshair

glacial pollen
#

a listen server is like a server and client

past rain
#

Programming for dedicated and listen servers

#

are almost identical

glacial pollen
#

I may be wrong

#

and its bullshit if they really made them different

past rain
#

its not

#

its almost identical

#

If you program it as dedicated, its the same for listen, but from listen to dedicated its a bit differnet

glacial pollen
#

a listen server, should fire two begin plays for itself. One as the server, one as the client

#

You need to start at the beginning of your function chain

#

and start something like this at every function

past rain
#

still cant get it to work

#

<

#

do I have to do GetLifetimeReplicatedProps for a variable here?

glacial pollen
#

if role = auth
print auth
if role = autonomous
print autonomous
if role = simulated
print simulated

#

Last but least you should be doing all of this in blueprints, you could take a single screen shot and have all the data I need to help

#

I don't know why you are trying to learn all this and do it in c++

past rain
#

Yeah I havent gotten used to the idea of prototyping in blueprints

glacial pollen
#

where the iteration times are shit

past rain
#

I'll prototype stuff in blueprint from now on, just wanna get this done in c++ though

#

since Im pretty far in it

#

Also the print stuff you said

#

where do you want me to put taht code?

glacial pollen
#

Make a global function

#

Call it Whats the fing role

#

and call it, at the beginning of every function you are having issues with

#

brb

past rain
#

Let me explain what i think is the issue from my side. I dont think it has anything to do with ownership, that's all good for now. The problem is, Since we do the firing on server side only. That when we calculate the line tracing, it will use the server's (since in this case it's a player too) Camera to get the starting location, So the end result will be that if any other client fires, it moves towards the servers crosshair

#

But in the case where its a dedicated server, and the server is not a client, then the server wouldnt even have a crosshair or a camera, so Im not sure how the linetracing on the server would work

#

Which explains why when I run the game on a dedicated server, the line tracing fails and the projectile just goes down to the ground

#

So when Im calculating the line tracing server side, I need to somehow use the client that shot as a starting point

glacial pollen
#

INSIDE PLAYERCONTROLLER :
ServerFireClient(Actor Input) : call ServerFireServer(Actor Output)

ServerFireServer(Actor Input):
Get Actor : Get location : Do linetrace : Spawn : Assign (self, playercontroller) as owner

INSIDE ACTOR:
OnMouseButtonDown:

if role=auth : Actor : GetOwner : cast player controller : call ServerFireServer(actor)

if role <auth : Actor :GetOwner : cast player controller : call ServerFireClient(actor)

#

If you use Getowner -> Cast player controller, you never have to use GetPlayerController(0)

#

@past rain

past rain
#

I dont really want to do input in player controller, thats not how epic does it

glacial pollen
#

fine

#

put it in the actor

#

either way

#

I could write it up in blueprints in 2 minutes

past rain
#

Are you at home now?

glacial pollen
#

yes

#

teamviewer?

past rain
#

yes please...

#

can I call you on discord first?

glacial pollen
#

sure

obtuse dirge
#

Is there a way to use cheat manager with dedicated server? Specifically the built-in commands like Teleport(), which rely on the player controller. I made a function which can relay the commands to the server and execute them there, but of course the server doesn't know which player controller to use

#

Also afaik, CheatManager should not be able to use replicated functions since it isn't an actor, but it has one anyway.

past rain
#

EvoPulseGaming is awesome, just putting it out there

gusty lily
#

networking in a non-dedicated server game: does the server tickrate match the server player fps? if not, how is it set, and if so, is there a way to limit to say 60 tick? cheers.

bitter oriole
#

@gusty lily It does

gusty lily
#

Any way to keep it regular or limit it without limiting server player FPS?

bitter oriole
#

No

#

It's always going to be the same

gusty lily
#

Hmmm. That’s a some encouragement to economise right there. I wonder at what FPS things start to fall apart. In my genre people lie to run at 120+. I might have to build in that limit for server players at least.

ember fern
#

Hi guys, can anyone help me with this

#

I'm spawning an actor, just a static mesh really in my level, when I put my server into dedicated mode and say 2 clients, everyone can see this static mesh

#

Now I want to scale this mesh while the game is being played

#

I'm spawning it via the server, however, when I change the scale over time nothing happens

#

It does work in 1 player, non dedicated mode

#

I've tried replicating the vector that's responsible for resizing the static mesh

#

But nothing helps

#

At least, I'm sure it is scaling on the server because I check this with an overlapping event, the static mesh's scale does not change visibly

#

For context: I'm checking if a player is overlapping with a static mesh, the static mesh is like a battle royale safezone, if overlapping no damage is dealt, if outside player is taking damage

winged badger
#

scale doesn't get replicated by default, since it rarely changes

#

replicating a vector representing that scale, then setting the mesh scale OnRep will do the trick

ember fern
#

Ah ofcourse, forgot to set my MeshComponent to SetIsReplicated(true) besides bReplicates = true for whole class. Works like a charm now, thanks alot @winged badger!

glacial pollen
#

lol

#

So I have a client on dedicated
I spawn an actor on the server, and set the client's playercontroller as owner
on the actor's beginplay -> GetLocalRole
I get Simulated Proxy... which is dead wrong for the client

#

If I do
GetOwner-> GetLocalRole (which is the player controller) I get Autonomous Proxy

#

Help?

bitter oriole
#

@glacial pollen You need to set autonomous manually if the actor supports it

#

autonomous is generally for pawns

glacial pollen
#

I'm listening

#

c++ I assume?

bitter oriole
#

I don't do anything else but I guess it works in BP

#
void APAwnClass::PossessedBy(AController* NewController)
{
    Super::PossessedBy(NewController);

    // Set the correct network role
    if (GetNetMode() != NM_Standalone && Cast<APlayerController>(Controller))
    {
        if (Cast<APlayerController>(Controller)->GetRemoteRole() == ROLE_AutonomousProxy)
        {
            SetAutonomousProxy(true);
        }
        else
        {
            SetAutonomousProxy(false);
        }
    }
}```
#

Bit of a moutful

glacial pollen
#

Okay, but this is a Character

#

which is a pawn?

bitter oriole
#

Yup

glacial pollen
#

O..M..G
Sometimes I really question the sanity of the developers at unreal... Other times I question my own for putting 4 years into this game.

#

So check this bullshit out:
SpawnChar(Set owner as PC)
Char Begin play : simulated
possess
right?

#

if I put a DELAY node, in the begin play

#

I get autonomous

#

because when you spawn, begin play happens before you can posses it.

#

So now I need to split up my code even more, on possessed, with a merge with begin play. Because... guess what? You can spawn the character for customization, and you want to look at it, not control it

#

Why do we not set Autonomous by default? Why does it matter? Its not like we are saving a few byte by changing from one enum to another

bitter oriole
#

@glacial pollen There can be no way for the engine to ensure possession before beginplay.

#

If only because the pawn might be in level and you possess it when you connect

glacial pollen
#

I dont mean that

#

I mean, why are we not setting autonomous by default?

#

Why does it matter if its possesedf?

bitter oriole
#

Autonomous by default would simply be wrong. If no one's possessing a pawn it can't be autonomous

glacial pollen
#

why not? I own it, and have semi control over it

bitter oriole
#

Autonomous = remote player not on server actively controlling this pawn

#

If a pawn is created and not possessed, it has to be simulated

glacial pollen
#

why does it HAVE to be pawn though?

#

why can't actors be auto?

#

You know how confusing this is now?

#

I can run server RPC's on a simulated proxy!

#

Everything I was ever told is a lie kinda deal

bitter oriole
#

Simulated = server-controlled object, basically.

#

If you want to "control" an actor, sure, set it to autonomous

glacial pollen
#

okay, so then how about this

#

How do you tell the difference between owned-simulated

#

and not owned simulated?

bitter oriole
#

Everything defaults to simulated, because in a video games, 99% of actors will be

#

Generally everything but player pawn

glacial pollen
#

thats fine

#

but I want some code to run only for the owner

#

but getlocalrole is simulated for everyone

bitter oriole
#

Then test by owner

#

Not by net role

#

The net role is basically a permission, it's a safety to prevent cheaters from calling RPCs everywhere

#

Makes the netcode way simpler

glacial pollen
#

So the server, spawns an actor, and see's it a auto for the remote, but the client see's simulated?

#

because my rpc calls still work for the client

hoary lark
#

Are you looking for IsLocallyControlled() ?

glacial pollen
#

that = possesed

#

I have a character, I spawn, from teh server, for the client to prevent cheating
but its for customization, so I don't need/want to possess it

bitter oriole
#

Can't spawn characters on client anyway

#

No possession = no RPC

glacial pollen
#

I call bullshit

bitter oriole
#

Use another actor, like player controller

glacial pollen
#

I'm doing it

#

maybe im not

hoary lark
#

You can spawn actors locally on client. I do it too (for bullets)

bitter oriole
#

Ah, right, owner is enough for RPC

glacial pollen
#

actor != character or pawn

#

I guess I can pull the owner, and then call my getlocalrole

bitter oriole
#

@hoary lark You can do it but you can't spawn a posses-able pawn on client

glacial pollen
#

I still don't understand why we can't just set the role to auto for everything the client owns

#

like what can it do wrong?

#

Like, if I can run RPC's on simulated because I own it, why do we not just call it autonomous?

bitter oriole
#

You're free to do it yourself

glacial pollen
#

I'm just trying to understand the reasoning for this

#

Does autonomous run special code or something?

bitter oriole
#

Autonomous is basically "pawn possessed by remote player"

#

That's all it's used for

glacial pollen
#

damn, alright

#

very well

#

There went another week for nothing xD

worthy perch
#

Huh, that was a bit confusing. Didn't know that. I'll now investigate where/when the AutonomousProxy role is set.

#

In APawn::PossessedBy, it sets the AutonomousProxy on the pawn.

fossil sentinel
#

Hey all quick question from a noobie - for multiplayer, where do I setup variables that I want to be unique to each player (Like ammo that they have on them)?

winged badger
#

you don't really have a restriction on that

fossil sentinel
#

I was really hoping you wouldn't say that @winged badger ... Currently, when my or server reloads, they both take ammo from the same pool (but oddly enough not from the 'ammo in the gun')

#

my client*** or server

winged badger
#

in that case your ammo would break in single player as well

fossil sentinel
#

in single player it works perfectly - somehow, they're both accessing the same pool of ammo - do you mind if I take a screenshot to show you? I feel like there's something simple I'm missing with multicasting

winged badger
#

just paste it here

fossil sentinel
#

@winged badger thanks man! So I've been doing some experimentation with different replications (multicast vs client vs server) - I only seem to have found one that lets the client actually reload (unfortunately with the same issue of sharing an ammo pool)

#

I'll post some screenshots in a sec

#

Thanks @winged badger - I really appreciate any kind of feedback! πŸ˜ƒ

#

Oh the experimentation - on the first screenshot... If I set ServerReloadGun to Multicast, the server uses the shared pool, but the client can't reload.

It doesn't seem to matter too much what ReloadGun on the base weapon is set to, it always shares the pool - however the closest to the desired result is the screenshot I pasted first - as it plays the sound and animation for the client (animation isn't replicated to server tho :?) and the reload sound plays.

#

What makes it also strange is that the "reload time" variable you see there changes depending on which weapon the client or server are using - in other words, the reload time is independent, but the shared pool of ammo isn't.

fossil sentinel
#

I take it no1 here knows? I am pretty stumped. Wonder if I should do the whole ammo system over

graceful cave
#

no need for a multicast here unless youre trying to replicate sound or animation

#

and then everyone running it is going to get player character 0 which is their own character

thin stratus
#

There is really no need to fire a Multicast here

#

Performing the reload stuff on the Server is enough

#

And then maybe a Multicast if you want to play a reload animation

fossil sentinel
#

Thanks guys - you see that multicast lets the animation and sound play for the client as well, but doesn't seem to impact anything else. Setting it to run on server still takes ammo from the 'shared pool'

#

@graceful cave thanks for the help, could the issue be that the Player Character is set to 0, and should be dynamic depending on which player calls it?

graceful cave
#

where are you running this at?

#

if its on the character you dont need to cast anything

#

if its on the weapon try getting the parent actor or something

fossil sentinel
#

Yea that's on the weapon. The function is called from the character that is assigned the weapon on spawn

#

Let me see if I can try get the parent actor or something along those lines

graceful cave
#

set a variable on the weapon that stores a pointer to the character when the character is assigned the weapon

#

and use that

fossil sentinel
#

I thought of that too now, but I have no idea how to get that reference... maybe setup a reference to self in the character, promote that to a variable, then cast to character in the weapon and get the reference?

graceful cave
#

well if you could get the character to get that variable you wouldnt need that variable

#

is the gun a component on the character

fossil sentinel
#

Ok I tried my roundabout way above and it doesn't work. Makes things worse haha

#

No the gun is a base blueprint that is attached to the character on spawn.

graceful cave
#

how are you attaching it to the character?

#

you should already be getting a reference to the character somewhere if youre able to attach it

fossil sentinel
graceful cave
#

create a 0_base variable on the weapon and set it to self here

fossil sentinel
#

firing off off event begin play? Done.

#

off of*

graceful cave
#

also you should instead have only the server spawn that weapon

#

and make sure its a replicated actor

#

because that setup will cause all clients to create their own weapon for that character

#

and replication wont work properly

#

so only the server should run that

#

and what you can do then is create a 0_base variable on the weapon and check expose on spawn

#

that one

#

so it shows up on the spawn actor node

#

and set the value to Self

#

as long as the weapon is set to replicate in the class default settings for the blueprint, clients will have the value of that character when the actor replicates and they run begin play

#

the 0_base variable will also need to replicate

#

so on begin play in the weapon, you can then handle the attachment there instead of on the character

#

that way all clients and the server have the same object for the weapon and then you can properly replicate variables and call RPCs on the weapon

fossil sentinel
#

oh my gawd... so this whole thing is kinda screwed up ><

graceful cave
#

yea lol

fossil sentinel
#

I thought I was doing well xD

graceful cave
#

easy to make a lot of big mistakes like that when learning mp though

fossil sentinel
#

OK - so call a server function on event begin play in 0_base to spawn the weapon. Then attach the weapon in the base weapon. Did I get that correctly @graceful cave ?

hoary spear
#

Lol im struggling with the exact same thing. Re-reading cedrics compendium pointed me in the right direction tho

graceful cave
#

@fossil sentinel dont call a server function because the server is already running begin play

#

should be begin play on character -> check if server -> spawn weapon and set 0_base var to self via expose on spawn (make sure the variable is replicated) -> begin play on weapon attaches itself to that 0_base variable

fossil sentinel
#

Ok... can't attach the 0_base variable because the Parent Socket on AttachToComponent is not compatible

#

I can maybe get a mesh reference?

graceful cave
#

get mesh from it

#

like you did with the original attach setup

fossil sentinel
#

hmm ok so it's spawning, but it's not attaching

graceful cave
#

what is the target here

#

should just be itself

#

with no target

fossil sentinel
#

I casted to get that ref this is my current setup (i changed This Character for Character Mesh)

#

btw this is making SO MUCH sense as to why when I debugged I had to guess which of the 4 weapons my character was using lol

graceful cave
#

player character 0 will always return the local character and nt the character youre trying to attach to

#

is this on the weapon?

fossil sentinel
#

yes this is on the weapon, that's why I have to cast... maybe get player pawn?

graceful cave
#

show where you spawn the weapon

fossil sentinel
graceful cave
#

the character variable needs to be on the weapon

#

not on the character

#

the spawn node should look like this

#

thats where you use Self

fossil sentinel
#

Well I have that variable on the weapon... how did you get Your Character pin on the SpawnActor?

thin stratus
#

He literally showed you in the screenshot above

grizzled totem
#

i'm using a widget to interface to a door & elevator, and the widget in MP doesn't fire off at all with server or client clicking on the widget button from their widget interaction component. what could fix this?

thin stratus
#

I assume your Door/Elevator has the RPC in it and it doesn't work for Clients?

grizzled totem
fossil sentinel
#

I'm sorry guys - I'm trying here. I had to create a new one to get the pin πŸ˜ƒ

thin stratus
#

You can't call RPCs in non-client owned Actors.

#

@grizzled totem

#

ServerRPCs in an Actor that the specific client doesn't own won't ever reach the Server.

#

Neither will ClientRPCs from Server (cause there is no specific owning client.

#

You can't directly go from Widget to Door to Server.

grizzled totem
#

Ok. Hmm thank you. its working in SP atm but wasn't sure what all it would take to have it work in MP.

thin stratus
#

A lot

#

First off: Understanding how Ownership and RPCs work

grizzled totem
#

i figured itd be alot haha

thin stratus
#

That#s why people say: If you need Multiplayer, do it directly.

grizzled totem
#

I was having a time just getting the Widget to finally use the interface right for operating the door and elevator separately.

thin stratus
#

Yeah you'll have to route your logic through something client owned

#

Like the PlayerController

#

Widget -> PlayerController -> Server -> InterfactWithDoor

grizzled totem
#

Okay. Thanks i'll look into doing that to get it working in MP and might be back.

mystic barn
#

Hi guys - anyone know's if something changed regarding local multiplayer and player controller dispatching in this regard?

#

Because UE recognizes all my controllers only as controller 0

steep grail
#

hello all, I have just recently started making a game. I have a dedicated server for it going. The problem im having when the game connects is the game is frozen and the server log window gives displays this over and over again can someone help me out?

#

the server is on one pc and the client on a different pc

lone vapor
#

Hey all, can anyone please help me with this seemingly very basic multiplayer sync issue?
My client doesn't see the first update of the text render component on this AI character.
It still sees the health value as 100, even though the print string is suggesting the client does actually know the character's health is really 90

#

The second time the server shoots the AI, the text render updates, but it stays 1 shot out of sync:

inland rain
#

might sound like a stupid question but im new to UE4, but how do I add background music? lmao

hazy herald
#

@inland rain shouldn’t be in #multiplayer but... in BP you can do they play sound 2d feature which is useful for background music

inland rain
#

oh s*** didn't realize this was multiplayer lmao

stark hull
#

Hey guys, I might be missing something but, for whatever reason, once I posses a pawn client side, the actor seems to move only on the client that possessed the pawn. I do an RPC when possessing the pawn and when I unposses the pawn (also via RPC) I get sent back to the location I originally possessed the pawn. Any thoughts on why that's happening?

stark hull
#

Ow I see, it's not enough for the client to have the replicate movement ticket. The movement RPCs also need to be sent over

vital thunder
#

how would you guys go about running a multiplayer ready game as a singleplayer player please ?

thin stratus
#

Handling the Singleplayer just as a ListenServer

vital thunder
#

so using server travel etc ... ?

thin stratus
#

Yeah that should all work

#

Just don't create a session and neither start with ?listen

vital thunder
#

ok thanks

grizzled stirrup
#

If you iterate over the same player controllers after traveling to different maps, will they always return in the same order?

granite oar
#

Hey guys, PlayFab not run here

#

Someone using PlayFab in UE 4.22?

#

Severity Code Description Project File Line Suppression State
Error C5038 data member 'UPlayFabAPISettings::DisableAdvertising' will be initialized after data member 'UPlayFabAPISettings::VerticalName'

rotund sapphire
#

You can perhaps try edit this .h file and fix on the error.

granite oar
#

Yes, the problem it is resolve this problem 😦

#

I go try here edit the file

rotund sapphire
#

The error points at/around line 21, tho i have no idea what could be there. But with a bit of trial and error it may be possible to flip the order of these defined properties and the error should go away. Or you can wait for official fix.

granite oar
#

True, I go try here

#

Compiled here, Now I go try if the demo run lol

#

Thanks @rotund sapphire by your help.

rotund sapphire
#

You're welcome. Hope you are keeping a backup of your project just in case.

granite oar
#

ok πŸ€™

tribal shore
#

i'm having a weird problem

#

my multiplayer project used to work but then it suddenly stopped working

#

i have to versions of ue4 installed ue4.19 and 4.21

#

but weirdly enough none of them seem to support it

#

the only way i can open the project is from the .uproject file

#

also now the join session node doesn't work

rotund sapphire
#

firewall may prevents your editor to use networking features, or perhaps you should enable 'dedicated server' in the play options if that's the default for your project

tribal shore
#

it works on editor

#

but when packaged the join session node doesn't work :(

#

it used to work tho

#

and i've changed nothing of the create/join game blueprint

#

it doesn't work in mobile to mobile
or in computer to mobile
or in computer to computer...

wheat eagle
#

I have trouble finding documentation for Advanced Sessions plugin. Can someone give me a useful link please?

#

I'm trying do understand what "Min slots" parameter is supposed to do and what filters I can use for Find Sessions Advanced BP

thin stratus
#

The AdvancedSession Plugin is created by a specific user. You should just contact them or check their forum thread.

wheat eagle
#

ok I will try that. Still , can you explain me what Min slots in Find Sessions Advanced does?

modern token
#

Hey, I was wondering how much can I customize the dedicated server generated by the UE? What if I want to customize the packet form, or I don't know let's say I want to use TCP rather than UDP (bad idea I know, but let's say that)? I feel like networking in UE is very hard to customize, please let me know I'm wrong πŸ˜„

#

I am asking because I would like to use a dedicated server from my own... But the thing is it would take quite a lot of effort to reproduce the "positioning authority", that is reproduce the fact that a player cannot go through walls, hills, etc. because I think it requires to parse the map or have some kind of geodata. So using the dedicated server of UE is definitely a good idea, however I would like to be able to tweak the networking of my dedicated server and client at most...

#

If anyone is familiar with networking in UE, let me know πŸ˜‰

#

(By the way I see no #networking channel here :p)

woeful fox
#

Hey guys. I've started to work on a multiplayer game project but when I was creating the server hosting and tested it, I got 2 errors. First, if I click on Host button and test with 2 windows, in both windows the players spawn to a certain map without having to press "search game" for the player that wasn't hosting. Second, they might be in different worlds or something, because when they spawn, they can't see each other. Here's a video that includes my blueprint script and the errors as well, please check it out and help me if you can: https://youtu.be/tVg4jYxlZjY

vital thunder
#

would that be a good idea to store a character index in a player state to actually let the server now which class he must spawn for each player ?

woeful fox
#

you mean a player index? I can try that actually but there should be another way I believe

vital thunder
#

oh sorry I wasn't trying to answer, I have actually no idea of how to help you out :/

woeful fox
#

no problem, I will try to do something with indexes if no one answers

#

I've tried so many methods and spent so much time on this but I'm missing something for sure

vital thunder
#

good luck

woeful fox
#

thanks, I'll wait for a while to see if anyone has any ideas I just don't wanna mess up my code even more

grand kestrel
#

@modern token to be blunt you're reinventing the wheel and there's no reason to and your assumptions are incorrect.

#

If you're that unfamiliar with the engine then you should focus on learning it first

#

The reason you're not getting a reply is because your question is the type that generally leads to continuous newbie questions about an advanced and frankly pointless topic

#

Maybe start with Cedric's compendium and build a small game or two then come back to it

hoary spear
#

Wasnt it always?

#

Cant say i noticed any difference

#

Hmm maybe its my hacky setup that always was shady then. I always needed delays on stuff to make it work properly because it was so slow

fringe dove
#

does anyone know if the message bus can communicate over pipes instead of UDP?

#

hmm seems everything may be in Engine/Plugins/Messaging, just see TCP and UDP

hoary spear
#

4 sec? Really? That sounds insane

#

I can try some when i get home.

fringe dove
#

@lilac gazelle how long does it take for OnActorChannelOpen to be called?

#

and have you increased bandwidth limits?

#

prob not

hoary spear
#

Using plugin?

#

Cant see why it would matter but

#

If this happens for me aswell im definetly downgrading

#

4 ish sec or are you using a timer?

#

Timer then i guess

twin minnow
#

do animation blueprints automatically replicate?

hoary spear
#

Have you tried calling the beginplay manually?

#

Was pretty sure i just saw the node...

fringe dove
#

@lilac gazelle have you tried on a blank test project (like third person template)?

wild arrow
#

Any recommendations for a dedicated server In EU ?

spark wadi
#

I have an issue when i try transferring a boolean from client to server. It's supposed to show that Player 2 is ready to start a match, but when I check it on server it shows that boolean "player 2 ready" is not activated. What am I doing wrong here?

#

I have 0 idea how to transfer variables from client to server

twin minnow
#

is this variable, ready, set to replicate?

spark wadi
#

For player 2? No

#

As I understand replication only works from server to client

flint plaza
#

Hi guys. I have a vehicle which has a canon weapon firing bullets (currently only working for single player)

#

what is the best way to replicate it for best performance and least lag?

#

I was thinking owner client can fire his own bullets and send RPC to server to fire bullets as well so the bullets get replicated to all others except owning client

#

but my game has up to 16 connections at the same time

#

will this be the best approach?

viral raft
#

Anyone who knows how to build a dedotated server very easy?

bitter oriole
#

It's never very easy since you need a source engine

#

If you need a dedicated server you're not near "easy" in the first place

viral raft
#

ah

#

Poop

#

Any good tutorials?

bitter oriole
#

Do you really need a dedicated server in the first place ? If you need tutorials you're probably not doing the next Fortnite

#

No offense

#

Listen server goes a long way, it scales really well

#

You basically don't need to think about servers anymore

#

It makes cheating easy, but unless you plan on buying some solid anticheat tech, people will cheat anyway

viral raft
#

I need somesort of online multiplayer

#

Doesnt really matter what kind of servers

#

As long as people can play togther on internet @bitter oriole

bitter oriole
#

@viral raft Then you really should look at listen servers. Basically one player hosts the game

#

It's not a great idea for a PVP game, or a large-player-count game, but it's free, doesn't require complex setups, doesn't need hosting servers, protecting against attacks, etc

viral raft
#

@bitter oriole Yeah but listen servers need portforwarding for the hosting player right?

#

Or can it be like steams p2p system without port forwarding

bitter oriole
#

Steam should enable NAT punch which makes port forward not required

viral raft
#

Am currently using listen servers, but relying on steams backend, and since i release on discord first its a no go

#

so i need smth different πŸ˜„

#

Discord has a game sdk, but i am not understanding C++ yet. So its hard to implement for me

#

I know C#, but its complete different πŸ˜‚

bitter oriole
#

DOn't confuse Steam / Discord (sessions) with your multiplayer setup (dedicated, listen)

#

Completely different things

#

Steam doesn't host anything

viral raft
#

No i know

#

But am currently relying on the steam backend for matchmaking

#

Which is not allowed when publishing on discord

#

So i need to change the system, thats why i was asking for dedicated servers

modern token
#

@grand kestrel Well thanks for you honesty I appreciate it. I think I just wanted to go too fast, and right now I feel like I'm just moving the problem further in time but... Although I already read the nice PDF from Cedric, I will follow your advices. Thanks.

bitter oriole
#

@viral raft Matchmaking and dedicated have nothing to do with eachother

viral raft
#

I know

#

πŸ˜„

bitter oriole
#

So you don't need dedicated servers for Discord

#

You just need matchmaking for Discord

#

Which they might provide, or not, I don't know, never looked at that store

viral raft
#

They kinda do i am right

#

But since i dont understand C++, and they only have a C++ sdk and no BP its gonna be hard to do hahah

flint plaza
#

I am messaging my problem again because it's gone a bit up and wasn't answered

#

I have a vehicle which has a canon weapon firing bullets (currently only working for single player)
what is the best way to replicate it for best performance and least lag?
I was thinking owner client can fire his own bullets and send RPC to server to fire bullets as well so the bullets get replicated to all others except owning client
but my game has up to 16 connections at the same time
will this be the best approach?

vital thunder
#

Hey guys, what can be the reason for UE to crash as soon as I use server travel with two PIE as long as I have only one everything works fine but two is a big no

flint plaza
#

try launching it via CMD in standalone mode

vital thunder
#

it work

#

but apparently PIE make it crash

flint plaza
#

Yes. Whenever you server travel, you standalone

vital thunder
#

oh ok didn't knew that

reef heath
#

Hi, has anyone used the Amazon GameLift Client SDK plugin before? Whenever I call UGameLiftClientObject::CreateGameLiftObject from my game instance object, it throws an error:
[2019.04.19-18.36.29:516][ 0]LogWindows: Error: [Callstack] 0x00007ff7cebf33ff ProjectCoreServer.exe!UGameLiftClientObject::Internal_InitGameLiftClientSDK() [d:\github\projectcoreue4\mainfiles\plugins\gameliftclientsdk\source\gameliftclientsdk\private\gameliftclientobject.cpp:11]
[2019.04.19-18.36.29:517][ 0]LogWindows: Error: [Callstack] 0x00007ff7cebf2a17 ProjectCoreServer.exe!UGameLiftClientObject::CreateGameLiftObject() [d:\github\projectcoreue4\mainfiles\plugins\gameliftclientsdk\source\gameliftclientsdk\private\gameliftclientobject.cpp:42]
[2019.04.19-18.36.29:518][ 0]LogWindows: Error: [Callstack] 0x00007ff7cee900e4 ProjectCoreServer.exe!UCDGameInstance::UCDGameInstance()

twin minnow
median elbow
#

does anybody know how you might (or have a link to some resource) make sure everyone joining a session is "ready" before they actually join?

#

i'm just wondering how i'd go about this using the advanced sessions plugin

#

basically, i want the user to click "find match", but then ONLY join once there is enough people to play the match

#

something like how counter strike does matchmaking, except i don't really need the "ready" dialogue, unless that makes it easier

#

i would just have everyone automatically be ready once they click find match and wait for a session with enough people

median elbow
#

Would it make sense to have one master server everyone joins right away when they find match, then the game mode of that server does all the logic, like finding players with similar ping and possibly rank, who are also currently searching for a game, then make all those users travel to an available game server with the actual game match?

#

Will advanced sessions plugin and steam subsystem already do something similar for you?

glad shell
#

I'm having a little issue. I'm starting to implement my first steps of multiplayer in a first-person shooter. If I start the game from the test map, Both my players show up. I have bullets replicating, most stuff works... But If I start my game from the StartMenu map, and then both players click Play, they end up on their own maps and can't see each other. Anyone help me figure out where to look to fix that?

median elbow
#

Are you using a discrete server?

#

Otherwise one of the players will need to host a session, while the other joins it

glad shell
#

@median elbow Right now, I'm testing by just setting the Players to 2 in the PIE.

#

fairly new to UE4 and very very very new to trying anything MP πŸ˜ƒ

twin minnow
#

How are you connecting to the main map from the start menu?

viral raft
#

Does gamelift have a free tier/trial?

bitter oriole
#

The Gamelift pricing page mentions one

twin sable
#

so I'm trying to create an array of all of one type of actor in a game which is used to construct a minimap. So i'm simply having the actors call a multicasted networked function within the beginplay function, which will make all of the clients have an up to date set array of actors.

the problem with this is that if a player connects later than others, this function wont be called.

TLDR: Is there function similar to beginplay that would ensure actors created through replication will call?

graceful cave
#

everyone already runs begin play on any actor that spawns

#

so multicasting would be pointless

twin sable
#

ah

#

so I'll just get the actors to add themselves on beginplay

graceful cave
#

just add themselves to the array on beginplay and new clients will run that when they join

twin sable
#

thanks

jolly siren
#

Does anyone know how to keep smooth movement with something like a melee that lunges towards an enemy?

  • I have tried storing past character locations on the server and lunging towards a location in the past on the server. In order to try to get the server and client lunging towards the same location. This works in the case where there is no collision blocking that location on the server. But fails when there is collision between those points. For example, when the enemy is walking towards the attacker. The rewind location is therefore behind the real location of the enemy on the server. So collision with the victim character blocks the attacker from reaching the rewind location on the server. Thus causing correction on the client. I can't just disable collision in this case because we support listen servers as well.

  • I have tried using bIgnoreClientMovementErrorChecksAndCorrection=true to do a client authoritative approach where the client drives the movement and the server just follows. This works except when I flip the bool back to false, at the end of the melee, I still get a very noticeable correction.

jolly siren
#

Is the best approach just to interpolate the correction at the end of the melee over a few seconds so it is mostly hidden? Wondering if anyone has done that before.

#

@thin stratus I see you were trying to use PostNetReceiveLocationAndRotation to smooth out corrections. Did you ever get that working?

thin stratus
#

I just used what the CMC did

#
void AHLHoverdrone::PostNetReceiveLocationAndRotation()
{
    if (Role == ROLE_SimulatedProxy)
    {
        const FVector OldLocation = GetActorLocation();
        const FVector NewLocation = FRepMovement::RebaseOntoLocalOrigin(ReplicatedMovement.Location, this);
        const FQuat OldRotation = GetActorQuat();

        HoverComponent->SetNetworkSmoothingComplete(false);
        HoverComponent->SmoothCorrection(OldLocation, OldRotation, NewLocation, ReplicatedMovement.Rotation.Quaternion());
        OnUpdateSimulatedPosition(OldLocation, OldRotation);
    }
}
jolly siren
#

Ahh okay, I'm trying to smooth autonomous proxy corrections; at the end of a specific ability

thin stratus
#

That happens somewhere else

#

At least I think so

#

I think corrections are really just forced

#

You'd need to apply smoothing when the correction comes in

jolly siren
#

Hmm okay, I'm trying to smooth it out over a few seconds at the end of a melee lunge. So it doesn't look so awful.

thin stratus
#

ClientAdjustPosition_Implementation

#

That is overriding everything

#

So you'd need to add your smoothing there I guess

jolly siren
#

Okay, checking it out now

thin stratus
#

However Idk how needed that is

#

Corrections should barely happen

#

Even on higher pings

#

And it's sqrt(3) of an error

#

Even if you get corrected, it's barely visible

jolly siren
#

It's very visible with my melee

rotund sapphire
#

I made the mesh move independently from the capsule, so it allows the capsule to pop in place and the mesh will smoothly lerps towards

jolly siren
#

Since the client and server are lunging towards different locations

#

Due to latency

#

@rotund sapphire This is for the local client tho

#

That approach makes sense for simulated proxies

#

I don't know how I could get the server and local client to always lunge towards the same location.

#

The only two options I can think of are.

  1. Don't start the melee on the server until the client hits the target. This would be strange though since the melee lunge isn't an instantaneous action like bullet fire.
  2. Disable character to character collision on the server while the lunge is happening so we can lunge to the same location on both the client and server. Listen servers would unfortunately see players lunging through each other in this case tho.
#

So if they aren't lunging towards the same location then I need a way to smooth out the correction.

rotund sapphire
#

All this sounds a bit like early optimization

jolly siren
#

Optimization? This isn't optimization. This is trying to create a smooth viewing experience for the client.

rotund sapphire
#

Like, overly optimizing on the visual experience, but i'm not judging anything here, merely just expressed my thoughts :)

bitter oriole
#

Visual experience on a game should be smooth

jolly siren
#

No it looks awful without any of this

#

Which is why I am working on it

#

A lot of rubberbanding looks bad for the client

bitter oriole
#

My personal take on similar issues, albeit without CMC or anything, is to switch networking off while doing deterministic animation

#

In my case it's a vehicle landing - there's a "land" event, and then replication stops while the vehicle lands smoothly

jolly siren
#

That is essentially my bIgnoreClientMovementErrorChecksAndCorrection=true approach.

#

The issue is that when I flip it back to false after the lunge I get a big correction

#

So that correction needs to be smoothed over a few seconds to not be visible

bitter oriole
#

Do you have a large correction because of actual differing simulation outputs, or a large correction because of timing / CMC not being aware of what happened ?

jolly siren
#

I think it is because of timing. I have tried delaying the flag being flipped back to false on the server by ExactPing / 1000.f. Which I thought was working, but I'm still getting a bad correction at the end of the melee if I jump and melee.

#

With the bIgnoreClientMovementErrorChecksAndCorrection=true approach, I'm not even changing the velocity on the server. I am using ClientAuthorativePosition and changing the velocity on the autonomous proxy.

bitter oriole
#

I don't know the CMC at all but I guess it's important that all players resume networking starting from the same values

jolly siren
#

So manually set the character location on the server at the end of the melee?

thin stratus
#

ListenServer?

#

On a Dedicated it might really make sense to simply trust the client for the animation

#

And then go from there

jolly siren
#

I mean, send the attacker's location on the client, at the end of the melee, to the server. And update the character's location on the server to that location.

#

For listen servers we aren't worried about cheat protection or anything like that. We use dedicated for everything except for practicing against bots.

#

How would you implement "trusting the client and then going from there", Cedric?

thin stratus
#

Hm, not sure. The Server needs to know that the client is performing the animation.

#

And the next location that comes in should then be accepted (if not too much different)

#

Are there no docs on how SmashBrothers does that stuff?

jolly siren
#

I haven't been able to find anything

#

(also we don't use root motion)

sharp pagoda
#

Smash bros uses deterministic simulation exi

#

Ethan are you using the builtin character movement system or are you trying to initiate your move based on an rpc?

jolly siren
#

My server rewind approach used the built in character movement system (with a custom flag).
And my bIgnoreClientMovementErrorChecksAndCorrection approach uses a rpc

#

Re-pasting for visibility

#
- I have tried storing past character locations on the server and lunging towards a location in the past on the server. In order to try to get the server and client lunging towards the same location. This works in the case where there is no collision blocking that location on the server. But fails when there is collision between those points. For example, when the enemy is walking towards the attacker. The rewind location is therefore behind the real location of the enemy on the server. So collision with the victim character blocks the attacker from reaching the rewind location on the server. Thus causing correction on the client. I can't just disable collision in this case because we support listen servers as well.

- I have tried using bIgnoreClientMovementErrorChecksAndCorrection=true to do a client authoritative approach where the client drives the movement and the server just follows. This works except when I flip the bool back to false, at the end of the melee, I still get a very noticeable correction.
sharp pagoda
#

"But fails when there is collision between those points. For example, when the enemy is walking towards the attacker." Rewinding should not factor in realtime conditions that could affect the rewind. The purpose of the rewind is to simulate the game state of the client at the moment the move was initiated, so you need to rollback and simulate any dynamic obstacles like the other players @jolly siren

#

When the enemies aren't rolled back, you're creating a potential divergence in the simulation which is exactly what you're seeing

jolly siren
#

Right, yeah that makes sense. I'm not actually rolling back anything. I'm just using the rolled back victim's location when performing the lunge on the server.

#

The issue with rolling everything back is it doesn't work for listen servers

#

You would visibly see the rollback

twin juniper
#

your server is what? dedicated, vps or? @jolly siren

jolly siren
#

We use dedicated servers for everything except when playing against bots, in which case we use listen servers.

sharp pagoda
#

So ethan if you're rolling back the victim what is the client hitting that's causing the divergence? Other players not involved in the simulation?

jolly siren
#

Sorry, I didn't explain it correctly. I edited my message.

#

I'm not actually rolling back anything

#

I'm just using the rewound location on the server when performing the lunge

#

So the client and server are lunging towards the same location

twin juniper
#

ok cool but what is your dedicated server?

jolly siren
#

But it's hitting the victim in the case I am describing there.

jolly siren
#

We use AWS

twin juniper
#

what is this from?

jolly siren
twin juniper
#

hmm

#

πŸ€”

#

but is this free?

jolly siren
#

no

twin juniper
#

hmm

bitter oriole
#

What's that got to do with his issue

jolly siren
#

Anyways, I'm in the middle of getting help with an issue

twin juniper
#

how to configurate?

bitter oriole
#

@jolly siren So, when you re-enable net, can you log the transforms and compare on each device ?

sharp pagoda
#

"I'm just using the rewound location on the server when performing the lunge" So you have two choices here (that I can think of), either 1. Use fully client authoritative lunging with some basic anti-cheat checks or 2. Implement full rewinding and resimulation to emulate a deterministic playback

jolly siren
#

Right, that's what I'm thinking too xen. The issue with #2 is that it doesn't work for listen servers

#

I guess the correct approach would be to do #1 for listen servers and #2 for dedicated

twin juniper
#

where are the prices and how to configurate this server? @jolly siren

jolly siren
#

@bitter oriole Yeah I can do that. I am experimenting with just sending the ending location from the client to server and setting the actor location on the server to that.

#

To avoid the correction

bitter oriole
#

@jolly siren here's a breakdown of what I do here on my listen server setup :

  • Owning player has full rollback/replay
  • Server (also a player) has independent simulation based on input sent by the client, with framerate interpolation
  • Other clients get interpolated transforms basically
#

When I need animation, I pause networking and resume it

#

When restarting network, I have some processing on the first replicated frames to filter out some errors

jolly siren
#

Doesn't the listen server see the rollback though?

bitter oriole
#

The listen server can't rollback, he's authoritative.

#

Only the remote client can ever rollback

twin juniper
#

anyone to recommend me cheap server? like this aws but cheaper

bitter oriole
#

No

#

We can't recommend hosting services - AWS is very likely to be the cheapest ever

twin juniper
#

why?

bitter oriole
#

Depends on your game

twin juniper
#

ok

bitter oriole
#

Try a few and pick the best

twin juniper
#

ok

bitter oriole
#

Better yet, don't have dedicated servers πŸ˜‰

twin juniper
#

I want to learn to configurate it and to make request from this computer to the s erver to make multiplayer system and many other things

bitter oriole
#

Okay, feel free to ask questions on particular points that you don't understand from tutorials. There are quite a few on this

#

I usually recommend the "UE4 multiplaye rmastery" course on Udemy

jolly siren
#

@bitter oriole To my understanding rollback is normally server side. The simple example is for favor the shooter. So the client shoots the player on his client. But it doesn't hit on the server because the locations differ. So the server rewinds and checks to see if the trace would have hit on the server at that time in the past.

twin juniper
#

what you mean by "Better yet, don't have dedicated servers"

bitter oriole
#

That's a different kind of rollback here @jolly siren - my rollback is in the context of "rollback + replay", which is always on client, while you describe lag compensation

twin juniper
jolly siren
#

Ahh okay, yeah I was using more of the lag compensation approach in order to get the client and server moving towards the same point. But it doesn't work in cases where collision blocks obviously since it isn't a real rollback.

#

I'll need to read up on rollback + replay

bitter oriole
#

@twin juniper Dedicated servers are expensive, difficult to setup and maintain, require care to not get hacked, basic legal guidance to not be illegal in Europe for example, and dedicated servers are only useful if you're doing something way harder than what you should be doing as an indie, IMHO.

twin juniper
#

ok

#

what is IMHO?

bitter oriole
#

Google it

twin juniper
#

a ok

bitter oriole
#

Listen servers where a player hosts the game don't have any of these issues, at the cost of being unable to prevent cheating, and unable to support large player counts.

twin juniper
#

ok

#

I don't need local multiplayer or listen servers

bitter oriole
#

You never need listen server, it's just the most sensible approach to indie multiplayer

sharp pagoda
#

@jolly siren I don't remember if these specifically cover rollback/resim, but I would definitely watch these talks https://www.youtube.com/watch?v=h47zZrqjgLc https://gdcvault.com/play/1024001/-Overwatch-Gameplay-Architecture-and

GDC

In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking. Register for GDC: http://ubm.io/2gk5K...

β–Ά Play video
fleet raven
#

wtf y recommend AWS

#

AWS is the most expensive hosting service there is

bitter oriole
#

No one's recommending anything at all

twin juniper
#

they said me that they are the cheapest or I understand them this

jolly siren
#

Thank you xen. I've watched those before, but it's been a while. I'll rewatch πŸ˜ƒ

twin juniper
#

so reccomend me cheaper @fleet raven

bitter oriole
#

Listen servers are cheaper

#

Since you know, they're free

twin juniper
#

ok

#

but I don't need them

#

I don't need listen servers

bitter oriole
#

I thought you wanted cheaper hosting

jolly siren
#

How do you store the rollback state Stranger? Are you strictly storing locations?

bitter oriole
#

No, I store the full transform, velocity, angular velocity, and a timestamp

#

The Udemy course I mentioned has a great UE4-based guide to rollbakc and replay for what it's worth

#

But CMC implements rollback replay, so you don't need to add it if you're using character

#

Just need to understand how it works

jolly siren
#

Ahh okay yeah I'm using character

bitter oriole
#

I didn't use character so I had to do it

twin juniper
#

so recomend me cheaper servers but not listen-okay? this is better I think like explanation

twin minnow
#

aws is decently cheap if u deploy a linux server tbh

#

and the performance is good

jolly siren
#

@bitter oriole Can you explain how rollback would help with my melee?

twin juniper
#

I will work with windows

bitter oriole
#

Windows dedicated servers is just nonsense

twin minnow
#

u can build a linux server on windows

#

im currently working on making a video on it

#

altho there is a good article about how to do it

twin juniper
#

ok

#

can you send me link?

bitter oriole
#

It's in the official engine doc

#

Can you start by reading that ?

#

You'll work much faster by figuring it out yourself

sharp pagoda
#

Ethan from what I can tell it enables state consistency at the beginning of the attack, so therefore you won't have to be corrected after completing the attack.

twin juniper
#

ok

#

in the doc then which category

bitter oriole
#

"UE4 doc linux" on Google ?

twin juniper
#

ok

#

ty

bitter oriole
#

"Cross-compiling for Linux" is the actual doc page

#

@jolly siren Well, I have no idea how your melee is implemented, and I have little experience with CMC. However, you should be able to suspend CMC when starting the ability, then telling the CMC at the end of said ability where you are know - velocity, location, rotation - before restarting it. The important part is
A) having deterministic animation
B) resetting the CMC state to a common state

#

If you do that, you shouldn't get a rollback

sharp pagoda
#

In the event of an inconsistency, do you favor the client stranger?

bitter oriole
#

No, I favor the server, so the client rolls back

#

Though the client is permitted some leeway because it's impossible to be fully deterministic on PC

sharp pagoda
#

Hm, then I think he'd be in the same position as he is now

#

I think ethan's issue is dealing with inconsistencies

bitter oriole
#

The point is that inconsistencies shouldn't happen in his case.

#

Either they don't really exist and CMC is either not behaving, or not driven properly ; or they exist and the animation isn't fed the same parameters or something like that.

#

If your client was in sync before animating and is not in sync after, it means one of these things

#

Dealing with inconsistencies is a thing but that's not really the issue here, the issue is preventing them

jolly siren
#

Yeah that makes sense. I'm strangely getting a correction still sometimes even when sending the client's ending location to the server and setting the character's location to that. So digging into that now.

#

I'm going to check out that udemy course too

bitter oriole
#

I usually put tons of log in the movement component to get a detailed overview of what happened - like two text files aside each other with the same action on the to machines

#

Usually it's quickly clear what happened

jolly siren
#

I really appreciate the help xen and Stranger πŸ˜ƒ

jolly siren
#

@sharp pagoda Have you done interpolation for the autonomous proxy to smooth out corrections received from the server?

sharp pagoda
#

@jolly siren No, but the CMC has that built in if you're looking for a reference

thin stratus
#

Half sure the autonomous one just gets a hard override

sharp pagoda
#

Ah yea it might, it would be fairly easy to implement similar smoothing to the simulated proxy solver though

jolly siren
#

Yeah it feels like autonomous proxy just gets set to that location without smoothing

#

It's strange that I am still getting corrections when I am literally sending the client ending location to the server and updating the server location before flipping bIgnoreClientMovementErrorChecksAndCorrection back to false

sharp pagoda
#

If you need interpolated adjustment, make sure you have a hard limit where it will override the lerp solver and set it directly if ||discrepancy|| > 1 meter or something

jolly siren
#

Makes sense, I just hope I can find what is causing the correction still

sharp pagoda
#

How much movement happens in the period right before you initiate the lunge?

jolly siren
#

That is what seems to be throwing it off. When I jump and melee

sharp pagoda
#

Does the correction still happen even when both players are still?

jolly siren
#

No, I've only seen it if the attacker jumps before meleeing

sharp pagoda
#

So yea it's probably a processing order issue

twin juniper
#

so I didn't understand for cheaper servers? not listen servers

sharp pagoda
#

The jump was simulated on the client but not yet on the server

thin stratus
#

It's actually weird that executing the animation corrects you

sharp pagoda
#

You would need to add strict ordering integrated into the cmc to solve that ethan

jolly siren
#

Yeah I'm testing with 100ms ping, jumping, and then meleeing while in the air.

thin stratus
#

Does it correct you in the exact moment the anim executes?

#

Also doesn't the CMC support root motion stuff?

jolly siren
#

It's not the animation really. I'm not using root motion. I'm setting the character's velocity to lunge him towards the victim at 5000.f speed.

thin stratus
#

Oh that, yeah that corrects me too

#

haha

#

I do this when players ram each other

#

And the Server and Client apply it in different ticks

#

So they get corrected

#

Haven't really fixed that yet

jolly siren
#

I'm setting the velocity on the autonomous proxy only; I'm using ClientAuthorativePosition. And setting bIgnoreClientMovementErrorChecksAndCorrection to true. So it doesn't get corrected.

thin stratus
#

Yeah, but it will get corrected once you renable it

#

Cause the location is still different

jolly siren
#

Right, that's what I was seeing. So I'm sending the ending location from the client to the server

#

And setting the location on the server to that location

#

And then flipping bIgnoreClientMovementErrorChecksAndCorrection back to false

sharp pagoda
#

In theory your system should work fine with bIgnoreClientMovementErrorChecksAndCorrection always false. You might need a bit of redesign for that though

jolly siren
#

Yeah it works as always true, but I only want to have it true for the melee lunge.

#

Wait did you mean always true?

thin stratus
#

And updating the Server location doesn't resolve it?

sharp pagoda
#

No I mean never ignore corrections during the melee

jolly siren
#

Why would not ignoring work? Then I get corrections during the melee as well.

thin stratus
#

If you need it synced, you need to use a flag

jolly siren
#

Updating the server location looks to have make it occur a lot less. But it's still happening sometimes.

thin stratus
#

So instead of manually setting the velocity

sharp pagoda
#

If you design it like how the cmc's movement was built, you can have the client and server constantly on the same page

thin stratus
#

Or some acceleration

#

You need to add a flag for that

#

And set the flag

#

Then server and client will do it at the same time

#

We have a downwards push

#

It works the same as jumping in the end

#

It won't correct you

#

But you can't just apply force on each one, that will cause a correction in the end

#

Cause you will never get that synced

#

PressedMeele->SendFlag and SaveMove

sharp pagoda
#

Yea the saved move stuff is what I was thinking of

#

It's the closest you can get to emulating determinism in the cmc

jolly siren
#

That is what I started with. But it still was just lots of corrections because the server and client were lunging to different locations due to latency

thin stratus
#

That shouldn't happen though

#

The whole system is based on the idea that they do the same thing at the same time + ping

#

When the update comes in x ms later, the Client just replays the moves + the server move

#

And if you didn't do much wrong they end up at +- the same location

#

The SavedMoves + replay part is important

jolly siren
#

Hmm that isn't what I was seeing. So I wrote some lag compensation stuff that didn't work because of collision.

#

I guess I'll try going back to that

thin stratus
#

If it's only about apply a force/velocity change in direction X

sharp pagoda
#

Ethan if you look at lawbreakers their entire movement system (afaik) is implemented in the same style as the cmc saved move system

thin stratus
#

Then the flag does it

#

You just need to pass all required info

#

If the Direction and the strength of the attack are always the same

#

(e.g. 500 strength and actor forward) then it's fine to just pass the "PressedAttack" flag

#

If you have a player input direction (stick direction) and a player input strength (time button hold or so), you need to save/pass that too

#

E.g. a Jump has a hold time in the CMC and a fixed z Strength. That's why they pass and save the hold time

jolly siren
#

There is info on lawbreakers implemenations?

#

looking it up now

#

I wish there were more big open source games besides UT

sharp pagoda
#

I meant like look at the kind of movement abilities available to the player in that game. Not sure if there's any dev blogs etc, can't remember where I heard that they use the cmc system from

jolly siren
#

@thin stratus How do you pass the required info tho?

thin stratus
#

Most of my stuff is based on fixed values.

#

But usually you follow the way InputAcceleration is passed.

jolly siren
#

The strength is constant. But the direction is not at all. It depends on the victims location.

#

Which is why it was different on the client/server

thin stratus
#

But the victims location should be the same for both too

#

Or actually it shouldn't

#

Cause of the ping

#

Shot Behind Wall

#

Well the CallServerMove function gets an old an new move

#

The move contains the direction

#

So you gotta make a variable there

jolly siren
#

Right, ping was the issue. So I added a lag compensation solution. But it doesn't work in cases where the historical target location is behind the real character location on the server. Since they collide.

thin stratus
#

There should be a netQuantized normal for that

#

It's important that, if rounded etc., the Client uses the same rounded value!

#

Then in CallServerMove, it passes the stuff to ServerMoveDual, ServerMove and ServerMoveOld

#

Not sure if you can easily change that without your own Component

#

E.g. ```cpp
// Acceleration should match what we send to the server, plus any other restrictions the server also enforces (see MoveAutonomous).
InputAcceleration = NewMove->InputAcceleration.GetClampedToMaxSize(GetMaxInputAcceleration());
AnalogInputModifier = GetAnalogInputModifier(); // recompute since acceleration may have changed.

#

That happens to the input acceleration

jolly siren
#

Are you saying there is existing values on the move functions I can use? Or to create custom ones for them all and pass something else there?

thin stratus
#

I never extended the CMC. I made my own.

#

So I had/have free choice of parameters for ServerMove (ServerRPC)

#

The CMC might not provide that out of the box.

#

I also don't know what the CMC allows you to override

#

I think by default, the ServerMove function has, TimeStamp, InputAccel, ClientLocation ;MoveFlags and MovementMode.

#

I assume you'd need to pass the NetQuantizedNormal AttackDirection to the Server somehow (via the RPC)

#

So you might better off spending some time making a custom movement component

#

Even if that means copy pasting 90% of the CMC

#

But don't start with that until someone confirms

jolly siren
#

Yeah UT created their own move functions

#

For different reasons, but they did and it is quite a lot of code just for that

#

So it should be all overridable without a custom CMC

#

I guess VictimLocation might be better to send tho instead of AttackDirection

#

Hm except I keep moving towards the victim

#

On tick

thin stratus
#

Really depends. Idk what is cheaper.

jolly siren
#

So it's not just a singular location that I need to lunge towards. It tracks the player and keeps moving towards the victim until it gets close enough

#
        // Perform the velocity based lunge
        FVector DirectionToEnemy = MeleeEnemyLocation - MyLocation;
        DirectionToEnemy.Normalize();
        Velocity = DirectionToEnemy * MeleeSpeed;
#

I do that on tick while meleeing

thin stratus
#

WΓ€h

#

Also, may I introduce you to "GetSafeNormal()"

#

Saves you the additional Normalize line every time

jolly siren
#

πŸ˜ƒ Thank you, that is a helpful tip

vital thunder
#

hey, is there a nice way to handle the host leaving a game ?

thin stratus
#

The GameInstance should have a OnNetworkError delegate

#

Despite that, everyone will time out at some point and return to the main menu

#

or whatever level they joined from

vital thunder
#

ok thx i'll look at that OnNetworkError πŸ˜ƒ

jolly siren
#

It's kind of strange that CMC server moves were setup to only allow sending custom bools

fleet raven
#

how else would they do it though

#

you can't make rpcs extensible with new arguments

jolly siren
#

Even if it passed a ustruct?

onyx gale
#

Anybody familiar with the process of setting up networking for a HTML5 UE4 game?

fleet raven
#

I guess it could be done by passing a struct that has a net serialize function that then calls another function that is virtual to let you serialize your custom move inputs manually

thin stratus
#

It's kind of strange that CMC <insert newest realization here>.

#

A good start to realizing the madness called CMC

jolly siren
#

I wish someone would do an entire udemy on CMC πŸ™ƒ

thin stratus
#

Well I do understand it to 80%

#

There is a lot of weird code with variable names longer than the HISMcomponent name that I don't get

jolly siren
#

Do you think subclassing all of the ServerMove, or whichever I actually need, and adding a parameter for EnemyLocation will work? Or would that only work for a single shot melee that doesn't keep following the enemy?

#

That or trying to figure out why my client authoritative implementation is still correcting are the options I am looking at right now.

thin stratus
#

You need a custom SavedMove class anyway

#

Here, look at this

#

That explains it a bit

jolly siren
#

Yeah I have a custom SavedMove and that is how I did my initial implementation

thin stratus
#

That wiki post as a dodge move

#

Maybe that helps

#

A convenient place to send the inputs is in the beginning of the OnMovementUpdated method.

#

Seems like that is a better place?

#

Not sure if that is actually a good idea

#

I still think you need to have a custom ServerMove function

jolly siren
#

Right, I was using that wiki when I wrote it

#

I used PerformMovement, but it is the same as OnMovementUpdated

thin stratus
#

The main problem of that wiki entry is (didn't see that before, sorry!) that they perform two RPCs

#

One is ServerMove

jolly siren
#

PerformMovement calls OnMovementUpdated

thin stratus
#

and one is the ServerSetMoveDirection

#

That won't work in my eyes

#

Cause that's not sync

jolly siren
#

Right, ServerSetMoveDirection looks like a bad implementation

thin stratus
#

You do have to pass it via the ServerMove function. I don't think you can get around that

jolly siren
#

I modeled mine after that and sent the enemy to melee like that

thin stratus
#

void UHoverMovementComponent::ServerMove_Implementation(float TimeStamp, FVector_NetQuantize10 InInputAcceleration, FQuat InControlQuat, FHoverInfo InHoverInfo, FVector_NetQuantize100 ClientLocation, uint8 MoveFlags, uint8 ClientMovementMode)

#

I'm sending all kinds of stuff

#

Currently not optimized though

jolly siren
#

It's so ugly to send melee specific stuff for all my moves lol

#

But I guess it's the way to go

#

It just feels wrong

thin stratus
#

The Enemy is on two different places on client and server though

#

So the Direction will be different

#

If you need one direction then either client gets corrected

#

Or client tells server the attack direction

jolly siren
#

Right, that makes sense. Yeah I sent the enemy itself. And was using my lag compensation stuff. But just sending the location would have been better. But still there is a race condition there between the separate rpc and the move

thin stratus
#

Correct

#

So a custom ServerMove is most likely required

#

Even though I'm pretty sure you grinning face is grinning a bit less thinking about making a custom movement comp :D

jolly siren
#

lmao

#

I can do it without a custom move component, like UT. It's just strange to clog all movement with melee specific stuff

fleet raven
#

what are you actually going to add to the move rpcs though?

jolly siren
#

I'm thinking enemy location

thin stratus
#

I would just add the direction

jolly siren
#

Which is the location the client is lunging towards

fleet raven
#

can the server not compute it too?

median elbow
#

how would i only have users join a server session once everyone that is going to play the match is "ready"?

thin stratus
#

I assume the client doesn't see the same location as the server @fleet raven

#

The Local client might see a ghosting image

#

So you gotta trust the client here

#

It's the "I GOT SHOT BEHIND THE WALL" all over again

median elbow
#

i'm using advanced sessions. the only way i can think of is have a master server which EVERYONE joins when searching for a match, doing the logic in there, then having them travel to another server when they are all "ready"

fleet raven
#

πŸ€”

thin stratus
#

That's called Matchmaking

#

once everyone that is going to play the match

#

Like a party?

#

Or just like "Press Play" and wait?

#

@median elbow

jolly siren
#

Did you keep all of these ServerMove functions with your custom movement component? There are so many of them

median elbow
#

yeah

#

sorry

thin stratus
#

Yeah my movement comp is quite big again

#

I only stripped all of the root motion stuff

#

cpp is currently 3.3k lines

median elbow
#

ok, so basically, they don't really have to click "ready", i will do that in code for them. but basically, i don't want someone to join a server all by himself, then wait for the entire server to fill up until theres enough people before the match starts

thin stratus
#

SavedMove stuff not in there cause I moved it into a different file

median elbow
#

i would like them to see "searching for match", until there's enough people ready in a group to play a match

thin stratus
#

@median elbow Yeah that's matchmaking

median elbow
#

so yeah, matchmaking

#

sorry, i guess i could have just said that

thin stratus
#

The backend needs to be able to do that

#

GameLift for example can matchmake and create sessions of your build.