#multiplayer

1 messages Β· Page 714 of 1

ancient adder
#

I cannot use widgets on server atleast for holding data?

fossil spoke
#

I know this is old, but this works surprisingly well. Havent tested it in a fully packaged build, but works in Standalone on 4.27.

empty axle
twin juniper
#

hello i have an issue when passing a variable from the server to the client and i dont know why if anyone could help me that would be great

#

in this picture u can see the call refresh is called from the server and passes the item array.

#

but when the client receives it the values are set to none why is that?

thin stratus
#

What are you sending there?

#

UObjects?

#

@twin juniper

twin juniper
#

one sec

twin juniper
meager spade
#

If they are actors then your rpc is happening before they have been replicated, if they are uobjects then you need to do some additional networking stuff in c++ to make them replicate

twin juniper
meager spade
#

Yes you can't replicate them without some C++ work

twin juniper
#

o thats great

#

this would then also apply for structs?

#

beacuse the reason i am doing it like this is when i acces a replecated struct from as client it is empty

meager spade
#

if the struct has those uobjects, it won't have anything

#

on the client side

#

but a normal struct should replicate fine

twin juniper
#

it is an array of structs but yea it also holds the same objects among other normal variables

#

could you point me in the direction on what i should implement in c++

thin stratus
#

Search for subobject replication

#

It's basically an actor that takes care of the UObjects

twin juniper
#

thanks mate

meager spade
#

Should be one in the pins here @twin juniper

twin juniper
#

thanks so if i understand correctly i wanna change my object blueprint to c++ so i can add replecation?

meager spade
#

you create a C++ class, and parent your BP ones to it

twin juniper
#

thanks again

atomic barn
#

Hi can a variable in c++ be blueprint accessible and be replicated?

solar stirrup
#
UPROPERTY(Replicated, BlueprintReadWrite /** or BlueprintReadOnly */)
int32 MyVariable;
#

@atomic barn

dreamy terrace
#

I'm trying to test a very bare bones setup of multiplayer by running in standalone mode: one as -server and another as -game from .bat files. It definitely works on a build from source version of 4.27 but definitely doesn't on a straight release.... does anyone know if you DEFINITELY need to build from source to have this type of network play work?

chrome bay
#

You only need to build from source if you want to package a dedicated server

#

A listen server will work just fine

dreamy terrace
chrome bay
#

I don't think the default templates have any real multiplayer functionality

#

You're saying one is running as -server and one as -game, but how is the second instance connecting to the server instance?

dreamy terrace
#

the pawn by default replicates, the running in standalone on our build version operates identical to the PIE multiplayer tests you can run in listen mode. the pawn runs around its inputs are replicated. the second -game instance has the ip pf the server it connects to. Basically following instructions from the book - Unreal Engine 4 VR projects by Kevin Mack / Robert Rudd.... give me 2 to screencap the bit.

leaden atlas
#

How does replication work with level streaming?

#

I've got this replicated geometry cut actor thing

#

And it takes a chunk out of static meshes using booleans

#

But I'm not sure how it'll work if the static meshes are in different levels or if someone makes a cut in a level that' not loaded for other players

marble gazelle
#

very likely that you need to take care of it^^

leaden atlas
#

Is there some sorta delegate like

#

Like on level load, i should perform the cuts if the static mesh actor is loaded?

dreamy terrace
#

@chrome bay

marble gazelle
#

I guess you have some system that replicates the cuts, so yeah, at some point you need to sync the cuts with the loaded meshs

leaden atlas
#

yeah right now just the cut box dimensions and the cut static meshes are replicated

#

like as 2 vectors and a list of actors

marble gazelle
#

so what's the question πŸ˜„

leaden atlas
#

okay so

#

what happens to that list of actors when the actors are streamed in/out?

marble gazelle
#

well if they are UPROPERTY I hope they get nulled^^

#

you will need to store their GUID or another identifier that the actor it self knows and can thus register again on reload

leaden atlas
#

also i got another question, is beginplay called before or after initial replication?

#

like on server, if set some variables on begin play, does that get initially replicated out?

#

or is it only stuff passed on construction with SpawnActor?

chrome bay
#

Before

#

Replication runs at the end of the frame

meager fable
#

It seems like my EventDestroyed is not getting called on listen server when traveling, is this normal?

chrome bay
#

But it depends if the actual match has begun play also

marble gazelle
#

does replication of an actor first starts after its begin play got called or could it be earlier?

chrome bay
#

Initially Replicated Properties will be read in before BeginPlay is called yeah

solar stirrup
#

I've had rep notifies get called before beginplay yeeeee

#

Generally just wait and have BeginPlay() call them again

zealous wind
#

Hey all. I have some variables in an animation instance that aren't being replicated. Is the animation instance not normally used for replication?

viscid narwhal
#

I'm using DemoNetDriver. On Server and on Client movement of the car looks ok, but on the replay car jerks like every 1/8 per sec. How to fix it?

leaden atlas
#

usually you stick the variables on your pawn, or compute them from pawn values

zealous wind
#

Turns out replicating it was a bit of a dumb idea

#

haha yeah, that's what I'm doing now

#

Thanks though

#

I was trying to avoid the pawn class getting unreasonably bloated

leaden atlas
#

You could stick it in a component

#

That's what I do for basically everything. I hate putting anything in character

chrome bay
#

Components have additional cost, so it's pointless to do that if it's a character property

plucky prawn
#

am i allowed to send, from the client, the property reference and a value and have it be set on the server? or do i need an RPC for every single property that can be set? eg if i have 2 bools and a string, would i need 3 RPCs from client->server to set those?

chrome bay
#

You just pack them in the same RPC

plucky prawn
chrome bay
#

sure why not? All you're doing is sending values to it

#
ServerSetSomething(bool b1, bool b2, const FString& TheString);```
plucky prawn
#

ah nah i meant the RPC would just take a property/value pair

#

so i would make 3 calls to change all 3 values if that makes sense

chrome bay
#

No that won't work

#

Unless you send some FName to identify the property and an array of bytes to directly set it to

#

But that's hugely inefficient and smells of design problems

plucky prawn
#

right

chrome bay
#

You're normally doing something very specific with an RPC

#

If you can set any property to any value, that's an open door for cheating

plucky prawn
#

so i guess if i have some UI that has a bunch of scalar values i can change on an actor i would need an RPC for each one

chrome bay
#

That's different

plucky prawn
#

oh

chrome bay
#

But ultimately, yes you need to send them somehow - either packed together, or with some ID to identify what you're changing.

#

Generally you never call RPC's directly from UI though

#

You don't want a slider to spam the server with 100 RPC's everytime it's dragged

plucky prawn
#

right

leaden atlas
chrome bay
#

The component adds an additional header, since it has to be identified. It's not massive, but it's not nothing.

#

Either way putting properties into a component only makes sense if it's logical data for that component

#

If it's a property of the actor, that's where it belongs

leaden atlas
#

πŸ€”

#

The overhead for component replication is relatively low. Each component within an Actor that replicates will add an additional NetGUID (4 bytes) 'header' and an approximately 1 byte 'footer' along with its properties. CPU wise, there should be minimal difference between replicating a property on an Actor vs replicating on a component.

fervent musk
#

hey all, does steam multiplayer work in 5.0.1 atm ?

bitter oriole
fervent musk
#

so the first hit i got on the marketplace was "multiplayer fps basic pack" but it says this:

bitter oriole
#

What's the bug report like?

fervent musk
#

i have zero experience in network replication, servers etc, i use unreal for archviz and as a hobby,this is why i figured a pack would be a fast way

bitter oriole
#

I don't have that particular issue myself

fervent musk
#

in 5 ?

bitter oriole
#

(yes, in 5)

fervent musk
#

aight

#

thanks a lot man

umbral dragon
#

Is it possible to use AddStaticMeshComponent in multiplayer? I get this:
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: StaticMeshComponent NODE_AddStaticMeshComponent-2 NOT Supported.

winged badger
#

it is

#

if its added on server and replicated

#

or its added on client and server separately and has the exact same name

ancient adder
#

I have a bp inherited from this //Header UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite) bool ReplicateToEveryone = false; UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite) FName Name; //CPP void UInventoryComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); if (ReplicateToEveryone) { DOREPLIFETIME(UInventoryComponent, Name); } else { DOREPLIFETIME_CONDITION(UInventoryComponent, Name, COND_OwnerOnly); } }

#

But when i set "ReplicateToEveryone" to true in my bp defaults the "Name" var still gets set to OwnerOnly

chrome bay
#

GetLifetimeReplicatedProps() is called on the class

#

You'll need to make a new Blueprint Class of that component, set the flag, then add that class to your actors

#

This would work at the actor level because the actor blueprint is a new actor class, but it's components are not new classes

ancient adder
#

Do you mean "Add component by class" in bp or "UInventoryComponent NewComp = NewObject..." in c++?

crystal crag
#

If I wanted to handle rotating the character to face a target when a certain property is set, would one way to handle that be inside of the character movement component's GetDeltaRotation ?

#

I could do it inside of the actor tick, but I was thinking of lerping the rotation as the character is moving instead of just rotating the actor even when the character is not moving

#

well, I guess the second part of what I said at the end could be handled inside of the movement component too, so I guess ignore that part. The question really is, which method would be best to handle rotating the character towards a target in a multiplayer game?

leaden atlas
#

how do you keep a replicated reference to something that gets loaded/unloaded with level streaming?

#

the reference gets nulled out on level unload

ember sinew
#

I have a "InventorySlot" struct with an FIntPoint index and a TObjectPtr<UMyItemClass>. The index replicates, but the object pointer won't. Is there something I'm missing? Or is that just not possible?

#

I know that UMyItemClass replicates fine normally - e.g. I have an AMyItemContainer with pointers to items, and those replicate on the network

crystal crag
#

Make sure that the UMyItemClass is marked as supporting replication and you also will need to override whatever component or actor you are using and manually call upon the pointer to be replicated

#

Unless you mean to replicate it outside of an actor or actor component. I haven't done that before.

ember sinew
#

I did all the stuff to make sure UMyItemClass replicates - like I said, I have actors with pointers to items (just like I'm trying to do with the struct) and everything works fine. The FInventorySlot struct is being replicated by an actor component. Other fields in the struct replicate fine, but the item pointer does not.

fleet crown
#

Hello, why all of a sudden ServerMove stops getting called and I just get acks?

#

Client can see server move but Server can't see Client move after a while

chrome quest
winged badger
#

as struct not having a valid pointer because it replicated first does not mean the object didn't replicate after

ember sinew
chrome quest
winged badger
#

if you breakpoint AActor::OnSubobjectCreatedFromReplication on the actor responsible from replicating that UMyItemClass

#

does it hit?

ember sinew
ember sinew
winged badger
#

if it hits - it means your UMyItem didn't replicate by the time you got a replication callback, and if the same actor channel is responsible for both struct and items, you should put the Super call at the end of ReplicateSubobjects

#

if it doesn't hit you either have a problem in ReplicateSubobjects on the Actor responsible, or you didn't override IsSupportedForNetworking on the UMyItem

#

assuming here that UMyItem inherits from UObject, if it inherits from UActorComponent, then it was not set to replicate

ember sinew
#

Those are good points. Talking this out has made me realize a few things I could be missing.

For more detail, the "flow" of what's happening is:

  1. Player steps on a button
  2. I spawn a new AItemDrop that players can pick up (spawning happens on server, drop actor gets replicated.) When it's spawned, it calls a server-only 'Setup' function with a line myItemPtr = NewObject<UMyItemClass> (with myItemPtr being a replicated property on that actor)
  3. Client or server player walks up close to the drop
  4. We try to add the drop to inventory: we call the server-only TryPickUp(item) function, which will create a new FInventorySlot, give it the reference to the item, then add it to a replicated array of slot structs.

I've tested and confirmed that when I create the item object initially (step 2), the item is being replicated. All clients & the server will see the new AItemDrop actor, and everyone's copy of the actor has a reference to the same UMyItemClass object (again, I tested with random int IDs, everyone's machine gets the same ID replicated.) However, when we get to step 4, all clients & the server will get an updated array with slots that are replicating correctly, except for the item reference.

...however, I also know that the server deletes the AItemDrop once it has completed the TryPickUp, so I'm wondering if the item pointer is getting destroyed in that step. I'm also realizing: I probably need to handle the ReplicateSubobjects when the item is added to inventory, since that means it's owned by another actor. I don't think I'm manually setting any outer/owner, either.

#

And yeah UMyItem does inherit from straight UObject, and I do have IsSupportedForNetworking and GetLifetimeReplicatedProps properly implemented on the object. But like you're saying, I may not be properly doing replication on the actor side. Gonna double check all that.

winged badger
#
bool UAttributeComponent::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
    bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    for (USolsticeBuffBase* Buff : ReplicatedBuffs)
    {
        if (IsValid(Buff) && Buff->IsReplicated())
        {
            WroteSomething |= Channel->ReplicateSubobject(Buff, *Bunch, *RepFlags);
        }
    }
    return WroteSomething;
}```
chrome quest
#

