#multiplayer

1 messages ยท Page 694 of 1

peak sentinel
#

I followed the same guide, works perfectly on me

plucky prawn
#

yep i have it overridden on both my UObject and my proxy actor

#

im doing DOREPLIFETIME(UJob, Title); and DOREPLIFETIME(AJobProxy, Jobs); respectively

#

i updated it to use github if you care to take a look. i included both of my classes in it too

peak sentinel
plucky prawn
#

thanks for checking it. i should be on about then

sand sedge
#

anyone? ๐Ÿ™‚ I apologise if my question is wrong formatted ๐Ÿ˜ณ

peak sentinel
fluid summit
#

Hi everybody! does anyone know why this OnRep is not triggering at all?

#

I'm adding new items to the array or using "set array elem" and the OnRep is not triggered at all

plucky prawn
#

Replication for arrays is only triggered when the array is set, not when elements are changed

#

You should be able to change an element, then set the array to itself? I think the replication code had stuff built in to make sure that the property being replicated has actually changed

fluid summit
#

that's weird, i have another array that is arrays of Structure, and if i use "Set member on ST" on one of the array items, it triggers the onRep

plucky prawn
#

Perhaps I am mistaken but I'm pretty sure I confirmed this ages ago

thin stratus
#

I can remember that being a problem and since I never have the time to confirm it again I usually set arrays with themselves ๐Ÿ˜…

#

In BPs that is

peak sentinel
#

In C++ .Add() doesnt make it replicate for arrays?

thin stratus
#

C++ OnRep and BP OnReps work differently

peak sentinel
#

Ah, curse of BP

fluid summit
#

if i do the "Set to itself" workaround, it's triggering the OnRep on server side only ._.

thin stratus
#

In BPs it's more of a "Property Changed" callback, which thus also calls for the server

#

In C++ it's actually driven by receiving new network data. Can't recall how that exactly triggers

#

Which of course sounds like both should support .Add() etc

thin stratus
fluid summit
#

yeah, the actor and the array are both set to replicate

#

i'm testing it in the most simple way and it still only calls server side

thin stratus
#

What is expedition inventory?

#

Component?

#

Is that set to replicate?

fluid summit
#

Actor

thin stratus
#

Hm okay

fluid summit
#

yeah, it's a children of the parent class "Inventory Base"

#

i'm checking for the OnRep call on the base

thin stratus
#

Not sure then atm. Non replicated is the only thing that comes to mind

fluid summit
#

no problem, i'm gonna try to find an easier way to update the UI, my previous setup was working fine but was a mess

#

and OnRep is kind of wonky : (

thin stratus
#

Other stuff, but that's a long shot, would be if you are doing reliable rpcs on tick or so

#

OnRep is usually actually fine

#

This must be something you overlook ):

#

I use OnReps constantly for state changes, even with Arrays just yesterday

fluid summit
#

yeah, it's weird because the InventoryContent has the same setup with a more complex array and it works okey, prob i miss something. Going to erase this changes and redo it from scratch

#

Also, is this the best way to do this?

fluid summit
#

Okey this was the problem.

#

The child of inventory base had Ony relevant to owner, how was that one ticked? No freaking idea

sand sedge
#

Hi again! I am using FJsonObjectConverter to serialize /deserialize structs. For some reason after deserialization my FStrings of my struct are empty. Have any ideas?

#
{
    FMatchflowStateBase state;
    FJsonObjectConverter::JsonObjectStringToUStruct(stateSerialized, &state, 0, 0);
    return state;
}```
lusty cloak
#

Can anyone advice to me about how I synchronize physics objects?. I have a fallen tree, which seemed to be synced working fine. Falls in the same place on each client. But if it gets hit. It can acts differently on each version. I tried replicates and replicates movement but that didn't work, Guessing that's just for Pawns with a movement component.

kindred widget
# lusty cloak Can anyone advice to me about how I synchronize physics objects?. I have a falle...

If you just want it nearly identical and don't mind the cost while it's moving or writing the code to optimize it when it stops moving, etc, you can visually get away with replicating it's location, rotation, angular and linear velocity and letting clients interpolate towards those values in their own ticks. It doesn't work well for fast moving things, but for a falling tree it should work fairly well.

#

I found for most things you don't really need to replicate it more than maybe 4-6 times a second. Can have some jitters on faster moving things, but ๐Ÿคทโ€โ™‚๏ธ

lusty cloak
#

Ahh okay, so that is the way it needs to be done. Thanks!!

kindred widget
#

Bear in mind that this method leaves clients always behind server. Not by much, but it shouldn't be a huge issue for something like a falling tree using physics.

tight oar
#

Is there any convenient way to test multiple clients on one machine using the Steam OSS?

bitter oriole
#

Not really

peak sentinel
#

I'm trying to implement a 'charged rifle shooting' mechanic. I update a float value (which has replication condition as COND_SkipOwner) on tick by incrementing it by deltatime. When players starts firing, it fires a RPC to server to start updating it. With 'average' network conditions difference between server and client is about 0.25f. What is the best way to make this most accurate?

I'm thinking about still making server and client update values simultaneously, but when client releases the trigger send its local value via RPC, if the gap isnt too much let server use it, otherwise use server's value.

woeful ferry
floral crow
# sand sedge Hi again! I am using FJsonObjectConverter to serialize /deserialize structs. Fo...

https://github.com/nahuelarjonadev/blueprint-json-converter I made this class to serialized and deserialize json in blueprints. Maybe you can get some ideas from it. Look at UBlueprintJsonConverter::JsonStringToStruct implementation

GitHub

UE4 BlueprintFunctionLibrary that acts as a wrapper on top of FJsonObjectConverter to expose its functionality to blueprints - GitHub - nahuelarjonadev/blueprint-json-converter: UE4 BlueprintFuncti...

floral crow
peak sentinel
#

Sanity check, does InitializeComponent() runs on authority only?

latent heart
#

I doubt it. Add a breakpoint?

peak sentinel
#

It does not stop at breakpoint, thats why I asked for a sanity check

#

Probably something else is wrong

meager fable
#

How does RepNotify gets called? AFAIK they get called only on clients when bound in c++ and on all when replicated through blueprints, but now I have a blueprint array property with rep notify and that only gets called on clients

fluid summit
winged badger
#

if you were to set array it would get called on server, too

coral wing
#

Is there a way to shutdown the session automatically?

#

Like a timeout?

winged badger
#

blueprints are generally terrible for networking, as you have less then 10% tools, and half of those are hacks

kindred widget
#

Increment Int and Increment Float nodes won't trigger a blueprint onrep for server either.

fluid summit
#

One question with OnRep on BP.
If i have an array of floats in one actor, set to replicate (both the actor and the array) and OnRep i update the UI.
Should i be passing the new array value on the methods or just get the actor reference on UI and grab the value of the array?

kindred widget
#

Really depends. Can go either way. If it's a massive array that can affect a ton of slate, definitely consider passing it along and only affecting that. I find it can lead to more accurate UI just to update the majority of it when something changes. It invalidates slate from text sets and such, but you don't necessarily need to recreate the widgets and such.

pearl yacht
#

how can i make this day night cycle work on listen server ?

vague fractal
pearl yacht
#

i dont know what is that

vague fractal
#

There's a BP node called "Switch has authority" or smth like that

#

It's also a concept you should try to understand before doing things

pearl yacht
#

im stupid

vague fractal
#

Felt the same at the start (and i still do)

pearl yacht
vague fractal
#

Is the actor which owns this light replicated and also the light itself ?

fluid summit
vague fractal
#

Was about to recommend that too

fluid summit
#

cedric would recommend it too, probably : P

pearl yacht
#

thx man

shadow aurora
#

So what are my options here? I am trying to teleport a character/pawn to a location, and THEN possess them in a server-side function. However, despite the fact that the possess is called after the setransform call, the transform change doesn't seem to rep to the owning client till after the possess.

sand sedge
#

Don't know what is wrong ๐Ÿ˜ฆ

lost inlet
#

what does your JSON payload look like

#

though it might be expecting your struct members to use the UE4 naming conventions and I'm not sure if that's case sensitive

sand sedge
#

L"{\r\n\t"childName": "New Name!",\r\n\t"parentName": "Please Work!",\r\n\t"inMatchTime": 20\r\n}"

sand sedge
pearl yacht
pearl yacht
#

Can is somehow replicate directional light ?

#

i dont see that option

hexed thunder
#

Any experience with voip attenuation not working even when setting it correctly by setting the voip variable after create talk player, the attenuation itself works properly but it seems when players use it there is no attenuation?

scenic ginkgo
#

When I start a local server and have multiple instances connect to it, the player character is duplicated but only for the person who joined. This is on the third person project, how can I not have their characters duplicate whenever I connect another window to it

sand sedge
#

How this is possible?

#

okay. It works further in code. Just strange debugging issue

#

Thanks all for help

sinful marlin
#

If I want to change the mesh property of a StaticMeshComponent on a StaticMeshActor, and have it update on clients to match, is there something I'm missing other than marking the SMA to replicate? (via bReplicates = true in constructor of the SMA)

obsidian cargo
gleaming kite
#

what's the solution for dealing with attached actors falling out of network cull range and just never updating on the clients again? In my case, i have a car that i can drive, once i get out, my old body is teleported to the get out location but the attached actor is super far away so it never gets shown. I guess I could teleport all attached actors to my player but i feel like theres a better solution

sinful marlin
#

All though the mesh is in a completely different location on the client now

obsidian cargo
#

I'm checking what the bool is called, but there is different bool for replicating location on static meshes

sinful marlin
#

is it Replicate Movement?

obsidian cargo
#

bStaticMeshReplicateMovement

sinful marlin
#

Yeah I got that checked.

obsidian cargo
#

Hmm.. I can't see where I found that before

#

I'm looking in the code btw

#

I'm making a custom StaticMesh, so I was aware of the replication oddities.

obsidian cargo
#

Oh wait, it looks like that was on the StaticMeshActor

#

As in handled on a per instance basis

#

I might be incorrect though

#

I haven't actually experimented on it yet, just reading code

sinful marlin
#

So, when I check Component Replicates to true on the SMC of my SMA, the mesh updates properly but the location is being set to some seemingly random value on the client

#

When I leave it unchecked/false, it's in the right spot on the client

#

๐Ÿค”

obsidian cargo
#
    /** This static mesh should replicate movement. Automatically sets the RemoteRole and bReplicateMovement flags. Meant to be edited on placed actors (those other two properties are not) */
    UPROPERTY(Category=Actor, EditAnywhere, AdvancedDisplay)
    bool bStaticMeshReplicateMovement;```
