#multiplayer

1 messages ยท Page 167 of 1

soft flare
#

Yea but i mean i can keep my overview rn xD

#

i just dont know what the "own client" thing is for when its not really working

#

I tried dooing it on a normal event but it still plays when the server does it

hoary spear
#

Your logic doesnt really make much sense tbh

#

You come from a Multicast

#

then Rep back to server (coming from the server)

#

why wouldn't you let the server run the same logic server side ?

#

going back and forth is not steps you wanna do for fun

soft flare
#

uhh i did play the animation and wanted to do the remaining code on the server because its the hitbox and dmg that comes at the notify

hoary spear
#

Multicast means its gonna run on both server (already) and all relevant clients

soft flare
#

yeye the animation should play like this

hoary spear
soft flare
#

the problem is the "shake cam" event

hoary spear
#

No, the problem is your entire setup

soft flare
#

Hmm

hoary spear
#

Another thing is ofc how this is set up regarding which animation to play. This could be far cleaner and more maintable code

soft flare
#

i didnt knew how else to solve this tbh

hoary spear
#

In a 6 client scenario, this is what's going on

soft flare
#

Client 1 is the server?

hoary spear
#

Client 1 is an example owner of the character

#

it could be any client. All other clients would ignore the Server RPC

#

sorry, its a bit wrong

#

there we go

#

Run on Owning client , as the table shows, is ran on the invoking client if its not the owner

#

5 clients playing a camerashake they cannot see

#

Anyways, I cant recommend much more than to clean up your logic, get an overview view of the flow, and try to think of a better way to solve this..
Whenever you're duplicating code (like you are, with Play Anim A, Play Anim B etc) you're in 99% of the cases doing it wrong (or atleast hard for yourself)

soft flare
#

Hmm okay

#

The client 2 doesnt see the shake bcz the server ignores it ?

hoary spear
#

Client 2 dont see the camera at all, because its not his pawn/view target

soft flare
#

aight

#

thanks for all the explaination brother

#

โค๏ธ

hoary spear
#

Didnt work, so resorted to subclassing and overriding it.

dark edge
#

what th e actual fuck

#

no

soft flare
#

The mess or the code? xD

dark edge
#

the mess is the code is the mess

soft flare
#

i mean i figured it out meanwhile i got it somehow working xD

dark edge
#

you can not live like this

soft flare
#

its an old single player project im just trying to get into multiplayer

dark edge
soft flare
#

Bro i have a worse one wait

dark edge
#

no

soft flare
#

sadly

#

it doesnt let me zoom out further

upbeat basin
#

For a Dead by Daylight's generator repair challange kind of a thing what would be the best approach to both keep server as authority for the result and reduce the effects of ping as much as possible?

dark edge
soft flare
#

Funny part is i know where everything is

#

i mean yea some of this is just dead code thats true

dark edge
#

no for real just throw it out and start over. That's like a hoarder's house.

#

don't try to clean it, bulldoze and rebuild

#

lol

soft flare
#

hell naw i have too much time spent into this xD

#

About one and a half year i dont delete that

upbeat basin
#

But would it be any different than just sending true or false from the client?

soft flare
#

Doesnt dbd update your challenge and points whenever you leave a gen?

#

not every second?

#

So you can make it count and give the points when you leave the generator

upbeat basin
#

Hmm I'm not sure if we talk about the same thing, I mean the thing that pop ups from time to time that requires you to give an input at a specific time

#

I don't mean the accumulated repair points

soft flare
#

(sorry if i got this wrong i am a bit special)

#

ohh okay then i dont think i can help i am new to multiplayer stuff xD

upbeat basin
#

Ah okay, thanks for trying anyways

soft flare
#

np

lethal peak
# soft flare

What in the heck? Kill it with fire. How do you even read that? Actor components and function collapse all of that nonsense.

soft flare
#

i have multiple collapsed nodes with this size xD

#

Searchbar is my best friend yk

lethal peak
soft flare
#

i mean i learned with this project so i tried everything there

lethal peak
#

I'm over here with this complaining...

soft flare
#

Yea i could never

lethal peak
#

My locomotion system that ties into all of those repnotifies.

soft flare
#

if i start like this

#

i would sit 2 hours just perfectionizing it xD

#

and tbh i would take equal as long to find stuff, i tried to make everything clean on another project

#

for me it really doesnt change idk im a messi person

lethal peak
#

What happens if anyone else tries to work on it or help you? lol?

lament flax
#

but i always clean up after

hoary spear
hoary spear
#

Ofcourse, you can ignore this if you're for eternity just gonna solo dev something, Then you do you^^

soft flare
#

Yeye if it starts to really annoy me i would clean it up

#

and one day i will probably do but i need the time and energy for this xD

hoary spear
#

You'd be off my team instantly ๐Ÿ˜‚

soft flare
#

LMAO

#

understandable tho

#

My sealed code nobody can understand it xD

hoary spear
#

Even if you could understand and track this, everyone else touching it would have a horrible experience ๐Ÿ˜…

soft flare
#

yea i know

dark edge
hoary spear
#

Oh no. How hiedous๐Ÿ˜ฑ

#

Scrap it, try again

#

Pretty clean tbh

#

Id probably collapse some into functions

#

The top part(s)

dark edge
#

ok

void USLMDeviceSubsystemWheel::PreSimulate(float DeltaTime)
{
    for (auto& Wheel : DeviceModels)
    {
        if (Wheel.Collider)
        {
            const auto SteerSignal = FMath::Clamp(DomainSignal->ReadByPortIndex(Wheel.Index_Signal_Steer), -1, 1);
            Wheel.SteerAngle = FMath::FInterpConstantTo(Wheel.SteerAngle, Wheel.MaxSteerAngle * SteerSignal, DeltaTime, Wheel.SteerRate);

            Wheel.DirectionWheelAxis = Wheel.Collider->GetRightVector().RotateAngleAxis(Wheel.SteerAngle, Wheel.Collider->GetUpVector());
            Wheel.DirectionLong = FVector::CrossProduct(Wheel.DirectionWheelAxis, Wheel.ContactPatchNormal);
            Wheel.DirectionLat = FVector::CrossProduct(Wheel.ContactPatchNormal, Wheel.DirectionLong);
            Wheel.Velocity = Wheel.Collider->GetComponentVelocity();
            Wheel.WheelMass = Wheel.Collider->GetMass();
            Wheel.ImpulseBudget = Wheel.NormalImpulseMagnitude * Wheel.FrictionCoefficient;

            Wheel.ImpulseAccumulator = FVector::ZeroVector;
        }
    }
}

void USLMDeviceSubsystemWheel::Simulate(float DeltaTime, float SubstepScalar)
{
    for (auto& Wheel : DeviceModels)
    {
        auto AngVel = DomainRotation->GetData(Wheel.Index_Mech_Drive).AngularVelocity;
        const auto WheelMOI = DomainRotation->GetData(Wheel.Index_Mech_Drive).MomentOfInertia;
        const auto BrakeSignal = FMath::Clamp(DomainSignal->ReadByPortIndex(Wheel.Index_Signal_Brake), 0, 1);

        //Brakes
        const float MaxBrakeImpulse = Wheel.BrakeMaxTorque * BrakeSignal * DeltaTime;
        const float BrakeImpulseToStop = -0.1 * SubstepScalar * AngVel * WheelMOI;
        const float BrakeImpulseClamped = FMath::Clamp(BrakeImpulseToStop, -MaxBrakeImpulse, MaxBrakeImpulse);
        AngVel += BrakeImpulseClamped / WheelMOI;

        //Grip
        const float DesiredAngVel = FVector::DotProduct(Wheel.Velocity, Wheel.DirectionLong) / Wheel.Radius;
        const float AngularImpulseToStop = (DesiredAngVel - AngVel) * WheelMOI;
        const float LinearImpulseMaxSizeThisSubstep = FMath::Abs(AngularImpulseToStop * 10000 / Wheel.Radius);
        
        const float SlipSpeedLong = Wheel.Radius * AngVel - FVector::DotProduct(Wheel.Velocity, Wheel.DirectionLong);
        FVector ImpulseToStopLong = SlipSpeedLong * Wheel.WheelMass * Wheel.DirectionLong * SubstepScalar;
        const FVector ImpulseToStopLongClamped = ImpulseToStopLong.GetClampedToMaxSize(LinearImpulseMaxSizeThisSubstep);
        
        const float SlipSpeedLat = -1 * FVector::DotProduct(Wheel.Velocity, Wheel.DirectionLat);
        const FVector ImpulseToStopLat = SlipSpeedLat * Wheel.WheelMass * Wheel.DirectionLat * SubstepScalar;


        const FVector ImpulseToStop = ImpulseToStopLat + ImpulseToStopLongClamped;


        const float RemainingImpulseBudget = Wheel.ImpulseBudget - Wheel.ImpulseAccumulator.Length();
        const FVector ActualImpulse = ImpulseToStop.GetClampedToMaxSize(RemainingImpulseBudget);
        Wheel.ImpulseAccumulator += ActualImpulse;
        const float GripAngularImpulse = -0.0001 * FVector::DotProduct(ActualImpulse, Wheel.DirectionLong) * Wheel.Radius;

        const float TotalImpulse = GripAngularImpulse + BrakeImpulseClamped;

        
        AngVel += GripAngularImpulse / WheelMOI;
        
        DomainRotation->SetAngularVelocity(Wheel.Index_Mech_Drive, AngVel);
    }
}
#

