#multiplayer

1 messages Β· Page 46 of 1

pallid mesa
#

but it is indeed more complicated

scenic bobcat
#

hello everyone, i’m making a multiplayer fps and my camera is attached to character’s head, and the head isnt alining perfectly with the forward vector, so whenever i start the game the player controller resets the camera rotation to face the forward vector, the problem is the remote characters dont have a character controller so their camera never gets reset, so their aiming endup slightly offseted,

and the aim functionality which is based on the camera totaly breaks, see the pictures

i tried sending the relative rotation at beginplay to the server and set it but didnt work idk why

feel free to seggest anything cause im getting crazy stuck with this for 3 days πŸ₯²

if im not clear enough please let me know, thanks

thin stratus
#

It uses controller pitch for server and autonomous

#

And a replicated pitch for anyone else

#

Should be available for pawns and or characters in blueprints

scenic bobcat
#

the pitch is allready replicated through the aim blendspace

thin stratus
#

@dry pebble @digital herald @graceful flame

Some engineer on/from a Client of mine recently looked at GEs for MovementSpeed changes.

The removal of GEs can't be predicted, so that's always a little annoyance. I think they wrote some fancy custom code into the CMC that keeps track of GEs applied via their Prediction keys or so. There was also a small delay between application on server and client when not using the CMC directly (e.g. applying the GE from an Ability).

It all came down to him adding some "threshold" or "slack" where the server waited on the client or so. I sadly can't share the implementation, but it did remove corrections from applying GEs for MovementSpeed changes. Without that we always had corrections at start and especially end of the GE as the client can't predict removal.

(We also went away from using GEs for cooldowns because of that, which is also what Epic did internally)

thin stratus
scenic bobcat
#

yeah

#

i think i fixed it

#

i wasnt using the camera boom

#

now that i attached it to the head and the camera as its child it all works fine

scenic bobcat
thin stratus
#

Oki glad you solved it

scenic bobcat
#

i think some problem don't get fixed until u ask someone

#

lol

#

even if he didnt give u the answer

thin stratus
#

That's more or less the concept of rubberducking

scenic bobcat
#

yeah thanks mate, a lot

real ridge
#

hey guys its again me πŸ˜„ i was sick af but today I tried use my thirdperson character as plane with its(movement) but anything I do I mean any move is not replicated either

#

I moved with my plane and from second client it has same position, maybe is problem in my controls?

#

also i am doing flying like this

#

but CMC should be replicated

#

I have it inside

#

set it to flying

scenic bobcat
#

did u check the replicates checkbox

#

on the character movement

#

and replicate movement on the thirdpersonBP

real ridge
#

yes all are checked

#

if you mean this

scenic bobcat
#

idk men

scenic bobcat
scenic bobcat
#

i never used used add actor offset/rotation so idk πŸ˜…

#

try replicating through events

real ridge
#

u mean RPC?

scenic bobcat
#

no just replicate the input event

real ridge
scenic bobcat
#

somthing like this

#

Hey guys, in today's video, I'm going to be showing you how to replicate sprinting for your online multiplayer game. This will replicate the movement, speed, and animations.

More Replication Videos: https://youtube.com/playlist?list=PLQN3U_-lMANOaPmzSGLDhyWzKzwgKDz9V

#Ue4 #UnrealEngine4 #Ue4Tutorial
____________________________________________...

β–Ά Play video
real ridge
#

ah yea do you think its good for replicating movement of my pawn?

real ridge
#

do you know why I am getting this error? I am doing this

scenic bobcat
#

as for the warning im not sure

real ridge
verbal tendon
#

you're calling a ServerRPC from a non-owning actor

#

so your BPDFCPlayer RPC is not being called from the owning client

#

So in your example you most likely have 2 players, the Tick is being called on each client. And for the non-owning client it'll throw the error

#

There should be networking basics guides in the pinned messages. Check those out @real ridge

scenic bobcat
scenic bobcat
digital herald
real ridge
#

i am testing it in 2 windows

#

so thats maybe problem

verbal tendon
real ridge
verbal tendon
#

That's literally what it is there for.

hollow sentinel
#

Can anyone please help me out of this!!1

real ridge
scenic bobcat
#

can u clear this up

hollow sentinel
#

Just ago fixed that issue. Thanks for answers.

hoary spear
#

Is a property limited to the replication condition of the actor/component that holds it, or are they individual for all intents and purposes?

dark edge
#

Are replicated variables guaranteed to be in good condition when an actor becomes relevent?

#

Like say I had a component that gives itself a replicated GUID on spawn.
On BeginPlay, the component registers with a subsystem.
When the actor containing the component becomes relevant, should its GUID be in good shape by the time it registers?

quasi tide
#

I think there is a better place to do that in the Actor lifecycle - I think PostNetReceive or PostNetInit...something like that anyway

lean surge
#

kind of a bump on a question I asked earlier but still;

Anyone know how to turn off certain clients receiving character / CMC location corrections from the server? doesn't matter whether this is done server side, as in simply not sending corrections to that client somehow or client side, just not using the corrected versions that the server gives. Overriding methods like ClientAdjustPosition_Implementation and PostNetReceiveLocationAndRotation to simply just be empty still cause corrections from what I'm experiencing.

lean surge
regal mica
#

Hey guys, I'm working on a listen server game where players can do damage to each other, but there is also environmental damage. When setting the owner of the environmental who do I set as an owner of that damage? How do I separate the listen server player from the environment, which is its own neutral entity?

dry pebble
thin stratus
#

Stamina, outside of GAS, is relatively straight forward

#

The problem is that the CMC needs a lot of boilerplate code to fully support this

verbal tendon
verbal tendon
dry pebble
#

I am completely lost on how to predict GAS stamina now with sprinting speed change. If anyone can point me in some sort of direction in the CMC, I'd really appreciate it. Back to the source code for me lol πŸ˜„

thin stratus
#

I don't think anyone can point you

#

Either no one solved this or can share it

#

This isn't every day code anymore

#

Stamina without GAS, where the Value lives in the CMC directly and is not replicated and only modified via the Sprint Code, is relatively okay

#

But if you use GEs to modify the value, then you suffer from the problem that prediction can't remove GEs

#

You'd need to cut the local player some slack for the duration where the server removed the GE and the Client hasn't yet

dry pebble
thin stratus
#

There is no need for it

#

The idea of the CMC is that it does the same on the server as on the client

#

In the same timestamp at least

#

If you consume the value during the sprint, it should consume on both ends the same

#

If you end up having a different value, it will cause a correction, at which point you send the server's value to the client to sync again

#

The CMC itself isn't even replicated fwiw

dry pebble
thin stratus
#

Yeah, you need to

#

I learned the hard way that SavedMoves are not only for replays

lean surge
thin stratus
#

SavedMoves are also used to send stuff to the Server

#

while you don't send the stamina value to the server, it can still be that the Client chooses to combine two moves

#

And the client at that point actually performs the original move twice

#

So it's:

  1. Perform Move 1
  2. Choose to not Send Move 1
  3. Combine Move 1 and Move 2
  4. Perform Move 1+2 (performing Move 1 twice)
#

The thing that resolves this is that the SavedMove has a method in which it resets the CMC state back to BEFORE move 1

#

So you will want to save the Stamina value before you perform the move

#

So you can later reset it

#

Otherwise the Client will consume too much Stamina when mvoes are combined

#

Pretty shitty to find out cause Moves aren't combined that often, unless the client is > 60 FPS

#

At least with default settings

thin stratus
#

But they aren't available outside of GameplayAbilities by default

#

If you execute those on Server and Client together, it will sync up everything automatically in the CMC

#

Only thing you need to do is flush server moves before executing them

dry pebble
# thin stratus So it's: 1. Perform Move 1 2. Choose to not Send Move 1 3. Combine Move 1 and M...

Oh wow I didn't realize it worked like that, that is very insightful, thank you. And yeah that would've been a shock to find out. I hate bugs that happen rarely like that.
And when you say "If you end up having a different value, it will cause a correction, at which point you send the server's value to the client to sync again", is this just automatic because server and client are running the same code or are you saying I need to manually sync this?

thin stratus
#

We have no corrections on 200+ Ping with that

thin stratus
#

Nowadays you make a new Container Struct that inherits from the default one

#
struct FVRTCharacterMoveResponseDataContainer : FCharacterMoveResponseDataContainer
{
    typedef FCharacterMoveResponseDataContainer Super;

public:
    virtual void ServerFillResponseData(const UCharacterMovementComponent& CharacterMovement, const FClientAdjustment& PendingAdjustment) override;
    virtual bool Serialize(UCharacterMovementComponent& CharacterMovement, FArchive& Ar, UPackageMap* PackageMap) override;

    float Stamina;
};
dry pebble
thin stratus
#
UVRTCharacterMovementComponent::UVRTCharacterMovementComponent(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer)
{
    SetMoveResponseDataContainer(VRTMoveResponseDataContainer);
}
#

Last line is for setting that

thin stratus
#

VRTMoveResponseDataContainer is a member variable

#
void FVRTCharacterMoveResponseDataContainer::ServerFillResponseData(const UCharacterMovementComponent& CharacterMovement, const FClientAdjustment& PendingAdjustment)
{
    Super::ServerFillResponseData(CharacterMovement, PendingAdjustment);

    const UVRTCharacterMovementComponent* VRTMoveComp = Cast<UVRTCharacterMovementComponent>(&CharacterMovement);
    const AVRTCharacter* VRTCharacter = Cast<AVRTCharacter>(VRTMoveComp->GetCharacterOwner());

    Stamina = VRTMoveComp->GetStamina();
}