#

This is on the StaticMeshActor

#

The comment makes it sound like you need to change that variable on the ACTOR

#

In addition to marking the component as replicated

sinful marlin
#

hmm. I have that true on the SMA.

obsidian cargo
#

That is odd

sinful marlin
#

Oh yeah, obligatory working on UE5 warning

obsidian cargo
#

Sorry I can't be much more help right now

sinful marlin
#

shoulda prefaced my question with that lol

obsidian cargo
#

I'll be working more directly with this myself over the next couple days

sinful marlin
#

I appreciate the help none the less

obsidian cargo
#

So I'll have more insight later

#

I'm assuming you set the actor to also replicate

sinful marlin
#

Correct

#

I think this is a non-multiplayer issue at this point because the vector it's being offset by is not random

#

by that doesn't make sense as to why it isn't matching up with the server

obsidian cargo
#

Good luck tracking it down

#

Those types of oddities are always the worst to find

sinful marlin
#

Left window is Listen-server, right window is client. Right hand weapon seems to work correctly, left hand is not. Both are spawned from the same class.

sinful marlin
#

Aha. It was the FAttachmentTransformRules being passed into the attachment that was causing the client only offset. How it was causing it to be offset only on the client, idk. Why I had different attachment rules for left and right hand weapons, idk.

stable hinge
#

Just starting out with unreal programming (have a background with c++) but if I wanted to have a multiplayer spaceship game is it better to replicate the properties for the players position or handle the users input via RPCs?

peak sentinel
#

TL;DR you need to use replicated movement, look for FRepMovement struct in AActor

#

Also PostNetReceiveLocationAndRotation() and OnRep_ReplicatedMovement()

stable hinge
neon ether
#

Test

#

Sorry was not letting me send a message and was testing a shorter message

#

So i've been working through tutorials and reading documentation to help implement better and more reliable multiplayer in the two player first person shooter im working on. I've hit a snag in the tutorial document i've been reading though and though it would be easiest to find the anser here. Its to do with the players healths. The general flow is when a player takes damage their "PlayerTakeDamage" is called which calls the "SetCurrentPlayerHealth" which in turns runs the following: ```c++
void UInventoryComponent::SetCurrentPlayerHealth(float NewHealth)
{
if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority)
{
CurrentPlayerHealth = NewHealth;
OnHealthUpdate();
}
}

The OnHealthUpdate() looks like this:
void UInventoryComponent::OnHealthUpdate()
{
//Client-specific functionality
if (GetOwner()->GetInstigator()->IsLocallyControlled())
{
FString healthMessage = FString::Printf(TEXT("You now have %f health remaining."),
CurrentPlayerHealth);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);

    if (CurrentPlayerHealth <= 0)
    {
        FString deathMessage = FString::Printf(TEXT("You have been killed."));
        GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, deathMessage);
    }
}
//Server-specific functionality
if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority)
{
    FString healthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetOwner()- 
              >GetInstigator()->GetFName().ToString(), CurrentPlayerHealth);
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);
}

} I've also made sure that the CurrentHealth has the UPROPERTY ofc++
UPROPERTY(ReplicatedUsing=OnRep_CurrentHealth,EditAnywhere,BlueprintReadWrite,Category= "Inventory | Player Settings")
float CurrentPlayerHealth;```

#

And the OnRep_CurrentHealth just calls the OnHealthUpdate function.

#

The idea behind this is that when the take damage is called it SetsCurrentHealth on the server which also and since the change happens on the server and health is replicated the client also gets that change and calls OnRep_CurrentHealth

#

However the issue im having here is when the client shoots the server it never makes it into the SetCurrentPlayerHealth's if check, but when the server hits the client is does seem to correctly function. If anything stands out to anyone I would be appreciative of some feedback

tawny nova
#

I think it's something like.. if you just set the boolean on the server, it won't get replicated automatically

#

so you'll have to manually make sure it also gets pushed to the clients

#

i'm not particularly good at this though

neon ether
#

From what i was reading when you have a variable set with that Replicated="function name" in its UPROPERTY that means when the server changes that value its gets replicated to all connected clients' copies of that instance. I didnt specify having to any manual work for getting the server to push the updated value to the clients. But im also new at this

cobalt pawn
#

guys i am making a ball game but when we i host a game and other players join, everyone has their separate instances of the ball and they can't see each others balls so that fails the purpose. Here's what my replication section looks like.

#

how can I fix this?

tawny nova
#

so what you pasted, i believe, is the replication section for just a single class ?

#

you probably, no offense, want to work through some kind of tutorial

#

you're going to have to make that section work for everything in your game

#

not just the one class you're looking at now

cobalt pawn
#

thanks for the info

cobalt pawn
neon ether
#

#multiplayer message

The message got pushed up a bit, but if anyone has any insight I seem to just be going in circles without much avail. Everything in the documentation I'm going through says this should indeed be working...

#

It might also be worth noting that the class type im working in is derived from a UObject which is a UActorComponent. Thats why im doing that c++ GetOwner()->GetInstigator() That just gives me a reference to the player owning the inventory component

neon ether
#

Just for extra info I've got it working correctly for when the server shoots the client. The issue im finding is that when the client shoots the server and this code is ran: c++ void UInventoryComponent::SetCurrentPlayerHealth(float NewHealth) { if (GetOwner()->GetInstigator()->GetLocalRole() == ROLE_Authority) { CurrentPlayerHealth = NewHealth; OnHealthUpdate(); } }
Which is supposed to update the health on the server , doesnt get ran at all. The GetLocalRole() when this code gets ran from hitting the server returns ROLE_SimulatedProxy. Can anyone elaborate on this conundrum?

sinful tree
#

Sounds like you might be running SetCurrentPlayerHealth on the attacking client rather than on the server?

#

ie. not RPCing the attack to the server so the server can handle what it needs to

neon ether
#

as someone who is still trying to grasp the concept of networking in unreal could you elaborate on that so I can better tell if I'm indeed doing what your hypothesizing?

#

I know what RPC's are and everything just what exactly you mean by the situation your describing

sinful tree
#

What I'm thinking you might be doing is along the lines of:
Client Presses Attack Button > No RPC is done > Whatever functions you are calling to determine damage are all being run on the client rather than on the server.

Where it should probably be:
Client Presses Attack Button > RPC to Server > Whatever functions you are calling to determine damage are being run on the server.

neon ether
#

So when a player fires a projectile what is ultimately happening is this function gets called: c++ UFUNCTION(reliable, server, WithValidation) virtual void ServerFireProjectile(FVector Location, FTransform CollisionTransform,FVector Direction) override; which spawns a projectile on the server. Then when the player registers being hit by the projectile (which both players do) the 'damage' code which is described above gets ran

#

I am checking what player is getting hit and what player is getting referenced by the GetOwner()->GetInstegator() and the players all seem to be correct when it comes to player 1 and 2

tawny nova
#

i really do think you need to change something from Replicated to RepNotify

neon ether
#

and everything works fine when the server player hits the client player. The health variable gets replicated correctly and the OnRep function gets called all as expected. Its just when the client player hits the server player that if check in the SetHealth() doesnt do what id expect

neon ether
tawny nova
#

anyhow you have to narrow it down somehow

#

but yeah my thought was, it works on the server but not the client because the client is not actively reading the variable but waiting for it to change

#

i don't know, your issue keeps ringing this vague bell

#

like the check is failing because the variable it's reading is not synced

sinful tree
tawny nova
#

I will say also.. please don't hate me.. I have literally been removing code to sync multiplayer health tonight from my project, because I realized that I should probably be using 'PlayerState' and not implementing my own version of it

neon ether
#

Because that would mean it thinks the client is the server correct?

sinful tree
#

I believe that means the SetCurrentPlayerHealth is being called on the client.

#

Which actually could happen - if your collision on your projectile is triggering the call on both the server and the client(s).

neon ether
#

Since the projectile is spawned on the server could that situation you're describing be happening?

sinful tree
#

The projectile is marked to replicate no? So clients can see it?

neon ether
#

The projectile is indeed replicated

#

Currently having trouble with other players being able to see the vfx when it's spawned on the server but yes the projectile itself works as intended

#

What I think I'm not getting is if it was indeed getting ran on both client and server, would the prints not indicate that by double printing mismatched information? The information it prints in regaurd to what was taking the damage is correct

sinful tree
#

Ok, so when you spawn a replicated actor and it is relevant (I imagine it would be in this scenario) then a copy of it would exist on the server and any clients that see it as relevant.

Question: When you say you are doing prints, do you see Client1: or Server: being displayed?

neon ether
#

For example server is Player1 and the GetOwner()->GetInstegator() in the method prints the Player1_C

#

The prints are being done in c++ so it doesn't print that info along with it. Unless there is a way to do that like it does automatically in blueprints?

sinful tree
#

Dang

#

Yes I agree, you would probably see two prints if it was running on both. Since it appears that you're getting ROLE_SimulatedProxy for the Role and ROLE_Authority for RemoteRole, that's heavily indicating that it is being called on the client only.

neon ether
#

Okay so I'm peering through the OnOverlap im using for the projectile and one thing does stand out to me (NOTE: i did not write most of this code as I recently got pushed onto fixing most of our games networking issues). The overlap looks like this: ```c++
if (!HasAuthority()) // if we arent the server then dont continue
return;
if (!OwningPlayer) // make sure we have our owning player set
{
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Yellow, FString("Projectile Owning Player not set!"));
return;
}
if (OtherActor->Tags.Contains("Player") && OtherActor->GetName() == OwningPlayer->GetName())
{
return; // we are hitting ourselves when the projectile spawns
}
if (!OtherActor->Tags.Contains("Player") && !OtherActor->Tags.Contains("Environment") && !OtherActor->Tags.Contains("Enemy") )
{
return; // were overlapping with something we dont care about
}