void USLMDeviceSubsystemWheel::PostSimulate(float DeltaTime)
{
    for (auto It = DeviceModels.CreateIterator(); It; ++It)
    {
        if (It->Collider)
        {
            const FVector Impulse = It->ImpulseAccumulator;
            const FVector AngularImpulse = It->DirectionWheelAxis * FVector::DotProduct(It->DirectionLong, Impulse) * -1;
            It->Collider->AddImpulseAtLocation(Impulse, It->ContactPatchLocation);
            It->Collider->AddAngularImpulseInRadians(AngularImpulse);

            //Debug
            const FVector DrawDebugStartPoint = It->ContactPatchLocation + FVector(0, 0, 120);
            DrawDebugLine(GetWorld(), DrawDebugStartPoint, DrawDebugStartPoint + It->ContactPatchNormal * It->NormalImpulseMagnitude * 0.1, FColor::Blue, false, -1, 0, 5);
            DrawDebugLine(GetWorld(), DrawDebugStartPoint, DrawDebugStartPoint + It->ImpulseAccumulator * 0.1, FColor::Red, false, -1, 0, 5);

            It->NormalImpulseMagnitude = 0;
        }
        DeviceCosmetics[It.GetIndex()].AngularVelocityDegrees = FMath::RadiansToDegrees(DomainRotation->GetData(It->Index_Mech_Drive).AngularVelocity);
    }
}
dark edge
#

extra BP runtime for.... what?

#

Can just collapse the whole graph if I don't want to look at it but it's all the same, that IS pretty much the whole thing

hoary spear
#

I cant imagine the extra bp runtime showing up anywhere at all while profiling

dark edge
#

Still what's the point of a function that's called in one place

#

it's Event DoTheThing, just do the thing

hoary spear
#

The reasoning would be somethingnlike separation of concerns, and getting a higher pov without having to delve into every little detail

dark edge
#

Just don't go Uncle Bob on me here enforcing 1 line functions

hoary spear
#

I would guess something like 70% of my functions are only ever called once

#

Perhaps more

dark edge
#

I never make a function unless it's getting called multiple times

#

it's just an extra "Turn to page 3 to continue the adventure" when reading the code

lament flax
#

longest event call

#

old dialogue system

dark edge
lament flax
#

maybe rn i would just re add the get of the var

#

instead of making it 1km long

dark edge
#

yeah just add another get

#

so you don't need to pan to see wtf it actually is

hoary spear
dark edge
#

it's logically the same and probably compiles down to the exact same bytecode but it's way more readable

lament flax
#

maybe i should make tiktoks of me cleaning code

might be satisfying to match xD

dark edge
hoary spear
#

Now here i see potential

lament flax
hoary spear
#

The 3 chains all do the same thing

#

This could be a function

dark edge
#

Those are both the before tho

lament flax
dark edge
#

where's the after

hoary spear
#

Yes they are.

lament flax
#

if you zoom in there are changes that make it very anoyying to collapse in 1 function

hoary spear
#

Pins might be swapped, or the values are different, but its the same thing

lament flax
#

so i stayed with 3 splitted

lament flax
dark edge
#

yes you can

lament flax
#

from my POV its pretty clean

dark edge
#

add more of those blue object getters

#

so you don't gotta play chutes and ladders to see what you're calling something on

hoary spear
#

Its not the worst, but quite a stretch from 'perfect'

lament flax
#

the good part is that with how i work now, stuff is so splitted in modular parts that i cant make a single screenshot anymore
i guess i glowed up

dark edge
#

What's more readable, this?

lament flax
#

or ?

dark edge
#

or this

hoary spear
#

Top one for sure

#

Id collapse the first part into "UpdateWheelDirections"

dark edge
hoary spear
#

๐Ÿ˜† fine

dark edge
#

lol

hoary spear
#

You'd still be on my team i guess

dark edge
hoary spear
#

You undersell yourself

dark edge
#

I work outside of games, super low COL area. I'd take 60k remote working on a cool project over 120k on-site at Joe's Shovelware

#

Not joking, I'd take that. But it'd have to be a cool project that I believed in.

#

Otherwise no interest.

lament flax
#

i got the same mentality, people around me absolutely wants to get in big studios

#

for me im more about the "what is the project of the game and the leaders of it"

valid imp
#

So Epic disables Replication Graph for console builds because it does not support split screen, yet Fortnite has split screen on consoles and uses Replication Graph.
Where is the lie?

hoary spear
#

Fortnite uses Iris?

#

So i guess the lie is their use of rep graph๐Ÿ˜‹

#

And they prob have fixed support on their fortnite branch. Afterall, its their money printer

cursive steeple
hoary spear
#

So all i can (have balls to) do atm is part time game dev, and full time my other job

#

I also dont like the volatility in the market...

half iris
#

Christ, yea this makes it look differently for sure. It is still not horrible, but it is far from a smooth experience when using the "bad" network settings that UE provides

hoary spear
#

Bad is bad tho, keep that in mind

#

Cant fix it all

half iris
#

Right that is actually a good point. How common is the bad scenario that Epic provides? Ofcourse there are lots of places on earth that will have a bad connection, but generally speaking in the western world, is it a common scenario?

#

Gotcha! To be fair, I am going to need to translate that to bad internet in Europe as I have no idea how bad internet can get in the USA

#

That is crazy

dark parcel
#

you shouldn't even have rubber banding to begin with in editor

gloomy tiger
# half iris Right that is actually a good point. How common is the bad scenario that Epic pr...