bool FVRTCharacterMoveResponseDataContainer::Serialize(UCharacterMovementComponent& CharacterMovement, FArchive& Ar, UPackageMap* PackageMap)
{
    if (!Super::Serialize(CharacterMovement, Ar, PackageMap))
    {
        return false;
    }

    if (IsCorrection())
    {
        Ar << Stamina;
    }

    return !Ar.IsError();
}
#

Something like this

#

Not sure if the Serialize is needed tbh

#

Just followed what Epic did iirc

#

I'll have to write something for that eventually, but i'm busy refactoring something that is quite old into something new and shiny and that comes first

dry pebble
#

Ohh interesting that is very helpful, now I can start reading about those methods. appreciate the help exi! πŸ™‚

dry pebble
thin stratus
#

Note though that code above is not all you need. Depends on what you actually do

#

It might also need a bIsSprinting boolean for example

#

When you handle the MoveResponse you might then need to start or stop sprinting based on that boolean

dry pebble
thin stratus
#

ClientHandleMoveResponse is the function that gets your move response container

#

Something something in there const FVRTCharacterMoveResponseDataContainer& VRTMoveResponse = static_cast<const FVRTCharacterMoveResponseDataContainer&>(MoveResponse);

dry pebble
pallid mesa
#

basically @dry pebble same stuff we said yesterday on stream, you can use an attribute for that and handle the base value yourself.. great explanation from exi with practical code

dry pebble
pallid mesa
#

Yes you could use your stamina attribute for dashes aswell as long as the dash is also handled in the cmc

#

the moment you use something that mutates stamina outside the cmc, issues will arise for sure

dry pebble
pallid mesa
#

yes unless you have some delays that prevent you from sprinting right after dashing

#

but its a mess

#

in fact I'm suggesting to use an attribute but... you are losing the benefits of using an attribute (mutations and such) so... heh

dry pebble
#

I could put dash in the CMC later, but for now for practice, I might try a seperate variable. Any benefit to using an attribute and modifying the base value vs just a value on the cmc?

pallid mesa
#

not many without pulling lots of hair

dry pebble
pallid mesa
#

it'd be cool if you can simply apply an instant GE locally which appends tags and such

#

its possible but you have to modify GAS

#

which is another deep pit

dry pebble
# pallid mesa which is another deep pit

right yeah, I'd prefer to avoid that for as long as possible lol. I'll try tapping into all those methods eXi mentioned and see what I can make. thanks for the help guys!

pallid mesa
#

sure!

dry pebble
#

I'm going to read through CharacterMovementReplication.h, are there any other classes relevant that link to CharacterMovementComponent that I should look into?

low helm
#

Anyone remember how to make a client-side-only pawn send its location updates to server for purposes of the net culling of other objects?

#

I have to ask every 6 months because I forget

thin stratus
#

But then again also not

fresh cloud
#

SPEAKING OF CMC, i did some prototyping and research

#

i'm going to, again, try a more basic implementation of INetworkPrediction interface

#

but, both the version i just finish and stock CMC didn't really respond well to root motion locomotion

#

it would be fine in an empty space, but as soon as i had collisions and surface sliding, root motion locomotion got too unpredictable and i would get constant rubberbanding under all my tested network emulation settings for both my own work and stock cmc

#

i'm going to go back to square one, do another solid and simple movement component, but i need to have root motion be only incidental

#

it's not that bad, i just have to adjust some locomotion animations that are root motion based and normalize them to work with a static movespeed, but after my tests today with stock Character and CMC, i'm pretty sure it's just root motion in networking that is too unpredictable when used for locomotion

#

again, kind of a "duh of course" moment, but hey i LEARNED something which is always nice

low helm
#

did you try turning on client authoritative during root motion?

fresh cloud
graceful flame
#

I'm still not 100% clear on what saved moves are (even though my code uses them lol). My understanding is that in the simplest terms a "move" is the resulting world location for the character actor after processing all of the player's input which is handled by the CMC. A "saved move" is the vector as predicted by the client and may or may not be used but kept temporarily in a small buffer.

Here's where things become even more unclear for me.
When moves are combined together does it mean the CMC is processing two or more inputs simultaneously?

or does it mean the CMC is processing the first move for input X, then re-runs the code to process another move for input Y and returns a vector all of which occurs on a single frame?

or is it more like the player is pressing W to move forward but the server says no you're pressing space bar to jump and so the end result is both the character moving forwards while also jumping?

earnest comet
#

Guys a general multiplayer question if I may.

#

In a game I know, many people are experiencing sync issues, such as like lets say you have 2 items in your inventory and you are not the host. You drop item 1 but host sees it as you drop item 2.

#

So after game syncs you also see that you dropped item 2 despite wanting to drop item 1

#

However the dev can't reproduce this when testing. What could cause this in general terms?

hollow eagle
# graceful flame I'm still not 100% clear on what saved moves are (even though my code uses them ...

A saved move is a single "action" taken by a movement component, either on a client or server. It might be a movement vector for walking, or a signal to start jumping, or some other "input". Also most inputs can be combined into a single move, since you can for example jump at the same time that you move in a direction.
It also contains logic for how to apply, revert, and combine other saved moves so that CMC can replay or rollback movement state when necessary.

#

On clients the CMC needs to retain a saved move buffer because when the server confirms a move the client may have already applied additional predicted inputs, and if the server's confirmation differs at all then the client needs to replay unconfirmed inputs back on top of the server's confirmed state.

#

As far as combined moves go, CMC doesn't really process things in terms of inputs. It processes saved moves - which may be produced by inputs.

#

If on the same frame you hold forward and press jump then the result should be a single combined move that contains both

#

How that's achieved is somewhat irrelevant, but it could be by each one producing a move and then combining them at the end of the frame

#

Or potentially only at the next network tick

graceful flame
#

Ahhh okay this has helped me a lot. Thank you!

formal path
fresh cloud
#

mhmm, basically... the overall flow is tick component on client -> if received client correction, fix here -> replicate to server is called -> create saved move + initial fill -> performmovement -> finish saved move + ending fill -> CallServerPacked -> server unpack and setup -> server side perform movement -> check for error -> if no error, send Ack of good move, if error send client adjustment -> tick component on client -> if receive... and so on

earnest comet
#

Much appreciated everyone. Thats good information!

fresh cloud
#

there's more abstractions beyond that, such as sending an old move, pending move, combining moves that aren't important together, etc. but that's the basic flow for autonomous pawns and the server

cloud stirrup
#

idk wtf is wrong here. followed guide as only 2 steps. click generate file click build. fresh "release" version so should build no issues

fathom aspen
#

They will tell you not to look at the error list and instead look at the output log

#

Just a heads up before you ask there

cloud stirrup
#

im building src tho its not a cpp issue?!? its src itself. anywho im just pissed boput waiting 2 days for the error on something that shoiuld be click build. not midified a thing XD

dusky yarrow
#

it can be cruel over at #cpp but you need to force through all the judging emojies

cloud stirrup
#

cheers man

fathom aspen
#

You still count πŸ₯ˆ tho πŸ•Ί

round mist
#

Does anyone know if World Partition in UE5 works for listen servers? Our game uses player-hosted sessions that other players can join as clients.

IIRC World Composition doesn't work because the server (our hosting player) handles the loading/unloading, so if the server left a zone in our open world but a client was still there, it would be unloaded and they'd fall through the ground into the abyss. Is this still the case for World Partition? Trying to decide if moving my project from 4.26 to 5.1 would be more work than it's worth.

fresh cloud
#

hm... i know there are functions in place via the player controller where when the server loads a sublevel, the clients are informed and told to load that sublevel as well (i had to override that for a recent project), i THINK there is a flow for the other way around no?

fathom aspen
#

Keep in mind this is all still experimental

cloud stirrup
#

thnx. its a bp project im trying to build the dediserver. but iv broke it adding c++ starter content to it to try make the vsproj file as it just crashes now 😦 il get src built first from this guide. then try start again

dry pebble
twin juniper
#

What would be the best way to rotate a character toward a specified location on a server. I am using GAS and have a custom CharacterMovementComponent on my pawn.

#

SetActorRotation seems like its not playing well with the movementcomponent and I cant seem to find anything that makes sense in the movementcomponent

dry pebble
twin juniper
#

I saw that, but didnt know if I had to go through the movementcomponent

dry pebble
#