//if overlap with environment
if(OtherActor->Tags.Contains("Environment"))
{
    GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString("Hit Non-Enemy"));
    Destroy();
}```
#

The thing that stands out to me is that authority check at the top

#

But the projectile does hit the appropriate player as would be expected so im not sure if that would really cause any issues

sinful tree
#

!HasAuthority() should mean ignore everyone who doesn't have authority, which is what you would want for an overlap of a projectile.

#

Buuuut.. that could also be worded poorly depending on what you want done... Like... You want to have authority to do the overlap checks.

#

So if HasAuthority returns true, and you're notting it, then it would be false.

#

which in this case looks like it would proceed (if I'm reading it right lol)

neon ether
#

Yes you are indeed reading it correctly, as long as i am also reading it corretly lol. Other than that everything else is pretty trivial then, just check to make sure what we hit is a player and taking that hit actor and dealing damage to them which trickles into the taking damage code above. Nothing to indicate that if the server is hit then call the function on the client

#

I would also like to say thank you for all the help and info you've provided so far! It's been a huge help (even if it isnt fixed yet lol), and with the deadline thats been put on me with little time to try and learn how unreal does it's networking and change a heap of non-networked code into networked code this has been great so far

sinful tree
#

Somewhere in that overlap check there is the call to SetCurrentPlayerHealth? Like there's no other RPCs in there anywhere?

golden warren
#

Hey, Can I get "Is Character owned by client itself" ?
"Is Locally Controlled" not worked for me

neon ether
#

There are none otheres, it calls deal damage to player which is in the player and that function in the player calls the inventory components which calls to the SetCurrentPLayerHealth

sinful tree
#

So client presses key > maybe a few client side checks to make sure they can shoot > ServerFireProjectile()

peak sentinel
#

What are the common reasons OnRep function is not firing for clients in C++?

neon ether
peak sentinel
sinful tree
peak sentinel
#

Well it only needs to be changed in server

#

So client will detect the change locally and call onrep

neon ether
peak sentinel
#

Yep it replicates

#

Value is synced and RPCs firing perfectly, somehow just OnRep is not getting called ๐Ÿค”

neon ether
#

The class is overriding this function i assume as well: ```c++
void UInventoryComponent::GetLifetimeReplicatedProps(TArray <FLifetimeProperty> & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);

//Replicate current health.
DOREPLIFETIME(UInventoryComponent, CurrentPlayerHealth);

}```

peak sentinel
#

Yep

neon ether
#

Welp i new to all this and still learning so thats about all i got lol

peak sentinel
#

Np, thanks for the effort anyway

sinful tree
neon ether
#

OH! Well that actually makes sense I think, so your saying something like this? if (GetOwner()->GetInstigator()->HasAuthority()) {...}

#

You might also mean just HasAuthority() by itself, but in that case since this derives from a UObject it doesnt have that method to call

sinful tree
#

No, you don't need to care about the owner at all - you just want to make sure you're running on the server.

#

So even IsServer() if that exists on a Uobject

neon ether
#

UObject doesnt seem to have access to either IsServer() or HasAuthority()

sinful tree
#

๐Ÿค”

neon ether
#

Trying to look up how to check if running on server while in a UObject

sinful tree
#

GetWorld()->IsServer()

neon ether
#

Ahh well that is indeed avaliable. Is that the same thing as the others or is that just a huntch?

#

Hmmmmmmmm...bad news...that didnt change anything. I'll trying printing that out to make sure it is indeed false. I guess a good question to ask would be why that SHOULD work? Is that because the projectile should only be running on the server?

#

and therefor when it hits the player that logic is continued to be handled on the server?

sinful tree
#

I really am a goof... That was a eureka moment that shouldn't have happened. An attached component will return the appropriate authority on the server:

LogBlueprintUserMessages: [BP_ActualCharacter_C_0] Server: BP_ActualCharacter
LogBlueprintUserMessages: [BP_ActualCharacter_C_0] Server: ROLE Authority
neon ether
#

Ahh okay i see

sinful tree
#

You're not attaching the component at runtime are you? ๐Ÿ™ƒ

neon ether
#

Just found some interesting info. I went ahead and in the projectiles Tick i printed out: ```c++
GEngine->AddOnScreenDebugMessage(-1, 0.01f, FColor::Blue, FString::SanitizeFloat(HasAuthority()));

#

By that you mean in the characters constructor creating the default sub object and doing it that way?

sinful tree
#

Constructor should be fine.

#

Just again, narrowing down places where things could be getting done on the client that could possibly cause this kind of issue.

neon ether
#

Okay, good. Can confirm that thats where the Inventory gets created and added to the player

sinful tree
#

client fired it only printed 1 as expected. But when the server fired it printed both 1 and 0.
this is concerning.

neon ether
#

Yes, yes indeed. That means when fired from the server its putting a projectile on the client and server correct?

sinful tree
#

When a replicated projectile exists, it should exist on both client and server. Has Authority == 0 on the client's copy. Has Authority == 1 on the server's copy.
If you only see 1 being printed when the client fires, that tells me the client is firing the projectile directly as the client would have authority of a projectile spawned on the client, and since it was spawned on the client, you wouldn't see two numbers being printed.

#

ALTERNATIVELY...

#

If the projectile isn't replicated, in which case the server could still be spawning it, and the client doesn't get it at all, so then your Has Authority == 1 would display, but seeing as you are getting two numbers when you know the server is spawning the projectile, this seems unlikely to be the case.

winged badger
#

@neon ether its imporant to take grom Datura's explanation that HasAuthority and IsServer are not the same

twin juniper
#

If I wanted to play a montage on all clients ASAP, Should I play it locally then ask the server to replicate it to other clients, or should I just ask the server, and play it locally when it multicasts back from the server?

neon ether
# sinful tree When a replicated projectile exists, it should exist on both client and server. ...

Sorry for the late response, im sure your asleep by now assuming were in similar time zones. Though I will leave my response to you comment here in case you still end up seeing this at some point

So the way I'm spawning my projectile is when the player reads a fire input the inventories "StartModFire()" is ran from the player's blueprint. That method first checks to see if "GetOwner()->GetInstigator())->GetLocalRole() < ROLE_Authority". If it is then it runs "ServerStartModFire()" which is of course a reliable server method whos implementation just calls StartModFire() again. StartModFire() then proceeds on with FireActiveMod(). This to me from what I understand just ensuring that no matter who fires, client or server, that it will always also happen on the server. FireActiveMod() calls the Mod's Fire() if and only if "GetOwner()->GetInstigator() && GetOwner()->GetInstigator()->IsLocallyControlled()" essentially saying proceed if we're on the local machine from what i understand. Then from the Mod's Fire() that calls the ServerFireProjectile() which is also a reliable server funcion. Which is supposed to put the projectile on the server which in tern also on the clients as well. I dont know how it would be possible for the server function to only spawn something on the client side.

#

Okay so i think my issue is with that FireActiveMod check for c++ if (GetOwner()->GetInstigator()->IsLocallyControlled()) { DefaultMod->FireActiveMod(CameraComponent,MuzzleLocation); } If i remove that if check entirely then nothing changes with reguards to the server but for some reason as to which im not entirely sure on, the client now fires two projectiles on the server and one on the client instead of just one on the client and nothing else. Although even with this extra server projectile the client still only damages the client one time. So it works but its not perfect

odd iron
#

Hello Guys .. If i have a big space and i want to seperate each planet on different instance or different server is that possible with ue4 ?

rain sandal
#

that would be a response for your avatar, a more sensible response would require more specific details about how you plan to implement interplanetary traversal mechanics

latent heart
#

@odd iron you can use servertravel to do something like that I think?

rain sandal
#

yes, if you want to see a planet in distance have some kind of load mechanism and wait for the actual load to travel there, servertravel would be sufficent

latent heart
#

Similar to how EVE handle star systems. Each one has its own virtual server or osme such

rain sandal
#

then when you pop in what about the ships in the area

#

will you replicate copies to nearby servers? ๐Ÿฟ

odd iron
#

Good i saw this method in a game called Atlas when you travel from island to another one you will have to connect another server automatically

#

Thats why im thinking to start implement that when i start building the game

rain sandal
#

I hope you don't want to engage in interactions across these servers

#

then

odd iron
rain sandal
#

possibly

odd iron
#

Cool then its seems easy littlebit

odd iron
latent heart
#

That's basically how a lot of games work, even like world of warcraft at zone transitions

rain sandal
#

you typically get around it by portalling where you can't see what's on the other side, that's not really easy to hide in space

latent heart
#

If the distances are large enough, it won't matter. Just ENGAGE WARP DRIVE to jump to a new server

odd iron
rain sandal
#

you will have harsh transitions, best option design a warp mechanic or something

odd iron
rain sandal
#

like warp to sector can work well

odd iron
#

I will put that in plan

#

But if i made the game witb ue5 world partition isnt that better for one server ?

rain sandal
#

that's also not a simple answer

#

probably not

odd iron
#

Good

#

Then multiple instances best answer

rain sandal
#

but tbh I don't think it hurts just using it anyway, in case you do need it

odd iron
#

Well its cheaper than multiple instance

#

xD

rain sandal
#

partitions are not instances

odd iron
#

Yes i meant paritions much cheaper than multiple servers for each planet

rain sandal
#

ohh

odd iron
#

Server**

rain sandal
#

you need to design and test each server

odd iron
#

Yes

#

Have to start digging

rain sandal
#

iz nice ๐Ÿ‘

#

I make big multiplayer for glory of Kazakh people

odd iron
plucky prawn
#

Hey @chrome bay any chance you feel like helping me out with this? I've followed your article and linked a gist containing my UObject and actor proxy but nothing is being "written" in ReplicateSubobject

chrome bay
#

Looks fine to me. When you create the Job it's "outer" is the actor too right?

winged badger
#