@ember sinew Do you by chance have a destroy function on the UObject that is called when the replicating owner is destroyed?

If you follow Jambax's tutorial on replicating Objects, there's a function like that that may cause your problem

winged badger
#

short example of ReplicateSubobjects that replicates an array of UObjects

#

looks the same if implemented on Actor level

scenic jasper
#

I am using blueprints and cant find hosted sessions, my guess is i should set bShouldAdvertise to true?

#

but how do i do that while using blueprints..

#

or am i missing something else

ember sinew
winged badger
#

its a UObject, you don't call Destroy on those usually

#

you just let go of the pointer keeping it alive and GC handles the rest

chrome quest
winged badger
#

MarkReadyForDestroy() ?

chrome quest
winged badger
#

never had a cause to use that

chrome quest
#

I had to remove it also cause I don't want it to get destroyed that way

#

It just tied the lifetime of the object to the replicating actor.
You can remove the function if you don't need it

summer tide
#

If I put the server and multicast and replicated variables code in a common-component then inherit that component. Would that network replication work?

winged badger
#

as long as the Actor which that component belongs to is owned by the PlayerController, yes

#

otherwise, only multicast will work

summer tide
#

So setting a replicated variable using server RPC wont?

winged badger
#

you can do it in PlayerController, Pawn and PlayerState by default

summer tide
#

Not using a component

#

A common component being shared by two components. And two separate components are added to two separate characters.

winged badger
#

all Server and Client RPCs require that Actor whom they ultimately belong to is owned by the PlayerController

#

otherwise you'll just get a "No owning connection for..." warning in your Output log

ember sinew
summer tide
chrome quest
winged badger
toxic lion
ember sinew
vivid sparrow
#

can I only ever call server RPCs on pawns/controllers (aka something the client owns?)
I originally was doing a NetMulticast RPC call in the gamestate (which is shared between server/clients) but it seems to make more sense to do it from the pawn, even though I moved my original code from the gamestate to the pawn and it made no difference, I understand the syntax though, as the client, you call a function only the server should have access to, then call that server function, which will then call the base function
I'm honestly not sure why this isn't working, when playing as the server I am calling the function and it successfully NetMulticasts, but when I play as a client it never multicasts, even when I ask the server to do it
I'm basically going Pawn->FunctionInGameState->ServerFunctionInGameState->FunctionInGameState
is my logic messed up??

chrome quest
#

You can only call server functions from player controller or something that pc owns.

crimson valve
#

GameState isn't owned by the pawn presumably?

lost compass
#

Hi, does Replication Graph replace the default Network Relevancy System or are they supposed to be used in combination?

plucky prawn
#

i have this function in C++ which is clearly marked as Client but is being run on dedicated server. i know this because i create a widget inside which crashes because PlayerController::IsLocalController fails because the netmode is dedicated cpp UFUNCTION(Client, Reliable, BlueprintCallable, Category = Interaction, meta = (HideSelfPin = true, DefaultToSelf = true)) void ShowUI(class AMob* Player); does anyone know why this would be happening?

plucky prawn
#

the problem was that this function was on an actor that the player did not own. moving the core of this function to the player controller fixed it, although not being allowed to call an RPC on an actor that you dont own is annoying af and clogs up the player controller/player character

fathom aspen
fathom aspen
plucky prawn
short void
#

I'm using Smooth Sync for my racing game - does anyone know how to fix the major discrepancy in the client locations? The actual position of the owning client severely outpaces the replicated position. It's almost as if the plugin is not using extrapolation. I've gone through all the settings and can't seem to figure it out.

nova wasp
winged badger
#

most movement components with prediction work like this:
1 - client applies its movement predictively and sends its FSavedMove to server
2 - server receives FSavedMove, applies it and sends the timestamped result back to client
3 - client receives the server result, then reapplies all moves that happened after the timestamp of last server update, and that is its position

#

which means client will always "be a little bit ahead" of where it is on the server, unless its standing still

short void
#

I guess the main problem I'm having is, people cannot race side-by-side because they don't know whether or not there actually is a car to their inside or outside. The desync gets too far out of hand at 200+ KPH, like 5 car lengths

short void
nova wasp
ancient adder
#

How does ustruct repnotify works?, changing a value inside the struct does not call repnotify

thin stratus
#

In BPs?

#

I always felt like modifying variables in BP without involving the Set node of the variable doesn't cause RepNotifies

#

E.g. adding to an array

ancient adder
#

im working in c++, but its for both, do i have to keep a loop to check which value changed in the struct and apply it?

thin stratus
#

Hm in CPP it should be fine to just modify the structs property. Not sure

ancient adder
#

Yea setting the struct fires the repnotify but changing a value inside the struct doesnt

ancient adder
#

In blueprint it does call the repnotify when i change the values inside the struct

#

But not in c++

#

Well, it appears to be also working with c++ version, gotta check the code then

lament garnet
#

when i send an rpc with a pointer parameter(for example a montage) what does the parameter looks like when sent over the network?

#

its the asset path?

chrome bay
chrome bay
lament garnet
#

alright so there is no point in manually sending it, ill just let ue handle the thing

chrome bay
#

yeah, you don't need to do anything - just send the asset pointer

#

Or if you have a fixed list of assets you are using and can index them somehow, that's a way to save cost

lament garnet
#

make sense, thank you

chrome bay
#

C++ rep notifies work differently though (aka, properly)

#

BP "rep notifies" are just "when any change is made to this property regardless of who or where it came from"

#

And the difference between them is an endless source of frustration

solar stirrup
#

I wonder if they'll ever "fix" that

chrome bay
#

Probably not now.. I wonder how many BP projects would outright break if they did

#

Just a silly legacy decision we gotta live with 😒

signal lance
#

The higher the latency the worse it will look as the only information you have to predict them is their last state from the server and their last input

plucky prawn
#

If I have a door control panel ui that opens the door when I click a button in the widget, but I don't own the door, is the best/only way really to tell my local player controller to call a server RPC on itself to then call open on the door?

chrome bay
#

yes

plucky prawn
#

I'm trying to better understand the workflow for client side actions that are performed on the server for actors I do not own. The way I described seems like it would clutter the player controller with dozens of RPCs which only exist to call a function on another actor

chrome bay
#

Usually something like this is done through a generic interaction system

#

You don't make it specific for every possible actor, you design a system that can handle many interactions

plucky prawn
chrome bay
#

Would never recommend anything from marketplace tbh

#

But a simple approach would be just a single "Interact" RPC that takes an actor and a gameplay tag

#

E.g. "Door.Open"

#

And through an interface, call a function on the target actor

#

e.g. OnInteract(Player, InteractionType)

#

Usually quite game-specific