I did this to slowly rotate player in that method

        const FRotator SmoothRotation = UKismetMathLibrary::RInterpTo(CurrentRotation, NewControlRotation, DeltaTime, RotationFactor);
        SetActorRotation(SmoothRotation);```
dry pebble
twin juniper
#

Cause I see that the MovementComponent uses the FaceRotation, but it doesn't seem like there is an explicit way to just rotate the character through it.

#

I'm think I might need to make something custom

#

Sorry, as an update FaceRotation wouldn't work. In the game i'm working on we aren't using any controller rotation.

#

It's all pawn

jovial charm
#

Heyy ghuys I am following the function replication tutorial here https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/ReplicatingFunctions/

Basically there's a collision box in the world, then through the Level Blueprint, logic is setup so when a player runs into the collision box, a "Switch has Authority" check makes sure that the collision is only handled by the server. The server then calls a replicated function with "Run on Owning Client" replication optiion to update a variable's value on the character that ran into the collision box.

How does the server know which player is the owning client? Is it because of the "Character" parameter passed into the replicated function? This is the logic inside the level blueprint.

dark edge
#

Whatever it's doing, do that I'd guess.

fathom aspen
#

p.NetShowCorrections 1

#

You edit Engine/Config/ConsoleVariables.ini

fathom aspen
#

Correct

#

Not project name though

twin juniper
fathom aspen
#

Just Engine folder

#

There is no Engine folder in your project directory anyways

#

That's in Engine directory

#

You could see that if you looked at the top

#

The one below

#

That's source code

#

Is source code part of your Project directory?

#

Yes just add it

#

You found the file

#

I thought you added the file for some reason

fathom aspen
#

No

#

Part of your project directory

#

Which is obviously not

#

Sarcasim that is

#

Laura pls no toxic

dark edge
sinful tree
# jovial charm Heyy ghuys I am following the function replication tutorial here https://docs.un...

To clarify what WizardCell said, it does indeed chain back to the NetConnection for the actor in question, however, in the example you've provided, your RPC's target is "Self" which appears to be a Level Blueprint, in which case the RPC will fail to send to any client. Your "Character" is only an input that would be passed through the RPC but that is not the actor you are RPC'ing on - the target of the RPC is what determines the actor and in this case, your target is "Self" which would be the level blueprint. The only instance this RPC would fire on, even though it's marked to replicate to a client, is the server in a multiplayer scenario.

fathom aspen
#

That slipped under my radar

#

Good catch Datura

#

They said they are following the tutorial by Epic. That's why I rolled with closed eyes and just answered the question kekw

#

Would be funny if Epic did that lol

#

Oh yeah they indeed did it rip

#

Okay I declared it, I officially lost faith in the official docs

#

Yeah it's indeed my fault for keeping some hope πŸ˜”

#

It goes even deeper, they client RPC to change a replicated property on client

#

Well I guess I can't trash talk YT/Udemy tutorials after today

#

Link plsss

#

I'll believe you considering your hat is not Good Looking

#

You must believe me considering you made both patrick_hehe

jovial charm
fathom aspen
#

It is good that you questioned that at least

jovial charm
dry pebble
twin juniper
#

the kicker with this is the animations that play for some abilities also apply root motion

#

So I'm trying to get the CMC to understand that I want a instant rotate the pawn toward the mouse then cast an ability.

#

I'm too sure i'f i need to override something and do custom logic or if i'm just not understanding how it should be implemented

dark edge
cloud stirrup
#

ok that took a long while but i managed to get vscode to play nice and build to a point where i can make the dedi server and client builds. seems u have to start the project with this ion mind for it to not break so start with settign it up for this build env and run from vscode editor not epic editor. fingers crossed i can recreate the project. props to wizard and laura for their help earlier

obsidian basin
#

Experiencing a little bit of lag when I feel like I shouldn't. Basically it's on selection of a character. User clicks, I do a get hit result under cursor for objects. I then send that actor reference to the local player state and replicate it as a variable to the server. However, when I click on an actor, there's about a second of lag before it actually updates.

I'm using mostly blueprint interfaces to transfer information - are they laggy in Multiplayer environments? Should I be casting when possible instead?

thin stratus
#

In the function where the client handles the move response it should theoretically check if you need to sprint or not and if you are already sprinting or not

#

And then manually force it to

#

At least I think so. Always worth checking what epic is doing in the parent class

verbal tendon
#

There is a very simple philosophy to this, I call it: Local First
If there is anything that does not strictly need to be replicate it, you don't replicate it.

For example UI clicks, VFX from gunshots. If the action affects the game environment and therefore other players, it needs to be replicated. However if the only actions are locally, and it won't out of sync you ... you don't replicate it.

So for the character selection if someone else is supposed to see it, you just simulate locally first for the selection, and the server will update everyone else on your selection.

Simply routing UI clicks through an RPC to the server to then get it later yourself... sounds flawed by design.

#

And obviously if the action has no visible effect for others at all, it should not get replicated at all

vivid prawn
#

Should I load the content before joining a session or after joining a session?

#

i see most games start with joining a session and load the content in loading screen

#

but when I try to use UE default join session, it connect right away, though if the map quite heavy; it hang for a min or so

gloomy tiger
#

So, here's me trying Projectiles + Multiplayer. Most of the solutions rely on Multicast + some filter to guarantee a dummy projectile isn't seen to the owner of it (to compensate for lag). Question: this is a waste, right? In the sense of bandwidth.

dark edge
#

At a minimum, everyone needs to know that a projectile was fired from X location at X direction if they're meant to see it.

gloomy tiger
# dark edge Why would it be?

One way to address "lag" in projectiles is to spawn one locally, then ask the server to spawn dummy ones for the remaining clients. Lots of solutions though suggest doing this technique via Multicast - however, Multicast affects all the clients, including the one that instigated the projectile - which is someone who doesn't care about it.

real ridge
#

Guys if I have Basic Thirdpersoncharacter and it has its basic CMC why when I change it to flying and I am moving with my character in game it's not replicated shouldn't it be like when u running on the ground?

vivid prawn
#

@real ridge is Can Fly checked by default? or you are switching it in the game?

hoary spear
real ridge
vivid prawn
#

hmm... the movement in character bp is replicated by default, i assume it's something else

#

are these 2 are standalone application?

#

i don't see server/client on them

real ridge
#

then my second approach is using pawn where I replicate movement by RPC but there is also one problem , when I move only little bit on the other window where it is replicated I see much bigger movement

#

even I replicated it via rpc

#

so I dont undestand how to do it

real ridge
#

but for example I am not replicating moving of propeller and it is replicated

#

I am confused πŸ˜„

real ridge
#

or maybe do I somehow need use instead this function from cmc and set location there to have my char replicated? i dont know

vivid prawn
#

i see... try to use Add Movement Input instead of moving the actor

#

that would handle the replication

real ridge
#

but for add movement input is target pawn

#

this is character

#

but I will try

vivid prawn
#

pawn has controller and movement as well

#

yup

real ridge
#

yes but pawns are not replicated

#

only characters as I was said

#

many times here

#

ou shit its doing some crazy shit :DDD

#

wtf

#

oh my bad only moving up and down is replicated but it's strange he moved to the left

vivid prawn
#

@real ridge just use character blueprint, everything is already there

real ridge
#

i just used also that blueprint for roll etc

#

and its definitely not good controlling of plane

vivid prawn
#

you can roll in CBP

#

have to turn on Use Controller Rotation Roll in CBP

real ridge
#

also it's not like a plane

#

what is cbp?

vivid prawn
#

I just checked the Can Fly and set default land movement Mode to Flying everything replicate nicely on myside

vivid prawn
real ridge
#

its uploading

vivid prawn
real ridge
vivid prawn
#

my suggestion is not to reinvent the wheel, you will save more time and have more progress

real ridge
vivid prawn
#

for rotation, you can turn on delay rotation

#

so it doesn't snap

real ridge
#

oh no old video..

#

this is my pawn and right movement

vivid prawn
#

i see... all that actually exists in CBP

real ridge
#

i will try make new project and test it maybe I Fucked something

#

if u saying

#

it must work

vivid prawn
#

check Orient Rotation to Movement in Character movement component

real ridge
#

it's ticked

#

but I have changed inputs

#

in settings

#

maybe that's problem

vivid prawn
#

also you can use Pawn Control Rotation in SpringArm

real ridge
#

so u saying it should work so I just will try find where I have mistake

half umbra
#

What do you think about Inventory which is based on MySQL database?

twin juniper
plucky prawn
#

Not arguing but how would you go about synchronising said inventory between servers? Like if you had some kind of "server node" set up? Or is that a completely different problem

outer sphinx
#

hello guys, a question someone uses the plugin "MySQL Integration
"?

timid moat
#

Hi!

#

Are there better options of UGameplayStatics::GetPlayerController to use them developing a multiplayer game?

#

Thanks.

silent sinew
#

How can I sync a simulated proxy if its late joining the game? Right now I'm testing two windows on a listen server. If I wait for all players to connect then no worries, but if I let the server/ client (same) run around and do something first, then the new player joins , they don't get any updates (unless the property is replicated). In my case I have a TMap (which can't replicate) and if the original starting player adds an element to this tmap I want to be able to tell the joining player - their Simulated proxy (of the starting player) needs to add this elem to the Map.

#

They weren't in the game when the OnRep for any replicated variables occured and I don't have one that would suffice. I could keep an integar of the number of elems and create an onrep for that, so when the new player begins their int gets the OnRep because it's not the same, and in this I could do something - but it seems so Meh

timid moat
#

Something like instead of GetPlayerController(0) use GetOwningPlayer.. Or APlayerState::GetPawn().

sinful tree
gloomy tiger
quasi tide
#

It is exposed to BP

gloomy tiger
#

Is it?

quasi tide
#

It's the "Replication Conditions" dropdown for a variable

gloomy tiger
#

Hm. I'm quite lost, then, geez.

hoary spear
#

Not sure if it was a good suggestion tho as im not very network experienced, but it came to mind

gloomy tiger
#

(Thank you by the way)

#

The thing is - I just skimmed that docs (shame on me), and thought that could be something that would skip the entire Actor from being spawned to the owner of it (missed the second param of DOREPLIFETIME_CONDITION).

#

That to ask: can I spawn actors conditionally?

#

In the sense - I want to spawn a projectile to everyone but the owner of it.

#

(That actually seems to me a pretty common thing to do in multiplayer games when it comes to lagfree solutions. I'm surprised it's so difficult (taking me hours) to get it done correctly, without the need of a multicast.)

hoary spear
#

bSkipOwner

#

Is for actor replication

#

In the actor settings

gloomy tiger
#

Wait. Where? πŸ€” In the Actor Settings within the Editor you mean?

hoary spear
#

Or avaliable as a property in c++

#

Yepp

gloomy tiger
#

Supposed to be here?

hoary spear
#

Probably under a replication category

#

Not in editor atm so cant find it

gloomy tiger
#

Can you point me the docs for this variable you talking about?

gloomy tiger
#

(Which relates to a variable)

sinful tree
#

Yeah that doesn't appear to be a property of AActor.

gloomy tiger
sinful tree
#

IsNetRelevantFor requires C++.

gloomy tiger
#

Not a problem. Whatever it takes to skip an unneeded multicast.

sinful tree
#

Ok, then it's fairly simple.... One sec.

#
.h
  virtual bool IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const override;

.cpp
bool YOURAPIHERE::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
    const APlayerController* RealViewerController = Cast<APlayerController>(RealViewer);
    if (IsValid(RealViewerController)) {
           // Do whatever checks necessary to determine if the PlayerController should view it or not.  
           // In your case, you'd probably want to return  (controller of the instigator of your actor != RealViewerController) thereby, only those who are not the instigator would return true.
    }
    return false; // Return false if thew viewer was not valid.
}
#

This would go into your projectile C++ class.

gloomy tiger
#

Testing right away. I anticipate my gratitude πŸ™‚

#

OK so - doing that would mean that when Spawning the Actor implementing this custom IsNetRelevantFor, the server would spawn it everywhere except at where IsNetRelevantFor would return false. Correct?

sinful tree
#

Yep

#

So that being said, you may want to add to your condition if the super is true, so any other relevancy may apply rather than just always being relevant for everyone else which it may not necessarily need to be if they're far away for example πŸ˜›

gloomy tiger
#

You mean

    if (!IsValid(RealViewerController))
    {
        return Super::IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
    }
hoary spear
#

Well damn. You're right, the property is "OnlyRelevantToOwner"

#

My bad there, mixing it with the cond

sinful tree
sacred kraken
#

I'm working on a two player co-op. You pick a role (there are two roles) and once both players have indicated they're ready, the game starts.

What are the steps I need to take? Abstractly, I mean. I can host a session and I can join, but I don't know when the other player has joined so I don't know when to show them as joined on screen. Should they just pop-up and do I replicate UI? How do I know when to enable the "start game" button?

A "rtfm" is also fine, I just don't know how to proceed.

hoary spear
#

Gamemode keeps track of players joining

#

Gamestate holdes an array of players

sacred kraken
#

@hoary spear What do I use to be notified of players joining? I have a custom game mode in c++ and I have a blueprint of it as well if that helps

hoary spear
#

Theres an event in bp (in c++) as well

#

OnPlayerLogin? Or something like that

sinful tree
#

OnPostLogin() is the function in game mode where a player has been granted a playercontroller.

hoary spear
#

OnPost* ah yes

sacred kraken
#

Thank you, that helps a lot.

#

virtual void OnPostLogin(AController* NewPlayer) override; there she is... If I may be greedy, do you have any pointers on syncing the UI? Player picks a role, and both players connected can see that?

#

I'm not doing that part until tomorrow, but I thought I'd try my luck πŸ˜„

hoary spear
#

Datura will provide a better method than what I did xD

#

( i may have snaked my way through some super redundant rpc bullshit via the gamemode and whatnot)

sacred kraken
#

I found the other method I need for my first question I think, it's called Logout. I was looking for OnPostLogout like a pleb.

sinful tree
#

Well really, I think it's more about what information it is you want about a player when they join which probably means the Begin Play of the Playerstate may be a better choice as the PlayerState would likely contain that data. The begin play in playerstate on the client could signal something to your UI, possibly by calling something in your HUD class to indicate a player is joining. Your UI would then need to react to that signal, set up any other binds that are required - you may want to read any values and have event dispatchers set up for when changes are made to any OnRep variables (like player name) You can always read the player array from gamestate as well if you want to read the current full list of players and then read their properties and set up binds to their data.

sacred kraken
#

Binds as in umg?

sinful tree
#

Binds to event dispatcher or binds in umg if you desire.

sacred kraken
#

Ah, right, thank you. I'm taking notes, because I need to look up what those are still.

#

So far I've done the basic map travel, host session, find and join session... That stuff. Now I need to figure out the rest.

hoary spear
#

this was some of my setup

sacred kraken
#

Any docs/tutorials on how this stuff works?

#

I copied both your messages to notion, so I can go through it using the docs lol

#

I'll just keep playing around and see what happens πŸ˜„ Thank you both

hoary spear
#

whenever someone did anything in the UI i went through the playercontroller to rpc(ignore the S)

#

which just passed it forward

#

which ends with the first function i showed, "Server_UpdatePlayerStatus"

#

this is probably not an acceptable way to do it at all , but it worked for my 4 man lobby x)

sacred kraken
#

Oh, wait, would gamestate then make sense?

#

Because that's synced, right?

#

And it's per game mode, so if I have a game mode for the "lobby" then that has a game state I can use to keep track of who's picking what. That information should be available to both players and is a draft until the real game starts anyway

sinful tree
#

It's more about what actor is pertinent for what data. PlayerState is a replicated actor just the same as GameState, the difference being only one GameState exists for everyone. Each player would have their own PlayerState, thereby, any data about a specific player that needs to be replicated to other clients and can be replicated at any time regardless of relevancy should likely be stored in PlayerState.

#

If it's specific to the state of the game or what is happening and isn't specific about any single player, and again, needs to be replicated to others, GameState makes sense to store that value.

sacred kraken
#

PlayerState lives as long as the controller does, right?

#

So it can outlive maps

sinful tree
#

PlayerState lives longer - it can stick around and be reassociated to a player that disconnected with a bit of work in C++.

sacred kraken
#

That's good to know

sacred kraken
sinful tree
#

So rather than having the gamestate store what each player picks, which in order to replicate would require a weird structure and/or some array management hell, you can store what the player picked on their playerstate, and then the playerstate can replicate those values to everyone else, and you'd use OnRep properties on the PlayerState so you get functions that are called when those values change so your UI can be updated when those values change.

sacred kraken
#

I didn't know that was how it worked

winged badger
#

Outlive maps... kinda... its going to get reisnantiated with the PC. But you can override CopyProperties to carry the data you need over map transitions.

sacred kraken
#

But clients can change their own playerstate right?

#

Or is that also server-only?

sinful tree
#

If you wanted to have something replicated, you'd be able to send a Server RPC on the client's PlayerState with the data you want to send, and then when running on server, set the replicated properties you want with the values that were sent through the RPC.

sacred kraken
#

Wait now I'm getting into "rtfm" territory because I am pretty sure the doc I found will cover this

#

So I need to keep reading

winged badger
#

I strongl, suggest separate lobby and game player state classes with a common base containing all the data you want to persist across levels

#

Those things tend to grow as you start adding more customization options

sacred kraken
#

I see

#

Added to my list of messages to decrypt πŸ˜„

#

Thanks again!

winged badger
#

Good choice of light reading material

hoary spear
#

The validation part confused/surprised me a bit

#

Failing validation results in a disconnect

#

Is that really how one wants to handle that?

#

Just disconnect anyone we decide tried to go outside some bounds during some rpc ?

#

Guess i just expected a rejected rpc, and nothing more

winged badger
#

You can do that, just noz how iz works out of the box

hoary spear
#

I see

sacred kraken
#

I found the answer to my question on literally the next page I had to read. I’m sorry

winged badger
#

Its basically there to kick out cheaters

#

You can add your custom validation and call it from RPCs _Implementation , for cases where xou dont want to accept what client sent you, but dont want to kick him either

#

And just have the _Implementation return out eithout doing anything when it fails

hoary spear
#

Ahh right, that makes sense

#

Thanks

obsidian basin
#

Hey all, I've setup an interaction system - I click on a player and it sets a replicated variable on my player state storing the actor I've clicked on. I've noticed there's a noticeable lag, however of about 1 second between when I click and when it's updated. This is happening on a dedicated server setup.

Anyone have any ideas why this might happen?

#

If I'm getting this much latency on a local test with selecting an actor now I'm worried what else could be lagging

graceful falcon
#

Quick question, how do server like call of duty or fortnite work? Are those servers dedicated servers?

#

okay, thanks

sinful tree
obsidian basin
obsidian basin
#

Or is there a way to change the frequency if I needed to?

sinful tree
obsidian basin
#

(nm, I found it in defaults lol)

obsidian basin
#

Hey, so I need to update an entry in an array. I'm telling the array "Increase this entry by 1". On the server, I find the right entry in the array and go through normal steps to update (Break the struct, set the members and then set array elem). It's updating it locally, but won't update the server.

I assume this is because set array elem isn't replicating; would a better way be to clone the array, make the changes to that array then set the actual array to that? THen it's just a simple set that can be replicated.

thin stratus
#

Yeah that's Blueprints for you

#

You can try to just call "Set" on the whole Array and pass in the whole array

#

That might trigger it properly

#

But that goes for the replication part

#

You should, even without that, have a correctly updated array on the Server after incrementing the entry. Otherwise you are doing something wrong

hoary spear
cloud stirrup
#

if i used loadlevelbp with url/ip how do you know if the level didnt load? would i just add a delay and if im still in the current level when the delay fires i throw up an error dialouge. otherwise iv moved levels and its all good. e.g walk into a tp box to tp from one server to another but if that servers down dont go there and stay where i am. as it doesnt have a success fail output on the bp

jolly siren
#

Is the only way to have a conditional for whether to replicate a property within a ustruct to also replicate a bool and check against that within NetSerialize?
Or can push model be used to control when properties replicate within a ustruct?

dry pebble
#

Does anyone know why the character class disables a replicated property as being not replicated? DISABLE_REPLICATED_PROPERTY(ACharacter, JumpMaxCount);

thin stratus
#

Is that function called by both?

#

Also ControlRotation is send from Client to Server

#

maybe something is going wrong with which ControlRotation is actually being used

#

ControlRotation is packed and send to the server usually

#

You'd only need to set it on the Server if you correct the Client iirc

fathom aspen
thin stratus
#

If it's known at compile time that you don't want to replicate a specific property, you would do what Wizard said

#

But a boolean is theoretically also fine

#

We use a bitmask for the GameplayEffectContext

#

We have multiple inner structs in that and only if someone calls "SetXYZStruct" on the Context, we flip a bit to 1

#

And use that to check if we need to load/save that part into the archive

#

I think that's what Epic also does with their EffectContext

fathom aspen
#

I'm looking over at FRepMovement they do something similar. For example they check against RotationQuantizationLevel to know how to net serialize

#

Though that is not marked as NotReplicated for some reason

#

Could be that they use it client-side

thin stratus
#

You need to replicate the flag/boolean

#

Cause you need to know on the client if you need to load the value

#

You are basically writing it in some dynamic order

jolly siren
#

yeah FRepMovement was the example I was looking at for the bool

thin stratus
#

So the client needs to know the order in which it has to read

fathom aspen
#

That's if you do it dynamically right?

thin stratus
#

Yeah

fathom aspen
#

Yes fair enough

thin stratus
#

Yeah, not entirely sure atm why it would cause corrections

fathom aspen
#

AFAIK Push Model looks for properties by name within the class that you specify, so in theory if you could slap the Struct name in there... then you would be able to control the struct inner properties

#

But I haven't tried that

#

Interesting

jolly siren
#

yeah that's what I was thinking too

#

How does the bitmask method differ? Isn't it the same as the bool method just packed?

fathom aspen
#

Saving those extra bits ^^

#

But yeah it probably doesn't make a big difference if you're only looking to conditionally replicate one property, but if you have multiple of them then having a bitmask would be a good idea

jolly siren
#

awesome, yeah that makes sense

obsidian basin
#

Just to be clear, once I setup an Event as Run on Server... and this may be a dumb question... everything in that event is run on the server, right?

quasi tide
#

Yes

fathom aspen
#

Potentially run on the server

obsidian basin
#

Potentially

fathom aspen
#

RPCs sometimes get dropped

#

For reasons

obsidian basin
#

Got it

#

I wish there was an easier way to visually see player array data on the server

fathom aspen
#

I have something not working for some reason though, but I like it nevertheless

quasi tide
#

Like the workflow or like GMC?

fathom aspen
obsidian basin
#

I can call a server event from a sever event, right? Like it should know it wants to execute on itself?

fathom aspen
#

The way properties replicate is different to how you replicate them in a non-GMC environment, so it must be that

#

I fear it's something with the plugin, but I feel I missed something

fathom aspen
quasi tide
fathom aspen
#

To be honest I was not punished enough by the CMC to appreciate enough what the GMC offers, but I can feel the potential the plugin has

quasi tide
#

@whole grove πŸ‘† A light review

fathom aspen
#

I mean I wouldn't program in BP but the fact that you could prototype something really fast is mind blowing

quasi tide
#

How would it be faster than CMC?

#

Prototype wise

fathom aspen
#

I still dislike for example some boilerplate, so for example you have to tell the GMC owner about the action/axis mappings that you are using

#

You also have to bind those inputs with dedicated functions and hardcode the names again

#

But well you can bypass that using the construction script for example so it's not that big of a deal

quasi tide
#

Yeah, that part was not all that attractive πŸ˜…. But with enhanced input, you kind of have to do that now anyway. Just asset based now.

fathom aspen
#

But you're eventually going to be doing MP when hired at WizArmyℒ️

thin stratus
#

I just want a Prediction Plugin Movement Comp

#

With that sweet sweet debugger

#

I had to debug Movement shit again

#

I hate it

#

you can't log it cause it's obviously not in order when printed

#

That debugger Dave showed in his youtube video was so awesome

#

I already thought about just trying to get that to work with the normal CMC

fathom aspen
#

Honestly the dream is if NPP was continued and the CMC worked better in tandem with the GAS

thin stratus
#

Yeah the NPP would just have a general state

#

A generic SavedMove

#

With all info you need

#

;_; UE6 #believe

twilit radish
#

See you in a decade πŸ₯²

fathom aspen
#

That kinda sucks because it means I will be at 40

fathom aspen
#

Ah okay I didn't watch the video (I know the video you're referring to)

thin stratus
#

Basically a timeline that shows the "moves"

#

And if they were acknowledged, or rejected and replayed

#

And you can click on them to see the state

#

Like the variables

fathom aspen
#

Wow... this left me speechless

quasi tide
#

Apparently not

thin stratus
#

Blue is predicted iirc

#

And Red is a correction

twilit radish
#

Did this get scrapped or no?

thin stratus
#

Pretty sure if it still exists it's part of the NPP

#

Which is still not integrated into any other class that we daily use

fathom aspen
#

How easy life becomes... debugging tools are the best

thin stratus
#

Right?

#

How easy it would be to instantly see the move that got rejected and compare the values

#

Instead of printing in random places and having to compare timestamps

#

cause by default the CMC is like "HEY THE POSITION IS SQRT(3) OFF, GET F DUDE!"

#

Why? Who knows

#

Maybe you forgot that the CombineMove function is supposed to reset the CMC back to Move1

#

freaking hell, still haunts me

quasi tide
#

Cedric dreams in CMC stuff

thin stratus
#

My whole life is a rejected move

#

what?

#

That said, I'm actually working on refactoring something that I released some time ago

#

Not so interesting for you all, cause you already know how everything works

#

But(!), I'm rewriting it in a way that others can easily extend and update it

twilit radish
#

What are we talking about?

fathom aspen
#

Only one knows how everything works πŸ‰

thin stratus
#

The Compendium

quasi tide
#

The Compendium V2 - AKA "The Compendium Wiki"

fathom aspen
#

The Persistent Data Compendium?

twilit radish
#

Oh.. That's what I was thinking, but the "easily extend" part threw me off 🀣

thin stratus
#

I'm turning it into a React app with MDX, with a public repo for PRs

quasi tide
#

Yeah - just make new pages on the pdf Thom!

fathom aspen
#

Probably extend it with the Iris stuff? πŸ‘€

thin stratus
#

It can still be "printed" into a new PDF, if someone still wants that

fathom aspen
#

I mean me and @whole grove only care about a dark theme

thin stratus
#

But this should make it easier to correct mistakes, update to newer versions and also link specific topics to people

#

No, Multiplayer is the light in our lives

#

Dark theme is for Singleplayer

fathom aspen
#

Our opportunity to revamp our #multiplayer learning experience @whole grove

thin stratus
#

Original main reason why I wanted to redo the doc into a website was so I can easier code custom animations, such as highlighting only specific elements if you hover "Server" or so.
But by now I'm happy that I can use Markdown

fathom aspen
twilit radish
thin stratus
#

Yeah I'm still rewriting it. Lots of the text was cut down due to the limited space I had in the doc before

fathom aspen
thin stratus
#

And my lack of webdev skills are also a bit time consuming

fathom aspen
#

Cools dudes use Jekyll (and MM for the extra coolness)

thin stratus
#

I'm even considering moving my guide for C++ Sessions to the same page

#

Well, other tab, but overall same page

twilit radish
#

Wordpress or custom solution you'll get hacked either way one day lol.

#

Web sucks.

quasi tide
twilit radish
#

Get a game dev job πŸ˜›
Says the person without game dev job, but you know.

thin stratus
#

I even recreated the damn diagrams as svg

fathom aspen
thin stratus
#

And, what is also kinda cool, I can use blueprintUE for the BP examples

#

I asked the creator if they could look into making it printable (well save to PDF) but I think they didn't get far with that

#

So I might need fallback pictures -.-

quasi tide
quasi tide
#

I'd honestly even be willing to just take a very small pay cut - but the stability....

cunning stirrup
#

Hello, I'm having issues with location replication and attachments :
I've got a mesh to which I attach multiple actors, all are set to replicate, as well as the root component.
The thing is that i'm spawning and attaching the actors in the same frame, and on the client, sometimes the attached actors get wrongful offsets (not the same as the ones on the server. I'm using attach rule KeepWorld.
Does someone know a fix ?
Btw it's all runtime (runtime mesh and UGC), so unless I code them myself, sockets are not an option as of now.

fathom aspen
twilit radish
thin stratus
#

Actor Attachment is replicated by default

#

I even had to turn that shit off cause it was interfering with attaching it to different meshes on different clients..

cunning stirrup
#

yeah but for actors with components it's needed otherwise it just doesn't attach

thin stratus
#

Actors always hae at least one component though

#

Either way, are you moving while spawning/attaching?

cunning stirrup
thin stratus
#

Doesn't really matter. Actor Attachment is still replicated

cunning stirrup
#

In theory, it should still be connected in the same place on the client ?

thin stratus
#

Yeah but the Actors aren't guaranteed to be in the same relative places on Server and Client

#

Cause they are moving

cunning stirrup
#

Yes, but some spawn at the correct location on the client, other spawn at the location of the component they are attached to instead and so theyu don't get the correct offset

thin stratus
#

Would it be an option for you to, instead, "snap to target" and then set a relative offset?

cunning stirrup
#

Is that possible ?

thin stratus
#

Relative Transform should also be replicated

#

So if you calculate the relative offset between the World Location and the Attach point, you can snap to target and set that offset as relative location of your attached actor

#

That should theoretically ensure that client and server use the same offset

cunning stirrup
#

If i've understood correctly, I should use Attachment rule to SnapToTarget and then add an attachment offset ?

quiet fjord
#

How can I replicate an animation in standalone modes?

thin stratus
#

@quasi tide @twilit radish Not to escalate this, but from the POV of the person hiring, I can understand that one doesn't want to bother hiring people across the border. Even within the EU it's annoying to deal with. We do however have three of 5 people work remotely, but within our country.

thin stratus
cunning stirrup
#

Ok thanks, i'll try and keep you updated

quasi tide
quiet fjord
#

I am trying to replicate an animation of an actor on a map and when I compile and test it on my dedicated server that I run from standalone, the animations are not replicated, I only see them in the actor that runs it but not in the others

thin stratus
twilit radish
thin stratus
quasi tide
#

International contractor is fine. From what I've seen, it is generally, "Hey, here is your money. Figure out taxes on your side."

thin stratus
twilit radish
#

#BlameCedric πŸ˜›

thin stratus
#

Oy, I made sure to help the peeps that asked in between. Otherwise I would be crucified in that feedback thread, which is apparently locked by now (thank goodness).

quiet fjord
#

It does a super weird thing to me, the actor only replicates me when I'm with the other player near the actor who interacted with the object in question to replicate.

#

all this is for a dedicated server model since the machines are connected by standalone

cunning stirrup
# thin stratus For example, yeah

It works ! Thanks ! Also, would you happen to know why there is self-collision between attached objects on client but not on server ?

thin stratus
#

No clue. Just make sure to turn off collision on both

#

And since it's state, preferably via RepNotify/OnRep

worn wagon
#

Uh before I go down a debugging rabbit hole, are there any known issues with ServerTravel in packaged builds for 5.1? I haven't changed anything since the last time I packaged regarding session hosting apart from upgrading to 5.1. I can do it fine in editor, just not when packaged.

thin stratus
#

ServerTravel, as in moving together with Clients to the next map?

worn wagon
#

It basically reloads the main menu when I try it.

worn wagon
thin stratus
#

Ah, that's not ServerTravel

#

What Subsystem are you using?

worn wagon
#

NULL subsystem for now, hosting lan

thin stratus
#

Then please check your logs

#

If something went wrong it should be in the log

worn wagon
#

Yeah about to do so

cunning stirrup
# thin stratus For example, yeah

Nevermind, there's still the same issue : the objects spawn at the parent's location on the client and don't get the relative location applied after the snap.
Do you know if there is a way to replicate data to the object so that it has it on BeginPlay ? that would allow me to fix the issue.

thin stratus
#

Exposed on Spawn variables that are marked as replicated should be available on BeginPlay

#

Same goes for Deferred spawned Actors in C++

cunning stirrup
thin stratus
#

Please re-read the thread

#

Nothing in there says that Replicated Exposed on Spawn Variables wouldn't work

#

The poster wants ALL exposed on spawn variables to get send to the Client by default

#

Which is not what I said

worn wagon
#
[2022.12.28-23.17.26:287][372]LogNet: TravelFailure: ServerTravelFailure, Reason for Failure: 'Failed to load package '/Game/Maps/MixtapeMansion''```
thin stratus
#