actor is replicated and Jobs are SupportedForNetworking?

winged badger
#

and also whats your test scenario? what did you do to conclude they are not replicating?

golden warren
#

Hey, How can I get whether the character is mine or not?

waxen socket
#

I've come with my own question.

I understand that before BeginPlay is dispatched by the world, the game mode and the game state are guaranteed to exist since together they initiate BeginPlay. I also have read that before GameMode will tell GameState to dispatch BeginPlay, it needs to have the controller class? So that means that by the time PlayerController's BeginPlay fires, it's guaranteed that the game mode, game state, and player controller exist.

My question is, what about controllers beyond ID 0? Will GameMode wait until all travelling/connected clients' controllers exist before telling GameState to fire BeginPlay?

Any advice would be appreciated.

Cheers.

tawny nova
#

i would sort of guess that it doesn't.. they have to handle players connecting mid-game, right?

#

I'm curious also though, I don't know for sure

twin juniper
#

Why am I getting error messages when trying to do 'get player controller' on multiplayer? I only want this logic to execute on client, I thought 'get player controller (index 0)' just defaulted to giving you the PC of the client (which is what I want)?

waxen socket
#

Are you calling it before the player controller might exist?

twin juniper
#

Definitely possible, when I use 'isvalid' it removes the error but also calls the logic afterwards which I don't understand, wouldn't 'isvalid' just prevent the execution? Or does it queue until valid or something (in level blueprint on begin play)

waxen socket
#

IsValid doesn't create a queue. It either succeeds or fails.

twin juniper
#

Weird that the isvalid node then gets rid of the error

#

Also the error was displaying while the logic was executing

#

Maybe it just delays execution for a fraction of a second needed for the PC to be created?

waxen socket
#

It's funny that it's similar to my question above about begin play order. I hope Jambax or Zlo or someone who knows all chimes in to clear it up for us.

twin juniper
#

It's working fine now but wouldn't trust it in a finished product XD

#

But even before 'isvalid' node was added, logic was all executing, just a red error message after I closed the game (which is bad if you want to package)

waxen socket
#

Yeah, I can't explain that.

golden warren
#

Hey, How to not replicate event even it is run on server?

#

"Changing camera with changing weapon attach location" Event cause this issue only on listen server
Dedicated server won't cause this because all players are client

tawny nova
#

you could probably add a check for the authority level and only run it if it's a client

golden warren
#

I just don't want to replicate this weapon's location when it's on FPS mesh

pearl yacht
sinful tree
twin juniper
#

Ignoring the rest of the logic for now, why is the print string only displaying on server?

sinful tree
# twin juniper Why am I getting error messages when trying to do 'get player controller' on mul...

The reason you're getting an error message is that the Begin play fires on both the client and server copies of the actor you're looking at, and I'm guessing you're doing "Play as Client" which means it's a dedicated server, and dedicated servers cannot have widgets created for them. Your best bet here is to use a HasAuthority node and only do the widget creation on the "Remote" node only.

The standard Get Player Character / Controller nodes are also not very good to use in multiplayer and should be avoided. There's usually other ways one can get the controller or the character depending on where you're calling values. For example, if this code is on the character, you can usually do a GetController node instead which is different as you're then asking for who is in control of this particular character rather than asking for a specific controller. Something to keep in mind though is that controllers only ever exist on the owning client and the server - you cannot get other player controllers while running code on the client.

Lastly, if the code you've posted is on the player character then you'd not only need to do a HasAuthority node, but also check if it is Locally Controlled - if true, then you would want to add your UI. If you don't do this, any time a character begins play, additional UI would be created overtop of the existing UI for every single player that joins the game, or becomes relevant again.

twin juniper
#

yes

sinful tree
#

Widgets aren't replicated.

waxen socket
#

It would be a great relief to me if I could count on GameState[Base] existing when PlayerController calls BeginPlay.

twin juniper
sinful tree
sinful tree
tawny nova
waxen socket
#

I think it must as GameMode tells GameState to dispatch BeginPlay to all actors. But I donโ€™t know for sure.

twin juniper
#

The actor is a non replicated widget

sinful tree
waxen socket
sinful tree
#

In my basic testing, it doesn't look like it is a problem. On the Begin Play of the client's player controller I can cast to the game state and run a function and I don't get a fail on the cast. Try doing what you're trying to do with the gamestate, and if you're starting to get unintended behavior from whatever you were doing on the gamestate, then you at least know where the culprit may be.

waxen socket
#

Thanks for testing that, Datura. Iโ€™ve just read so much about BeginPlays firing in different orders on the server, on the client, in the editor, in the build, and etc. that it has me scared.

tawny nova
#

this event runs when a player overlaps a server owned actor - how can I get it to run only on the overlapping character's machine?

sinful tree
#

The playerstate I know suffers from a problem in that the actual copy of it doesn't exist on the client on the beginplay of PlayerState. The only way around this particular issue was to override the OnRep of playerstate so that it calls a function so that I know that I have the appropriate playerstate.

tawny nova
#

can I somehow check the index of the pawn input or

sinful tree
thorny fog
#

has anyone tried advanced sessions recently?
we had a playtest a few weeks ago and everything worked having 10k in sessions find and now doesn't ๐Ÿ˜ฆ
even with a few millions

tawny nova
#

the authority check is meaningless because it returns the same for all players

sinful tree
#

It's to ensure that it's not running on the server.

tawny nova
#

same... locally controlled does not help, the actor is controlled by the server

sinful tree
#

You want to check if the character is locally controlled.

tawny nova
#

oh i see

verbal tendon
#

Since your problem lies with the replication of the actor, and not some authority check in blueprint logic

winged badger
tawny nova
#

no.. it spawns in the game world above an actor, but thank you

winged badger
#

point being

#

PC should not control the widgets

#

directly

tawny nova
#

thank you for the unsolicited advice

winged badger
#

it has plenty of responsibilities, that is not one of them ๐Ÿ™‚

modern cipher
#

my uobject replicates but doesn't call rpcs ๐Ÿฅฒ

#

it does even show warnings

winged badger
#

UObject that is not Actor or ActorComponent?

modern cipher
#

outer is playercontroller

winged badger
#

yeah, but it needs extra c++

#

GetRemoteFunctionCallspace and something else overriden

modern cipher
#

it is in c++

winged badger
#

in order to be able to RPC

#
    virtual bool CallRemoteFunction(UFunction* Function, void* Parameters, struct FOutParmRec* OutParams, FFrame* Stack) override;
    virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;```
#

those 2

modern cipher
#

i did ill share code hold on

winged badger
#

they did add some complexity to that function, multiple net drivers

verbal tendon
winged badger
#

you did not call Super in GetLifetimeReplicatedProps, btw

lost inlet
#

though why didn't you just use an actor component that has all of that setup already?

modern cipher
tawny nova
#

hi please STOP PINGING ME

#

I had a really specific question, thank you

#

jesus christ this discord

lost inlet
#

UMyObject in that pastebin does really seem like it's reinventing the actor component

modern cipher
tawny nova
#

I'm sorry that I am not going to rewrite a fucking tutorial because "Zlo" objects

lost inlet
#

what with this ego?

winged badger
#

i borrowed the code from ActorComponent around 4.12 or so

#

for similar purpose

#
bool USolsticeBuffBase::CallRemoteFunction(UFunction* Function, void* Parameters, struct FOutParmRec* OutParams, FFrame* Stack)
{
    AActor* MyOwner = GetActorOwner();
    if (MyOwner)
    {
        UNetDriver* NetDriver = MyOwner->GetNetDriver();
        if (NetDriver)
        {
            NetDriver->ProcessRemoteFunction(MyOwner, Function, Parameters, OutParams, Stack, this);
            return true;
        }
    }
    return false;
}```
#

looked like that back then

#

and it worked just fine

lost inlet
#

since if all you're doing is just doing everything UActorComponent implements for networking anyway

tawny nova
#

@winged badger or @verbal tendon if all you do is tell people what to do, without even attempting to explain why it doesn't help

#

it just gives you an ego boost

winged badger
#

i could had explained you the whole separation of concens

winged badger
#

you did not seem interested to hear it

tawny nova
#

if you really, really have to jump in, an hour later, just to tell me to arbitrarily change code?

winged badger
#

so why would i bother writing half a page

tawny nova
#

start with the fucking knowledge part bro

#

i know, why bother teaching, when you can just preach

lost inlet
#

who shat in your corn flakes this morning

tawny nova
#

way more fun for you

#

scrollllll up

kindred widget
#

Can't tell if you're angry at Zlo or if you're just having a really shitty life. Gonna assume life, cause this is like the third time I've seen you losing your shit on someone in here. ๐Ÿ˜„

lost inlet
#

yeah and I didn't see anything that bad

kindred widget
lusty sky
#

lol you signed up for this

kindred widget
lusty sky
#

old epic tutorials used game mode for ui?

winged badger
#

TL;DR; UI gets replaced 10 times during typical game development - doing anything that requires you to modify the game code in order to modify or completely replace the UI will bite you in the arse

tawny nova
#

tldr, I DIDN'T ASK ABOUT UI

lost inlet
tawny nova
#

you just all really need to lecture me about it

lost inlet
#

you can set the AHUD class from game mode, but that's just sent to clients as an RPC

kindred widget
#

Pretty sure CreateLootableWidgetWidget creates a Widget doesn't it? Pretty sure widgets are used for UI.

tawny nova
#

try reading the question bro

#

it's the part you replied to, i can see it without even scrolling up

#

someone answered it

#

you guys are just getting off on the lecturing or something

meager spade
#

@tawny nova please be respectful to people who are helping, we are volunteers here, and help because we want to help.

modern cipher
#

dont get banned over ahud man

lusty sky
#

XD

tawny nova
meager spade
#

That is fine to do, just sometimes its best not to say anything sometimes, and ignore/block.

undone plinth
#

If I call a Client RPC in the controller beginplay should that be okay? Because it's not being called on the client?

lusty sky
#

should be okay

kindred widget
undone plinth
#

I

#

This is it

modern cipher
#

from client side it will always run on invoking client

undone plinth
#