plucky prawn
#

Ooh I keep forgetting about gameplay tags

chrome bay
#

Ignore whatever Lyra did, it's awful

plucky prawn
#

How much would it cost me to have you implement this for me? Haha jk unless...

chrome bay
#

Well me personally I have no time πŸ˜„

#

But tbh generic systems like these are the most fun things to make IMO

signal lance
#

πŸ‘†

plucky prawn
chrome bay
#

Yeah but then these are the times when you learn the most too πŸ˜„

#

Even if you reinvent it a couple of times, you learn a lot from the failures and mistakes

#

Throwing stuff in the bin is underrated

plucky prawn
#

Great advice actually. I really need to learn to not be scared of having to rewrite code. I have this thing about writing code once and have it be perfect so I never have to revisit it and it's absolute hell. It means I get bogged down with tiny implementation details and micro optimizations that cost me days or weeks of time

chrome bay
#

I still do that tbh πŸ˜„

#

Very hard not to get too excited and over engineer once you get into a flow

#

But the first thing is identifying the problem, you don't want to pollute the controller with misc code from all over the place which makes sense - now it's just thinking about how to solve it in a nice way

plucky prawn
dreamy terrace
#

The way I was testing is by making a default third person project and using that. In a particular 4.27.1 build from source one of my coworkers made it works flawlessly. each game clients joins and they run around seeing each other. In 4.27.2 launcher release, 5.0 launcher realease or a 4.27.2 build from source it doesn't work the same. On those versions we have to manually use the console and type open 127.0.0.1

#

I'm trying to figure out if there's some type of bug or is something magical changed in the engine .ini's of that build that is making it work

lament garnet
#

for example if i create a new object that is maybe some hit informations when a character is hit and i send this damage object over rpc(i know it does not make sense, its just the first example that it comes to my mind)

#

should i pass only relevant data and rebuild the object on who receive the call or there is some magic happening behind the scenes?

chrome bay
#

You can't pass objects created with NewObject

#

The object has to be network addressable

#

So it has to be reachable some other way, e.g as a replicated subobject of another actor

lament garnet
#

oh

#

so in this case where the object is just a transient object, how would you do this?

chrome bay
#

You can't

#

It has to be networked somehow, and reachable anohter way

plucky prawn
#

i am currently trying to figure out how to send a wildcard through a blueprint function call to a blueprint event. decided to not use wildcards and just use an FString instead :( i dont like it but.. it will work for now

meager spade
#

@chrome bay ignore what lyra did?

#

what ya mean on the interaction thing?

chrome bay
bitter oriole
#

Thinking of that time where Destiny 2 DLC got out of GamePass and players lost abilities mid game in PVP

meager spade
#

I mean I use abilities for interaction but these are triggered from native code. But the interact ability is mainly for gameplay purposes and timed interactions

fathom aspen
# chrome bay No - owned by the GameMode

I keep seeing this in bunch of different places, though looking at the source code, the GameModeBase seems to spawn GameStateBase without specifying the Owner, so it's kinda left null there. How would I still conclude that it's owned by the GameModeBase?

chrome bay
quasi tide
#

Well, I don't think it needs to explicitly set the owner, because aren't null owners considered to be owned by whoever spawns it?

#

If this is true, because GM only exists on the server, it'd naturally be what owns the GS.

chrome bay
#

Nah it has to be set explicitly for sure, you can definitely have actors without owners

fathom aspen
chrome bay
#

But tbf it makes sense for it not to have any owner, GameMode wouldn't replicate to clients anyway

#

No point replicating a ref that will never resolve

quasi tide
#

So I'm part right. I'll accept it.

solar stirrup
#

Is it a known bug that map actors destroyed via Initial Lifespan on the server still appear on clients that join after it was destroyed?

chrome bay
#

Hmm, as long as they are replicated it should work as expected I think

solar stirrup
#

Client that joined late on the left still has spawns that got destroyed (not visible in the client in the right)

#
LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: GER_ForwardSpawn2, ObjOuter: /Game/PostScriptum/Maps/Wolfheze/Offensive/Single/UEDPIE_0_Wolfheze_Offensive_Single_01.Wolfheze_Offensive_Single_01:PersistentLevel 

big rip, whines about it when I call a Server RPC if I try to spawn on it mmLul

#

guess i'll figure out why it doesn't get replicated destruction info created for it

#

.... it does?

chrome bay
#

Relevancy issue maybe?

solar stirrup
#

Always Relevant

chrome bay
#

Hmm not sure

#

Oh wait, you're using rep graph right?

solar stirrup
#

Yea

chrome bay
#

There's a max range for actor destruction infos being replicated IIRC

#

But haven't got code atm so can't find it

solar stirrup
#

does it come with a warning in the output log?

chrome bay
#

I don't think so

#

It just doesn't send out destruction infos for actors that are far from the viewer, but yeah here that would be a problem

solar stirrup
#

gonna check all usages of DestroyedReplicatedStaticActors

rose prawn
#

Hey people, is there somewhere I can access replicated control rotation? I currently have my own replicated control rotation variable. But if it's already exist in somewhere I might drop mine and use it. (Using cpp)

solar stirrup
#

Not seeing anything about visibility thonk

solar stirrup
#

Alright, don't get that destruction issue without the rep graph

#

odd

#

Ay got it: UReplicationGraph::SetActorDestructionInfoToIgnoreDistanceCulling()

#

Beats me in what case you'd want to cull destruction info for map actors

#

especially always relevant ones

ancient adder
#

I have a component that creates a basic inventory such as players inventory, storage and that kind of stuff
And on its begin play it populates a replicated with repnotify(ReplicatedUsing) structure thats called InventoryData
when the player logins the repnotify function fires and creates widgets with data from InventoryData struct

What im trying to do is put this component on an actor owned by no one and act as a storage to the player
so when the player interacts with the storage actor it opens a storage widget with data relevant to him
or even as a marketplace with online data that everyone can access

But i can't seem to make it work as a storage(didnt try marketplace yet), the data is always empty
Can't find a way to make the actor load data relevant to the player since he doesnt own the storage actor

So i was wondering is my approach possible? should i stick with adding the inventory components to the player controller or is there a better way?

dark edge
ancient adder
#

I havent played diablo but yes, different contents to different players

dark edge
#

That data should live in PlayerState probably, replicated to Owner only. The stash just acts as a way to interact with it.

#

It's your items, you can only get at your items when interacting with the stash

#

it's not the stash's items

#

Set it up such that you can open the inventory any time you want with a keypress, then just hook into the interaction with the stash

#

Sort of like a shulker chest in Minecraft

ancient adder
#

I've thought about keeping all data thats relevant to the player inside controller and make the storage actor just a way to open the widget, but its kinda hard to make new inventories at runtime with this approach

dark edge
#

Is this inventory global or tied to the specific actor, just restricted per character?

ancient adder
#

i dont think i understand, you put the component in an actor and you have an inventory for that actor

dark edge
#

I mean, if I put items in chest A and go open Chest B, are my items there? Is it like the WoW Bank where it's accessable from many spots or just from the one actor?

ancient adder
#

aha

#

just one actor

#

You put items in actor a, they say in a and a only

dark edge
#

But another player can't see them right?

ancient adder
#

Yes, you only see what you put in it

dark edge
#

I'd just add OwningPlayer to an item slot and filter by that

ancient adder
#

But there is no data for the slot to have

dark edge
#

add it

ancient adder
#

hmm

dark edge
#

I mean it all depends. I was leaning towards adding a global inventory to the PlayerState but then you said that each actor has a separate inventory so that changes things up a bit

#

What's the context, is this for a stash or bank or auction house or what

ancient adder
#

Everything xd

#

Im trying to make an inventory system that i can use for everything

ancient adder
dark edge
#

Not doing any of the context stuff though, everything is the same for everyone.

ancient adder
#

All the logic is contained in the component, you just call events/ interfaces or functions from the component

dark edge
#

A component is typically the approach, the wrench in the whole thing is the "ownership" mechanic.

ancient adder
#

Yea the ownership is what making it hard to me

dark edge
#

maybe that should be on the item level

ancient adder
#

Marketplace seems easy to do since i just make the data replicate to everyone but im not sure

ancient adder
dark edge
#

Is a dropped item owned?

#

or is it just an item on the ground

#

are items soulbound?

ancient adder
#

just an item, a dropped item will be an actor that contains an item data

dark edge
#

Like is it MY sword because it has my name/id on it somewhere or is it just the sword in MY chest?

ancient adder
#

might make it owned

dark edge
#

Do you have item slots?

ancient adder
#

Yes, on client side they're widgets

dark edge
#

I mean in the data

ancient adder
#

on server they're just structures

dark edge
#

does a component just have an array of item structs?

ancient adder
#

yea

dark edge
#

or an array of slot structs with item structs in them

ancient adder
#

exactly

dark edge
#

which one?

ancient adder
#

Its a struct called inventoryData, which contains some data about the inventory like name, owner type and 2 other array of structs that hold the information for the slots

dark edge
#

Usually it just has 1

#

but these special inventories have 1 per character

ancient adder
ancient adder
dark edge
#

Instead of one InventoryData, have an array of them

#

Most inventorycomponents will have 1 of them, but these special (subclassed probably) inventorycomponents would add more when interacted with by a player.

#

Or just have ownership on the slot level, and only show slots owned by Player or Nobody

ancient adder
ancient adder
#

I did make it once operate with objects, but i dont think it made it any good to me

dark edge
#

You have 3 options that I can see. Add an Owner field to

  1. The InventoryData
  2. The Slot inside the InventoryData
  3. The Item inside the Slot
ancient adder
#

Which i did all of them, except for Slots inside the inventorydata, i instead used objects as slots

#

Anyway thank you so much for the information i really appreciate it, i'll look into doing slots with ownership if i couldnt make the current approach work

fathom aspen
solar stirrup
#

eh

#

would be short, just me cursing at the engine

magic yoke
#

What happens when I replicate an array with object references in it? (in blueprints)

I don't see any options to mark objects as replicating

#

does the client only get a bunch of pointers, or does it replicate the objects as well

willow prism
#

Hi!! I have a bot that looks at the player when it sees the player, is there a way for the rotation to be as similar as possible on the server and client. Currently it looks at me but if on the server it is looking at an angle of 90Β°, for example on the client it may be seeing at 80Β° or some other value close to those of the server, but never the same. How could I make it as close as possible to the server?

eternal canyon
#

which they will then match with the object on their side

#

tho if it doesnt exist it will just be null

magic yoke
#

if you missed my slight kerfuffle in blueprints

#

I'm basically trying to create a large tile system

#

and trying to figure out the best way to communicate to the client about the world tiles it's near

#

I don't see a way to replicate objects actually

#

probably missing something basic

dark edge
#

Is there a variable LookDirection? AimPosition? TargetActor?

dark edge
willow prism
magic yoke
dark edge
#

Is the bot a Character?

magic yoke
#

it has relatively little information in it

dark edge
magic yoke
#

not a good reason, found out making them out of actors raw was bad so I stepped down to object instead

willow prism
magic yoke
#

I think I could make them out of structs easily enough

#

the data does get updated, but tiles aren't created or destroyed after setup

#

only the data inside

#

struct would work better?

dark edge
magic yoke
#

a lot

#

mind you, I don't have a set number

#

but 10k would be small

dark edge
# willow prism yes

Then it's rotation should be replicated already. Is it yawing towards the player?

magic yoke
#

I'd prefer 100k/1m

#

if possible

#

the client would only need to know about a small subsection at a time

#

the chunky array would be server side

dark edge
#

Is it static or dynamic? Procedural generation?

magic yoke
#

static, procedural

#

the actual structs

#

the info inside the structs could change

dark edge
#

You could just start with replicating the seed + diffs

willow prism
magic yoke
#

mmm, I think I misspoke

#

the tiles themselves are static, not all the info inside them is static

#

who owns the tile would change for example

wet bridge
#

Anyone know if large scale maps using world partition work well with a listen server multiplayer setup?

#

I can't find much info on the topic but what I have seen has implied it might be computationally heavy for the host to have to load multiple regions in at once

dark edge
#

Or GetSurroundingTileInfo(MyLocation)

magic yoke
#

yeah, more or less

#

I think you put me on the right path :)