Guess your map isn't packaged?

worn wagon
#

How do I verify this?

thin stratus
#

Can you try to travel to it via the console?

cunning stirrup
thin stratus
#

Other than that, I would manually mark them when packaging

thin stratus
#

Concept stays the same

#

Replicated Variables that are set before Finishing the Spawning are available on the Client

cunning stirrup
#

So with deferred spawning, the value of the replicated variables should be set on the client when BeginPlay is called, but that's not what I'm seeing

hardy sluice
#

Can someone please explain me: assuming my GameModeBase has valid UserWidget inside it and I call for example thatWidget->AddToPlayerScreen()
Now, I know that GameMode exists only on server, but AddToPlayerScreen() uses local player. How does it work? Will that widget be added to all players' screens? Links with articles and tuts will be appreciated too

thin stratus
#

Are you setting it before calling FinishSpawning?

cunning stirrup
#

and my values are set before FinishSpawning

thin stratus
#

Hm

#

I'm pretty sure this works. have used that countless of times before

cunning stirrup
#

but my values are on the components of an actor so maybe it's different ?

thin stratus
thin stratus
#

I'm only using that with properties on the actor

worn wagon
cunning stirrup
#

hmm

thin stratus
#

That thing allows for more advanced setups for packaging

cunning stirrup
#