it just never gets called ๐Ÿ˜ฆ

lusty sky
#

i think you can follow a player locally without rpcs

kindred widget
#

I love it when people act like dicks in public. Get called out on it, and then PM me in private to call me shitty and then block me. ๐Ÿคทโ€โ™‚๏ธ

modern cipher
#

let the mods know he'll get banned

verbal tendon
#

Well this is awkard, I literally just got back to check if any further elaboration was needed, which I have time now and would be very happy to do. And then I read chat history ๐Ÿ™ˆ

kindred widget
# undone plinth This is it

This looks like you're spawning something and then calling the RPC? Chances are the thing you spawned and sent as a pointer isn't valid yet on that client. The RPC would reach the client long before the replication will in most cases.

undone plinth
#

That's fine however I'm trying to just print in that function

#

The print doesn't come through.

kindred widget
#

What sets your IsServer?

undone plinth
#

Nothing its just GIsServer

kindred widget
#

I would consider a HasAuthority or GetNetMode() != NM_Client

sinful tree
tawny nova
#

i sent him a screenshot of someone who privately dm'd me to say thank you for sticking up to a bully

#

lol

kindred widget
#

A screenshot that wasn't even related to today's conversation. It was a screenshot about some other conversation involving Zomg.

lusty sky
#

bro pls stop this xd

modern cipher
#

they should add beef channel for sure

uncut schooner
#

Hey guys

#

Does anyone know how to calculate RTT

kindred widget
#

As in ping, or more advanced?

uncut schooner
#

Ping yes

#

Could it get more advanced

plucky prawn
plucky prawn
kindred widget
# uncut schooner Ping yes

I know that PlayerState has a ping value. It's compressed, I don't remember the exact compression though. Memory offhand says multiply that by 4?

#

Yeah, here.

lost inlet
#

I think you can get a more accurate ping for the local connection

leaden scaffold
#

Ping isnโ€™t delivered on some platforms FYI

lost inlet
#

if that's what you're after instead

uncut schooner
#

As accurate as possible

#

And how does one get the client timestamp?
Is that a thing?

#

I usually use bp, but have started to use c++

lost inlet
#

what is the problem you're trying to solve, let's start with that

uncut schooner
#

Server rewind

lost inlet
#

for lag compensation? because we tried that and just went for CSHD instead

uncut schooner
#

How would I go about doing that

#

Just register hits locally and do some server checks?

lost inlet
#

yes, and our server checks are relatively strict because it does steal one lag compensation concept

#

there's a buffer of historical positions and it compares them based on a server timestamp (which gamestate does provide, but with an increased update frequency)

uncut schooner
#

Ah I was trying to do that exact thing

#

I mean recording locations on the server and checking againsed that

kindred widget
uncut schooner
#

So should I go and check the game state

#

This is something I setup in like 30 mins so its a bit simple atm

#

@lost inlet the server timestamp, is it this:

lost inlet
#

oh damn, you're doing this in BP

uncut schooner
#

I can switch over to C++, I don't mind

#

I was just doing some testing in BP

lost inlet
#

we changed ServerWorldTimeSecondsUpdateFrequency to be more frequent on the GS too

#

but if the client sends their server timestamp, then the server will know roughly how far behind they were when they shot their weapon

leaden scaffold
lost inlet
#

I've never seen the ping property in PS ever not work

lost inlet
#

well steam session results are different to the playerstate property

leaden scaffold
#

It doesnโ€™t work on iOS

lost inlet
#

it's not platform specific, what you've linked is session results, which is OSS stuff

leaden scaffold
#

Itโ€™s transport specific

lost inlet
#

well it works on consoles at least, and PC

#

and nothing I saw about the in-game ping value was platform specific

uncut schooner
#

I have just gotten back to doing multiplayer, thanks for the reminder

fluid summit
#

Hi everybody! can anyone think of a reason as to why this RPC (on server) could not trigger? (even if the inventory ref is valid) ?

#

i'm having a trouble where that RPC triggers okey with one child type of inventory but not with other child (none of them change the rpc in any way and are set to replicate)

verbal tendon
#

If it works for one item in your inventory but not others, it might be that not all the items have replicated to the client fully and that's why you're getting hit & misses

fluid summit
#

Yeah, let me add some pictures and explain a bit more, i wanted to keep is as simple as posible

#

I have this 3 inventory class (First one is base, the other 2 are childs)

#

This RPC is on the base class, the childs don't override it

#

I'm having one case where this call from a widget is not even triggering the RPC even when the Inventory Ref is valid

#

it pass the valid get, is triggers "VALID" but it doesn't trigger the RPC

#

the ref is valid, is replicating and i can target that same inventory from my player controller and the RPC triggers okey

#

it just doesn't trigger when i do it from the UI(even if the ref is the same)

#

or even if i get the same inventory that the ref is pointing from other way

verbal tendon
#

So I assume the Widget is pressed on client, just because the Ref is valid on client, doesn't mean it exists on the server

verbal tendon
fluid summit
#

That ref on the UI is a variable (replicated) on some other actor

#

if i do actor --> inventory -> RPC is triggers okey

verbal tendon
#

The two most common ways of Client->Server RPC failing is
(1) the client actor not existing on the server that the RPC is being called on / same thing for one of its params
(2) the client actor not being client owned

fluid summit
#

if i do UI --> Inventory Ref -> RPC not even triggers

#

hmm

#

any way to actually check if it's on the server?

verbal tendon
#

if the item lifetime is controlled from the server ( spawned on server ) then it will exist unless you're also destroying it and the client has it when it's alrady destroyed on the server

fluid summit
#

it's not that the item is not being destroyed, the RPC won't call at all

#

the item is just text on the InventoryRef

#

This is how the inventory Ref that is failing (when called from UI) is created

#

it's probably something really really stupid that i'm missing, but i can't find it after a few hours.

verbal tendon
#

Sorry really gotta go, make sure you're not running into a case of (1) trying to execute an RPC on the client on an actor that's not client owned

#

you're spawning this in some class in the server

fluid summit
#

no problem, thanks for the help

sinful tree
fluid summit
#

This other actor

#

and that actor is created on the Player Controller

sinful tree
#

Ok, this part appears to be in a widget. If that's the case, the Inventory Ref here shouldn't be marked as a replicated variable as widgets don't replicate. And you're saying this part prints the "Valid" print string?

fluid summit
#

i think there's something wonky with the ref in the case where it fails

sinful tree
#

You're not getting a warning in the log indicating something along the lines of "No owning connection" right?

fluid summit
#

This is how i "update" the reference

fluid summit
#

that's it

#

okey, so the reference on the UI is pointing to a diff actor than it should, prob a client version.

graceful flame
#

Can a cheater in a multiplayer game add or edit component tags? I plan on checking for tags on the server is that a bad idea?

plucky prawn
#

im not an expert/authority on cheating by any means but i think its a pretty safe assumption that client-side a cheater can do anything. thats why server validation exists

kindred widget
#

Cheaters can affect their own PC's data. So if you're using a listenserver, they could cheat the tags. But no other user could add tags to the server's version of the actor.

graceful flame
#

ahh yes, that makes sense

kindred widget
#

Unless you explicitly allow them to in an RPC or something.

fluid summit
#

One more pic, sorry for interrupting.
Even on that case, directly pulling the actor from the player controller, i get the error of not owning it.
But if i print the inventory name from the controller on that exact same way, i get a different actor name.

#

Yes i found it

sinful tree
#

Got it working now?

fluid summit
#

That's the spawn of the UI that fails

#

welp, still not working

sinful tree
#

The Widget owner wouldn't really matter in this case.

#

So long as the expedition inventory has an ownership back to the player controller of the client that's trying to manipulate it, it should RPC without issue.

fluid summit
#

it has to be something with the Ref on the UI, at least i can look into that now with the Error that you pointed out in the log

sinful tree
#

And from what I see, you're spawning the expedition, setting the owner to the playercontroller, and then spawning the inventory, setting the ownership to self (so the expedition being the owner) so that should work.

fluid summit
#

okey, it's probably here, just need to dig a bit more.

#

i'm getting 2 actors of inventory, the names are the same for what i see on server and the one throwing the error, gonna look why i'm getting that second one, but most likely that's it

tawny nova
# fluid summit

you can probably pass a reference to the owner into the event

#

check for server / role early in your BP, then set the reference and pass it around

fluid summit
fluid summit
#

just in case someone is interested, i fixed the problem with the UI and the Ref.
The problem was that the inventory failed when the owner was posseses by a AI controller, i fixed it by just switching the owner of the inventory to the player controller on spawn

#

thanks datura for the clue on the error (?)

neon ether
#

If a UNiagaraComponent is spawned on the server does it automatically get show on the connected clients as well?

lost inlet
#

no, there's no replication with visual components

neon ether
#

So if a server is spawning a vfx how would i get that vfx to be shown on the server itself as well as the client?

lost inlet
#

multicast RPC?

neon ether
#

I had experimented with that but didnt have much success, I figured that would be the case, so I'll have to give it another shot

neon ether
#

If a print is within a multicast RPC then the expected output when that rpc is ran would be two prints being done since it would be called on the client and server correct?

#

Other question: if HasAuthority() is printed within that multicast RPC then the expected output would be a one and a zero correct since it should be running on the client and server?

lost inlet
#

a multicast called from the server calls the _Implementation on both client and server

#

HasAuthority() will return true for the server

neon mango
#

It is a bit annoying that when running the Editor as listen server for MP testing that it is seen as a client no matter what action you take rather than the server. At least for sure when un-possessing to test some server code.

thin stratus
#

No idea what you are referring to tbh

peak sentinel
#

If my pointer to a replicated object has COND_SkipOwner is it normal OnReps are not getting called in that object for the owner client?

#

I'm trying to solve why OnRep function is not being fired for my clients, I implemented all necessary things to make it work but I'm clueless about why its not working

fathom aspen
peak sentinel
#

But the object itself is replicated for everyone

#

SkipOwner only applies for variable of that object's pointer

#