#

structs + client owned actors are definitely what I was looking for

shrewd tinsel
#

hi guys

#

me health variable has a big delay on playerstate when replicating

#

how do i solve that?

chrome quest
chrome quest
shrewd tinsel
#

thanks for the response

#

you are infact right, i probably should have that on the pawn

#

and thanks for the tip on net update frequency

#

i did played with that but i probably set it too low cuz it broke everything

#

maybe 0.4 second rate would be good?

chrome quest
#

I can't really say tbh. It depends on what other stuff are replicating in your game. The default should have been fine.

shrewd tinsel
#

imagine counter strike

#

you really want as fast update on the health bar as possible

#

so you have good feedback on the damage youve dealt

#

i dont really want to rpc that

#

alright thanks for help!

chrome quest
snow tiger
#

hi guys i have a question related to voice chat in dedicated server. i made according to the tutorial but the voice doesnt replicate to the other clients
anyone know what to do on this matter

crystal crag
#

If you wanted to smoothly rotate a player towards a target when "locked on", wouldn't it be best to just mess with AddControllerYawInput to have to naturally replicate to the server / other clients?

#

The only other way I can think of doing it is making the lock on action call a server RPC and then have the client and server call SetActorRotation

#

on tick

distant turret
#

do you need to have savegame in unreal engine if you're using NoSql database?

blissful saffron
#

Does anyone have a blog or write ups on some good practices for validation/anti-cheat for multiplayer?

short arrow
blissful saffron
#

Well, I want to integrate Easy AC but I know from reading their docs that the primary anti cheat is based on validating game state, inputs, etc. Or at least that's what I gather from reading it so far

undone plinth
#

Hi, I've got replicated actors attached to a replicated actor. In viewport and new editor window they work fine. However in standalone preview the children replicated actors do not spawn on the client but show on the server. Any body got any advice on this?

I am seeing this line in the server console which points to something - Server connection received: ActorChannelFailure [UChannel]

pallid mesa
#

ie: client authorative server validated can use server validation to ensure things are proper, ie: checking the shoot was a valid shoot

#

or if you have a vehicle you could be checking on the server that it isn't surpassing certain velocity and that it isn't teleporting

#

it is really gameplay centric

#

and every game has different needs

lament garnet
#

in single player ive used a tmap of gameplaytag, fstat to define my stats for actors. since replication is not supported, how would i implement something similar? TSet?

#

and having the tag inside the struct

chrome bay
#

TArray is the only container supported for replication

#

But why would you replicate that anyway is my Q?

#

Ah wait.. FStat is your own type?

#

Either way the answer is to just use a TArray of structs, which combine the tag and data

tribal elk
#

You can also serialize the tmap to a tarray struct for replication purpose ( key-value sequence )

Ue5 GAS does this for replicating loose tags

chrome bay
#

Usually very special cases though, most of the time TArray<FSomeStruct> is preferable

lament garnet
#

mm thank you guys

tribal elk
#

Agree but also the stat definition could be an asset :)

And if they are dynamic the server should probably do the work anyway so no rep needed to setup the fstat

#

As you probably propagate it into components anyway ?

chrome bay
#

Even then I'd still make it an array

lament garnet
twin juniper
#

@chrome bay would you happen to know how to send more than 64kb between server and client? Chunked tcp sockets? Would a custom uactorchannel work for this? I think I read something about custom uactorchannels but couldnt find much.

chrome bay
#

RPC it in batches maybe?

#

Replication system isn't really designed for large data sets

#

Little and often is it's preference

#

Custom sockets might be an option if you want to download a large stream of data early on

twin juniper
#

I did try that but if it was too fast in between it would fail

chrome bay
#

But TL;DR it's not recommended to use the engines game-level replication for large data

tribal elk
# lament garnet what do you mean by that?

It sounded like your map is only used declaratively not really at runtime and other components ( like health / GAS ) replicate their health then
Sorry misunderstood probably

lament garnet
#

yep, thats how im doing it

twin juniper
chrome bay
#

What's being replicated?

twin juniper
#

Uobjects

chrome bay
#

I mean what data

#

UObjects can't natively replicate without piggybacking off an Actor anyway

pallid mesa
#

any good resource in which I could consult average network bandwidth and other stats employed by famous multiplayer titles?

twin juniper
chrome bay
#

And you can't generate that data client-side from a seed?

twin juniper
#

I suppose I could. Just dont know how πŸ˜…

chrome bay
#

I mean you're sort of stuck because if that all needs to be replicated for some reason, you don't really have any choice but to use regular property replication

#

And just wait until the engine manages to get it all out to the clients

#

How many objects are there?

twin juniper
chrome bay
#

If it's all in one array then it won't really work no

#

FastArraySerializer might work

#

If the array is that large you'll probably have to use it anyway

pallid mesa
#

What was the conclusion between the tarray and fastarray?

#

bigger arrays, or bigger members?

chrome bay
#

tbh I don't think there's any fixed answer

#

But there's definitely a cap for regular arrays at some point

#

TArray still works nicely if the array stays fairly constant in size and you care about order

#

Because you still get delta replication

pallid mesa
#

so what would be the problematic... the array size or the member size?

chrome bay
#

Both

pallid mesa
#

both

#

yeah

chrome bay
#

Especially if you consider the initial non-delta packet that replicates the full contents

#

Whereas IIRC FastArraySerializer will sort of "chunk" them internally

pallid mesa
#

so if we don't consider that initial replication

#

if we have a longer members in a reasonable sized array

#

probably it's just comparable

chrome bay
#

I think so. FastArray does have larger packets in general I've found

#

But

#

It does have delta struct serialization on by default now

#

It does seem to work, but I'm still seeing larger overall packet sizes

#

Can't figure out where the extra bits are coming from atm

pallid mesa
#

yeah

#

I always struggle on what to use, really.

#

I end up using TArrays unless the array is very very very long

#

and later, when you profile you see and go like "shit i probably should have tried fast array" hah

chrome bay
#

I'm near enough in the same area. If the array is "reasonably" sized, like 10-40 elements or something, and it's size is fairly constant, I tend to find it cheaper

#

I did have a little test project.. wonder where that went

solar stirrup
#

gonna be using it to replicate map marker data soon

chrome bay
#

The other benefit of FastArray ofc is the per-element add/change/remove stuff. That's useful

solar stirrup
#

^ yeah

#

big reason why i'll probs use it

chrome bay
#

Every marker in HLL is it's own actor πŸ˜„

solar stirrup
#

PS is either an actor or a component that registers on the map

#

refactor time soonℒ️

chrome bay
#

yeah, I've wanted to profile one vs the other for ages, just never got around to it

solar stirrup
#

issue with component is that it means the map marker won't show up for non relevant actors

#

even if it needs to

#

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

pallid mesa
#

Actually I have drafted several use cases to profile

chrome bay
#

Oh I meant actors vs fast array in this case

#

TArray vs FastArray I did, for small data sets TArray seemed to be a winner

#

But also it's removals that get you

solar stirrup
#

Fast array is probably lighter since it won't have all the actor overhead

chrome bay
#

You remove something from the start of a TArray, suddenly every element ends up being sent

solar stirrup
#

yeaaa

chrome bay
#

FastArray, no problemo

#

Removals were definitely faster with fast array

pallid mesa
#

ah actors vs fastarrays

#

I see... Zlo seemed to find extreme benefits from one over the other

chrome bay
#

It really depends I think, it seems very case specific

#

as usual

pallid mesa
#

yes

#

i mean u woudln't do it for 2 actors haha