Given you're asking this because you trying to evaluate whether you should bother or not... it depends. In our game, we made shooting as seamless as it could get and not even 9999999 ping will give players the sensation it's not working (although it won't). That to say: bad network emulation means bad, really bad, and it's probably not your typical - nor the typical user audience - of most games, but you do you and it's up to you to decide what to do with it.

In our case, another example - 400+ ping we simply stop replicating lots of stuff, to avoid the bad connection player to compromise the network even further.

half iris
dark parcel
#

delay != rubber banding tho, are u sure it's rubber band?

half iris
gloomy tiger
#

I don't have early context but your game isn't stable for 10-100ms?

half iris
half iris
gloomy tiger
#

Yea well there's definitely something you gotta take a look at before emulating bad connections and all lol

lament flax
#

depends on game, games like valorant or fortnite, as soon as you reach 50/70 ping, you bullets wont go straight away and you feel it

gloomy tiger
dark parcel
#

the visual part will be executed right away

half iris
#

Also, the parts that aren't super smooth is the physics sim being communicated to the clients

lament flax
#

can having a lot of subtrees in BTs be heavy for the server ?

gloomy tiger
lament flax
#

idk what optimization i can do regarding AIs

gloomy tiger
#

We're using HTN so I'm not really sure whether subtress in BTs tick, but if that's the case, the #1 optimization is avoiding expensive lookups in them. Use Blackboard to assign data you need.

dark parcel
#

im using regular array for my Item and Cosmetic structs

#

looking at small scale listen server 4 player co-op game with less than 200 items all together

#

should I be using FFastArray?

gloomy tiger
#

50 items each player?

dark parcel
#

hmm perhaps

#

or more ๐Ÿ˜›

gloomy tiger
#

Yes

#

Go with FFastArray

valid imp
half iris
fossil spoke
dark parcel
visual mountain
#

Anyone know the route to take to have a server event add widgets to client side Player Controller? Im hearing this is not a direct process but im getting mixed information on the approach.

fossil veldt
potent coral
fossil veldt
#

if it's for notifications or something, use ULocalMessage

visual mountain
#

it is for an interaction widget. the player gets widget, presses button, advances game

maiden flame
visual mountain
#

Thanks for the replies. I had been attempting the RPC but I don't think I fully understand it yet. Gonna take more time to research it. I basically have a turn based game like a game of cards between 2 people. Im just trying to figure out the best approach to how players interact with the listen server and vice versa. player 1 makes a move, turn is passed to player 2. P2 takes turn ect

cinder carbon
#

Are the checkboxes for replication client-side predictive & server side reconcilable?

dark parcel
cinder carbon
cinder carbon
#

haha

#

idk, it was like in their marketing or something

gloomy tiger
#

lmao

cinder carbon
#

or engine comparison people

#

I heard it a lot on the internet that Unreal Engine makes it really easy to make multiplayer shooters like Unreal Tournament.

gloomy tiger
#

Unreal Engine makes it possible, not really easy.

cinder carbon
#

I shoulda been an Electrician apprentice

cinder carbon
gloomy tiger
#

But to be fair and in all seriousness, Unreal abstracts away all the UDP/TCP stuff for you. That's serious business you don't have to worry about when doing multiplayer in UE.

gloomy tiger
#

You don't have to conciliate your netcode with the Game Framework hehe

cinder carbon
cinder carbon
#

big word I never saw before

gloomy tiger
#

So you decided to create your own netcode. Cool beans. You have raw data in hands. Now you need to: create your communication channels between clients and the server; make your data go through these channels until they arrive into Actors. You need to handle handshaking. What if a player has disconnected?

cinder carbon
gloomy tiger
#

It's pretty simple to do this thing you want. And Unreal allowing you to have control over this flow is just Epic doing you a favor. =p

#

Unity? Netcode? Where? ๐Ÿ‘€

valid imp
#

Hey there, I have a perfectly working multiplayer game but what I did is possibly uselessly complex. It's made of infinite tetraminos like puzzle pieces which I generate on the server (on purpose) and dispatch them around, to players near them.

Classes:
PuzzleManager: Keeps list of streaming sources
PuzzleStreamingSourceComponent: Keeps list of associated puzzle pieces
On tick, the manager that has authority looks at the position of sources to know what pieces they need.
If they don't have something they need, it sends its data with a reliable RPC.
The streaming source adds it to its associated list then sends it to the manager which meshes it.

The result is that a client manager only has the puzzle pieces of its player(s). The authority manager has all the puzzle pieces.
No iris, no repgraph.

Was there an easier way to do it?

gloomy tiger
#

I'd bet (and win) if DOTS netcode (or DOTS altogether) got deprecated(tm) in 2 years from now

cinder carbon
#

From what I saw, you still have to do like a lot of the network stuff.

#

How does it get easier?

You just ignore player prediction/rollback?

gloomy tiger
dark parcel
#

and everyone was thanking him

cinder carbon
valid imp
gloomy tiger
#

Ah, also @cinder carbon............... if you go through the Compendium, keep in mind all those things would have to be crafted by you in case you go with your own netcode

#

(I was referring to our socket friend)

#

(Although I'm certain you know it, heheh just making it crystal clear so I don't sound dumb)

#

ugh

#

i forget this thing pings

cinder carbon
cinder carbon
gloomy tiger
#

๐Ÿค”

valid imp
#

Like you have FPS, RPGs, turnbased variants, RTSs, Editable terrain games, racing games. And MMOs but those are special.
If you cover a basic template for all those, I feel like you covered everything in the genre. And they're all the same between eachother.

gloomy tiger
#

OH

#

When you said first

#

They probably understood as first bottom-top

cinder carbon
#

oh I thought bottom was

#

haha

cinder carbon
gloomy tiger
#

If you are considering Unreal, the only reason I can possibly think of as for you not using its built-in netcode is exclusively performance.

#

You cannot ship a They Are Billions multiplayer using the current netcode

cinder carbon
#

Right now I want to just make a small "Call of Duty arena multiplayer" style game as my first networked game.

gloomy tiger
#

and not just possible, if you are committed to C++, you can get it to run really smoothly

#

but avoid casting if you're using blueprints otherwise you won't achieve 0 ping ||/s||

cinder carbon
#

"built-in" multiplayer meaning I still have to write all the server-side rollback, etc myself?

gloomy tiger
#

if you want to skip this work, get yourself a template - there are tons on the marketplace multiplayer-ready that can get you the arena shooter in a week =p

#

(don't promise it will perform, but hey)

dark parcel
#

I wouldn't bother doing shooter with blueprint

gloomy tiger
cinder carbon
dark parcel
#

first task, make your character sprint with bp

gloomy tiger
dark parcel
#

spoiler, gonna hit a wall

gloomy tiger
#

Just search for 'shooter multiplayer'

#

(omg i just realised how many of them there are)

cinder carbon
#

Yeah.

The main reason I was looking at Unreal is because I thought at least the built in-"character" blueprint type and "projectile" would have prediction and rollback.

Thank you @whole grove and @gloomy tiger . I'm going to read through what you've given me and assess what I am capable of or if I should go back to making a single-player game for my next project.
I'd like to make a multiplayer game, but we'll see.

gloomy tiger
#

Just shooting is not - but again, you can rely on some third-party solution for that

#

I'm not really sure, but Epic's Lyra may have some projectile stuff

cinder carbon
#

It's a non-competitive PvP/PvE (MP with bots).
I do need it to be projectiles because the guns are slow moving projectiles.

gloomy tiger
cinder carbon
# gloomy tiger Movement is done for ya

So if I "just check the replication button" on a "character" blueprint, the movement of a player character if using Unreal's character movement system will "just work" to an "shippable" degree?

gloomy tiger
#

Yes

cinder carbon
#

I know a lot goes into making a game. I shipped a few.
I just don't know much about server-side rollback etc.

gloomy tiger
#

Perhaps it's already defaulted to checked so you don't even have to click a checkbox

cinder carbon
#

Opening the Lyra game project.

gloomy tiger
# gloomy tiger Yes

Read this with a grain of salt. It depends on your goals. 100 moving characters at the same time? No. Non-bipedal characters? AFAIR, no. Now if you're going to have somewhere between 1-20 bipedal/humanoid characters, probably yes. Then if you need to tune it up even further, there is this amazing plugin called SmoothSync - although to make movement smoother, it uses some exploitable techniques (aka if you care about protecting your game against cheaters, not for you)

gloomy tiger
visual mountain
#

Just looking for some clarity make sure im understanding at this point. Clients can only interact with the server via the use of the actor they own?

#

i was attempting to use widgets for on clicked events to produce the games outcomes, but if the above is true I think I may have to use in game actors of some sort instead to the same end

dark edge
#

they can talk to things that do though

visual mountain
hoary spear
#

Rpc's from client to server only work on that clients owned actor

visual mountain
#

thank you for the responses. Is helping out tremendously.

dry pebble
dry pebble
hoary spear
#

๐Ÿคฃ

lost inlet
#

but I suppose it's not a VFX course

#

so yeah all the HUD logic is in the player controller like this for some reason

#

which seems like a circular dependency hell, rather than just having delegates that the HUD elements subscribe to

gloomy tiger
# lost inlet lol

I personally dislike Lyra. But hey, that's what our friend wanted so. ยฏ_(ใƒ„)_/ยฏ

lost inlet
#

Lyra is "it has some cool things, but don't base your game on it" to me

gloomy tiger
#

Lyra and perhaps all templates in existance? That is, if you're going into business - not talking about prototypes, hobby projects, learning purposes etc etc

lost inlet
#

ShooterGame was also like that

#

but that didn't stop people from basing their games on it

gloomy tiger
#

Right hehe

#

Until the boom

#

(Not even the boom prevented people from base their games from it lol)

unique forge
#

Someone got a good multiplayer lobby/host/create tutorial to recommend?

dry pebble
storm wind
#

How about using blueprints only for multiplayer, it's doable right? I mean you really don't have to only use c++ for doing multiplayer. I'm not sure how complex can bp do with multiplayer, compared to using c++

lost inlet
#

it's doable, but it's definitely more annoying

storm wind
lost inlet
#

at least Mover 2.0 should make custom movement possible in the future

#

CMC

dusty void
storm wind
dusty void
#

i wouldn't konw tbh since i usually try to do a lot in cpp anyways xd

storm wind
lost inlet
#

debugging is the absolute worst too

#

but that isn't even exclusive to multiplayer

hoary spear
#

Is very relevant

graceful flame
#

Why isn't there some kind of blueprint to c++ conversion tool yet? Couldn't something like that be made possible with the help of AI?

hoary spear
#

Dont need AI for that

#

Just need a programmer ๐Ÿ™‚

graceful flame
#

But it would be so much faster to make a blueprint then single click have it converted into c++

hoary spear
#

I tend to do things a bit differentlynin cpp vs bp

graceful flame
#

whoever makes that is gonna be rich, just saying

hoary spear
#

Butnit would come a long way

#

Eren made the bp2cpp stuff tho

lost inlet
#

BP2CPP originally did that, but it really is just different paradigms

hoary spear
#

And it now works^^

#

Machine generated code tho, not human readable , atleast thats what i heard

lost inlet
#

that's what I was mentioning, BP2CPP was originally going the human readable approach but that changed, but forgot the exact reasoning

#

but I imagine it's hard to map it 1:1

graceful flame
lost inlet
#

when the Blueprint header preview was added in 5.1, that at least made it easier to get started with hand nativising a class

#

the BP properties get remapped to the C++ ones properly now too

hoary spear
#

^!?

#

Does it now?

lost inlet
hoary spear
#

About time, ive had the worst time converting old bps

#

Or even new mashups made in bp...

graceful flame
#

would save a lot of time

hoary spear
#

Would have to verify everything , every time..

#

Just like woth an intern ๐Ÿ˜…

lost inlet
#

well hand nativising a class is pretty much an intern's first task

#

I think it's pretty common to just do major systems in C++ and BP is then for smaller things and prototyping

#

avoid the problem entirely

hoary spear
#

Sounds about right

#

Bp formprotoing, asset picking, some light vfx stuff etc

graceful flame
#

BP to make it work, c++ to make it better.

lost inlet
#

that sounds like the wrong way round

graceful flame
#

depends on what it is tho

lost inlet
#

the major system being in C++ is "making it work", and the smaller things in BP is "making it better"

graceful flame
#

well im not about to make some level actor like a door or something that opens and needs to be replicated with c++ first

lost inlet
#

well on a previous project we did

#

but that's not really a major system

hoary spear
#

Barely a minor one

#

Id prob do that in bp

lost inlet
#

depends how important doors are to your game I guess, but we did have breachable doors and it was written all in C++

hoary spear
#

Timelines are chill to work with

lost inlet
#

it had some interesting replication challenges on its own

hoary spear
#

I cant even imagine what that looked like ๐Ÿ˜…

dark edge
cinder carbon
gloomy tiger
tired horizon
#

Hello. How can I find out players traveling from the lobby to the game map have completed the traveling?

cinder carbon
gloomy tiger
#

You may be asking the wrong question. What does completed travelling mean?

tired horizon
gloomy tiger
snow trail
#

is replicating an array of 100 component references expensive?

gloomy tiger
rare compass
#

Yes, sorry I only just saw your message. It's my game

snow trail
gloomy tiger
#

Probably whatever then

snow trail
#

i see

gloomy tiger
#

It'll be quite a big packet nonetheless (to answer your question about 'expensiveness' more specifically)

vagrant grail
#

@hoary spear I'm getting crazy with the movement issue for days, I thought I solved it and it's coming back like GameOfThrones seasons ๐Ÿ˜ญ

hoary spear
#

And you decided to poke me about it ? ๐Ÿ˜†

vagrant grail
lament flax
#

what would be a way to get server stuff from editor utility widget ?

gloomy tiger
gloomy tiger
vagrant grail
lament flax
#

i want to create custom debug tools, a part of it needs to access the AI controller at runtime
the issue is, the AIcontroller is null when try to access it

gloomy tiger
vagrant grail
vagrant grail
gloomy tiger
lament flax
#

but not AI controller, thats why i suspected its because it only exists on server side

gloomy tiger
#

๐Ÿค”

gloomy tiger
lament flax
#

yes

#

in PIE

gloomy tiger
#

Are you running this PIE with a single player?

gloomy tiger
#

Hehe... so how is that related to multiplayer? ๐Ÿ˜›

lament flax
#

i mean its running on a dedicated server

#

so still MP

#

just a server with 1 player

#

got the same issue if i spawn more

gloomy tiger
#

Right. And you're right. AIControllers don't exist for clients and should never exist.

lament flax
#

yes

#

its weird that on editor i cant access those :(

#

and for more context

  • this will print when selecting a player character
#
  • this will print nothing when selecting an AI character
gloomy tiger
#

It's not weird. It's how things work. AIControllers don't exist for clients. You have to bridge your communication via a proper channel, such as your APlayerController. You send an RPC to the server requesting data of your AIController and you use the resposne to work with.

lament flax
#

tried

gloomy tiger
#

๐Ÿ˜

lament flax
#

its like the editor BPs are cuted from the MP system

#

i can try one more thing

#

leme check

gloomy tiger
#

Well, I don't know what to answer, sorry.

lament flax
lament flax
vagrant grail
# gloomy tiger **What** is not working?

Ok let me explain better :
I'm having a MainMenu Level, a Lobby Level and a Mansion Level and each have a specific controller.
MainMenu Level = Pc_MainMenu (controller)
Lobby_Level = Pc_Lobby (controller) derived from PC_Core (controller)
Mansion_Level = Pc_Werewolf (controller) derived from PC_Core (controller)

On PC_Core, there are 2 methods : OnRepIsLookInputEnabled and OnRepIsMoveInputEnabled that I can switch from the server to enable or disable those inputs on both the clients and server. Both of these variables are set to true by default so the player can move and look around when he joins.

What I want is when joigning the Mansion_Level, I want players to not be able to move until all players have successfully travelled from the Lobby_Level to that Mansion_Level, then I launch a countdown of 10 sec then allow them to move and look around so nobody has an advantage over others in the game because they joined earlier than others.

The first issue I have is for some reason the client joining the Lobby_Level that the host created, he can't move or look around but the host can do that and I don't understand why it's not working properly with the client. And the client can't press the game menu by pressing T so it's looks like the whole inputs are disabled instead of just Moving and Looking like I wanted.

The second issue is when travelling to the Mansion_Level, the client can't move or look around (so that's good) but on the server I still can move but the look around I have to left click and drag the mouse to look around which is a weird behaviour. I also can press P to see the values of both variables to see if the server and the client versions of those variables are the same or not but on the client pressing P does nothing and I can't even press T to open the game menu (containing Continue, Settings , Quit button).

gloomy tiger
# vagrant grail Ok let me explain better : I'm having a ``MainMenu`` Level, a ``Lobby`` Level an...

You probably want to simplify this whole process.

  1. On your GameStates (one that exists on Lobby and Mansion), have a repnotify bAllowedToControl boolean, false by default.

  2. Use GetGameState()->bAllowedToControl to do your logic inside the different PlayerControllers.

  3. Whenever you want to allow people to move, just make your server GetGameState()->bAllowedToControl = true

One last thing: in your OnRep_bAllowedToControl you can broadcast/dispatch a delegate (which you can bind to in your player controller) so you can react to changes.

I mean, this is more or less what you are already doing, but by having things a little bit simpler/clearer and in the right places, it'd be a lot easier to make sense of what's wrong.

vagrant grail
gloomy tiger
#

No - you broadcast a delegate and then in your player controller you listen to it

vagrant grail
gloomy tiger
#

You just need a delegate that takes a boolean as an argument

vagrant grail
gloomy tiger
#

You can

vagrant grail
vagrant grail
storm wind
# hoary spear What type of game

It's a multiplayer night club where player just connect to a dedicated server, and if someone is there also, they can voice chat, sit down, dances, I think currently that's all what the people can do. Just boring stuffs. We haven't made any gameplay that might give reason for player to keep coming back. It's related to coin in cryptocurrency, so the most possible action is at least collecting points (that later can be converted to crypto coins), and spending points or coins in the world like buying digital stuff like drinks, or maybe some apartments, or building

I think it's a pretty simple stuff in context of gameplay and logic, everything can be handled by BP and without c++. And until now I haven't got any need of using c++

Currently I only have 3 maps:

  • Login map (singleplayer, for auth)
  • menumap (singleplayer, after auth, loading player's data from mysql using varest, and save it to game instance variable, and show it in UI, and there's a 'Play' button, which only open level to ip address and port in aws.
    -ServerMap, it's the multiplayer dedicated server map, where player joins the game in multiplayer. Right after joining onEventPostLogin, playerdata from game instance struct variable is loaded (so loading from rest api only loaded once after loading). Players Running around voicechat, sit down, dances.

But something in mind is. My server level is ServerMap. What if I have another ServerMap2, ServerMap3 (so I have 3 levels). And I want my players can choose which level they want to go. So if there are 15 users, maybe like:

  • 4 users in ServerMap
  • 6 users in ServerMap2
  • 5 users in ServerMap3

From what I read, we can use clienttravel. But cannot do it in BP, using node open level or console command clienttravel will not work.

Or am I missing something?

visual mountain
#

I have made a run on client event on my server, which passes to an actor, which passes to a player controller, (the client) to remove a widget at a certain time. The widget has been removed for the client, just making sure this approach is valid as I know seeing what I want is not necessarily knowing what I'm doing.

sinful tree
visual mountain
#

thank you, is appreciated. Just like to make sure I'm not moving forward with incorrect understandings.

sinful tree
lament flax
#

how can I test creating sessions on a dedicated server inside unreal ?

i know how to do it with a listen server, but not with a dedicated

vagrant grail
fossil spoke
mint stream
#

I'm running into an issue with trying to replicate a gameplay tag in a GA so that it triggers a state in my ABP.

if (GetAvatarActorFromActorInfo()->HasAuthority()) {
      LocalASC->AddLooseGameplayTag(ZSGameplayTags::Character_Rifle_Equipped);
      LocalASC->AddReplicatedLooseGameplayTag(ZSGameplayTags::Character_Rifle_Equipped);
    }

This was the only work around I could get working, which seems completely wrong. Initially, the replicated version has the animation working between clients, but the server sees none of the animations. Then when I add the non-replicated version, I see the animations for all clients and servers. I have the tags mapping to bools in this variable FGameplayTagBlueprintPropertyMap GameplayTagPropertyMap; that lives in the anim instance class. Any ideas why it acts this way and how I'd go about fixing it?

vagrant grail
#

Can the gamemode turn on / off movement and looking inputs that are in the player controller ?

lethal peak
chilly haven
#

Hi,
If I only want to support dedicated servers, I should use UE_SERVER and never WITH_SERVER_CODE, correct?
Thx

#

i.e. I should use UE_SERVER for server code and !UE_SERVER for client-only code

neon summit
storm wind
#

Oh I didn't know about this. Thank you for the insight. How about client moving to different map?

#

When we build dedicated server, we select a single map server, is that mean that ther server.exe only contain the selectef servermap?

If I have 3 server maps, mapA, mapB, mapC, do I need to build dedicated server 3 times with each map selectef as the server map in maps and modes? And then run the 3 exe in virtual machine (ec2) with different port? Will it work like that?

vagrant grail
neon summit
storm wind
sinful tree
#

Your server build should have all the maps the server will need to host.

twin juniper
#

I had a quick question maybe someone can help me with. I was testing my dedicated server and I wanted to see if I could change the variables with cheat engine. I was able to change my gold variable and buy things with it. Do you think this Is because im running the server on my pc/ip or is it because I am not doing a good enough job of making the server verify variables?

thin stratus
#

That's why games where clients aren't allowed to cheat stuff like that need the Servers to be hosted away from them. Which also makes such games so incredibly expensive for the developers.

#

I mean, it can also be that you, on top of hosting the server on your PC, coded the multiplayer part badly :P

twin juniper
#

Haha true, Iโ€™m gonna do more testing tommorow but I already change all important gameplay variables (like gold) through run on server events with replicated variables. But possibly missing โ€œswitch has authorityโ€ nodes might be causing problems?

thin stratus
# twin juniper Haha true, Iโ€™m gonna do more testing tommorow but I already change all important...

Depends what you actively changed with cheat engine.

If you changed a variable of the server then that's totally expected. Clients can't have access to the server. No matter how your code looks like. The server has to be hosted somewhere in the cloud, away from the client.

If you changed a variable on the client (only on the client) then you are telling the server the amount of gold the client has somewhere via an RPC and that's just bad and makes cheating easy

twin juniper
#

Ok Iโ€™m going to go through and check everything tommorow, ty for the advice

hoary spear
#

In other words, only the server itself should be able to grant you gold through some verified method

#

There shouldnt be any rpc that changes this directly

#

An rpc may "suggest" a clients intent, but the server will have to verify thenoutcome of that

#

Otherwise whats gonna stop the client from cheating.

"Hey, server! I just picked up Thundrfury, blessed blade of the Wind Seeker!"

"In stranglethorn whale? How did you.."

"Random drop, i swear it"

storm wind
lament flax
fossil spoke
#

You probably need to google how to make one first.

lament flax
#

So i have to build

#

This is kinda annoying if i want to iterate by doing changes

fossil spoke
#

Welcome to programming.

lament flax
#

Im still confused for the code part

#

For eg, how do i make a client create a new session on the dedicated server and join it

fossil spoke
#

Why would a Client create a session on a dedicated server?

lament flax
#

To create its private lobby

#

Then other people can see it in server list and join it

fossil spoke
#

Why do you need dedicated server?

lament flax
fossil spoke
#

๐Ÿคฆ

lament flax
lament flax
fossil spoke
#

Its clear to me you are very new to this, I suggest you start with something much less difficult.

#

Try just getting sessions working with Listen Servers.

lament flax
lament flax
#

But i coded my game to have a dedicated server, so i would like to perform my tests this way

fossil spoke
#

Have you compiled a dedicated server yet? Do you know you need a source build of the engine to do that?

#

You seem to be trying to jump to far ahead, no point building stuff for dedicated server if you havent even got the understanding of how to make/run one.

lament flax
#

There is no points building the server if no code is setup to create session like i have in mind

#

Also, with UE, can 1 dedicated server be splitted to run multiple games (maps) ?

#

Or do i have to virtually split it or something

storm wind
lament flax
#

ty

thin stratus
# lament flax Isnt this how works competitive games when you enter matchmaking ? If no servers...

Yes, but a Client isn't doing that. This requires something outside Unreal Engine, written in some other coding language fwiw (i guess C++ could work too), that handles starting and stopping processes, as well as managing all the session stuff.

PlayFab and similar services provide that for you, but that comes with high costs on top of the already high hosting costs of the DedicatedServers.

thin stratus
#

One UE DedicatedServer = One Match

lament flax
thin stratus
#

You should also be VERY aware of the fact that any project that wants to pull something like this off needs a lot of money and potentially a lot of people.

You are free to try this alone, but it's honestly a pretty shit idea.

lament flax
#

in the project plan i wanted to start with server listen to start, than seeing if there is enough player and budget to go to dedicated servers

#

but yeah, big stuff right there

thin stratus
#

You can do that, but the ListenServer approach instantly removes any form of monetization

lament flax
#

also, i wonder how much players i can host on a clients machine

thin stratus
#

Depends on the Machine and their Internet.

thin stratus
#

If you plan on having some sort of free game with monetization options, such as Battle Pass and all that shit, then ListenServer is not an option

lament flax
#

oh yes

#

the only monetization will be the game

thin stratus
#

Then why do you need DedicatedServers?

#

Is it a competitive game?

#

Then ListenServer's are also shite

lament flax
#

i will not have any skins or other paid currency in my game.

but since the best of the game has to be played by 10/30 players, its better to not host it on a players machine xD

thin stratus
#

10 to 30 players should be fine

lament flax
#

ill do tests anyways

thin stratus
#

You are just putting extra cost onto yourself with the DedicatedServers and all the backend shit

#

I would just not do that

#

Make a ListenServer fun or coop game and let Players host

lament flax
#

the other thing is, is it safe to make a client host the server, and be visible in public lists ?
usually you want only your friends to join, but in some cases you want to allow anyone to join

#

idk if this makes sense

thin stratus
#

Depends on what you mean with "safe"

lament flax
#

performances are not fully needed, but i'll do my best to make each player have a good experience

lament flax
thin stratus
#

Yeah it does

lament flax
#

cool

tardy fossil
#

if you're using steam relays, people's IP wont be public (not that people can do much with an IP in the first place)

lament flax
#

well, here i go editing my code to make it fully work for listen server

thin stratus
#

That's def the better idea

#

Lots and lots of headache avoided

lament flax
#

the plan of the game is

  • solo and AIs
  • self hosted mutliplayer (with added AIs if needed)
  • dedicated servers for bigger games and more performance
#

the 2 first will be done anyways, the last depends of the "success" of the game

thin stratus
#

๐Ÿ‘

lament flax
#

Prisoner0 is the server host

what am i doing :

  • Character : BeginPlay -> Authority -> Call Init event on replicated ACBP

  • ACBP : Init event (Run On Server) -> fills an array with stuff.

  • Character : Possessed - > Set Player Controller var (rep notify) on ACBP

  • ACBP : On Rep Player Controller : Remote -> Calls an event (client) <-- this fails on host client (Remote is not called because the "client version" of the Character and ACBP doesnt exist, it appears only later on (as you can see on first screen))

#

note : this was working fine when all instances where clients and the editor was the server
i am trying to convert my code to listen server

lament flax
#

this issue is also hapenning at other places

for example, the begin play of the Character is never called on client side of the client host

restive oak
#

Anyone about to talk to me about open world sandbox mmo design?

#

or just talk about it in general doesnt have to be jsut to me hhaha

thin stratus
#

@lament flax ListenServer is Authority

#

ListenServer does not count as a Client in that scenario

lament flax
thin stratus
lament flax
#

i have to replace simple "switch on authority" with this kinda stuff

thin stratus
lament flax
#

before i just needed that

thin stratus
#

With 3 pins

lament flax
thin stratus
#

Authority, if we ignore for a second that this doesn't ALWAYS mean Server, would be the ListenServer at all times. Remote will always be the connected Clients. The only extra case you have is if you want to specifically target the LocallyControlled Pawn/Character or its Controller, at which point Authority also needs to check for IsLocallyControlled.

thin stratus
lament flax
#

FocusStartPoint only needs to be set on client side

thin stratus
#

Hm, yeah. The only thing I can say is that one rarely has to do what you are doing there.
Which more or less means you are doing something more complicated than needed

lament flax
#

yeah ik there should be a more simple solution than this bunch of nodes

thin stratus
lament flax
#

idk what those are

#

also, idk how to fix stuff like this scene component

thin stratus
#

Then please read the Compendium again. That's very relevant to generally coding your multiplayer logic.

They are NetRoles. AutonomousProxy is usually the role of a Possessed Pawn/Character locally. SimulatedProxy are instances that are just simulated and not directly controlled.

lament flax
thin stratus
thin stratus
#

The SCBP_Focus should show the Widget for ALL Clients?

lament flax
#

thz actor "owner" or the network "owner"

thin stratus
#

Or just the local one?

thin stratus
lament flax
#

well if its on a cube, there is no pawn owner

#

its just an actor

thin stratus
#

What is that exactly supposed to do?

lament flax
#

like a door

thin stratus
#

Just show a Widget to everyone?

lament flax
thin stratus
#

Then just remove the SwitchHasAuthority?

lament flax
#

well

thin stratus
#

If all you want is spawn it on everyone so you can later change the visibility on whoever is close, just remove the Switch

lament flax
#

yeah it works

thin stratus
lament flax
#

but server side of joining clients should care about spawning it

lament flax
#

i only want this to run on client

#

for performance

thin stratus
lament flax
#

i would like only client

thin stratus
#

Isn't this just an Actor in the Scene?

lament flax
#

yes

thin stratus
#

Then BeginPlay will call in ListenServer and Client

#

idk what you mean with Client (Server) and Client (Client)

lament flax
#

its better if i say player (client side) and player (server side)

thin stratus
#

That's still not a thing for the Cube

#

The Cube exists once on each Player

lament flax
#

because its placed in level ?

thin stratus
#

Doesn't matter if placed or spawned runtime

lament flax
#

so its only owned by the listen server ?

thin stratus
#

That's a different topic, but yes

lament flax
#

this is all confusing me

#

doing for dedicated server was simplier xD

thin stratus
#

tbh you are just lacking knowledge

lament flax
#

true

thin stratus
#

Or rather misunderstanding things

lament flax
#

im still only 1 month into this

thin stratus
#

BeginPlay here calls on ListenServer and the connected Clients

#

Once per

#

There is no Client (server) Client (client)

#

There is just ListenServer (which is a Client hosting) and other connected Clients

#

So for 3 players, this calls 3 times, once on each game

lament flax
#

i think this is what make me say there is Client (server) Client (client)

thin stratus
#

But that's a different thing, we are talking abotu the Cube

lament flax
#

oh

thin stratus
#

The Cube should only have 2 entries there

lament flax
#

still both

thin stratus
#

At least per cube

#

Yeah, you have 3 of those in the scene

lament flax
#

yes

#

and each have client side and server side

#

?

thin stratus
#

Yeah

#

So BeginPlay calls on each of those sides, once

lament flax
#

yes

thin stratus
#

So you create one WidgetComponent, on every player

#

per Cube fwiw

#

And that's totally correct

lament flax
#

but i want it to create the widget comp only on client

thin stratus
#

Why

#

Then your ListenServer won't see it

lament flax
#

because server will never use it

thin stratus
#

But your ListenServer is a Player

lament flax
#

so the only server that has it is the listen server
and the clients the clients

thin stratus
#

But that's a different BP

#

For the CreateWidgetComponent part, it's totally correct to not limit it

lament flax
#

yeah because its not asking much in performance

thin stratus
#

That has nothing to do with performance

lament flax
#

but later on i will prob have to find this solution i m looking for

thin stratus
#

You need it to call on everyone

lament flax
#

why :(

thin stratus
#

........

#

If the Widget doesn't create on everyone, how are they gonna see it=?

#

You need to forget about the concept that your Server is a separate thing

#

Your Server is a Player

lament flax
#

is the reds one only for the listen server and the blue ones for the client that joined the session ?

thin stratus
#

Yes

lament flax
#

okayyy

#

i was still thinking the same than when i was coding for the dedicated server

thin stratus
#

If you host a game and I join you, you are red, I'm blue

lament flax
#

now i understand

thin stratus
#

Now for your Character

#

If you have something you want to only do locally

lament flax
#

now i see why my questions were weird

thin stratus
#

Then all you need to do is check if the Character is LOCALLY CONTROLLED

lament flax
#

okay yeah

thin stratus
#

Let's assume you want to trace the Item Container and show the Widget when hitting it

#

You don't need any SwitchhasAuth stuff here

#

All you gotta do is on Tick, check if the Character is locally Controlled

#

That will filter all SimulatedProxies

#

Aka Server runs this for its own Character
And each Client runs this for their own Character

#

That's all there is to it. The only little thing you have to always keep in mind is PING.
E.g. you can't check IsLocallyControlled on the BeginPlay of a Pawn/Character, cause the info about being Possessed and Local takes time to replicate.

If you need a callback that you can use for when that is sorted, you gotta use ReceiveControllerChanged and check if the "NewController" is valid and a LocalPlayerController.

snow trail
#

hey guys, sorry to interrupt, im trying to get the PlayerState in my Pawn on Beginplay, but i noticed it returns as Null (for the latency you just mentioned, im guessing)
if i add a short delay it works, but it seems like a sketchy solution, is there a better way to do it?

lament flax
thin stratus
lament flax
#

yes

thin stratus
#

Yeah no, then override ReceiveControllerChanged

lament flax
#

i had this before

thin stratus
#

That calls from C++ via the OnRep_Controller

#

You can check IsLocallyControlled there

lament flax
#

okay this worked great

#

ty

#

the last thing where im still a bit stuck, is this

why is there a client version of the listen server character ? (prisoner0)

#

is it the replicated version so the client can see it ?

thin stratus
#

Yes

lament flax
#

okay

thin stratus
#

It's the SimulatedProxy version of the Server's Character

#

A puppet so to speak

lament flax
#

it takes time to re understand how networking works, but i'll get there

thin stratus
#

No worries, we've all been there. You are seemingly grasping it faster than others

lament flax
#

its painfull to fix code when you passed so much time on it

thin stratus
#

It's part of the process (:

#

The more you learn, the more you will refactor, until you have the knowledge to create the thing you want in the more or less optimal state

#

And that takes years, so don't beat yourself up over it

lament flax
#

true

thin stratus
#

I find joy in fixing my old code haha

lament flax
#

im still shoked of the differences between my last project that i started last year and how i code now on this new one

#

anyways, ty for helping this long

i can finally eat, i should of started cooking 2hrs ago

vagrant grail
gloomy tiger
#

Your GameState does nothing

#

All it controls is the state of whether players are allowed to control their pawns or not

#

(via the bAllowedToControl prop)

#

Your PlayerControllers listen to the change on this property and react accordingly

#

This is wrong

#

I had to leave yesterday

#

Tell me what's your current situation

vagrant grail
gloomy tiger
vagrant grail
gloomy tiger
#

Ok, perfect

vagrant grail
gloomy tiger
#

Ok, yea, that's perfect

#

Now, let's just review it - where are you at right now?

#

How are you changing the value of bAllowedToControl on the GameState?

gloomy tiger
#

Yes, it's bad

vagrant grail
#

better ?

gloomy tiger
#

The default of your bAllowedToControl is false, right?

gloomy tiger
#

You can remove this

#

And this

#

Let's simplify this whole thing

vagrant grail
gloomy tiger
#

You do nothing there

#

Nothing related to GameState and/or bAllowedToControl

#

Once you removed these two functions, just play the game in PIE and see if you can control your character. You're not supposed to be able to do so.

#

Not the client, not the server.

vagrant grail
gloomy tiger
vagrant grail
# gloomy tiger Now we talking.

i still can't move in the lobby but I guess it's normal as the pictures above are the ones for the controller on the Mansion_Level only

gloomy tiger
vagrant grail
gloomy tiger
#

Holding on...

vagrant grail
#

In the Mansion_Level (the one having that PC_Werewolf) I still can move with the host and can rotate my camera but I have to press and drag around but with the client I can't move and can't look around. It's like all the inputs are disabled for him

gloomy tiger
gloomy tiger
#

That's part of the reason.

#

But can you move?

vagrant grail
#

I'm not sure to understand ๐Ÿค”

gloomy tiger
#

That is, can your host move?

vagrant grail
# gloomy tiger But can you *move*?

With the host yes and he can look around but by holding the mouse button down and dragging the mouse around. The clien't can't do both of these actions

gloomy tiger
vagrant grail
gloomy tiger
#

OK, just to be double safe

#

In your PC_Core

#

Call this function in the BeginPlay, passing false to it.

#

Run PIE again and see whether your server can still move/look around/whatever

vagrant grail
gloomy tiger
vagrant grail
#

And trying to set this to true works perfectly on the host again, but the client still can't move ๐Ÿ˜„

gloomy tiger
#

Make sure there's nothing setting InputMode UI Only for clients

vagrant grail
gloomy tiger
#

In the BeginPlay of your PlayerState, you check whether it refers to the player state of the local player and then you get the pawn and call an event BeginLocalPlayerState (on the APawn) - if you're doing C++, there's the GetPawn fn on APlayerState IIRC

snow trail
#

i see

#

thank you!

gloomy tiger
#

Remember: the InputMode persists travelling and whatnot - so if you set to something at level X, it goes along for every and each time you travel

vagrant grail
gloomy tiger
#

Yep. ๐Ÿ™‚

snow trail
#

the GetPawn is also returning null...

gloomy tiger
#

Ah yes its a custom event you create yourself, sorry if wasn't clear

gloomy tiger
#

In C++ we have a PawnSet event - not sure it exists in Blueprints, does it?

snow trail
#

i just tested with a couple prints and apparently the pawn's beginplay is firing before the playerstate's

gloomy tiger
#

You don't need ot access the pawn to check whether it's locally controlled - the PlayerState has its own IsLocallyControlled function - if not, then you can get the PlayerController (on the PlayerState) and check whether it's locally controlled

gloomy tiger
vagrant grail
#

My project is a mess

gloomy tiger
#

You probably can lead from here then, but go with the bAllowedToControl boolean - it's better than having two separated booleans

#

And allow the GameState to mange that variable for ya - your Controllers just react to those changes

gloomy tiger
vagrant grail
#

I really hate the way Epic did their class system by having 3500 different classes that we need to learn

#

and each tutorial I watch comes up with a new way of doing stuff

vagrant grail
snow trail
#

its throwing this error at me
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerController_ReturnValue". Node: Branch Graph: EventGraph Function: Execute Ubergraph Standard Player State Blueprint: StandardPlayerState
but the ping widget (which would show 0ms if it didnt have a valid playerstate) still works

#

wait now its not giving the error anymore

gloomy tiger
gloomy tiger
#

Run it 10 times just to make sure, because you might be facing a race condition

snow trail
#

yup its giving it again

gloomy tiger
#

Ok so

#

Is your Pawn being given to the Player automatically by the GameMode or you calling Possess yourself?

snow trail
#

its being given automatically

gloomy tiger
#

Yeah don't do that

#

That's your race

#

In your PlayerController, create a function called idk, RequestPawn, which is a RPC client -> server

#

Then in the RequestPawn you spawn your character (StandardPlayer it seems) and you call Possess

snow trail
#

reliable run on server?

gloomy tiger
#

Yea, reliable

snow trail
#

aaand i should call it on the controller's beginplay?

gloomy tiger
#

Yup

#

At the very beginning - and then you probably don't want to do anything else there

snow trail
#

wont the gamemode still try to spawn players by itself?

gloomy tiger
#

Ah yes! Good call. Remove the default pawn class from the game mode.

vagrant grail
gloomy tiger
#

I don't know if Blueprints automatically call OnRep_s

snow trail
#

on top of that, some stuff broke

gloomy tiger
snow trail
vagrant grail
gloomy tiger
#

You have to run an if to check whether the PlayerController is valid

#

Because that function is called to all connected clients (including the server)

#

And remote clients don't know the PlayerControllers of anybody but their own

#

(That said, if you put a print string in the OnPawnSet, you're going to see it's going to get called X times, where X is the amount of players with pawns you have)

gloomy tiger
vagrant grail
gloomy tiger
#

Are you sure there's nothing wrong with this logic?

#

More specifically to these nodes

#

You gotta debug a little

#

Put print strings in places, see what's going wrong, what is being called, where, when, etc

vagrant grail
snow trail
#

and its getting to the end of it twice on the client and zero times on the server
so i get two ping widgets on the client spawned and none on the server

#

this is so confusing

graceful flame
#

Hello

sinful tree
# storm wind Oh, so it doesn't matter if in the maps and modes we set MapA, server has every ...

There is a way to exclude assets when you're packaging, so your server doesn't necessarily have to have all the maps you may create - like there is no point in the server having any sort of "Menu" map or any maps that may be part of a single-player only campaign and wouldn't be used in multiplayer gameplay at all, therefore you could save some storage space by excluding those from the dedicated server build.

And yes, by running the command line in such a way, the server can load to a certain map.

summer orbit
#

How do I possess 2 pawns using one controller or player index? I want to move Pawn #1 using WASD and Pawn #2 using Arrow Keys while keeping it on one camera.

sinful tree
lament flax
#

i cant figure out how to patch the sprint logic

thin stratus
lament flax
#

can someone give me some feedbacks from my actual sprint system ?

loud tiger
#

Ever so often I run into situations in a listen server setup where:
Server player to client replicates fine
Client to server player replicates fine
But not client to other clients

For example this would be an int for attack angle choice in an anim bp or a Boolean for holding a weapon out (animation)

What am I probably missing with this scenario? I don't want to abuse use of multicast when it doesn't make sense to ๐Ÿ™‚

gloomy tiger
#

What's not working would be an easier question to answer.

#

In general, client to client communication is quite an equivocated idea. The actual mental model you'd have to have that may facilitate your life is: client -> server -> other destination (that may be all clients, or some specific clients, etc)

dark edge
#

that pattern will work in all situations. If you don't want to wait for the network round trip to see the results of a client action on that client, then you're in prediction land

#

Certain things like Character movement seem to automagically be making it to the server, that's the Character system doing the run on server events for you under the hood in C++, things like movement and jumping etc.

gloomy tiger
#

Knowing clients always have to go through the server to transmit their ideas to the world, everything becomes easier. And take note: the only way you can communicate client -> server is via an RPC. There's absolutely no other way; no replicated properties, no nothing. Period. Don't waste your time trying (unless you come up with your own netcode, then it goes beyond me and may invalidate most of the things I typed below.)

Now, knowing this information, the most used - and probably the only few ones - channels you can choose to call this RPC is one of these three:

  1. APlayerController
  2. APlayerState
  3. The possessed pawn of the APlayerController

Out of the box, these three Actors (when marked bReplicates = true) and their respective UActorComponents (also marked to replicate) can call Client -> Server RPCs. You can also go further and have your own UObjects calling RPCs, but under the hood, they mostly always use the callspace of one of these three channels. The key is: actors are your channels. And the channel you choose is on you and depends a lot on context.

Alright, now you got the info you wanted in the server. What now?!

There are lots of nuances here, but:

  • NetMulticast RPCs mostly for one-off effects, with (mostly) no filters to who is going to receive. Even if you put an if in your multicast trying to filter local players and whatnot, that does not save you from bandwidth waste - the local player received the information anyways.
  • Replicated properties (or variables, if I may) is mostly the way to go for state 99% of the times; these guys give you lots of filters out of the box so you can save big when picking to who you want to broadcast information to. Not to mention that, by default, they are replay-ready, so late joiners to your game will consume the world the state it is at that exact moment.

The above is just a general outlook. As I disclaimed, there are multiple nuances and tidbits spread out, but may be a good start.

loud tiger
#

Thanks guys, really appreciate the responses. Starting to make more sense :). I'll toy around some more with some of your suggestions to see what changes the behaviour

dark edge
#

they are insanely powerful

hoary spear
#

Atleast worth 3 level ups, if not more

bright summit
#

As I understood the Unity networking API in few weeks, in unreal I can't get it 100% for last months xd sometimes I am doing something but I don't have idea why it works this way. Today I was making a door actor. Is has interact interface implemented which is called via server rpc from player character. Door actor is ticked as replicated. Properties I did as replifetime and it works without any rpcs or something, but to play for example opening sounds I was forced to use net multicast even if my open the door function was executing on every client

solar stirrup
#

You can use rep notifies for your replicated properties

bright summit
solar stirrup
#

You should be able to play things like sounds in those rep notifies

bright summit
#

Ah

#

I will try, I had problem also with broadcasting events to all players, so I think I should do it in rep notify also

#

And the one of biggest difference between unity - unreal is that with rep values we have handling late joining players automatically. In unity was a one of the biggest issues when making mp

twin juniper
#

Losing my mind, NEED HELP.
Must support local split screen + LAN + Network. So many problems with local players 2+ controller initialization, etc. Please, if anyone is experienced and willing to help.

storm wind
#

Btw I have a case like this:

  • server is executed in ec2 with default server Map named MapA.
  • it's a mobile android game. when client is running the game, the will go into loginMap
  • After they login successfully, they will load playerdata from API using varest, and save the data to game instance variables.
  • They will automatically directed to CustomizationMap, and call the playerdata variables from game instance. and there's a Play button that excute console command open ipAddresOfEc2, and takes the client to MapA in multiplayer and client meet each other. They can chat, dance, sitdown, that's all. Everything works.
  • There are 6 clients connected in the MapA server, let's say named client1-client6
  • There are also different MapB, and MapC. is it possible if client2 and client 3 is go to level MapB
    Client 4,5,6 go to level MapC?
  • so that the server which has 6 clients, are divided into 3 maps like that?
  • How do I achieve that in dedicated server using aws like that?
dusk fable
#

hi , is there a way i can detect if a multiplayer is in progress ? checks before joining session if game in progress or not , like i tried with a boolean , and diff bp classes like game mode , and the boolean in the game instance doesnt seem to change its value at all , any idea ?

gloomy tiger
dusk fable
#

so players are in a lobby , they chose a map , and load it , im trying to prevent another player from join the same session when the game has already started

#

maybe there r nodes im unfamiliar with , but since im using different bp classes for the lobby and menu , the work with HasGameStarted boolean doesnt seem to fit , ive tried different classes , or a "bridge " to change the boolean value , but its always false for the new player *

gloomy tiger
#

You have plenty of options.

  1. If using lobbies (I know you mentioned sessions, but sometimes people use these two words interchangeably so...), you probably have access to flags. You can set a match ongoing flag that discloses the situation to others willing to join.
  2. If using lobbies still, another option is to just close the lobby altogether.
  3. If using raw sessions, you can allow others to connect and just kick them out once they connected.
  4. If using raw sessions still, AFAIR you can destroy the session once the match starts and re-create it once the match is over.
dusk fable
#

yeah , 4 seems fitting , thank you

stable grotto
#

a static mesh component with collision runs on tick? or is it only when Generate Overlaps is ticked? or not im assuming this because of the begin overlap and end overlap must be running on tick right?
please if anyone know share the knowledge
I'm asking because im trying to have few things running on tick on the server

sinful tree
cursive steeple
# stable grotto a static mesh component with collision runs on tick? or is it only when Generate...

regardless of whether or not things are running on tick, if you need tick to be on, then the rest doesn't matter. If you don't need it for gameplay, then turn it off alongside all other features (related to collision) that you don't use.

I don't have a basis for this, but my assumption would be that physics interactions would be updated when components with physics enabled are moved/moving, not on tick or periodically. I'd also be happy to be confirmed or corrected.

hollow eagle
#

Static mesh components (or other non-skeletal primitives) do not "tick" themselves. Unless you enabled it yourself which would be weird.

#

The physics engine manages its own ticking, whether a component ticks or not has no effect on physics.

lament flax
#

I remember having to enable ticking on my player mesh because it wasn't replicating some blend space params

#

If enabling ticking isnt a good thing, i might have to ho back and fix the issue

twin juniper
#

What happens to the GameMode when the map is reset, meaning when the current map is (re)loaded?

lament flax
#

Good question, im interested

#

I wonder if the game state is reset aswell

twin juniper
#

I know it runs begin play. I am asking because i am spawning loacal multiplayer + AI that fills any remaining player starts, players spawned first then AIs. When I reset is when I am getting +1 additional AI on top of the second local player and also the order in player starts is not the same; only happens when I re open the current map.

lament flax
#

so even if its reloaded, Unreal doesnt care and will do the same as if it wasnt ever loaded

twin juniper
native tapir
#

While developing a multiplayer game, we are persistenting player data on the server during SeamlessTravel to the next map using the PlayerState::CopyProperties function. However, the client is currently only replicating the data from the server and does not maintain the data locally.
(Destroying local data and replicating from server)

during SeamlessTravel. In this situation, how can we client to carry data locally while seamless travel? Which function should I check? (C++)

bright summit
#

for to be sure

In C++ OnRep functions are not being called on the server, listen server, right?

#

If I want to I must call them manually?

hoary spear
#

Yes

thin stratus
thin stratus
#

All function calls in that regard are done from the Server iirc

storm wind
#

Great thanks a lot for the help. It shed some lights to my problem ๐Ÿ˜ƒ

#

Now I know what I need to experiment with

native tapir
twin juniper
thin stratus
#

There is also AGameModeBase::ProcessClientTravel

#

Followed by APlayerController::ClientTravel and APlayerController::ClientTravel_Internal, later one being a ClientRPC.

#

That RPC will call APlayerController::PreClientTravel

#

You could listen to FOnPreClientTravel& OnNotifyPreClientTravel() { return NotifyPreClientTravelDelegates; } from the UGameInstance in classes where you want to react to it.

#

But this is not really allowing you to move data from PlayerState to PlayerState

#

That would only allow you to maybe save the Data locally and later somehow reload it.

#

All not really required, but I'm not gonna question your needs

tender solstice
#

Hello everyone! Is it possible to transfer the coordinates of a player from the server to another player who is in a single world? I know how absurd that sounds.

bright summit
# hoary spear Yes

But I must wrap this into HasAuthority condition, right? Because on client it will be called twice?

hoary spear
#

No, its a local call

#

(If the code also runs on client, then yes)

bright summit
#

yes it was

formal solar
#

A little confused by switch has authority node, it's my understanding that clients have authority over pawns their player controllers possess?

bright summit
formal solar
#

its to do with autonomous/ simulated proxies im testing it in listen server environment

#

looks like players have remote role for own pawns but remole role is split into autonomous/simulated, autonomous for your own pawn and simulated for the rest

#

probably authority for clients is only for the controller and controller spawned?

#

so can filter the switch has authority with an extra remote role branch

formal solar
#

looks like not easy to filter network roles just in blueprint though zzz

thin stratus
#

@formal solar @bright summit Clients have Authority over locally spawned Actors.
They are "Remote" for any Server-spawned, replicated Actor.

#

That's why people usually say that "Authority != IsServer"

#

If you want to branch on a condition for "actually local" and "simulated", aka AutonomousProxy and SimulatedProxy, you either use the LocalRole or you can do "IsLocallyControlled" on Pawns , as well as IsLocalPlayerController on PlayerControllers fwiw.

formal solar
#

I made a table
I would like to have a switch on ENetRole but looks like not exposed to blueprint

thin stratus
#

GetLocalRole should be available

formal solar
#

it is but there is no switch node to test for it

#

I can use print string to see it

thin stratus
#

You can check == fwiw

formal solar
#

oh ok i can try that

thin stratus
lament flax
#

what would be a good way to move an actor betweens points with consistent speed between them.

thin stratus
#

So that it's synced between Server and Client?

lament flax
#

yes

thin stratus
#

Out of the box that's a bit tricky.

lament flax
#

basically i got an flying AI that i move to follow an array of points

the issue i cant rely on any Move To because it doesnt handle "flying"

thin stratus
#

Ah

#

So not just an normal actor

lament flax
#

so before going for an event tick or timeline, i wanted to ask here

thin stratus
#

Hmm

lament flax
thin stratus
#

Last time I had to do a flying actor I just fake it with a high capsule, but that has to be something fitting the game

lament flax
#

i cant do that

#

it can fly high, and has to go through small holes

thin stratus
#

Does it have to actively navigate or just straight from A to B?

lament flax
#

i am using a 3D pathfinding plugin to get a path
so now i need to go between each point
A to B to C to D to .. to end

thin stratus
#

I would use Tick then. Server-only though I guess, cause the Server can replicate the Location back.

lament flax
#

yes

#

im just scared its a bit to much for server

#

replicating on tick

#

actually you are right, server will only does his job, then it will be the clients machine job to move it

#

(if i understood correctly)

thin stratus
#

If you use a Character, the CMC should already replicate the Location and smooth it or not?

#

CMC has a flying mode, so that should be fine to use

lament flax
thin stratus
#

Iirc, yes, cause the actual Transform replication that every Actor has (bReplicateMovement) is hooked into for the CMC to smooth stuff

lament flax
#

thats great

#

i'll test a event tick and see how it goes

thin stratus
#

I, personally, would modify the CMC for this stuff

#

And see if I can use some sort of PathFollow logic for this

#

But yeah, good old "BP Multiplayer sucks" topic.

lament flax
#

maybe one day :)

#

let me prove the world its possible

karmic briar
# thin stratus But yeah, good old "BP Multiplayer sucks" topic.

I remember the first time i built full BP Multiplayer game to distribute to my friends,the movement logic is messed up because it modify lots of CMC stuff in BP..lots of funny stuff like my friend can climb infinite height because the CMC height var nit exposed

#

Fun times

prisma snow
#

Hi! I am doing some debugging on our multiplayer setup - we have a bit of a different system where we have a class named "PlayerHandle" that inherits from "AController" and kind of acts as a substitute for PlayerState (partially) - I am not sure the reasons since I was not coding multiplayer at that time.

Anyway, I'm seeing that the PlayerHandles are not being replicated to all clients. I am aware that PlayerControllers are only replicated to owning client, but in this case we need all PlayerHandles to be accessible to clients to run certain game logic (like checking teams etc).
My question is - is the restriction of replication to clients "hardcoded" into the controller class, or does it only depend on how this actors are being spawned and configured to replicate?

Code for actor spawning:

    FActorSpawnParameters SpawnInfo;
    SpawnInfo.Owner = CurrentOwner;
    SpawnInfo.Instigator = GetInstigator();
    SpawnInfo.ObjectFlags |= RF_Transient;

    APlayerHandle* Handle = GetWorld()->SpawnActor<APlayerHandle>(APlayerHandle::StaticClass(), SpawnInfo);

And in the PlayerHandle constructor:

APlayerHandle::APlayerHandle()
{
    bReplicates = true;
    bAlwaysRelevant = true;
    bOnlyRelevantToOwner = false;
}

Thank you ๐Ÿ˜„

torpid whale
#

Hello, I have a question, I have a line trace that returns the character I touch, and I would like to be able to spawn a widget for the character I touch with my character, how can I do it?

The way I did it, the widget appears on all clients, but I only want it to appear on the client I touch

sinful tree
# torpid whale Hello, I have a question, I have a line trace that returns the character I touch...

You'd pass along your "Character Receiver" value as an input on your "SR_TradeSend" RPC to the server.
Change your "Client_TradeSend" event to be a Client RPC rather than a multicast.
Plug in the "Character Receiver" value from your "SR_TradeSend" event to the target of the "Client_TradeSend" event. This should now route the RPC to the client machine of the player that owns the "Character Receiver" you detected with your trace.

torpid whale
#

Change your "Client_TradeSend" event to be a Client RPC rather than a multicast.

How I do this? I thought multicast was to replicate to clients

torpid whale
#

I made the changes, but the widget still appears on the character I use, and not the one I interact with

sinful tree
#

Err...

#

Don't think this will work as I'm guessing the Receiver is the target character.

#

But your nodes are present on an actor known as "C Trade"

#

You need to have the client RPC go to the receiver, and from there it will communicate to that client to open the UI.

torpid whale
#

I think this is very difficult, I'm going to try to watch videos and learn more replication fundamentals before doing it.

young spoke
#

I'm getting a bunch of segfault crashes when doing seamless travel in FSeamlessTravelHandler::Tick e.g.

0x00007f0e798fded9 libUnrealEditor-UnrealEd.so!UEditorLevelUtils::ForEachWorlds(UWorld*, TFunctionRef<bool (UWorld*)>, bool, bool) [/UnrealEngine/Engine/Source/./Editor/UnrealEd/Private/EditorLevelUtils.cpp:1436]
0x00007f0e798fdfea libUnrealEditor-UnrealEd.so!UEditorLevelUtils::GetWorlds(UWorld*, TArray<UWorld*, TSizedDefaultAllocator<32> >&, bool, bool) [/UnrealEngine/Engine/Source/./Editor/UnrealEd/Private/EditorLevelUtils.cpp:1451]
0x00007f0e798b2745 libUnrealEditor-UnrealEd.so!UEditorEngine::CheckAndHandleStaleWorldObjectReferences(FWorldContext*) [/UnrealEngine/Engine/Source/./Editor/UnrealEd/Private/EditorEngine.cpp:7172]

I'm calling ServerTravel() from my GMB. these errors occur in PIE and in packaged build. i'm on ue 5.1, with seamless travel enabled (in pie and gmbs)

lament flax
hoary spear
#

Id imagine simulating this on the client should be very possible?

#

Path points + timestamps for arrival

lament flax
#

the path can dynamically change

#

so 'ill have to update client

#

also the tp effect is weird
the character isnt teleporting with it, its fixed

#

he is attached to the root comp of the fyling actor

#

(called on server)

hoary spear
#

Thats not really an issue

lament flax
#

im trying to find the soure of the issue

hoary spear
#

Depending on how dynamic ofc