Probably my English failed again at that sentence. I have a uint8 bSomeBool : 1 in a replicated UObject, and that UObject's pointer is stored in an actor with SkipOwner Condition

#

When I set bSomeBool from server (which doesnt have any condition) OnRep is not getting called

fathom aspen
#

I still don't understand. This is the workflow of skipping replication for owner. You make sure the object bReplicates to everyone and you add that COND_SkipOwner to skip replication for owner

verbal tendon
fathom aspen
peak sentinel
#

I have this variable in UPlayAnimationObject. Its a replicated UObject spawned from server and stored in an actor

    /** True if we are playing an animation and waiting for finish. */
    UPROPERTY(ReplicatedUsing=OnRep_PendingAnimationFinish, VisibleAnywhere, Category="Animation")
    uint8 bPendingAnimationFinish : 1;

This is my actor storing that UPlayAnimationObject:

//// .header

    UPROPERTY(VisibleAnywhere, Replicated)
     UPlayAnimationObject* ReplicatedObject;

//// .cpp
    DOREPLIFETIME_CONDITION(AIntaxWeapon, ReplicatedObject, COND_SkipOwner);  

peak sentinel
#

Woulnd SkipOwner condition only prevent the replicated variable changed on owner client?

#

How would it affect the object's state itself?

#

It should only cover the replicated property, not the object's replicated state itself

fathom aspen
verbal tendon
#

The documentation on this is pretty clear, the replication conditions only affect the replication of the variables that they are set on

#

the class instances that they are part of are either replicated or not replicated

peak sentinel
#

Yeah, I'm just trying to solve why my OnRep is not being fired to client when it's changed from server

#

I just had a suspicion maybe if its related with replication condition because everything is implemented propertly

fathom aspen
peak sentinel
#

So replication condition should not prevent the OnRep from triggering

#

Anyway, seems like the issue is not related with this issue. Issue itself is too vague to find a reason for, thanks for the effort for trying to help

fathom aspen
oak oracle
#

hi guys , i wanted to implement missile in multiplayer , and when i created a pawn "missile" my told me "Anything controlable with steering needs to be character class for movement prediction" . i dont wanna look an idiot infront of him lol , can someone explain wtf is that mean and why i shouldnt use pawn ?

modern cipher
#

projectiles also have movement comp i think

#

unless u want to posses it

kindred widget
#

It's likely just a laziness thing. CMC has an advanced input and multiplayer prediction system. Normal missiles could use the PMC, but adding input to that would be a small task that probably isn't worth it in the end. And the floating movement component doesn't really network well.

#

TLDR making a flying character with a missile mesh is easiest way to make controllable missile in Unreal without spending a month correcting system bugs.

verbal tendon
gaunt cliff
#

How would I go about implementing a replicated Actor (that exists on both client and server) however set the particle to be only visible for the owner but not other players

verbal tendon
modern cipher
#

thats for the actor visibility in the game world

#

you just do your particle

#

it should be local by default

twin juniper
#

how can i get the player index of the player who pressed a key?

gaunt cliff
#

yeah my case is more complicated than just only owner can see, that's only a start
for example this is for setting up traps, I want it so that only players from the same team can see the trap but the opponent team can't but can interact with trap (overlap with collision etc..)

modern cipher
#

that also can be done locally, since the actor trap is already replicated so everyone will know about it
but if its placed by team (a) its hidden in game for team (b)

gaunt cliff
#

would you please be so kind as to offer more extensive explanation ?

#

I still can't grasp it yet

modern cipher
#

if a player placed a trap
all clients will spawn that trap at the same transform
you might set the trap actor by default to be hidden in-game
then eg. OnRep trap actor if the actor instigator/owner actor's team is (a) set actor hidden in-game = false, otherwise true

hard mist
#