solar stirrup
#

I'll probs go fast array since i'm expecting 100 player markers + vehicles + objectives + spawns etc

pallid mesa
#

so much useful info in here, thank you guys <3

solar stirrup
#

and i'll split it into three actors, each relevant per team and one relevant for all

pallid mesa
#

i gtg now! have a good day!

chrome bay
#

yeah, if we did this again, I'd have one actor for each type of marker + data

#

per team

winged badger
chrome bay
#

Yeah I know about the RepID at least, so that explains at least 32 bits

#

There were a few extra I couldn't account for, but didn't dig in deep enough

#

I'll have to find the numbers again

winged badger
#

i kinda serialized some fastarrayitem structs to .json once

#

there was more then just repID there iirc

chrome bay
#

I think they've added some fixes for the delta stuff in 5.1 too, need to see if that makes a difference

winged badger
#

generally, never had a bandwidth problem, or even close to it, but had to do plenty of CPU optimizations

chrome bay
#

I was taking fair advantage of that

#

yeah

chrome bay
#

I'd like to know as well tbh

#

Seen a lot for latency, very little for actual rates..

winged badger
#

most games nowdays would work on a dial up

#

older ones definitely would

solar stirrup
#

Oh god

winged badger
#

to youngling such as you: dial up is an ancient tech that used a modem to do internet over the phone line πŸ˜„

pallid mesa
#

Zlo, you are not that old, come on man

#

xD

#

you are portraying yourself like an elder

solar stirrup
#

Ok boomer

winged badger
#

i am not, you are that young πŸ˜„

solar stirrup
pallid mesa
#

hahaha

lament garnet
#

"mum put down the phoneee, internet is down"

pallid mesa
#

I've lived that

#

But yeah, old games with real engineers run over crazy budgets

#

for both CPU and bandwidth

#

πŸ˜„

#

I was also thinking about profiling Lyra as a starting point to see how much a UE5 multiplayer title would be as a baseline

#

maybe not very ideal, but we can get good and detailed numbers with insights there

twin juniper
chrome bay
#

They do, but the initial state needs to be replicated too if it's different to the clients' initial values

#

Also have to consider join-in-progress, where massive deltas might be sent

twin juniper
# chrome bay Also have to consider join-in-progress, where massive deltas might be sent

Yeah. This is just during a main menu like tarkov for big inventory. Being replicated to one person. So no need to send all that data to everyone. Though what would ramifications be having net.MaxConstructedPartialBunchSizeBytes so high? I guess in such a situation its not as bad because main connection server is seperate from game server. But could be possibility in game an array might be large but not that large

split siren
#

I am having hard time understanding the login process. I generate a url and token for player to join a server (127.0.0.1?token=secret). Server should verify the token by checking DB or asking a webserver (at least 100ms processing time)

FString AGameSession::ApproveLogin(const FString& Options) - This looked like a perfect method, but it is not async, which causes lag when checking if token is valid

bool ProcessAutoLogin(); Is async with OnAutoLoginComplete callback, but I don't have access to url options like with ApproveLogin (and it fetches the login data from commandline etc).

What is the right process to check if token is valid without locking the game thread?

chrome bay
#

You probably want to check it before they actually join at the game-level

solar stirrup
#

Beacon would be a good way

chrome bay
#

Yeah. Otherwise lots of wasted time to load a level only to get kicked back to the menu again

solar stirrup
#

Client sends server secret through Beacon -> Server checks asynchronously -> Caches result and tells it to the client who can join if it's valid -> Check cache in login

split siren
solar stirrup
#

Yep

split siren
#

Lovely, thank you very much

solar stirrup
#

Lovely tool

#

Can do so much with them

arctic hazel
ancient adder
#

How do i call this manually? UInventoryComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const

solar stirrup
#

Why would you want to call it manually?

ancient adder
#

I want the variables replicate condition change based on an exposed bool

chrome bay
#

It'll only work at the class level

ancient adder
#

Yes, thats what happens

chrome bay
#

You can't do conditional replication that way

#

GetLifetimeReplicatedProps() is called by the engine at a specific point, so you can't really "call it manually" so to speak

ancient adder
#

ahaa

chrome bay
#

you can turn props on/off with PreReplication

ancient adder
#

let me check real quick

chrome bay
#

actors do this for replicated movement for e.g, depending on whether attached or not

ancient adder
#

Is PreReplication called manually?

chrome bay
#

no

#

none of it is

#

PreReplication() is called before just before checking for property changes

ancient adder
#

Do you mean when you press play?

chrome bay
#

no

#

every time the actor is replicated

#

or considered for replication at least

#

GetLifetimeReplicatedProps() is called once when the actor channel is created, on it's class

#

What do you actually want to do here btw?

ancient adder
#

So GetLifetimeReplicatedProps() is called on base class, but im having trouble understanding PreRep

chrome bay
#

PreRep is called on the instance, just before that instance is considered for replication

#

BTW this is all in the comments of Actor.h

ancient adder
#

Im trying to change replicate condition based on bool inside my bp details panel

chrome bay
#

If it's on a component, you can't

#

You have to create a new BP class for that component, THEN change the bool, then add that blueprint component class to your actor

#

You can only change conditions at the class level, not the instance level

ancient adder
#

I now understand i cannot do it with GetLifetimeReplicatedProps()

chrome bay
#

It will work with PreReplication yes

#

You'll need to replicate the property with a condition, you can use COND_Custom if you aren't using one already

formal solar
#

I noticed that I can't update an animBP variable on server directly, I have to do it via rep notify, why is this?

chrome bay
#

AnimBP's don't replicate

ancient adder
#

Thats great, the only missing piece is how to use PreRep, imma look for a doc on that or something like that

chrome bay
#

Look at AActor::PreReplication

formal solar
#

So it's either multicast or repnotify?

chrome bay
#

E.g. DOREPLIFETIME_ACTIVE_OVERRIDE(AActor, ReplicatedMovement, IsReplicatingMovement());

chrome bay
ancient adder
#

I mean i know those, but not how to setup the PreRep func

chrome bay
#

Just have a look at the actor

#

It's a virtual function you can override, nothing much to it

ancient adder
#

Whats the difference between RESET_REPLIFETIME_CONDITION and DOREPLIFETIME_ACTIVE_OVERRIDE?

wet bridge
#

Anyone know if large scale maps using world partition work well with a listen server multiplayer setup?
I can't find much info on the topic but what I have seen has implied it might be computationally heavy for the host to have to load multiple regions in at once

ancient adder
#

Why am i getting this argument truncation from ELifetimeCondition to const bool

#

with this DOREPLIFETIME_ACTIVE_OVERRIDE(UInventoryComponent, InventoryData, COND_OwnerOnly);

#

and this works fine DOREPLIFETIME_ACTIVE_OVERRIDE(UInventoryComponent, InventoryData, COND_None);

#

wait wat, it takes bool

#

So its for "when a property does and does not replicate"

lament garnet
#

mm.. so i was implementing the stat thing i asked before

#