Thanks for the help, i'll dig in more

austere burrow
#

Hey all, I am attempting to test multiplayer using 2 PIE windows with gamepad input routed to the second window. I have checked Route Gamepad to Second Window in Editor Preferences and Skip Assigning Gamepad to Player 1 in Project settings, but it doesn't workβ€” keyboard/mouse and gamepad get routed to the same window. I am using Enhanced Input as well as CommonUI. Is it possible those are interfering with the behavior? Thanks in advance for any help.

thin stratus
#

Hmmm

#

Skip Assigning Gamepad to Player 1 could be only for Splitscreen

#

Not sure about Route Gamepad to Second Window

austere burrow
#

that crossed my mind, but here is the tool tip:

thin stratus
#

Β―_(ツ)_/Β―

austere burrow
#

oh lol guess that answers that!

#

thanks for bringing it to my attention

#

I can ignore it for now then - not critical thankfully, just inconvenient

cunning stirrup
#

Is there a way to make two non-replicated objects share the same references when going over the network ?

#

so that both can be referenced by the client and the server without a link existing

thin stratus
#

I mean

#

You can't send non-replicated objects over the net

#

You need to create them in both places

#

The only thing to "link" them after that is using some unique identifier that you replicate back and forth

#

Like a TMap key

hardy sluice
# thin stratus GameMode only exists on the Server, as you said. A Widget Reference in the GameM...