Hi, I am having a struct with this data

    int32 SlotId;    

    UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Inventory)
    FGameplayTagContainer SlotTags;
    
    UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = Inventory)
    UARTInventoryComponent* ParentInventory;

    UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = Inventory)
    UARTInventoryComponent* ParentInventoryA;```

And then I do a very simple NetSerialize

```      Ar << SlotId;
    SlotTags.NetSerialize(Ar, Map, bOutSuccess);
    Ar << ParentInventory;
    Ar << ParentInventoryA;```
But for some reason game away crash and return ensure(IsValidLowLevelFast)
#

Is there any reason why this is happening?
This thing ran fine with the first 3 properties but when I add the 4th it just crashs.

lusty sky
neon mango
# thin stratus No idea what you are referring to tbh

If I unposses while Net Mode set as "Play as listen server" and I call an event exposed on an Actor via "Call in Editor" I can't seem to ever get a ref from "Get Game Mode". That must be because clients don't have a game mode. But I've told the editor to play as listen server, so is editor not the server? Then who is?

gaunt cliff
#

thank you thank you

modern cipher
twin juniper
#

how can i get the player index of the player who pressed a key?

neon mango
modern cipher
#

the window that gets opened first is the listen server

neon mango
#

seems like the first window that gets opened is client

#

Leaving the viewport/editor to be listen server

modern cipher
#

probably like this is better you can see who is server and client

twin juniper
lusty sky
#

what kind of index?

twin juniper
lusty sky
#

is it local multiplayer?

neon mango
#

I can see already? So the information is either wrong or not communicated correctly. Further more if I do it like that I can't call events via editor. @quartz totem

twin juniper
#

i tried with get instigator controller but its not working

oak oracle
modern cipher
#

I never tried that as i didn't do any local multiplayer, but if you explain a little bit more what you trying to achieve someone might help

fathom aspen
thin stratus
#

UE4 has two worlds when you have hte editor up

#

The EditorWorld and the GameplayWorld

#

Your EditorWorld has no GameMode

#

You are using CallInEditor wrong, this is not meant to be a button for runtime

#

If you need executions in runtime, you can add events to the LevelBlueprint and call them in the console via ce NameOfEvent

peak sentinel
#

Somehow RPC works but OnRep not called ๐Ÿคทโ€โ™‚๏ธ

clever needle
#

Hi, Foliage does not appear for clients

fluid summit
#

So i was testing the basic grinding functionality of my game and i got stuck for almost 1 hour farming items to get the right stats

#

grinding is so freaking adictive, it should be ilegal

clever needle
#

lol

fathom aspen
#

Foliage is appearing in both

#

Anyways, make sure that thing bReplicates

clever needle
#

Already solved, The problem was two duplicated virtual textures in landscape

#

yes is Trees

#

The grass is spawned by bluprint, not by foliage system

oak oracle
fathom aspen
#

Try using a pawn and see where it breaks. It's always better to try than not to.

neon mango
#

That works perfectly!

sinful marlin
#

Would the multicast rpc run on clients? The actor wouldn't have been replicated till the end of the frame afaik so I imagine the rpc wouldn't go through

SomeReplicatedActor* Actor = GetWorld()->SpawnActor<>();
Actor->SomeFunc_NetMulticast();
thin stratus
#

What do you need it for?

#

Cause BeginPlay kinda acts as pseudo multicast in that

sinful marlin
#

Setting up some properties on a weapon spawned by the character. Server character spawns the weapon, then sets some properties on it calls it's initialize func (basic telling the weapon "I'm done setting you up, now do your stuff").

#

The intialize func is dependent on some of the properties set before calling it. I'd send a snippet to explain it better if I was home

thin stratus
#

You can just spawn it deferred

#

Which is basically how ExposedOnSpawn vars work

#

I wouldn't send an RPC for this

#

Mark the Vars replicated and set them between the Deferred and Finishspawn

#

Mark the InitialOnly if you only need them to replicate once

#

They should all have the correct value on BeginPlay then

#

RPC sounds wrong here

oak oracle
sinful marlin
#

Oh I like the sound of that. Thanks.

kindred widget
verbal tendon
#

Fyi, regardless of whether or not RPC usage should be done in this case, just some general knowledge

sinful marlin
#

That's what I figured. Just wasn't sure if it would do some magic like "queueing rpc's for actor replication" or something

#

I appreciate the clarification

neon ether
#

Im having an issue where when i call a NetMulticast RPC from a server RPC to spawn a vfx intended for both the client and server players to see it only runs on the server. I even am printing out inside the multicast to check and it indeed only gets called one time on the server.

uncut schooner
#

Hey, How are you doing?
What exact variable is the timestamp

lost inlet
#

and make sure your actor is actually replicated

oak oracle
verbal tendon
neon ether
lost inlet
#

S H O W C O D E

neon ether
#

sorry didnt see your message above sir rogers

#

on it

lost inlet
#

and does the actor that is calling the server RPC actually have ownership of the actor?

neon ether
#

This is the delceration o fthe server and multicast rpcs within the actor. The server calls the multicast within itself like so

verbal tendon
lost inlet
#

lol what's with the WithValidation

#

why does it have an override specifier?

neon ether
#

The actor is a weapon mod which derives from out weapon mod. I should preface with i am no expert and am reading and learning as I go. I got recently thrown into updated non-networked code into networked code for the game my team is currently working on

verbal tendon
#

My gut feeling says that you're calling the Server RPC on a non-client owning actor

lost inlet
#

well that was the first mistake, converting something SP only into MP

#

you design for MP first if your game is supposed to be MP

neon ether
#

yes that was also my opinion but i got outvoted

lost inlet
#

but it still doesn't explain either of the things, typically the Multicast call would never be virtual

#

the _Implementation is usually what's virtual

verbal tendon
lost inlet
#

lol then I'm assuming your team is a bit... saying this as politely as possible... a bit naive?

verbal tendon
#

Gotta do that expectation management

neon ether
#

oh believe me sir rogers I have made that quite clear

verbal tendon
#

Then sit back and enjoy the ride, learn everything you can. Don't forget the popcorn! ๐Ÿท

neon ether
#

Thats why I'm here, trying to learn as best I can given the situation

lost inlet
#

a bit of house keeping first

#

and show the C++ side

#

if this MultiSpawnVfx is defined in a base class, then that should have the UFUNCTION markup instead

#

because in that cause you should be overriding the _Implementation function in the child class

neon ether
#

adjustment has been made, thanks for the corrections!

neon ether
verbal tendon
#

When you want to call a Server RPC from a client actor

#

the client that the RPC is being called on needs to own it

neon ether
#

I've not heard that term yet or read it in the documentation i've gone through

verbal tendon
#

Example: you dont want player2 to shoot player1's weapon

#

That's why (Client to) Server RPCs can only be initiated from the client that owns the actor it's being called on

lapis hazel
#

Hello! I've recently started with multiplayer c++ and after many hours learning about replication, multicast and so on...now I'm stucked with the using of loops....at least using the while loop: every time a while loop executes every client get freezed...after a couple of hours trying to figurate out what is happening...I don't have any idea ๐Ÿ˜ฆ and I don't know what to do next. Any advice? Is this a normal issue? (There is nothing like kind of bug in Google omg)

neon ether
lapis hazel
#

I have studied computer science and I have been working 4 years as backend web programmer :3

#

I also have 2 years of experience using blueprints

neon ether
neon ether
lapis hazel
#

all clients get freeze...

#

I tried execute the while loop only in local and only in the server....the same bug

#

the idea is to start the loop after an input....and ended it when release

verbal tendon
lapis hazel
#

but why all get freeze? xD With if(IsLocallyControlled) for example it would have sense that the client who pressed the input...get freeze....not everything

verbal tendon
#

If they are all executing it they all freeze ๐Ÿ™‚

kindred widget
# neon ether so checking to make sure IsLocallyControlled would be important before calling a...

This is a very difficult question, because generally your code just kind of knows when it should RPC. Sometimes you check it's on authority or not, but like if it's from input and you need to ServerRPC, there's no point in checking. Input is local so only one line of execution will run it. Can you? Sure if you want, but it's just clutter you sometimes don't need. Also IsLocallyControlled won't work for every network actor. Only Pawns. A weapon that the pawn owns for example cannot do that check. It has to check if it's owner is locally controlled. A bullet that the weapon spawns would have to check if it's owner's owner is locally controlled. Etc.

sinful tree
neon ether
#

So the general layout of how the code functions is as so:
(The following is within a UComponent for the players inventory)

  • Input received for weapon fire "StartModFire()"
  • Checks to see if running on server? If not then "ServerStartModFire()" calls "StartModFire()" so the logic also gets ran on the server
  • Continues on "FireActiveMod()" which determins what mod is active and calls its "FireMod()" (Note: still running on client and server up through this point)
    (The logic jumps over to the Mod Actor, of which does have a reference back to the owning player if needed)
  • Within the Mod Actor's "FireMod()" the "ServerFireProjectile()" is called to spawn the projectile on the server (from what I know this spawns a projectile actor on both the client and server)
  • Finally within the "ServerFireProjectile()" the NetMulicast "MultiSpawnVfx()" method is ran to try and spawn a vfx that both players are able to see.

The result of this logic gives the result of the client and server seeing the vfx when the client shoots it but the client cannot see the vfx when the server shoots, though the server is able to.

lapis hazel
#

Indeed, maybe this bug is for using a while in a binding function instead of using the event tick

sinful tree
#

The issue is everything effectively executes instantly. When you're in a loop, it's trying to continually loop until whatever condition is met, and since it's doing that effectively instantaneously, the engine can quickly think it's got an infinite loop as it just keeps going through the loop hundreds of thousands of time as the condition is never reached.

plucky prawn
verbal tendon
sinful tree
neon ether
verbal tendon
neon ether
vague fractal
#

I'm considering to use a Multicast to replicate an animation montage down.
Not sure if i should feel weird about it as the OnRep method doesn't seem to be great neither.
Like the attack animation itself should only be relevant for the other players around, right ?

sinful marlin
#

For those who have handled weapon swapping/switching, do you tend to do the spawning of the weapons on the server and just have them set to replicate, or rpc to the clients to spawn the weapons themselves, with the information for the weapon spawning coming from the server?

#

Is it also possible to replicate properties that can't be marked with a uprop? A TArray<>* in this specific case.

outer rose
#

Hi,
What's the best way to replicate TurnInPlace animations?

  1. replicated yaw property
  2. reliable RPC invoked from the server
  3. something else
verbal tendon
verbal tendon
sinful marlin
#

I appreciate the input. I did indeed go back to the drawing board, ended up creating a bit of a big mess of my code ๐Ÿ˜…

#

Had weapons spawning on server, ran into an issue with a tarray<>* not being replicable, started transitioning to rpc's instead, then lost track of where I was at sadcatthumbsup

verbal tendon
#

I'm heading off to bed. So I can't advise further, take a look at why that TArray is not replicable, there's most likely an easy solution to that, which is what you want to look at

#

just doing RPCs means unless you add a bunch of custom logic that you then need to keep track of ( if you want to support hotjoining with your game, amonst other things ) is not advisable

#

The standard advisable route is doing things through the property replication system, unless you absolutely really know what you're doing and you can go off-piste, being fully aware of all the trade-offs that you're making

#

Because if you're not aware of them, they will come to bite you potentially hundreds or thousands of manhours down the line when you're going to have a much much harder time to retroactively change things

sinful marlin
#

I am far from knowledgeable/comfortable enough to go off-piste with multiplayer lol. Thank you Sir Rogers, I appreciate it.

verbal tendon
#

That's why I mentioned it. I bid you good night, if you can't figure out making your TArray replicable, share all the details here and ask, someone should be able to help

sinful marlin
past totem
#

so how are you supposed to replicate physic objects in multiplayer?

#

I have this falling cube that I want to replicate in multiplayer

#

the location replicates fine but I want to make it so the player can move it around with controls input (so add force based on if the player is pressing a button or not)

#

do I have to spam custom event on tick from the client to the server with the player's input value?

#

or is there a better way to do it

winged badger
#

networked physics is something you do only if you have no other alteranative

#

because it generally doesn't work

#

unreal physics is not deterministic

past totem
#

well my game is physics based literally

winged badger
#

so even if you manage to perfectly sync all timestamps and data over the network, which you can't

#

the physics engine can still decide to do 2 different things on 2 machines

past totem
#

well they manage to do it with the regular player right?

#

the charactermovement component replicates

#

it has velocity and stuff

#

so why can't I do it with a cube?

winged badger
#

that is not really physics

#

there are no forces or impulses involved

past totem
#

well u can launch it but I guess maybe it's not the same

winged badger
#

and collision is simple and easy to correct

past totem
#

so what should I do?

#

I just want to replicate a simple cube

winged badger
#

lauch is also better done with root motion montage via gameplay tasks

#

because it can desyc really bad if you just use vanilla launch over the network

#

or at least jitter like crazy

past totem
#

mhm

#

so would it be okay to run a custom event on tick from the client to the server?

#

to send the movement input from the client to the server

#

my issue is mainly input, the rest works fine kinda

winged badger
#

you can't guarantee server and client tick at the same rate either ๐Ÿ˜„

#

physics + network, its terrible

#

if i had to do it, i would try with something akin to what CMC does with FSavedMove

past totem
#

mm what's that?

#

oh wait what if I just send a custom event only when the input changes?

#

like when u press/unpress

#

that shouild work let me try

winged badger
#

no, this more lets you accumulate a chain of timestamped inputs

past totem
#

ahh

winged badger
#

so server they can both replay the stuff

past totem
#

well I don't think I need somthing that complicated

winged badger
#

i think you might

#

if this is a learning project, physics based networked game is a terrible place to start

#

requires a ton of custom c++ correction code

#

easy to get lost if you don't have plenty of network coding under your belt already

past totem
#

no it's a real project

winged badger
#

you'll also need smoothing

#

separate the mesh from root component

past totem
#

okay give me a bit let me try to fix the input and then I will see how it runs

winged badger
#

so you can teleport the root and ease the mesh to root's position without jittering

#

it will get much worse in edge cases where client detects a collision and server does not or vice versa

past totem
#

well

#

it's very simple I feel like we can get it to work

winged badger
#

note there are games that do this

#

but they generally have a very low number of physics objects running around

#

like rocket league

past totem
#

yea

#

my game is like rocket league

#

it won't be much

#

every plaeyr is a physics objeect

#

max 8-16p layers

winged badger
#

i think they did a GDC or somesuch talk

past totem
#

I would be happy with only 2 players too

winged badger
#

if they did, should probably watch it

past totem
#

oh

#

found it

#

thanks

#

will do

winged badger
#

there is a silver lining

#

if you pull this off, you will probably no longer find 10k lines of CMC code in any way intimidating

past totem
#

well I don't plan to put too much time into it

#

just gonna try and see if it works without too much trouble

winged badger
#

there is a difference between "works" and "is on production level" too

#

works is much much lower bar to clear

past totem
#

๐Ÿ˜… ๐Ÿ˜…

#

so it seems they went for a custom physics solution

#

:/ not rly something I'm looking to do

bold shell
#

i know about the basics of multiplayer and im doing it with steam but im wondering about a another solution that involves host migrating and steam.

winged badger
#

unreals out of the box replication doesnt handle host migration in any way, shape or form

bold shell
#

so what would i be looking at to do that?

winged badger
#

your problem is clients don't communicate directly with one another

#

so you can't migrate anything on server auth network model

#

second is there are plenty of server only objects running around that clients never get to know anything about

#

and third problem is, clients connect to server/host, reconnecting to another would require hard travel

#
  • a whole host of minor problems
#

so you'd be looking to roll your fully custom network solution using FSocket

lost inlet
#

you might be able to still do it, and you might be able to show some UI to obfuscate the hard travel

#

but it's in no way a trivial thing

winged badger
#

if you're migrating because server disconnected, you don't have time to do it, not really

lost inlet
#

yeah I remember COD:MW2 with its listen server approach would force the host to send the relevant data to the new host before they got to the main menu, but if the host crashes or force quits the game in some way, you're SOL

#

a more seamless way of doing it with p2p would require a custom networking solution

winged badger
#

and the difficulty of that depends on the game, with us new host would be missing the gamemode, 200 or so AIControllers and entire mission system

bold shell
#

holy crap-a-cheno. sounds very out of my reach for now

lost inlet
#

either a) don't care about the host going AWOL or, b) use dedicated servers

deep shore
#

I plan to put my game on a dedicated server to accommodate a higher number of players. The game will not be sold or mass distributed for now, and I want to make it so I have authority to do things in-game that nobody else can: ending matches early, for example. Any suggestions on how to go about assigning special privileges to certain players on a dedicated server? I assume thereโ€™s no way around using some sort of login system.

winged badger
#

no but in this case it can be very rudimentary

#

if its steam, or some service with consistent unique net ids

#

you could have the game just write an external data file with steam ID / permissions

#

you hardcode your own in and use console commads or UI to grant it to others

deep shore
#

So far, while testing with listen servers, I have just packaged the game, zipped it up, and distributed it to friends that way. Itโ€™s all been very informal. Iโ€™d like to keep doing that and avoid Steam or some other service.

winged badger
#

if you are keeping the game out of distribution, you can probably avoid using the external auth server

#

and just write an auth system as a .json file on the dedicated server

gleaming kite
#

Ive heard from a lot of people that root motion is a pain/impossible on multiplayer. Is there any way to do it reliably?

winged badger
#

montages will work

#

rest... is dodgy

gleaming kite
#

ah ok, sweet, montages is all i need, is there anything special i have to do for them?

winged badger
#

i haven't done that system on our game, so can't tell you much detail off the top of my head

#

i know the broad strokes

#

basically GameplayTasks will handle root motion montages well

gleaming kite
#

gotcha thanks!

deep shore
#

thank you so much for the advice, Zlo. I wasnโ€™t familiar with .json but will read up on it.

winged badger
#

unreal knows how to serialize structs to and from json out of the box

#

as long as you're keeping it private and are running a single dedicated server instance, you'll be fine

#

as this provides no mechanism to sync the auth data between multiple server instances

#

(unless you're running multiple instances from the same computer and use a shared auth file)

past totem
#

physic multiplayer sucks

#

I quit

#

delete this channel

past totem
worthy eagle
#

I seem to be running into a sorta race condition issue. I am using a RPC to give abilities to a character based on an item in a slot. I am using a validate function with the RPC call to make sure the actor is actually owned by the character before giving them the abilities.
Stepping though the debugger this is what appears to happen.

ClientSetOwner
ServerRPCIsCalled
ServerRPCValidate->No owner on equipped item so client is kicked

ServerSetOwner
ServerRPCIsCalled
ServerRPCValidate->Completes as expected
ServerRPCImplementation

Throwing the rpc behind a role check to see if it is the server works...although it seems redundant to call a server rpc only on the server, but I like the idea of the validation checks. I also thought that was just done for you when you define it this way.

    UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable)
        void Server_FunctionWhatever();

I could also make the set owner function when the item is equipped an RPC to the server but seems unnecessary. Any ideas on how to potentially avoid this issue? It technically works but seems hacky.

winged badger
#

that doesn't sound like a race condition, it sounds you are running what should be server logic (set owner) predictively, and then trying to validate it on top, one of those needs to go

#

either client can wait a round trip for server to run SetOwner, or server can trust the client the owner's legit

peak sentinel
#

I have a root motion based melee attack system for AIs, currently I'm sending a data object as TSubclassOf that also stores the required root montage asset via multicast to play melee attacks. Is there any better way to do this?

#

Behavior Tree selects best melee attack animation by calculating their conditions and scoring them, but I couldnt find a efficient way to make the animations replicate

#

Sending reliable multicast RPC for each attack feels bloated

plucky prawn
#

so im doing SpawnActor<>() on the server, but its never created, or at least BeginPlay is never called, on the client. is there a way im supposed to spawn an actor on the server to replicate it? the actor im spawning is AInfo with bReplicates = true and has a UPROPERTY set to replicate

bitter oriole
plucky prawn
#

is there anything else im missing?

bitter oriole
#

Looks fine

#

If the Actor is blueprinted, make sure it doesn't override replication

plucky prawn
#

its not blueprinted

bitter oriole
#

For what it's worth AInfo is just AActor with a sprite and replication disabled by default, so check with AActor

#

Info.cpp is 50 lines

plucky prawn
peak sentinel
#

Be sure you are checking the value of bWroteSomething when you changed a property

#

Otherwise it will return false

peak sentinel
#

If it doesnt return true on value changed from server and same thing happens with actor probably something is wrong at UWorld level

#

Are RPCs being called?

plucky prawn
#

no

#

theres no RPCs, just replicated properties

peak sentinel
#

Try calling some RPCs, if they dont work something else is wrong

plucky prawn
#

its not even working with AActor so i think ive broken something

peak sentinel
#

Alright dumb question time

#

You are not on standalone right

#

It should still work tho but

plucky prawn
#

i dont think so. ive been packaging the game for client and dedicated

#

been running it locally

peak sentinel
#

Oh.. so this does not happen at PIE mode?

#

That gives a clue

plucky prawn
#

i cant test in PIE because im using the steam subsystemm

chrome bay
#

Maybe avoid debugging the sub-objects for now and just get a basic replicated actor working

#

The OSS shouldn't make a difference to game-level MP code

#

You should still be able to test MP in editor

plucky prawn
#

interesting

#

ill have to see how to connect to my server then

chrome bay
#

You don't connect to a specific server, the engine will run a server in the background and connects to that

plucky prawn
#

oh nice

chrome bay
#

Just open a game level, set to "Play As Client" and hit play

plucky prawn
#

ye doesnt work with PIE either

#

although my server crashed inside the editor which is nice

chrome bay
#

Yeah so must be just a general issue

#

But yeah being able multiplayer in PIE is pretty essential to any sane workflow ๐Ÿ˜„

plucky prawn
#

ye ive been packaging every time i need to test :l

#

also the editor doesnt seem to be launching my dedicated server configuration. am i mistaken, or is it not supported?

chrome bay
#

All you need is the editor to be in "Play As Client" mode, and a dedicated server is launched in the background.

plucky prawn
#

hm because its crashing in editor when trying to GetWorld in my UWorldSubsystem but it doesnt crash when packaged

chrome bay
#

Yep lifetimes of objects can vary in editor

#

UWorldSubsystem in particular has some troublesome initialization routines in editor

plucky prawn
#

very nice

#

well, if i leave before it crashes i still get no log output from my proxy actor to indicate its being networked

chrome bay
#

Also you have to be careful with static vars, since they share the same process unless you explicitly tell them not to

plucky prawn
#

i dont think im using any static variables

#

do i need to pass anything extra to SpawnActor? this is what im using JobProxy = GetWorld()->SpawnActor<AJobProxy>(AJobProxy::StaticClass());

chrome bay
#

Shouldn't do, worth checking it's actually spawning

plucky prawn
#

its spawning in the server, that is the pointer being returned is valid and BeginPlay is called

chrome bay
#

Kk, so it sounds like it just isn't replicating then for whatever reason

#

But, if it's always relevant and bReplicates = true, then there's really nothing more to it

peak sentinel
#

I feel you Gambit ๐Ÿ˜” Wasted a nice weekend to solve a vague issue as yours

verbal tendon
#

@plucky prawn small not for PIE. If you're making a game that runs on dedicated servers, you want to test "As Client" for the networking mode in PIE. If you're making a game that's playerhosted, you want to test "As ListenServer" and maybe alternate that with "As Client" if you're feeling lazy and usually testing in the main window. It's to simulate the setup that you have at production to the closest

#

Because with dedicated servers all players are always Clients, but with ListenServer you get a mix of Client + Client&Server ( the host, a ListenServer )

plucky prawn
#

I only just started using PIE when jambax explained how to use it. Outside of that I would package my client and dedicated server, run both, and connect to the dedicated server from the client. I can connect fine, my player controller and stuff are all replicated but not my actor.

plucky prawn
verbal tendon
formal spruce
#

Hi! I'm working on a multiplayer game which I eventually want on a dedicated server. A host/"listening" server seems logical and makes sense - but setting up a dedicated server is like a brick wall to me.

Can I develop using a listening server and transfer to dedicated later or would it be a big mistake?

vague fractal
#

You could run into a few problems

bitter oriole
#

Usually if you're thinking about dedicated it means you should start there

formal spruce
bitter oriole
#

Main thing again is that usually, you know early if you want dedis. Competitive play essentially required dedicated

#

And you don't want to need dedicated so if you're not in competitive play you'd rather stay on listen

formal spruce
#

Ok, thanks for your thoughts.

I'll probably need experienced help to set up a dedicated server, since it's beyond my skills. But I'm a long way away from that.

past seal
#

Does anyone have an idea of how to set materials of other players but only on local client screen? Trying to make opposing team have a red tint and all teammates have blue tint.

outer rose
#

Hi,
Do dynamic-multicast-delegate broadcasts replicate to clients by default?

  • DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTurnInPlace, ETurnInPlace, Direction);
    If so, how can i stop the broadcast from reaching clients, i want the broadcast to only happen in the server?

I am getting some weird behavior with turn in place animations.

chrome bay
#

no

#

They are local only

outer rose
#

By default, ActorRotation replication occurs between the server and the clients, but not between the clients and the server, correct?
Is prediction included in the default implementation of ActorRotation replication server->client?

#

Should I rotate characters exclusively on the server and allow the client to adjust the actor rotation only through replication?

chrome bay
#

Character rotation is predicted via the movement component

#

So long as you aren't explicitly setting it anywhere and are using the built-in rotation features, i.e. following control rotation.

outer rose
#

I am using custom rotation logic, and using the SetActorRotation method.
Should I modify the controller rotation, instead of changing the actor rotation directly?

chrome bay
#

yes

#

And have it follow control rotation

twin juniper
#

how can i get the player character index of the one who pressed a key?

twin juniper
#

i mean, if i want to jump when i press space on the second player then both of them jump. How can i fix this?

tawny nova
#

well.. you can probably get a reference directly to the character that pressed the key

#

it sort of depends on how you've set up your key press handling though

twin juniper
#

i think that like this it will always makes jump the first player because the player index is 0 so i need to get the index of the character who wants to jump but i don't know if there's a specific node or what

tawny nova
#

is that in your character blueprint?