im getting the stat from the array as a pointer and then edit it(it's a struct)

#

the actual struct does not change tho if it's replicated..the second i remove replicated property it work

#

what am i missing?

solar stirrup
#

show code

lament garnet
#

send code

#

you can hit me if you want

#

the answer is that i was missing the component replicate boolean

solar stirrup
arctic hazel
#

ok so

#

uhm

#

(Mouse is not moved in this recording)

#

wait.. i gotta pass the actor's location thru server and over to the multi.. dont i? <.<

pallid mesa
#

what's "Shared" in net insights?

potent cradle
#

Found this comment by Zlo. Does anyone know how to accomplish this?

#

My usecase here is object pooling. I'd like to not destroy actors when they go out of reprange, so they can stay in the pool on the client as well.

#

If I'm not mistaken, actors that are part of the level are not destroyed when they go beyond your rep range, but stay frozen in their last known position when they were in rep range.

#

How can I trick the engine to do this?

solar stirrup
#

looks like the net driver has a function for that

potent cradle
#

Thank you so much @solar stirrup, I'll take a look at that one

solar stirrup
#

o7

potent cradle
#

Oh wait, I think bNetTemporary is something else. It replicates only once or something of the sort πŸ€”

solar stirrup
#

Yeah, wouldn't touch that

#

I'd probably just modify the net driver, or (haven't done that before so no idea if it's even possible), derive and override ShouldClientDestroyActor()

mellow solstice
#

Hey, I have a client joining a listen server and both can see each other move correctly. After the host initiates a transition from the lobby to another gamemode and both pawns have spawned, he can see both players move correctly as well. However for client I can give input and control the vehicle on the host but I can't see myself move?

solar stirrup
#

How are you controlling the vehicle

mellow solstice
#

It's replicating vehicle input, I am a bit at loss why it stops working after going from lobby to the gamemode

#

I also get this warning but not sure if related "No game present to join for session (GameSession)", it almost seems like the client is connected to the host but in its own world

chrome bay
potent cradle
chrome bay
#

If it's a map startup actor it has to be stably named

#

So they must be spawned independently on Server + Client with stable names, trick the engine into thinking it's a map startup actor, and the rest should work

#

But channels will still be created/destroyed

solar stirrup
potent cradle
#

hmmm, is this a silly approach?

chrome bay
#

And opening a channel sends all properties that differ from the serialized defaults

#

Because change history is lost with it

potent cradle
#

I imagine this is also something that you ran into with HLL no?

chrome bay
#

nah, we don't pool anything

potent cradle
#

Oh, Lol

#

Shit πŸ˜†

chrome bay
#

The bullets are data only, no actors or anything

solar stirrup
#

Hax

#

Do you have a manager that just handles them all or something?

chrome bay
#

yeee

solar stirrup
#

Damn

potent cradle
chrome bay
#

since they're all projectiles, so actors would never have scaled

#

Maybe, closing/opening channels a lot isn't advisable I'd say.. it's cheaper than spawning new actors ofc

potent cradle
#

Gosh I'm starting to think it might be better to just serialise the whole pool to disk or something. It feels dirty but this whole set-up is starting to cause a lot of friction πŸ€”

solar stirrup
#

Place the pool on the map in editor

potent cradle
#

Yeah

solar stirrup
#

One by one, by hand

potent cradle
#

πŸ˜†

solar stirrup
#

Tbh, could just make them non replicated

chrome bay
#

I ended up using dormancy for pooled actor-based projectiles, still hits a peak though

solar stirrup
#

And have the server just give instructions

potent cradle
chrome bay
#
  1. yeees
  2. set bNetStartup = true
  3. in theory...
#

Whether it actually saves any real cost is anyones guess though

potent cradle
solar stirrup
#
  1. engine makes you pay for messing with it
potent cradle
chrome bay
#

Trying to remember how I did it but I think the gist was:
1- Spawn a pool or replicated projectiles with the weapon, they should be dormant.
2- Remove from dormancy when "fired"
3- Return to dormant when "finished"

#

The downside is, dormancy has the same issue of sending all properties

#

So I had to trim down the # of replicated props per projectile to as minimal as possible

#

So still hits a ceiling

potent cradle
chrome bay
#

Dormancy doesn't kill the actor

#

If you're talking about relevancy range then yeah, that's a problem still

potent cradle
#

Yeah πŸ€”

chrome bay
#

But I don't see any good way around that tbh.. maybe the net startup hack might work

#

Still gnarly though

potent cradle
#
  1. I spawn 10 actors for my pool on the server, at 0,0,0.
  2. Player is 5KM away from 0,0,0, so pool is out of rep range, and pool actors do not exist client-side.
  3. Player requests something from the pool on server.
  4. Server moves the pool actor, client has to spawn it separately and pooling falls flat on its face
#

Gnarly indeed

chrome bay
#

If scale is such a concern, not using actors at all is probably a more sane approach

#

more E N G I N E E R E D though

#

The other massive problem I had is

#

You join a game where a few vics/weapons have spawned

#

Client times out trying to spawn all the replicated projectiles, majority of which aren't even active

#

IDK, it gets complicated

potent cradle
#

Multiplayer TM

ancient adder
#

Is it possible to replicate a property to a specific group of clients?

chrome bay
#

negative

#

Well that's not strictly true, you can do some stuff with custom net delta serializers but for the most part, nope

solar stirrup
#

I did take a look at doing something like that once

#

It wouldn't be too hard to create a custom condition and handle it

#

but there's likely better ways to do what you're trying to do

ancient adder
#

The closest thing i found is this AActor::IsNetRelevantFor

solar stirrup
#

You can replicate an actor to specific connections yes

#

Which would be the easy way to replicate properties to a selection of players

potent cradle
#

Does RepGraph handle changing dormancy at runtime, automagically, yet? πŸ€”

#

void UReplicationGraph::NotifyActorDormancyChange(AActor* Actor, ENetDormancy OldDormancyState)

#

Seems like!

#

πŸ₯³

tribal trout
#

There is a GenericToolServer.exe that is being distributed by Epic with the NASA MarsXR Challenge and requests network permissions independently of the standard Epic/Swarm editor request for similar network permissions.
It's unsigned. They assert that it is included with the Editor -- "this is a default message whenever you want to connect to a server using unreal engine multiplayer".. However if I search for that tool with my 4.26 or 5.0 installs it isn't found.. but there are 3 copies of it within the Challenge installation.
any thoughts?

#

it requests at installation, not when you are already in the editor and trying to run a multiplayer game

glossy kettle
tribal trout
#

where

lament garnet
#

so how do i deal with notifies that play from a replicated montage?

#

the server is firing it two times of course

blazing jolt
#

Hey slackers. I am currently encountering an issue described perfectly at the given link. The players are spawning into the server and seeing the map through the player controller, then they possess the pawn and have their vision blacked out appropriately for the level to load. I was wondering if anyone knows a way to block out the player controllers camera on start up, to avoid that view of the map. Using the player camera manager or a UMG to cover the player controller has not worked for me. Both are not active when the controller starts up.

Link: https://forums.unrealengine.com/t/multiplayer-level-open-glitch/51792

solar stirrup
#

Hey, replication graph question, getting a server crash due to this ensure in UReplicationGraph::ReplicateSingleActor():

#

Something I don't get, isn't an actor that's getting destroyed supposed to be removed from the rep graph and not replicated?

#

Are there any pitfalls I should be aware about?

solar stirrup
blazing jolt
solar stirrup
#

Use a loading screen perhaps?

blazing jolt
elfin hinge
#

Ok, so.. I really dont know if this is the right place for this but I made a transforming mechanic, which now finally works if you do netmode client with 2 it works and matches, but if its netmode listen server the I assume host it is backwards. What is the possible problem or does it not matter?

kindred widget
#

Don't know what transform mechanic is or does programatically. If it doesn't work the same for one player as another regardless if they're listenserver or a client, then it's not being RPCed and replicated properly.

elfin hinge
#

I have basically 5 characters and a human, the player can change to a character and human back and forth, I have "isHuman" and "isTransformed" both with repNotify. First one is where the custom events and the button press it located, the second is the multicast and the third is the graph inside isTransformed if this helps

lament garnet
#

anyone can send me something regarding animation notifies when dealing with network? i cant find sheat

latent heart
#

Animation notifies won't trigger on a client if the animation is playing on a server and vice versa.

#

They will only trigger locally.

lament garnet
#

mmm

#

but the montage is replicated of course

latent heart
#

They're probably playing the same animations, yeah.

#

If you want network stuff to fire off when anim notifies happen, you have to add an extra level of code yourself to do it.

lament garnet
#

yes but im having trouble understanding what's happening in the first place to be honest

cyan drift
#

Hello, I'm attaching my characters to other actor when they get close, but on the client the character is out of sync, keep moving forward. I searched and found that there's a bug report on this, but it's been 4 years ant still the same issue on UE5. Anyone know if there's some way to fix it?

lament garnet
#

at the moment the montage is multicasted and the notify runs two times when asked from the server

latent heart
#

How are you multicasting it?

lament garnet
#

from the server

latent heart
#

You should be good then.

lament garnet
#

why is the notify triggering 2 times on the server then?

#

the code is really small and all inside the notify just to make sure nothing else is breaking the thing

timid breach
gilded charm
#

Hello folks I hope you all are doing well. I am working on a multiplayer game for few months and now I am trying to create network system and there are two ways that you setup up your game on dedicated server but I wont use them because that's too expensive for me. And second that user can create its own listen server but that works locally and for all over network you need to port forward in your router.But there is no implementation or tutorial how to do it automatically without prompting user to do it. Can any one suggest me some ideas or advice.
Plus I use EOS online services but there are some issues for brand account only registered email can access EOS and not available for all users.

dark edge
lament garnet
#

ill try again, does anybody have any idea on why an anim notify state on a multicasted montage run twice on the server?

#

im going crazy

peak sentinel
#

Subobjects can not manage their own relevancy, right?

#

They are strictly bound to actors

compact talon
#

In a party game do I store information like player scores, cosmetics and items in the game instance on the host or the gamemode?

Or is there a better place? It doesn't need to persist through game instances. In fact I don't want it to persist through game instances, I want it to persist only within the session

twin juniper
sinful tree
# compact talon In a party game do I store information like player scores, cosmetics and items i...

Game Instance: Stored specifically on the running game instance. Not replicated. Not accessible to any other instances of a game (eg. A server cannot run a "Run On Client" RPC on a client's Game Instance, nor can a client run a "Run On Server" RPC on the server's Game Instance)
Game Mode: Only exists on the server of the game. Not replicated to clients. Store data specifically regarding the game that clients should not be able to access.
Game State: Replicated. A single instance is created for the level. This should be used to store data about the current game session. Eg. Team Scores, Round Time Remaining.
Player State: Replicated. An instance is created for each player controller that exists in the game. This can be used to store data that all clients may need to know about any particular player. Eg. Player Name,
Character/Pawn: Can be replicated. Should be used to store data specifically about that character that doesn't need to persist through respawning. Eg. Current & Max Hitpoints
Player Controller: Replicated, but only to the owning client, no other clients can access. Should be used to store data that pertains, or can be replicated to only the specific client.

#

So based on the needs of who needs to know about your values, you should choose the appropriate place that:

  1. Stores data that is relevant to the class used. (Eg. It doesn't make a lot of sense trying to use a Game State to store information about the cosmetics a single player has unlocked.)
  2. Allows for replication as needed. (Eg. Game instance is completely out of the question as it can't replicate. It also doesn't make any sense to use the Game Mode to store the information about the cosmetics a single player has unlocked as it cannot be replicated to anyone from there.)
  3. Persists appropriately without having to re-replicate the data. (Eg. A "Character" class doesn't make much sense as when the player dies and respawns, you shouldn't have to re-send their cosmetic data)
  4. Allows for replication to the required people. (Eg. It might make sense to use the PlayerState or the PlayerController for replicating the available cosmetics, depending on if all clients need to know if that client has unlocked those cosmetics or not. If everyone needs to know, PlayerState. If only the one client, PlayerController)
compact talon
#

Wow, that is very helpful thank you very much.

I didn't realise how they all differed from each other - especially the player controller.

I am stuck on scores though. You mention game state which I don't doubt is right, but as I use different levels for the different minigames there would be different game states. Would I need to pass the score from the previous game state into the next game state with the necessary changes?

sinful tree
#

You can store the score in the Game Instance at the end of a level and read it back into the gamestate at beginplay if others need to see it.

#

But then you gotta make sure that value in the game instance gets reset whenever an entirely new session is started.

compact talon
#

I see, so for transferring the information through minigames I should store it on the game instance for the host at the end of a minigame and read from that gameinstance when the level starts for other players to see. I could probably just reset it when the host starts/joins a new session

#

I think I also need to move my UI functionality onto the player controller (like main menu pause menu etc) because it doesnt make sense to be on the character

compact talon
# sinful tree Game Instance: Stored specifically on the running game instance. Not replicate...

The first part of this has me a bit confused.

If the game instance is the server, it can only use "Run on Server" RPC. If the game instance is a client, it can only use "Run on Client".

So if I had 2 custom events, one running on the server and one running on the client, the host would only have the server event run, and the client would only have the client event run?

Or does none of these work as "Run on Server" is client > server, and "Run on Client" is server > client

sinful tree
compact talon
#

I see, it still has the checkbox for "Replicate" with the dropdown so I was confused as to why it was there.

So if I want only the host to run something on the game instance I switch on has authority?

sinful tree
#

Yes and no. Authority doesn't check if you're running on the server always. Eg. If you're in the game instance already, everyone has authority of their own game instance. As long as you know you're running on the server using it, then yes.
Eg. Enemy takes damage and dies is usually calculated while running on the server under a "Has Authority > Authority" node, so calling game instance from there, you're probably running on the server already.

compact talon
#

Weird

#

Am I right in using the Game Instance for transferring information between my levels in a session?

#

It just seems to work so weirdly with multiplayer that maybe there is a better way to store per-session information server side

hallow fiber
#

Does anybody know if there's something already some function already built into the properties system that you can call to determine if a replicated property has been synced to all clients? As in it has net serialized to all required clients yet?

twin juniper
#

how detrimental is bandwidth spike like this?

ancient adder
#

What i understand is Unreliable RPC calls might not be sent depending on server load, but what about replicated variables? are the changes to replicated variables guaranteed to be sent/reach the client? what if i have an important information update like player items, should i use replicated variables or rpc?

twin juniper
ancient adder
#

Also if have a a system that run fine with replicated variables, is there any bad converting it to RPC? like no more replicated variables just RPCs

ancient adder
thin stratus
#

RPCs and Replicated variables as well as RepNotifies are used for different reasons

#

You can't say they are better or worse in general

#

And you can't only use one of them for your game

ancient adder
thin stratus
#

Replicated Variables should eventually reach the Client.
RepNotifies in addition allow you to execute code inside the OnRep_ function.
RPCs are for one time events and can be divided into Reliable and unreliable.

thin stratus
#

One example would be an exploding barrel

#

The explosion VFX and Sounds (if the Client can't predict them) would be an Unreliable RPC, because they aren't important if they are dropped and they are only interesting to whoever is close to the barrel. Not to people that come in later or aren't even connected yet.

#

The visuals of the barrel, being it is destroyed and some fire is permanently burning in it after the explosion, is State. Represented by for example a boolean bDestroyed.
This is something you want everyone to see even people that come close to it an hour later or people that join later.
So here you use a RepNotify boolean where you change the mesh and turn on the VFX etc in the OnRep function

#

So again, RPCs and RepNotifies are for different usecases. You can't only use one and there is no better or worse despite simply using the wrong one.

ancient adder
thin stratus
#

Because RPCs are only executed for the clients that are relevant at the time of sending it. So connected clients that are in range.
They won't fire again for someone who joins later or comes into relevancy range (e.g. a huge map where you don't care about the barrel that is 5km away)

ancient adder
#

Aha, what i meant is calling the rpc when the client requests the change

thin stratus
#

If you change the mesh of the barrel with it and someone comes into it's range later or joins later,the RPC won't fire for them again and the mesh would be wrong

ancient adder
#

like for example, an inventory system where a player drags and drops the item, client sends RPC with index and item to server, server checks if valid then sends another rpc to update inventory indices with items

thin stratus
#

RepNotifies will however call again whenever the variable replicates. So a new player will get the new bDestroyed value and the OnRep calls and the mesh will be correct for them

thin stratus
#

A server RPC (sent by a client) is fine as it has no replicated variable equivalent

ancient adder
#

Sorry my question wasnt clear enough

thin stratus
#

The inventory example is a bit more tricky

#

Yes you would send a Reliable Server RPC to the server to tell it that you modified the inventory

ancient adder
thin stratus
#

The callback can then be a Client RPC, however a lot of users here would say use c++ with a Fast array bla (can't recall the name) for the inventory array because that has OnRep functionality per changed entry

#

Which is not a thing in BPs

#

So that more advanced array would basically tell you the changes while sticking to the idea that it's basically a state and should use a RepNotify

#

Only reason I'm saying this though is to make sure the whole state vs one time change is clear

#

You can use the client rpc to tell the client the update of the inventory

ancient adder
thin stratus
#

It might even never break in that example

#

Yeah but it's a special case. You could for example not do this with an inventory that is for the whole server

#

E.g. a Chest

#

Cause the other players that join later would not get the update

ancient adder
#

The idea is i had inventory system built with Only RPCs, now i have one with mostly RepNotify Variables, With RPCs i had way more control, Im just wondering is there a donwside to only using RPC performance or bandwidth wise?

ancient adder
thin stratus
#

Yeah or just a chest in the middle of the map like for Survival Games

ancient adder
#

Yes, but you can request the items from the server with RPC when u open the chest

thin stratus
#

I don't know about the performance diff between the two concepts to be honest. It rarely matters and there a lot of other things you tweak if bandwidth is an issue

thin stratus
#

Would be much nicer if the chest was in the correct state when opening for instant feedback

ancient adder
#

Or, you can call that RPC with Collision Box to make it nicer for instant feedback

#

Its like you have way more control with RPC, if i understand correctly

thin stratus
#

I mean sure. You could craft a system like that it might work fine for this usecase. My explanation is for general decision between the two concepts and while there might be some overlap between them, usually you find yourself using one over the other cause otherway round needs lots of workarounds

#

That depends what you mean with control

ancient adder
#

Reliable, unreliable, when to send the changes and things like that

thin stratus
#

Why is there a need for more control when all you want is the client to have the latest inventory array

#

The RPCs are still send whenever the engine can. You calling them doesn't guarantee timing

#

Could even be that a variable replicates before the RPC is sent

#

Or at the same time fwiw

ancient adder
ancient adder
thin stratus
#

Sure

#

I can't argue against that cause it would need some more work to get this going with just replicated variables

#

I would probably still go for the more work approach

ancient adder
thin stratus
#

But that's up to you. Can only give you the advice here

ancient adder
#

I really appreciate the information, and sorry for taking so much of your time, Thanks!

real ridge
#

guys can u give me advice ? So, I have created a dedicated server where I can connect using IP 127.0.0.1. Then I have added an EOS subsystem to the project and to do this I have created in C ++ functions to create a session, find a session and join a session. I need the game to work so that my dedicated server will run all the time, where sessions will be created, so the session creation will still take place on the server side. I did this by calling the create function via blueprint using a custom event on the server side but it doesn't work. I don't know how to do it can you advise me? In short, I need a server that will run 24/7, I will connect to the game (to my server) and there will be sessions (games) created on the server where we will connect as players.

latent heart
#

You're going to have to be more descriptive than "doesn't work."

glossy kettle
real ridge
latent heart
#

Yes.

real ridge
# latent heart Yes.

I was printing messages in LOGS (creating session ETC) And I was calling these functions on server side and when I was watching logs of a game and also log of server aftter clicking on CREATE SESSION inside game I got log message ( created) in my client game log not in server log

#

so i thought its running still localy not on the server side

latent heart
#

So how are you calling these functions "server side"?

latent heart
#

You can only call server commands like that on client-side actors that are "client owned" - character, player controller, player state, etc.

real ridge
#

so this should never work ?

#

then how to execute it on the server side ?

latent heart
#

Call it via your player controller or player state or whatever

#

EOS -> Pc -> server -> EOS

real ridge
#

what but code is in game instance or how do you mean it maybe I am too dumb XD

latent heart
#

You can't use the game instance to do it

latent heart
real ridge
#

so Should I code this inside player controller ? but its right way ? I want make a multiplayer game where server will run 24/7 and games will be created there players will join sessions or leave

#

I wonder if some short pdf or book about development of that type game does exists ah

latent heart
#

I want make a multiplayer game where server will run 24/7 and games will be created there players will join sessions or leave
this make no difference to how server RPCs work.

real ridge
ancient adder
#

If i have an array of structs inside an array of structs how can i tell which value has changed OnRep? do i have to loop thro all of them?

#

in c++

limber gyro
#

Does any know if the method "onMovementUpdated" in the character movement component is called every tick?

latent heart
#

Loop time, @ancient adder

pallid mesa
twin juniper
#

is there a certain way to take control of the server model??

when playing i can use the client model to move but when i switch back to the server screen im unable to move the other model

any ideas??

(btw its set to "play as listen server")

devout berry
#

Can someone point me in the right direction on how to replicate animations when using this new "Blueprint Thread Safe Update Animation"?
I have a bunch of variables in my ABP that feed into the state machine. But I can't set those to be replicated due to the above, it results in compile errors.

pulsar lotus
#

Kick client if you join from standalone if in viewport mode works correctly, how to fix it?

devout berry
#

I don't get it. Nothing in the anim blueprint of the Lyra game is set to replicated but the animations all work fine over network obviously.
How did they achieve this?

solar stirrup
#

You replicate values on the characters, and the Anim BP uses those values

devout berry
#

Yeah that's how I would normally do it.
But within that Blueprint Thread Safe Update Animation thing you have to access properties, which I cannot just modify or replicate on my character.
So how is that done?

ember sinew
#

I have an InventoryComponent for each player, stored on their PlayerController. This mean that functions like "AddToInventory"/"RemoveFromInventory" should be Client functions, not Server functions, right? Right now I have them set up as server functions that are being called by other server functions (e.g. "DetectedItemPickup"), but it looks like they aren't getting called at all.

#

I'm also curious... are there any good guides on best practices for ownership? E.g. in this inventory system, new item objects are spawned and owned by the server, but when player's pick them up and have them in inventory/equipped I figured I should make that player the owner. Is this reasonable?

devout berry
#

Okay I tried the normal approach with regular animation blueprint update function and replicating the variables in the character class.
Almost got it, but it does not replicate from client to server.
Does anyone see a mistake?

dark edge
devout berry
#

@dark edge I don't know it better. Got a suggestion?

dark edge
#

The movement is predicted

#

Just set up animation to be driven by movement (idk if last input is predicted/replicated or not) and it'll work everywhere. Look at the default 3rd person template

#

Velocity and forward vector are already synced

devout berry
#

I'll study the template. But for the sake of learning: Since I will need to replicate variables eventually, what is wrong with my approach?

#

Taking animations out of the context. Just in the light of variable replication.

dark edge
#

Skip the multicast, the variables are replicated already

#

But also remember that they aren't gonna be smoothly updated per frame on clients, you'll want to do some clientside smoothing for stuff that changes rapidly.

#

Like say you're replicating a vector AimPoint

#

So client sends it to server (unreliable run on server event on tick)

#

Server sets replicated variable

#

It won't necessarily update as smoothly on remote clients as it did on the sending client (bandwidth, jitter, etc)

devout berry
#

I see yeah

#

Man this stuff is super complex

dark edge
#

With the multicast either multicast or replicate state, don't do both (they'll conflict)

#

With your code, a remote client is setting Velocity on the multicast AND when the server changes it and it replicates. So it'll be spazzing all over the place.

pallid mesa
#

FVector replication is now 200 bits?????? 😩

dark edge
#

Idk, maybe the switch to doubles?

pallid mesa
#

yes 😭 it seems like

dark edge
#

You have precision settings I think

#

Quantization

pallid mesa
#

FVectorf and FVectord were the explicit types, right?

#

20 bits per component for the quantized ones

#

but yeah replication budget goes up by default

#

also I'm seeing this Shared a lot in the Net Insights profiler... and I don't know what they are referring to

#

I think I know what it is... but haven't dug in the sc to confirm it, if someone here knows I'd appreciate it

solar stirrup
devout berry
#

This event is not firing for me at all (took inspiration from the third person template).
Why?

ornate pilot
#

Hey, wild question but I have a security system using scene capture components and it's viewable on a widget and works fine but if the camera is too far from the person looking through the camera nothing is replicated through the captured camera. Im pretty lost on how to handle.

fossil spoke
ornate pilot
#

so interesting enough that didn't work but if I set another character to always relevant I was able to now them on the camera.

ornate pilot
#

if anyone is interested this seems to have fixed the issue. idk if its the best way to handle it but it works well enough.

devout berry
#

@dark edge I did it now as per the third person template and none of my animations are replicating (and they are using the 3 vectors you see in the picture). I am lost

distant timber
#

Destroying a replicated player (actor remains visible)

Hello,
I have a dedicated server and some clients. On the server, each client's AMyCharacter spawns an actor (MetaHuman blueprint) that it attaches to itself. The replication is set so that they appear and move correctly on all the clients.

The problem is when a client quits (OnLogout, the server calls DestroyActor on the controller), the MetaHuman stays present on the server and can be seen by remaining/new clients.
On the server, UWorld::DestroyActor is getting called for the AMyCharacter and the AMyCharacterController,
but their virtual destructors aren't getting called.

Do you know where I might be going wrong?

Thanks very much πŸ™‚

arctic hazel
#

Question

#

If my host commits a "damage" twice,

#

should i not multi-cast line-traces, and the dmg apply of the line trace?

spark ivy
#

Hi everyone, I’ve got multiplayer working on my VR game. I’m now trying to setup user profiles so each user can save settings and avatar changes etc. has anyone done this?

#

My multiplayer is hosted on a gcp server

low helm
# arctic hazel Question

This setup seems to make no sense. You don’t want to do line traces or run other logic from a multicast

arctic hazel
#

hm? i tought ya always had to multi-cast visual effects

charred crane
#

I have a replicated actor containing a 3d widget and a sphere collision. When a pawn overlaps with the sphere collision, I want the widget to be visible only to that pawn. I'm messing around with owner no see and only see, but I'm not sure if that's what i need to do. Any ideas?

arctic hazel
#

Well Phanter i guess that explains why host is double hittin

#

derp.

crystal crag
#

From a really high level, can someone explain some of popular methods (even conceptually is fine) for making the player lock their rotation to a target? I've heard that PhysicsRotate is one way its been done. I've looked at that method and I am not quite sure what benefit it would give me over calling say SetActorRotation from the server on the player character's or controller's tick

#

I originally thought that I would use AddControllerYawInput and just handle it client-side, but I was told in the CPP thread that it was not a good idea to do that.

#

If you call set ActorRotation on the server, wouldn't it have a better chance to cause corrections?

#

(which you don't want of course)

#

so far, I've tried a few things. They all either don't work at all or get me close but have issues. Right now I just have a check in the character's tick to see if the target actor is valid. If so, then try to "lock on" to it.

#
Super::Tick(DeltaSeconds);

    if(IsLocallyControlled() && AttackComponent && AttackComponent->IsCameraLockedToTarget() && CameraManager)
    {
        const FVector CameraDirection = CameraManager->GetCameraRotation().Vector();
        const FVector CameraZeroedDirection = FVector(CameraDirection.X, CameraDirection.Y, 0);
        const FVector CameraLocation = CameraManager->GetCameraLocation();
        const FVector SourceLocation = GetActorLocation();
        const FVector SourceZeroedLocation = FVector(SourceLocation.X, SourceLocation.Y, 0);
        const FVector TargetLocation = IRaevinTargetable::Execute_GetWorldTargetPosition(GetAttackComponent()->GetLockedTarget());
        const FVector TargetZeroedLocation = FVector(TargetLocation.X, TargetLocation.Y, 0);
        const FVector SourceDirection = GetActorRotation().Vector();
        const FVector SourceZeroedDirection = FVector(SourceDirection.X, SourceDirection.Y, 0);
        const FVector TargetUnitDirection = (TargetZeroedLocation - SourceZeroedLocation).GetSafeNormal();
        const float LoopDotProduct = FVector::DotProduct(SourceZeroedDirection, TargetUnitDirection);
        const FRotator TargetRotation = UKismetMathLibrary::FindLookAtRotation(SourceZeroedLocation, TargetZeroedLocation);
        if(LoopDotProduct > 0.0 && LoopDotProduct < 0.98f)
        {
            if (LastRotationTick.IsZero())
            {
                /*LastRotationTick = CameraManager->GetCameraRotation();*/
                LastRotationTick = GetActorRotation();
                return;
            }
            const FRotator Tmp = FMath::RInterpTo(LastRotationTick, TargetRotation, DeltaSeconds, 0.5f);
            /*UE_LOG(LogTemp, Warning, TEXT("LoopDotProduct %f. Camera Direction: %f %f %f Target Unit Direction: %f %f %f RInterp Rotator Yaw: %f Target Rotation Yaw: %f"), LoopDotProduct, CameraDirection.X, CameraDirection.Y, CameraDirection.Z, TargetUnitDirection.X, TargetUnitDirection.Y, TargetUnitDirection.Z, Tmp.Yaw, TargetRotation.Yaw);*/
            const float turnAmount = (Tmp.Yaw / DeltaSeconds);

            AddControllerYawInput(turnAmount);
            /*SetActorRotation(Tmp);*/
            /*const AActor* LockedTarget = GetAttackComponent()->GetLockedTarget();
            const FRotator NewRot = UKismetMathLibrary::FindLookAtRotation(GetActorLocation(), LockedTarget->GetActorLocation());
            SetActorRotation(NewRot, ETeleportType::None);*/
        }

        /*const AActor* LockedTarget = GetAttackComponent()->GetLockedTarget();
        const FRotator NewRot = UKismetMathLibrary::FindLookAtRotation(GetActorLocation(), LockedTarget->GetActorLocation());
        SetActorRotation(NewRot, ETeleportType::None);*/
    }
    else
    {
        LastRotationTick = FRotator(0, 0, 0);
    }
#

Am I anywhere close to getting what I am looking for?

dark edge
#

Just when locked, instead of adding yaw and pitch from input, you're setting your rotation (or you can formulate it to still add yaw and pitch) based on some function (look at rotation)

#

There's really nothing fundamentally different between locked on and not, just now you can't change whatever direction is the locked one, and instead it's updated another way

crystal crag
#

by "updated the other way" do you mean the server is updating it instead of the client?

crystal crag
#

I think the issue is I need to rotate the camera / controller. Otherwise I would have to uncheck use controller yaw and I want both the camera and the character locked to the target

#

so trying to call SetActorRotation on the character class does nothing, because it is taking the rotation from the camera / controller

dark edge
#

Just update ControlRotation using lock on mechanics instead of mouse/stick input when locked on.

atomic barn
#

Hi is there any function which one can use to get the pawn controlled by the client ?

pallid mesa
#

from the client controller you can invoke GetPawn(), it is also in Blueprints

proud galleon
#

How can I make an inventory save system on a dedicated server. For example, what should I do to delete everyone's inventory whenever I want. How exactly is it stored?

atomic barn
pallid mesa
atomic barn
#

in a widget

#

i dont know what to put in to the player index

pallid mesa
#

do you plan to have split screen? or multiple players per local viewport?

atomic barn
#

actually i want to cast to the actor that is being controlled by the client player and check it equals another actor

pallid mesa
#

I mean use GetOwningPlayerPawn

atomic barn
pallid mesa
#

what do you mean?

pallid mesa
atomic barn
#

I mean in blueprints like when u create a widget u assign β€˜get player controller’ to the player controller pin, so if I don’t do that will it automatically assign itself the client player controller

pallid mesa
#

@atomic barn It feels like the widget won't be created unless you tell which owning controller will hold it

atomic barn
chrome bay
#

The one which owns the HUD that creates the widget