What about standalone network mode?

I ask that bcs according to my understanding of your words there will be nothing for local players however In my singleplayer game localplayer sees that widget anyway
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Overview/ :

This mode is used for single-player and local multiplayer games. It will run both server-side logic and client-side logic as appropriate for the local players.

thin stratus
#

Standalone/Singleplayer has a GameMode

cunning stirrup
thin stratus
#

You can't apply Multiplayer Concepts to Singleplayer

thin stratus
#

You can try and see if an FGUID works

latent heart
thin stratus
#

Singleplayer has no Server/Client concept. You are basically the Server

latent heart
#

That's just a misunderstanding of the situation, rather than applying concepts πŸ˜›

thin stratus
#

A Listen Server that isn't listening fwiw

latent heart
#

Yeah. That's what I mean. ^

#

You could effectively take a whole MP game and just run it SP, though, as long as it was designed with a Listen Server in mind. So they aren't unapplicable.

thin stratus
#

Yeah, that's just not what I meant

latent heart
#

There may be better ways to do things in SP, though. More efficient.

thin stratus
#

Less restrictive, yeah

latent heart
#

However, there are bonuses to a certain rigidity that comes from MP.

#

In SP, you could effectively just stick everything in the game mode.

worn wagon
#

@thin stratus Thanks, checked out the Project Launcher tool and made a launch profile where I manually selected the maps to package πŸ˜„
Still weird how it suddenly stopped packaging that particular map when it was packaging it in 5.0.3.

latent heart
#

And that wouldn't be good design.

worn wagon
#

Everything working now

latent heart
#

You mean write your own SP subsystem in gmae mode that you can register things to tick in?!

#

πŸ˜„

austere burrow
#

@cunning stirrup if you want something to share state over a network, something needs to be replicated. It doesn't need to be the full data necessarily - you can replicated a key to some data that is stored locally

latent heart
#

E.g. when you replicate which mesh to use, you don't send the entire mesh over the network, you simply say, "I am using the mesh at /content/mymeshes/whatever"

austere burrow
#

right

thin stratus
#

Isn't there some #rules to strike Laura for?

#

tsk

hardy sluice
latent heart
#

More local players = more player controllers on the machine. About the only difference.... other than the widget/camera space, I guess.

#

(split screen UI)

#

I wonder if you can join multiple local players to a server and have it make PCs for thjem all?

#

(from the same client instance)

hardy sluice
latent heart
#

For each "local" player, there's a ULocalPlayer object (I believe) and, depending on your settings, potentially a unique screen/camera for each player

#

Each LocalPlayer object gets its own player controller.

#

I'm not too familiar with it really beyond that.

#

You might be able to do single camera / split UI as well?

sinful tree
#

Local multiplayer, well, then calling Add To Player Screen would likely add it to the screen of whoever was set as the owner of the widget.

hardy sluice
hardy sluice
sinful tree
#

Sorry, owning player.

hardy sluice
latent heart
#

GameInstance and World would assume a single local user

#

UWidget and WidgetTree probably have their own references to the oiwning player somewhere (probably in their owning objects)

#

And PlayerController would be owned by a specific local player.

#

Or mabye not assuming a single local player, but maybe the first local player or a "global" ui element.

#

Probably implementation (yours) specific

dry pebble
#

does anyone know what "custom bookkeeping" Fortnite uses to handle fire rates and cooldowns?

thin stratus
#

Cause rapid activation of abilities with GE Cooldowns doesn't work

#

But "custom bookkeeping" can be pretty much everything

#

I ended up making it 50% Predicted and 50% Authorative.

#
  • Cooldown is a custom Struct with an Array of another Custom Struct in it
    -- That's so the Outer Struct can handle NetSerializing the Array
  • The Inner Struct has the following properties
    -- Cooldown Duration (NotReplicated)
    -- Start Cooldown Timestamp (NotReplicated)
    -- bServerAck
    -- CooldownTag

The "NotReplicated" ones were the headache that had me handle Serialization of the Array by hand, but it's nothing more than custom looping over the new array and updating/removing/adding entries to the local one.

  • Client and Server both apply Cooldown when the Ability Commits
  • Server calculates a shortened Cooldown Duration (that's why it's not replicated) based on the Round Trip Time (RTT) of the Client, so the Client in theory doesn't suffer from their ping
    -- I had a synced NetClock (so a better setup for Timestamps that also gave me info on the RTT of the Client)
  • Client and Server check if the Cooldown is "over", however the Client only removes the Entry of the Array manually if the bServerAck boolean was never set. That's fallback for when the Server had 0 Cooldown (RTT higher than Cooldown...) and generally so the Client can still somewhat predict. Otherwise only the Server removes the Entry. bServerAck is set to true when the Server applies the Cooldown on its side.

Since adding of the Cooldown is predicted, the Timer for UI is too and the Client won't try to reactivate the ability instantly (cause without predicting this, it would have to wait for the Array to replicate back to the Client, which will allow it to try and activate the ability again during that time).

Removing is not predicted (with the exception of bServerAck being false), so the Client will have to wait on the Server to remove the CD. This will guarantee that when the Cooldown is over for the Client and they try to reactivate the Ability, it is also over on the Server.

#

Because with GEs you run into the problem that the Client thinks the CD is over and reactivates, only to get rejected later. If you play animations in your GA it will start looking really bad for the player :P

#

I won't go into more detail, as this is theoretically a really simple setup and can probably be improved. I'm sure you can figure this out from the notes above.

shut lily
#

Is it possible to call a server function on an unowned actor? I have a weapon UObject and i want it to call the SetHealth() function on my character but it doesn't work.

sacred kraken
#

If the RPC is being called from Client to be executed on the Server, the Client must own the Actor that the RPC
is being called on.

pallid mesa
thin stratus
#

The inner struct

pallid mesa
#

Ah so the tag identifies the cooldown identifier for your abilities πŸ˜„

thin stratus
thin stratus
#

Not directly the Ability

#

The Ability might use that Tag for its Cooldown

pallid mesa
#

yeah gotchu πŸ˜„

#

yeah so its possible to reuse cooldowns between abilities, simple stuff, really nicely explained

shut lily
silent sinew
#

I'm trying to learn how to setup TMap replication and I came across some stuff that goes over bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess) When I declare this struct as a UPROP do I still need to add 'replicated'? Or do I manually call NetSerialize when I modify the TMap within and it then replicates to clients with this struct?

thin stratus
#

I know this isn't solving your replication problem, but I'm asking cause if it doesn't then you could save yourself the headache and just use a TArray and place the Key into the Struct.
Because looping that TArray is def faster than solving the hash function for only a few entries.

#

You can always write yourself a Getter for an Element of the Array that has the Key as an input, so you don't need to loop in all places

silent sinew
#

No - probably would never exceed 100

thin stratus
#

Yeah then it's probably worse to even use the TMap

silent sinew
#

I found this

#
USTRUCT(BlueprintType)
struct FStructWithMap
{
    GENERATED_BODY()
    
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    TMap<FString, FString> StringMap;
 
    TArray<FString> StringKeys;
    TArray<FString> StringValues;


    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        if (Ar.IsLoading())
        {
            // Move data to Map
            Ar << StringKeys;
            Ar << StringValues;
            for (auto It = StringKeys.CreateConstIterator(); It; ++It)
            {
                StringMap.Add(StringKeys[It.GetIndex()], StringValues[It.GetIndex()]);
            }
        } else {
            // Move data to Arrays
            StringMap.GenerateKeyArray(StringKeys);
            StringMap.GenerateValueArray(StringValues);
            Ar << StringKeys;
            Ar << StringValues;
        }
        StringKeys.Empty();
        StringValues.Empty();

        bOutSuccess = true;
        return true;
    }
};
 
template<>
struct TStructOpsTypeTraits<FStructWithMap> : public TStructOpsTypeTraitsBase2<FStructWithMap>
{
    enum
    {
        WithNetSerializer = true
    };
};```
thin stratus
#

Yeah it's using 2 Arrays

#

It moves keys and values between the 2 Arrays and the TMap

silent sinew
#

Yeah I know

thin stratus
#

But it's really not worth it if you never exceed 100 entries

silent sinew
#

I agree - but do you know how the NetSerialize works?

#

Does it require a call to it and then it pushes this to the clients

#

or do I need to flag the UPROP somehow - and mark it replicated

thin stratus
#

NetSerialize is called automaticlaly due to the StructOps you have below

#

how that exactly works, no idea

silent sinew
#

Welp I guess I'll try some tests to see if its passing it to the clients

thin stratus
#

If it works like this, then it doesn't need UPROPERTY

#

However I do remember that struct props that should replicate needed it

#

Not sure if that also goes for custom NetSerialization, since you control it anyway

verbal tendon
#

WithNetSerializer means you are using a custom serializer and are taking control of serialization. So whilst the struct instance still needs to be replicated properly from whichever parent scope is replicating it. Anything within its scope of member variables, the engine is now hands-off beyond calling NetSerialize

#

You do still need to make them UPROPERTY for garbage collection

#

Unless that doesn't apply

silent sinew
#

So I have it inside a comp like so UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Overlay") FFw_NetTMap OverlayDataMap; When I add 'Replicated' to the specifiers I get red lines

verbal tendon
#

It's generally a good idea to keep annotating your structs and classes properly even with custom netserializer, in case you ever want to go over them using reflection

silent sinew
#

UPROPERTY(BlueprintReadWrite, Category="Overlay") FFw_NetTMap OverlayDataMap;

verbal tendon
#

I mean it says why πŸ˜„

silent sinew
#

Yeah because the struct has a map inside it

#

So then how does this struct replicate

#

If I remove it

#

If I have all the netserialize stuff inside the struct - then everything in the struct will replicate, but how do I get the struct itself to replciate?

verbal tendon
#

Like Cedric said. The easiest way is to use Arrays, and then you don't need a custom serializer

#

custom serializers are really for niche use cases, this looks like you are trying to make a generic struct to use multiple times throughout your game. That's a terrible idea

#

You either have a struct that's part of one array, and you find the entry via predicate, or you use an array for keys, use the found index to grab the value. Those are your two best bets.

#

Because very simply put. if you have a map with 1000 entries, and you change one of them. The custom NetSerialize will send over the entire map of 1000 entries.
Normal replication using arrays will only send over the 1 entry diff

silent sinew
#

Okay so something like this

#

What is going on with this TArray<FExampleItem>

#

Never seen a Tarray declared like this

prisma snow
#

the < is the html code of < if I am not mistaken

silent sinew
#

ty

quiet fjord
#

guys in standalone can it be replicated?

prisma snow
quiet fjord
#

I can't replicate animations of an actor when I interact with it. And his status is not reflected in the other players, why is it?

#

all this when i play on a dedicated server model

quiet fjord
#

clients run from standalone mode

#

that is, neither acts as a server

prisma snow
#

it doesn't matter, if they connect to a dedicated server they become clients

quiet fjord
#

I will tell you about my exact problem, if you can help me I would appreciate it very much since I have been having the same error for a few days and I do not see what it is due to

prisma snow
#

Are you using a client-server model or not?

quiet fjord
#

When I start a game, my game mode is in charge of generating some weapon chests for all the players, it turns out that these chests are replicated, when I approach them and try to open it, it opens for the client who interacts with it, but it is not reflected to me for the other clients.

#

The thing is that I know that the animations have to be executed on the server and then do the rpc for the multicast for the other players but that doesn't do it well for me. To make the animation of the opening of the chest

prisma snow
#

who does the RPC?

quiet fjord
#

the rpc that executes the opening animation is executed by the actor that belongs to it, that is, the chest itself

#

I will pass you screenshots of how I have it mounted

thin stratus
#

It all sounds very much like you are executing a server RPC for the interaction inside of the chest actor

quiet fjord
#

I'm just doing that.

#

what I don't know if I should call the rpc from the pawn that I control

prisma snow
#

the RPC has to be executed by a server-owned actor

verbal tendon
#

It's in the starter kit I believe. It shows chest opening, network relevancy how it relates

verbal tendon
verbal tendon
quiet fjord
#

Yes, of course, my actors are all replicated, that's not the problem, the problem is that the states of my actors are not updated when I interact with them from the clients

verbal tendon
#

The solution is to have the server-RPC on the playercontroller

#

Or one of the other ways that are in pinned messages here in this channel

#

It's very simple to debug those things, put print strings into your BP logic to see what is and isnt being executed

#

and fromwhere

#

I strongly suggest reading more networking guides and materials before working on the game

#

having a strong grasp of the basic concepts will be more fruitful than continuously making beginner mistakes

#

especially RPCs can be tricky when you're just starting out with them

prisma snow
dry pebble
sacred kraken
#

I'm stuck again. What I am trying to accomplish is:

  1. Two players. One runs around doing stuff (VR), the other has a side view of the same map (PC). These are two pawns with their own cameras.
  2. The build of the game should somehow dictate which player role you have. This never changes.
  3. The correct pawn should be assigned based on this player role.
  4. Once both players are ready (meaning PC connected to VR and both pressed some button) the game starts.

I don't know what the order of things should be and where to put them. I don't know where to decide the player role. I don't know where to assign the player role. I don't know where/how to assign a pawn based on the player role. I don't know where to create/assign even the UI.

Does anyone have the patience to, abstractly, help me through this? I've learned quite a bit about the functionality, I know roughly which methods are available and all that... I just don't understand what goes where in what order yet.

quiet fjord
#

I think I got it guys thanks a lot πŸ™‚

#

❀️

#

in the end the rpc launched it from the pawn that has a connection

wooden plover
#

Is there anyway to check and see if all players are loaded/valid in the level? I’m thinking of holding the number of players, and then incrementing a variable once they are valid in the level

verbal tendon
worn wagon
#

You guys having any issue with anim notifies in shipping builds? I know it's bugged in 5.1 but this convar (a.EnableQueuedAnimEventsOnServer=1) fixes it in the editor, but seemingly not in shipping builds, at least for me.

worn wagon
#

(for the listen server host)

clear island
#

one of the many reasons I'm avoiding 5.1

#

you'll have to wait until 5.2 for a fix

#

I didnt know about that console command but if its editor only, I guess its not a solution

#

I dont know why they didn't decide to do hotfixes like they did for the 5.0 release

#

some of these bugs are pretty critical

#

I'm still on 5.0.2 but I'm using a source build

#

I was like:

seems like 5.0.3 has a few bugs, I guess I'll just wait for the 5.1 release and stick with 5.0.2 for now

#

meanwhile 5.1 releases and its even worse πŸ˜„

#

so now I'm like: I guess i'll just wait for 5.2

worn wagon
#

I mean how long will that be

clear island
#

inb4, 5.2 gets worse

clear island
#

I think its going to be a while

worn wagon
#

anim notifies not firing in multiplayer for listen hosts isn't some minor issue either

clear island
#

yep I know

#

theres even worse issues in 5.1 than that believe it or not

#

I'm not touching it

clear island
quasi tide
#

There is a setting you need to turn on for it to work

#

Trying to find it now

worn wagon
quasi tide
#

Yeah - the one you have to put in a .ini file if I recall

worn wagon
#

Yeah I have that, it fixes it in editor only

quasi tide
#

Lovely

worn wagon
#

I packaged a development build and it make it better than it not being on at all, but some anim notifies aren't getting fired still

#

it's just a mess idk

short arrow
#

Me still on ue 4.26. That's craaazy hypers

clear island
#

I get the impression that 4.27 was the most stable version, alot of the issues I find, I often find comments like: oh yea that used to work but stopped working since 5.0

quasi tide
#

5 will be solid in 5.27

clear island
#

hopefully πŸ˜„

sharp yarrow
#

Hello Everyone! I am having a hard time understanding how the Gameplay Message Subsystem works for Multiplayer in Lyra. I have a widget that broadcasts a message through the GMS and a component attached to the LyraGameState that receives the message and stores it in a replicated variable. What I want is for both the server and clients to update the variable. However, when I run the game it does not work as expected. The host updates the variable on the server and all changes are seen by clients, but the clients only update the variable for themselves. All the tuts I have seen on this involve setting up custom events on the Player Controller and passing those through to the game mode but in Lyra all is done through components. This messaging system seems to be the proper way of doing this in Lyra. Could someone please let me know what I am missing?

winged badger
#

Havent looked at lyra or the gameplaymessagesubsystem

#

But i can tell you that subsystem cant use server rpcs

#

Subsytems typucally dont replucate

obsidian basin
#

Question about non-player controlled actors. What's the best way to store replicated data for them? For example, let's say I have a game that's PvPvE - obviously for players I'm storing stats like health on the player state so it can be kept in the player array on the server.

How/where would I store that data for mobs?

winged badger
#

So send a server rpc with y payliad that then broadcasts the message server side

#

Why, PS health id only really uaeful with multiple pawns thst share hp

#

You can access pawn via playerstate

obsidian basin
#

I have other stats that need to persist through player death, so I'm just keeping everything on PS to make it easy

winged badger
#

Slightly awkward, but ok. Mobs hp on their pawns

dark edge
winged badger
#

You can add an interface to keep access cobdistent

dark edge
#

pawn stats on playerstate just feels gross

winged badger
#

Consistent*

dark edge
#

the State of the Player is their score. The state of the pawn is the pawn's HP

#

I don't have the HP, my pawn does

obsidian basin
#

How do I ensure I'm damaging the right mob, though? Again with players, I can just get the actor's owning player state and then pass the information through that, but all actors have different ids on each client, right? Or is that only for player owned actors?

winged badger
#

Each actor that is net addressable has a unique NetGUID

#

in other words you can send an actor pointer through a RPC

obsidian basin
#

Is that available in blueprints or just c++?

winged badger
#

Bp as well

#

You just add inputs to RPC event

sharp yarrow
obsidian basin
winged badger
#

Not neccesarily

#

Your listen node binds to a delegate (event dispatcher), which lives in a replicated object that receives the delegate then broadcasts

#

Your node is likely a full object that has a handler function that then broadcasts messahe received, which fires xour exec pin

#

Cant tell xoumore from s m9bile phone though

#

But that is a standard pattern for znreal engine

#

(Cant help typos, small buttons, large fingers)

prisma snow
#

I think znreal engine means unreal engine

winged badger
#

It does

prisma snow
quasi tide
#

Nah - it's really "Zlo's Unreal Engine"

prisma snow
#

does it work with ChatGPT

winged badger
#

I barely ever modify it!

prisma snow
#

can it make game with brrr and AI

winged badger
#

Objects need an ActorChannel to replicate, and subsystems typically dont have an Actor as an Outer

#

So they tend to not replicate

dark edge
winged badger
#

You would have to also rename it to change outer

#

Which would kinda break it as a subsystem

dark edge
#

subsystem not actually replicating anything

#

just using the actor as a fax machine

#

"Hey Mr Actor here's a copy of my new state, replicate it plz"

"Hey mr subsystem, I got some new state for you"

#

basically the subsystem's secretary

winged badger
#

Actors dont like replicating objects unless they are also objects outer

#

You could do it indirect

#

But in this gameplaymessage scenario, you alsi need an actor owned by pc

dark edge
rose egret
#

has anyone ever used ActorSpawnParamter.CustomPreSpawnInitalization ?
I want to set some properties before BeginPlay , I was using bDeferConstruction but saw this callback now

sharp yarrow
winged badger
#

Even if the object is replicated, it would still need to be wired to always server RPC everything

#

For it to just work

#

Not near PC so cant check whats under the hood

leaden sparrow
#

i am trying to make the platform looping back and forward but its not synced can somebody tell me what is going on

wooden plover
#

Question - I am trying to have a countdown timer that is ran on the host(server) that gets replicated to the clients. However, the countdown only works on the server. I have the option for replication checked for the variable. Any advice?

prisma snow
#

also it is totally what I am doing

obsidian basin
#

Ok, so how does one get the Unique NetID for an actor? I put a variable on the player character and then replicated it, but I'm not sure how to access it. @dark edge I'm looking to you since you originally suggested making this change lol.

leaden sparrow
thin stratus
#

Well, the most basic way is to tick the Replicates and ReplicatesMovement checkboxes

#

But that wouldn't be pretty

#

Cause that will cause it to literlaly just set the location to the one the server sends

#

And that is not something happening often enough to look smooth

#

So you would need to code some interpolation to smooth between previous and new location

#

That's more a c++ thing though (daily reminder that Multiplayer without C++ is basically not working out one way or another)

leaden sparrow
#

thats my moving object blueprint

thin stratus
#

Yeah that's pretty wrong for Multiplayer fwiw

leaden sparrow
#

oh damn

thin stratus
#

BeginPlay calls when the Actor spawns on the Client

#

At that point the Timeline for the Server is already running

#

This will never sync

leaden sparrow
#

sooooo changing it to custom event would work?

thin stratus
#

Well

leaden sparrow
thin stratus
#

Again, you can mark the Actor is ReplicateMovement