#multiplayer

1 messages Β· Page 18 of 1

past totem
#

🀣

#

you know what

#

I actually had this issue too

#

with hosted sessions showing 9999s ping in the server search result

#

so I just disabled ping showing there

#

I don't know how to fix it

#

the ping showed fine for dedicated servers

plucky prawn
#

given that a lot of houses in my country are still on ADSL2 its probably not that far fetched for listen servers

past totem
#

but I was in the same room

#

with the 2 pcs

#

lol

#

and once I logged in to the server

#

the ping showed fine

#

and it ran fine

#

just a menu issue

plucky prawn
#

probably an OSS issue then?

past totem
#

Idk what oss is

plucky prawn
#

online subsystem

past totem
#

I mean the issue is with the search result thing

#

yea maybe with the advanced sessions plugin or that

oak prawn
#

I'm lobbying over the lan, it shouldn't show that much ping

past totem
#

just hide the ping there

oak prawn
#

can't we find the real ping πŸ˜„ @past totem

past totem
#

sounds kinda pointless,

#

too much trouble than it's worth

#

but if u figure it out, by all means, let me know so I Can fix in my project too

oak prawn
#

So how can I get him to join the session directly when I say invite him to the game via steam? @past totem

past totem
#

but if u use advanced sessions there is an event for it in the game instance

#

but when I tried it was kinda weird for me not really working Idk maybe steam is just bugged Idk

oak prawn
#

hmm

#

yes it didn't work for me either

past totem
#

r u using the event?

#

in the game instance

oak prawn
#

finally i have a problem

past totem
#

this is your third

oak prawn
#

Once someone has established or joined a session, they cannot create or connect to a second session.

past totem
#

always call destroy session before u call join session

oak prawn
#

are you experiencing this? I cannot establish a new session without entering and exiting the game.

#

hmm

#

I'm an experiment

#

@past totem

past totem
#

second seems correct

limber cloak
#

why doesn't this work:

public:
        UFUNCTION(Exec)
    void Join(FString ipAddress);

    UFUNCTION(Server, Reliable)
    void Test();
void UMyGameInstance::Join(FString ipAddress)
{
    UEngine* engine = GetEngine();

    if(engine)
    {
        engine->AddOnScreenDebugMessage(0, 2, FColor::Green, FString::Printf(TEXT("Joining %s"), *ipAddress));
        Test();
    }
}

void UMyGameInstance::Test()
{
    UEngine* engine = GetEngine();

    if(engine)
    {
        engine->AddOnScreenDebugMessage(0, 18, FColor::Green, TEXT("THIS SHOULD WORK ON THE SERVER ONLY"));
    }
}
#

this is the error:

CompilerResultsLog: Error: MyGameInstance.gen.cpp.obj : error LNK2005: "public: void __cdecl UMyGameInstance::Test(void)" (?Test@UMyGameInstance@@QEAAXXZ) already defined in MyGameInstance.cpp.obj

CompilerResultsLog: Error: MyGameInstance.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UMyGameInstance::Test_Implementation(void)" (?Test_Implementation@UMyGameInstance@@UEAAXXZ)

CompilerResultsLog: Error: MyGameInstance.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UMyGameInstance::Test_Implementation(void)" (?Test_Implementation@UMyGameInstance@@UEAAXXZ)

PuzzlePlatforms\Binaries\Win64\UnrealEditor-PuzzlePlatforms-5313.dll : fatal error LNK1120: 1 unresolved externals
jolly siren
#

@limber cloak should be Test_Implementation() in the cpp instead of just Test()

limber cloak
jolly siren
#

No problem ☺

limber cloak
#

why does the code run only on client?

UFUNCTION(Exec)
    void StartFunctionOnServer();

    UFUNCTION(Server, Reliable)
    void Server_Test();
    void Server_Test_Implementation();
void UMyGameInstance::StartFunctionOnServer()
{
    Server_Test_Implementation();
}

void UMyGameInstance::Test_Implementation()
{
    
    TArray<AActor*> allActors;
    UGameplayStatics::GetAllActorsOfClass(this, AMovingPlatform::StaticClass(), allActors);
    
    for(AActor* theActor : allActors)
    {
        UStaticMeshComponent* theComp = theActor->FindComponentByClass<UStaticMeshComponent>();
        
        if(theComp)
        {
            theComp->DestroyComponent();
        }
    }
}
limber cloak
#

it runs only on client

#

not on server, idk why

sinful tree
limber cloak
#

It only runs on the client, idk why. I want that the client tells the server to run this code, not the client
Here is what I did:

private:

    UFUNCTION(Server, Reliable)
    void Test();
    void Test_Implementation();
void AMovingPlatform::BeginPlay()
{
    Super::BeginPlay();
    
    //if it is client, then tell the server to run the function, if its server, then do nothing
    if(!GetWorld()->IsServer())
    {
        Test_Implementation();
    }
}

void AMovingPlatform::Test_Implementation()
{
    UStaticMeshComponent* theComp = FindComponentByClass<UStaticMeshComponent>();

    if(theComp)
    {
        theComp->DestroyComponent();
    }
}

sinful tree
limber cloak
sinful tree
#

You can have code run on an actor that isn't client owned, but you cannot have the client call RPCs to the server through it to run code.

#

For example, if you had an "else" on your if(!GetWorld()->IsServer()), then the code in that else would only run on the server.

limber cloak
sinful tree
#

Actors can replicate no problem.

limber cloak
sinful tree
#

In fact if you want something to replicate, it basically has to be an actor.

Any time you want a client to tell the server to do something, you're usually better off doing through a player owned actor, such as the player controller, their controlled pawn, or their playerstate, or anything that is owned by those three. You can change ownership of actors on the server to allow a client to RPC through them, but it doesn't make sense to if it's just a small thing, like say opening a door.

limber cloak
#

if i do like linetrace get the actor and then call the function from that actor

#

to command the server

sinful tree
#

If you're wanting the client to control the platform, then yes, something like that.
So something like, client presses button on their character/player controller, does a line trace, hits the platform actor, if hit actor is valid, runs an RPC to the server on the player controller/character passing along a reference to the actor that was hit, while running on the server you can use an interface to that actor (or cast, or however you need) to run a function on that actor.

limber cloak
#

can someone figure out, why this isn't working?:

public:

    UFUNCTION(Server, Reliable)
    void Test();
    void Test_Implementation();
void AMovingPlatform::Test_Implementation()
{
    //if(!GetWorld()->IsServer()){return;}

    UStaticMeshComponent* theComp = FindComponentByClass<UStaticMeshComponent>();

    if(theComp)
    {
        theComp->DestroyComponent();
    }
}
#

im doing a sweepsinglebychannel on my character class

#

and the hitResult triggers the public function of Test_Implementation()

#

but only the client removes the cube

#

not the server

#

What am I doing wrong?

#
void AMovingPlatform::BeginPlay()
{
    Super::BeginPlay();

    if(GetWorld()->IsServer())
    {
        SetReplicates(true);
        SetReplicateMovement(true);
    }
}
#

please help

sinful tree
#

Again, are you RPCing to the server first on the character before calling Test()?

limber cloak
#

the character does not have a UFUNCTION(Server, Reliable)

#

only the AMovingPlatform has

sinful tree
#

You can't call UFUNCTION(Server) on actors that are not owned by the client. Those types of UFUNCTIONs are Client -> Server RPCs and they can only be executed on client owned actors.

You must use a UFUNCTION(Server) function on one of the client owned actors, like their character, player controller, or player state, then within that function you can execute what needs to happen on the server. And if you pass along a reference to the actor you're trying to interact with in that function, then the server can use that actor reference - you need to either cast or use an interface to perform the required function on the target actor.

#

Here's a BP example to show the flow.

limber cloak
#

it works

#

when i placed the UFUNCTION(Server, Reliable) on the character

#

it worked

limber cloak
#

It's me again XD
I'm having this NetMulticast being called by the Server inside the character class.

UFUNCTION(NetMulticast, Reliable)
    void NetMulticastDoFunction(class AMovingPlatform* thePlatform);
    void NetMulticastDoFunction_Implementation(class AMovingPlatform* thePlatform);
void APuzzlePlatformsCharacter::NetMulticastDoFunction_Implementation(AMovingPlatform* thePlatform)
{
    if(thePlatform)
    {
        thePlatform->Test();
    }
}

The server simply calls this function but the clients dont run the Test() function

sinful tree
#

I don't think you need the class specifier. You're using a reference to an actor, not the class of the actor.

limber cloak
#

basically the Test function is this:

void AMovingPlatform::Test()
{
    UStaticMeshComponent* theComp = FindComponentByClass<UStaticMeshComponent>();

    if(theComp)
    {
        if(newMesh)
        {
            theComp->SetStaticMesh(newMesh);
        }
    }
}
#
public:

    UFUNCTION()
    void Test();

    UPROPERTY(EditAnywhere)
    UStaticMesh* newMesh;
fallow pendant
#

Hi veryone, I've been struggling to solve this problem. Please help me.
I have a multiplayer shooter game.
For now, When I left click, the character fire automatically. But the problem is. The line tracing and applying damage only happen on server then the visual effects are played on the client after some params are replicated.
But the problem is, there is a huge delay between the point I click a button and the player then fires.
I use Unreal Engine network simulation to get around 30-60ping.

How do I solve this problem?

limber cloak
fallow pendant
#

Thank you. But I intended for the host to be running in background. And I know that when I click a button, client has to send a request to server to trace a ray and apply damage etc. And then server replicates back to client to play visual effects. It takes ~1/10s to do so. So there is a delay.

fallow pendant
thin stratus
thin stratus
#

Just not the damage

#

You don't want any delay, not even 60ms

#

Feels like crap for the local player otherwise

fallow pendant
thin stratus
#

Yeah but shooting a gun uses a predicted GA

#

So the GC should also be predicted fwiw

fallow pendant
#

Oh

#

Can you please help me on that.

#

I guess my GA is not predicted

thin stratus
fallow pendant
#

Cool. I'll try to do it first then I'll ask for help there if I can't

thin stratus
#

There are more people than can help you with the setup

fallow pendant
#

Thank you

thin stratus
#

Theoretically if the ability is set to predict and is started locally on the owning client, the only thing you have to ensure is that the prediction window inside the ability graph doesn't "die"

#

Which usually happens if you have latent nodes

#

You can then use the WaitNetSync with ServerOnly Wait to give the Client a valid window again

#

You should also read through Traneks gas guide once more cause it talks about prediction there

fallow pendant
#

Thank you. That's really help.
I'm reading it rightnow

cobalt pawn
#

Hey guys, I am unable to make the players shoot when I increase the number of players to 2. I am getting this error and I suspect something wrong with the way the shoot logic works

#

The logic under question is this

upbeat basin
#

I'm guessing that you created your Rifle in client and trying to call a server RPC

cobalt pawn
#

this is the fps starter template

#

so all i did is increase the number of players to 2 and replicated the projectile and the character mesh

#

so i can see my guy running around but he can't shoot because of that error i mentioned

chrome bay
#

FPS starter template isn't MP ready AFAIK

upbeat basin
#

No it isn't

cobalt pawn
#

shit

#

What is a good multiplayer template to use

upbeat basin
#

The Shooter Game

#

Unreal has another template (or more of a demo) for multiplayer FPS

chrome bay
#

Lyra is the new kid on the block but it's a bit excessive/overwhelming to say the least

#

And it doesn't really teach you anything because JustUseGameplayAbilitiesForEverything(TM)

#

There's also the "Multiplayer Shootout" sample, but that's hidden somewhere deep on the launcher and hasn't been updated for some time (but it is BP, unlike the others)

wooden cypress
#

How do you make a kill counter in a multiplayer game when people have lost of different blueprints?

past totem
wooden cypress
past totem
#

Use a parent actor for all of them?

wooden cypress
past totem
#

Can't u make a child of that and use it as parent

#

U could also maybe use interfaces

wooden cypress
#

I tried making a parent but I cant cast it to it, it keeps failing

#

I'm trying to get DamageCauser

woven basin
#

For Servers + OnRepNotifies.

I understand that the "On Rep" notify only gets fired if a value changes and is then replicated down to clients.

But how do you handle scenarios where the game could be either a Listen Server or a Dedicated Server. If we take the following simple code;

void AWeapon::ServerFireWeapon()
{
     Ammo--;
}

void AWeapon::OnRep_Ammo()
{
      Controller->UpdateHUDAmmo(Ammo)
}

In a Dedicated Server, this works perfectly. But in a Listen Server, I need to call UpdateHUDAmmo on the server, otherwise the listen server local client wont know to update their own HUD (but the remote clients do).

Whats the "best practice" here to manage this generic scenario? Especially with larger functions where I dont want to duplicate 10 lines into two different functions.

Do/can/should I put OnRep_Ammo() as a manual call inside ServerFireWeapon(), so that it forces the listen server to run the same code as if it was only a client? Or do I split a third function like UpdateHUD() which both ServerFireWeapon() and OnRep_Ammo() both call?

dusky linden
#

Hey guys. I have problem with motion controller replication. I tried everything but nothing worked. What can I do? I'm stuck

twilit radish
twilit radish
#

But honestly all it takes is sending a server RPC with location and rotation and then smoothing that out on the other clients. Assuming you don't care about cheaters.

#

Or if you have a character that can move around constantly you could probably also send the relative location to the character so it syncs up a little better in the end.

shell forum
#

What’s the proper way of doing a RunOnOwningClient for a BP actor placed somewhere in the world? Let’s say something like a monster that I want to hide for 1 individual player.

meager fable
past totem
#

don't think thatll work (since no client owns that actor)

#

u want to have a run on owning client event on the player controller or whatever

#

that then hides the monster u want

#

or something like

#

I think that's how u need to do it

twilit radish
#

Depends on if the monster is client owned or not.

#

But it kind of depends on the use case anyway because it sounds like a state rather then a one time event.

warm finch
#

Hey, what is the best way to sync two moving platforms between server and the clients?

#

I've tried using client movement and server clock for the movement, however, there are still some hitches between the server and the client

stoic ore
#

I hope you don't mind the ping but the link isn't working. I could find it via google nevertheless.

thin stratus
#

I really need to switch host

#

Will fix, thanks for the ping

#

Should be up again

stoic ore
#

that was quick, nice. Thanks πŸ™‚

wooden cypress
#

How do I check if the pawn my controller is controlling has taken damage?

#

Event AnyDamage does not fire from the controller

wooden cypress
#

I'm trying to make is so that when the pawn's variable Health reaches 0, they respawn as another character

thin stratus
#

Better solution would be utilizing EventDispatcher

wooden cypress
#

Do I place health in the controller or the actor?

thin stratus
#

Or let the Pawn just tell the Controller if you only need to tell that one Actor

#

Health is usually in the Character/Pawn.

wooden cypress
#

Since I have multiple characters, which hold different health values how would I make it so that the controller can tell when that pawn has died

thin stratus
#
  • EventDispatcher in the Pawn that the Controller listens to
    or
  • Tell the Controller directly if only the Controller needs to know
wooden cypress
#

With the event dispatcher since one is on th echaracter and the other is in the controller how would I link them?

thin stratus
#

No

#

There would only be one in the Character

#

EventDispatcher are like Newsletters. The Character/Pawn has it and can Broadcast. And whoever is listening to it will get the Message.

wooden cypress
#

When I create i in the pawn I cannot reference it from the controller though

thin stratus
#

That allows you to not care who needs to know about the death, cause everyone who needs to can listen to the Dispatcher

#

Also called a Delegate in C++

#

You should be able to reference it though

#

If you have a proper reference of your Pawn, cast it to your custom class

#

Then you can bind to the EventDispatcher

#

If you only need to tell the Controller about the Death, you can also just call GetController in the Pawn/Character and call a function on it to respawn the Pawn

#

But that's only viable if the list of Actors you want to notify about the Death doesn't grow

#

If it does, then the EventDispatcher is the better/correct solution

livid holly
#

at those functions you ensure the pawn is ready

#

(I mean OnPossess might be called on a nullptr pawn so just check that πŸ˜„ )

thin stratus
#

Also OnRep_Pawn is c++ only

tribal mango
#

Hi, developing a multiplayer game using c++, how should I approach having two actors participate in the same animation (e.g a ROLE_AutonomousProxy drags a ROLE_SimulatedProxy).
My current direction is to have the player in his local unreal engine instance (local = ROLE_AutonomousProxy) have the enemy (local = ROLE_SimulatedProxy) attached to a socket that is involved in an animation - that socket represents the location for the enemy actor to be placed (more specificaly, its mesh).

Before I dive more to my own solution, does anyone knows of a best practice / or can direct to where and what to search for ❀️

thin stratus
#

I don't think you need a Socket

#

But the idea is probably correct

#

UE5 at least has this Motion Warping stuff for Montages, so you can always let it MotionWarp to the right location and then just attach with relative offset

#

A Socket might be cleaner but not if you need 60 different ones

quasi tide
#

GrabLocation1, GrabLocation2, GrabLocation3, etc... πŸ‘

tribal mango
thin stratus
#

But attaching to a socket vs attaching to the actor with a relative offset is the same

#

Just that it's not tied to a pre-created socket

tribal mango
#

Hmm Oh u mean like define the relative offset once

#

like a const

#

not like - update the relative offset every tick

#

so yeah by attaching it to a socket I hope unreal sees it as 1 actor

#

am I making any sense ?

#

Lets me rephrase what I am trying to achieve I think Cedric helped me understand what I want better

#

I would like to have a state where two online players are participating in the same animation - more technical,** combine them into one actor** so that when I change the location of that actor it changes in both clients

#

let me know if I am talking nonesense

wooden cypress
thin stratus
#

You do have to cast to your pawn

wooden cypress
#

I get this is what I'm meant to do but I cant get the object

thin stratus
#

The object is "GetControllerPawn"

quasi tide
#

Casting is not evil like so many BP tutorials tell you

thin stratus
#

But ONLY after the Controller possessed

wooden cypress
#

I tried that but it doesnt work

past totem
thin stratus
#

You can't do this on BeginPlay

wooden cypress
thin stratus
#

You can't do that

#

BeginPlay does not have a valid Pawn

quasi tide
#

You have nothing connected to the object pin on the left of the cast either. So you're not casting anything.

thin stratus
#

Also that IsLocallyController -> SpawnPawn is wrong

#

Like really wrong

#

BeginPlay already calls on everyone who has an Instance of that Actor

#

So here Server and local Client

wooden cypress
thin stratus
#

There is no need to ServerRPC

#

Just block remote with SwitchHasAuthority

#

And for the Dispatcher, you will need to use an event like OnPossessed

#

During BeginPlay you have no valid Pawn

wooden cypress
#

Everything before the cast works perfectly, it just spawns my actors in and puts the controllers onto them

thin stratus
#

Doesn't matter if it works

#

It's wrong

quasi tide
#

Also - why isn't the GameMode handling this? Curious question btw.

thin stratus
#

Yeah, GameMode should probably handle this in HandleStartingNewPlayer or similar

wooden cypress
#

In the video I watched he said not to put it in gamemode

quasi tide
#

GM already has functionality to spawn your character.

wooden cypress
#

All im trying to do is to check if the pawn dies

#

That is it

#

Gamemode > Controller in that case?

thin stratus
#

Instead of repeating yourself, try to apply what we suggest

wooden cypress
#

I really do appreciate your help but honestly its like ur speaking another language

thin stratus
#

You can get the Pawn with GetControlledPawn when the Controller Possessed the Pawn

wooden cypress
#

I dont understand what ur asking me to do

thin stratus
#

The thing is

#

If that is too much for you, then stop doing Multiplayer.

#

Cause you are literally facing singleplayer and beginner problems

#

Multiplayer is a whole other level of complexity

past totem
#

yea

thin stratus
#

You basically ask us how to figure out a simple respawn issue while showing numerous problems with programming a game in general

#

Which we then have to additionally address

#

The stuff I told you, you can google for those terms

#

If the language is a problem

#

But again, if you don't know how to do the Respawn stuff, which is basically the same solution in Singleplayer, then I would suggest not starting with Multiplayer.
It's just a suggestion. I'm doing this whole UE stuff for a while. You are by far not the first one to try doing MP first, and it never works out.

quasi tide
#

I know it's not the answer you want to hear. No one wants to be told to not work on their project that they do really want to work on. But what Cedric is saying is the better route overall. To get a better foundation in UE overall. Then you can come back and tackle the multiplayer problem. Adding networking adds a bunch of extra complexity that is not immediately obvious.

You can even learn UE doing a super simple single-player wave shooter game if you so choose.

thin stratus
#

If you want to proof us wrong, take the terms of OnPossessed, GetControllerPawn, Cast, Bind, EventDispatcher etc. and try to figure it the rest out with google.
I more or less told you exactly what you need to code anyway.

cold moat
#

Hey guys, I'm not sure why but this is always returning false when executed by the server

#

The 'get movement direction' macro shown on the screenshot

past totem
#

your theme is cringe

#

the server doesn't have camera data

#

instead of the camera data, get the control rotation from the controller

cold moat
past totem
cold moat
#

Oh my bad..........

#

I'm already doing it

past totem
#

what is 'Vector Zero'?

#

have you heard of debugging?

#

if you debug, you will find out which part is wrong

quasi tide
#

Don't directly compare float values. Look for the IsNearlyZero method to compare it to 0.

past totem
#

sometimes that fixes it for me too

quasi tide
#

You can also just remove the float comparison in the != check altogether

past totem
#

it's a vector btw

quasi tide
#

Not sure why it's even there.

cold moat
past totem
#

oh, now I get what vector zero is

#

lol

#

never seen this node before, sounds so useless tho

past totem
#

your videos are 25 seconds long

#

And If I wanted I could list multiple problems

oak prawn
#

The problem is. There is no problem with the vehicle movements of the player in the server server, but I am experiencing flickering in the vehicle movements of the player in the client server.

past totem
#

the problem is that you are using chaos and chaos is shit

oak prawn
#

yes it can πŸ˜„

#

ue5 has deterministic physics.
Networked physics was supported via the so called physics prediction plugin, but it doesn't seem to work very well πŸ˜„

quasi tide
#

Saying not sure why that is there.

past totem
harsh ice
#

Can I get help

#

I spawned weapons in multiplayer for character

tribal mango
harsh ice
#

But when the player gets disconnected the weapons are still visible on the server

past totem
past totem
harsh ice
#

It works when i click on it quite but not when i directly close the game

past totem
#

event end play?

harsh ice
#

Yeah

#

I did in game mode

#

I created a custom event and ran on the server. That event is destroying weapons

past totem
#

what

#

add the event end play to the pawn

#

not gamemode

harsh ice
#

Ahh now i understand

past totem
#

game mode is server

#

but thanks actually, that just made me realize that my weapons were staying in game after a player was leaving.

harsh ice
#

What ?

past totem
#

I just mean that I realized I have the same issue in my project

harsh ice
#

You have the same problem too ?

past totem
#

well I just never implemented it

#

but what I said should work

harsh ice
#

Did you fix it ?

past totem
#

I will now

harsh ice
#

So i have to call the event an endplay in the character blueprint ?

past totem
#

yea it works I just did it

harsh ice
#

I just saw a project and they called in gamemode or player controller

past totem
#

best is to do it in the character

harsh ice
#

It doesn't work in game mode so maybe this will work πŸ˜‚

tribal mango
# past totem can't u just think of it more technically, so like, can't u just, attach one of ...

Thing is, when I do that, because the player client sends the location of the player to the server it means:

  1. player1 grabs player2 on his client
    (they are performing an animation togather where player1 drags player2, so their position also keeps updating controlled by player1)
  2. player1 sends keeps updating the location of the now combined meshes of the two players, to the server for a period lets say 10 seconds
  3. the server sends the location of player1 to player2 which also performs the meshes attachment of player1 and player2
  4. the location keeps updating: player1->server->player2 for 10 sec

starting to write this I was skeptical but as I was approaching bullet 3 it all started to make sense
and it might work

past totem
#

thanks for the info

#

just try and see what works

tribal mango
#

Yeah I need u to verify what I have written

#

πŸ˜„

tribal mango
#

❀️

#

thats why i love to plan

harsh ice
#

Does this work waffle ?

tribal mango
#

Hmm im gonna give it a try soon and will report back

#

it will work for sure the thing is I am a bit concerned about network delay that's all.

#

thanks you guys I really appreciate the time you took to help me figure this one out

harsh ice
#

You had the same issue ?

past totem
past totem
harsh ice
#

I appreciate it's bro

#

Just i got curious

past totem
#

okay

stoic lake
#

Hi im trying to use a servertravel command, however it only works when the net mode is set to standalone. It doesn't work when I have net mode set to listen server

#

does anyone know why?

past totem
#

according to google

#

"Hey I just tried this for the first time and it seems server travel does not work in all preview modes, but it does in standalone mode."

#

this is what I searched btw

stoic lake
#

Which means the reviewer tried the product in editor.

past totem
stoic lake
#

alright, thanks for your help

tribal mango
#

looks good

#

lesson learned (

#

the millionth time, sometimes its faster to just check it out instead of speculating. am I right

past totem
tribal mango
#

running on dedicated server built from source

#

15 hours of building from source

tribal mango
#

network simulation

#

how does this coexists with ROLE_SimulatedProxy ? does it affect it, I mean I know its smth other then authority but the fact that I have this means I am on simulated network because I can see / use simulated actors

#

do u mean network simulation as in physics simulation on the server or smth? sorry I'm kind of lost

past totem
#

editor preferences*

tribal mango
#

oh and it simulates lags and packets and stuff>>?

past totem
#

yes

tribal mango
#

like not on lanohhh

#

lan*

#

ohh

#

thanks man !!!

#

wow assuming u are a man is not nice so whatever u are u are awesome!

#

wow my game is shit on real network

#

gonna work on that

past totem
#

πŸ˜… okay sure yes I'm

#

probably like 99% of the people here are

#

imagine girls coding

#

πŸ˜…

tribal mango
#

haha

#

but yeah thats not a nice thing to say dude

#

and I know some real good female devs

past totem
#

yea just jokking

tribal mango
#

i know i know

past totem
tribal mango
#

thanks mate gonna report back with the results asap

cold moat
#

can replicated variables be private? πŸ€”

latent heart
#

Yes

cold moat
#

on other engines I used and hated they couldn't hm

#

oh awesome

quasi tide
#

Wouldn't make sense if you couldn't.

latent heart
#

You said they fixed it. Did they rmeove it?

#

Heh

#

Is it ever called in the class?

quasi tide
#

More of a PB&J kind of person myself

latent heart
#

I had this lovely cheese and onion sandwich the other day.

lone kindle
#

I am willing to pay for multiplayer replication tutoring if there are any experts in here.

past totem
quasi tide
#

In my experience, the people who offer to pay for private tutoring can't actually afford an expert's price.

lone kindle
#

Sucks for you?

quasi tide
#

Not really. I'm not the one in need of private tutoring πŸ˜›. But #freelance-jobs is a more appropriate place to post for these kind of contracts.

past totem
#

help me decide which gun position looks better

#

first or second

#

I switch mid way

quasi tide
#

I think it's so closely similar it is hardly even noticeable

#

So, doesn't matter

#

Final answer

past totem
#

I'm terrible at this it has to be as perfect as possible

#

I can't just choose a random one

quasi tide
#

I just flipped a coin. Coin said first.

#

There, I chose randomly for you.

past totem
#

but I'm leaning towards the second

#

oof

quasi tide
#

You don't have to trust the coin.

past totem
#

but I'm not sure

lone kindle
#

Does anyone here offer tutoring services for multiplayer replication? I have stuttering issues on spell casts and movement. Instead of just fixing some issues for me I want someone well versed in the process to teach me along the way.

quasi tide
lone kindle
#

It doesn't work.

quasi tide
#

Or, you can just describe your problem here and people might be able to help

lone kindle
#

No, I explained what I wanted. You can ignore my posts as you are too arrogant to understand what I want and that /freelance is not working according to the instructions unless you know another way to post in freelance.

quasi tide
#

Huh - worked for me

lone kindle
#

Yes it worked after the third time, thanks. You can see me posting /job freelance in general chat.

past totem
#

I'm pretty sure once it works we can't see it

lone kindle
#

What do you mean by that? It's already posted. You have such a shitty personality.

#

Posted well before you comment.

quasi tide
#

Dang - imagine trying to ascertain someone's entire personality based on like 3 statements.

lone kindle
#

No, the conversation continued in general chat.

#

And in private chat.

#

You're moving up there with him.

quasi tide
past totem
#

I'm merely pointing out the fact that commands that work can't be seen by other people, so if u posted /job freelance and it worked, we can't see it

past totem
lone kindle
#

As an example of it not working.

past totem
#

yea and thats'; why we were able to see it

lone kindle
#

Then I apologize for that particular misunderstanding, I thought you were referencing my post in freelance jobs.

past totem
#

it's all good it was funny

lone kindle
past totem
#

but how would I know if I would tutor you or not if I don't know what it's about

#

I couldn't answre

lone kindle
#

That is not what I asked.

#

Yes you can.

#

I did not ask "Will you tutor me?"

past totem
#

your question was too generic and this discussion is neither interesting, funny, or has any point

#

why's that ?

#

Ik it's neded for dedicated servers but if u r using listen servers maybe it's not needed?

graceful flame
#

So you can have a separate client and server target build.

lone kindle
#

I've read a lot of it, I have multiplayer running in my game, most things work, I have issues. Most resources seem to either bee to generic for my understanding or too specific to not relate to what I am doing. I can and will continue to push through this and learn, but I am asking if someone is willing to offer tutoring services to me.

quasi tide
#

What - the tutor request has absolutely nothing to do with server builds, lol

lone kindle
#

No, I am asking for a tutor too look into my examples and show me proper ways of doing things. I do not want a long term partner or employee.

quasi tide
lone kindle
#

I have found 3 and have appointments. Those don't start until next week. I was looking for someone more readily available. Lots of people good at giving bad advice here, yourself included.

past totem
#

u guys just relax

lone kindle
#

I am merely defending my simple requests from snarky comments.

lone kindle
past totem
#

you're right cuz I didn't want your dms and neither do I want this discussion

lone kindle
#

Yes, you do. That's you keep replying to my request even though you have no interest in actually tutoring.

past totem
#

nop

lone kindle
#

I posted in freelance jobs, and I did specify more in this channel.

quasi tide
graceful flame
#

So there's this really neat feature Discord has called "block user". Just saying.

lone kindle
#

I am not interested in solving the problems in this channel, I was interested in finding people wanting to tutor.

graceful flame
#

I heard if you use it properly, then you can totally get on with your day.

kindred widget
#

I always miss the fun conversations. 😦

limber cloak
#

What am I doing wrong? The NetMulticast doesn't work. The code is placed in the Character class and the function was called from the Server.

UFUNCTION(NetMulticast, Reliable)
    void NetMulticastDoFunction(class AMovingPlatform* thePlatform);
    void NetMulticastDoFunction_Implementation(class AMovingPlatform* thePlatform);
void APuzzlePlatformsCharacter::NetMulticastDoFunction_Implementation(AMovingPlatform* thePlatform)
{
    if(thePlatform)
    {
        thePlatform->Test();
    }
}
plucky prawn
kindred widget
#

Would definitely start with a UKismetSystemLibrary::PrintString(this, "NetMulticastDoFunction"); above the if statement.

limber cloak
#

the server function works, just the netmulticast doesnt work

#

server function is placed in the character class, the netmulticast is placed in the character class, but the change mesh is placed in the actor class

kindred widget
#

Start with a print. See if it prints anything using the Kismet print has the benefit of also showing which machine ran it.

limber cloak
#

server runs the change mesh function and the netmutlicast function

limber cloak
kindred widget
#

You should be able to test this sort of basic thing in PIE. Also, you said something about this being for setting a mesh?

limber cloak
#

ill show you the code

#

I also tested this on host

#

when the client runs the code, the host changes the mesh, but the client doesnt

#

when the host runs the code, the client changes the mesh, but not the host

#
//I call this function from a Mouse button click
void APuzzlePlatformsCharacter::MyFunction()
{
    //The client will call the function
    if(GetWorld()->IsServer()){return;}
    ServerCharacterFunction();
}

void APuzzlePlatformsCharacter::ServerCharacterFunction_Implementation()
{
    FHitResult hitResult;

    FCollisionShape sphere = FCollisionShape::MakeSphere(20.f);

    FVector locationForward = GetActorLocation() + GetActorLocation().ForwardVector * 2000;

    if(GetWorld()->SweepSingleByChannel(hitResult,
    GetActorLocation(),
    locationForward,
    FQuat::Identity,
    ECollisionChannel::ECC_Visibility,
    sphere))
    {
        AMovingPlatform* theMovingPlatform = Cast<AMovingPlatform>(hitResult.GetActor());

        if(theMovingPlatform)
        {
            theMovingPlatform->Test();
            NetMulticastDoFunction_Implementation(theMovingPlatform);
        }

    }
}

void APuzzlePlatformsCharacter::NetMulticastDoFunction_Implementation(AMovingPlatform* thePlatform)
{
    UKismetSystemLibrary::PrintString(this, "NetMulticastDoFunction"); 

    if(thePlatform)
    {
        thePlatform->Test();
    }
}
#
private:
    void MyFunction();

    UFUNCTION(Server, Reliable)
    void ServerCharacterFunction();
    void ServerCharacterFunction_Implementation();

    UFUNCTION(NetMulticast, Reliable)
    void NetMulticastDoFunction(class AMovingPlatform* thePlatform);
    void NetMulticastDoFunction_Implementation(class AMovingPlatform* thePlatform);
#

that's on the Character Class

#

actually, when its 2 players , that's what happens

kindred widget
#

For starts. Probably nothing to do with this issue, but don't gate server like you're doing in your first function. If this is meant to be changed by player, it shouldn't matter whether a player or server calls this first function. Both of them can call the server function. Server simply calls it locally instead of networking it if they're a listenserver. Much less branching in your netcode.

#

What is Test doing?

limber cloak
#

and the host works totally fine now

#

when the host left clicks, it changes on all clients

#

but when the clients, it changes on the host only

kindred widget
#

You're calling Test twice on Server technically. Don't need to call that locally when you have the Multicast there.

limber cloak
#

sorry i was wrong

#

when the host calls the function

#

i mean when host left clicks, only the host changes the mesh

#

not the clients

#

and also when the clients do that too, only the host changes the mesh

kindred widget
#

Are your moving platforms replicated?

limber cloak
#

yeah

#

replicated + movement replicated

kindred widget
#

Should be valid on the client then. Bit odd.

#

On another note though. Are you planning on doing anything besides changing the mesh here?

#

Asking because your current task is better suited for an OnRep through replication rather than a multicast.

limber cloak
#

just change the mesh

#

what do you mean OnRep?

#

im doing this to learn netmulticast

#

πŸ˜„

#

maybe because its pointer ?

#

i mean

#
void APuzzlePlatformsCharacter::NetMulticastDoFunction_Implementation(AMovingPlatform* thePlatform)
{
    UKismetSystemLibrary::PrintString(this, "NetMulticastDoFunction"); 

    if(thePlatform)
    {
        thePlatform->Test();
    }
}
#

the address is different for the host and for the client

#

right?

#

could be that I think

kindred widget
#

Multicasts are more for like, playing a quick emote that won't affect gameplay. Or broadcasting random things that don't need state. Your mesh needs state. It should definitely be a replicated asset pointer in the platform. ServerRPC should get the platform, and tell it to change the mesh pointer, then set it locally. Asset pointer can replicate to clients, and have an OnRep that locally changes the component's mesh to the new asset.

#

The pointer should be fine, that's why I asked if the platform was replicated. Pointers to assets, and pointers to replicated actors/actorcomponents/UObjects are net addressable. They get converted to a guid for sending, and then back to a pointer on the other side of the RPC.

limber cloak
#

this works on all client, including the host

UKismetSystemLibrary::PrintString(this, "NetMulticastDoFunction"); 
limber cloak
#

or

kindred widget
#

Dunno without testing it. Either the pointer is invalid on the client, which isn't likely if it's a correctly replicated actor and the client can see it. Or whatever you're doing in test isn't correct.

pallid mesa
#

recommended read for the use case

limber cloak
#

my case is, they are all connected

#

once a player (after they are connected) left mouse button clicks, it should change the mesh for all

twin juniper
#

It’s your case then lol

#

Use OnRep

limber cloak
#

can i use chat

#

onrep?

#

i mean simple chat system

twin juniper
#

You should have the answer if you just read what vori linked you πŸ€·β€β™‚οΈ

limber cloak
#

I did

#

when a variable changes, it will replicate

#

even if someone joins later it will replicate

#

but instead of storing all the messages on a TArray

#

is it possible to do it with netmulticast?

latent heart
#

I wouldn't use onrep for chat, just a multicast.. maybe even an unreliable one.

#

Do you need a chat history when a player joins late?

#

And if you do, probably better to do an rpc to that player of the last x chat messages or something, rather than constnatly replicating a tarray.

plucky prawn
#

Why did you ping me?

#

I'm not really in a position to check code at the moment

limber cloak
#

ok

#

sorry

plucky prawn
#

Ping me in like... 5 hours

gleaming kite
#

Whats a good place to bind delegates for clients? PostInitializeComponents doesnt seem to fire on clients for server owned actors, which makes sense but is there a "proper" place/way to bind delegates?

plucky prawn
#

Depends what you are trying to bind. Chances are the delegate you are binding is fired before that function is called

gleaming kite
#

Its latent stuff like match state and what not, nothing immediate. Its on a rep notify so it will always fire for late clients

#

but that leads to the question, does begin play fire before any repnotifies are delivered to clients?

plucky prawn
#

Are you binding the delegate in repnotify?

gleaming kite
#

no

#

delegate is being broadcasted in the notify

gleaming kite
#

gotcha

plucky prawn
#

I tried figuring out the order of networked called and.. Well I didn't get anywhere. I'd try and think of another solution if you are relying on this. Even if it's janky af, just get it working lmao

#

I sunk way too much time trying to do stuff the "right" way

gleaming kite
#

yeah.. begin play seems to work fine for me so I suppose I will use that

#

post login might be a good entry point though

plucky prawn
#

I couldn't figure out how to check if a client has a valid game state and other replicated stuff. Instead of checking it on tick, I overrode all the onrep functions I needed in c++ to set flags, then each time a flag is set I check if all flags are set and if so, I do a server RPC to say I'm ready. It's a stupid solution when I could have done a one liner on tick

gleaming kite
#

Yeah that doesnt sound too bad

plucky prawn
#

I mean i thought it was more elegant than tick because I wasn't doing useless checks in tick, but it was a dumb micro optimisation that didn't matter

gleaming kite
#

its always a struggle to draw the line between good architecture and dumb micro optimizations haha

plucky prawn
#

Comes with experience I guess

gleaming kite
#

definitely

graceful flame
#

So I just implemented object pooling on a laser weapon that has client side prediction to reduce the feeling of input lag, but now the ownership is all screwed up because the server owns both server and client laser beams because they're pooled by the server instead of spawned by a player with a RPC. Not sure what I can do to resolve this other than abandon object pooling for the client. Any suggestions?

The laser beam does a line trace and may or may not continue on depending if it hits a mirror or not. It spawns in a laser beam actor with a mesh, does some distance calculation work then sets the rotation and scale. Only the server side laser beam is being used for gameplay related collision events, the client beam is just for looks.

I used to have it so the client laser beam was only visible to its owner but can't now because it isn't being spawned by the player anymore.

graceful flame
#

I drew a diagram to help make sense of my issue.

past totem
graceful flame
#

That just brings the network lag back. No thanks.

#

and im not going to use reliable on tick either

past totem
#

I don't think I can top off that response 🀣 🀣

short arrow
graceful flame
#

But its used for collisions to drive gameplay, it must be server side.

#

And to reduce the player's feeling of laser lag I use a second laser beam that's visible for them only.

short arrow
#

The only thing that technically has to be replicated is the beam you want everyone to see . If you want a lag free experience let the client decide what it hits collision wise

graceful flame
#

I'm just not going to use object pooling for the client side beam. The server beams are pooling just fine now and the ms has been saved.

short arrow
#

and then send that information to the server unreliably

#

if you're worried about hacks and what not then do as many light weight checks on the server as you can to verify what the client says makes sense

graceful flame
#

I'm just going to not use object pooling for the client beam

#

Those will be spawned and destroyed without replication and since they're a separate blueprint actor there's no gameplay logic happening if it collides.

short arrow
#

yeah I'm not sure why you need actor pooling for a lazer anyway

#

don't people use particle effects with a line trace for that

graceful flame
#

because it spawns in more and more whenever it bounces off of a mirror

#

and runs on tick

short arrow
#

that wouldn't pose any problems tbh

#

you should be more worried about fps rather then tick performance from the laser particles

graceful flame
#

That's why I added pooling

#

tick times were large when I had 4 other AI's using the laser, then with object pooling it went way down

#

Particles are only spawned in once on hit

#

The laser beam is a mesh

short arrow
#

What exactly do you have on tick that could be so expensive for a laser?

#

aren't you just line tracing, or sphere tracing?

#

you should be able to have 10,000 lazers on tick

graceful flame
#

You can follow along if you'd wish: https://www.youtube.com/watch?v=EM1MkdDW0Ic

In this free step by step Unreal Engine 4 tutorial video (UE4 how to) you will learn how to make a laser system that reflects light with emitter, sensor and mirrors using blueprints.
All my UE4 tutorials: https://www.youtube.com/watch?v=BT0jFArPtGM&list=PLEp7216xGGILh3i2BZe2E0ZEuiIGa-VQT&index=1

Download Light Bulb asset: https://drive.google....

β–Ά Play video
short arrow
#

I mean you'd have 2 fps probably from the particles but tick wise wouldn't be a problem

#

let's see here

graceful flame
#

I used that as a starting point, and added a second (client only) laser.

#

I plan on adding particle effects during warmup, and cooldown and maybe some near the muzzle while the laser is on but not as the primary component.

left lance
#

I'm using the default template in UE4 and I'm getting some very slight rubber banding on my character class when I walk around with AddMovementInput. E.g., Client 1 watches client 2 move, when client 2 stops, client 1 sees them move forward a bit more and then correct back to actual position.

However, I don't see this behavior when I'm looking at the third person template. I have no idea why I see it in my project, but not others. I'm testing via 2 clients in editor.

Does anyone have any suggestions?

graceful flame
#

Are you using the CMC (Character Movement Component)?

left lance
#

Yep - it's just the base Character class - no additions to it other than movement input

graceful flame
#

Using default values for tick and network update frequency?

left lance
#

Yep!

graceful flame
#

Are you emulating lag?

left lance
#

Not intentionally - what's the setting for me to double check that?

graceful flame
#

search for "network" on the editor preferences

left lance
#

Network Emulation is disabled

graceful flame
#

there's only a small part under the heading Level Editor - Play for some Multiplayer options

#

If you play the game with p.netshowcorrections 1

#

Do you see lots of capsules?

left lance
#

Nope - don't see any capsules actually

graceful flame
#

so its not server corrections, its something else

#

If you make the character's capsule visible, and use p.netshowcorrections 0 does the capsule have the issue? or maybe its just the skeletal mesh and some animation causing the problem.

left lance
#

It's hard to tell... But I think no. The item that's rubber banding is a static mesh that is a child of the skeletal mesh (but the skeletal mesh is set to be None) Would that cause anything?

graceful flame
#

set to be none?

left lance
#

As in I'm not setting the skeletal mesh on the character

graceful flame
#

So the static mesh is a child of none?

#

How does that work?

left lance
graceful flame
#

will there be a skeletal mesh in the future?

#

it seems like if all you're doing is adding a hat, then the hat should be a child component attached to your character

left lance
#

No, TLDR - this will be a VR game, but I need a PC character for easier testing

#

The hat is so I can visualize

graceful flame
#

So when you move the hat lags behind?

#

But what bone is the hat attached to if there's no skeleton?

left lance
#

More like when I stop the hat goes to far and then resets

#

No bone, just standard parent/child

graceful flame
#

Maybe it's easier to make a new Pawn and then add your Hat mesh and the CMC?

#

So there's no empty skeletal mesh

left lance
#

I'll give that a shot πŸ™‚

graceful flame
#

and capsule

#

oh I guess you can't add the CMC to a pawn without using c++

#

but then again why would anyone want to do that, when they could just use a character class....

#

@left lance what if you make the hat a child of the capsule and not the skeletal mesh?

left lance
#

It gets a better when attached directly to capsule, but still there a bit

short arrow
#

I went ahead and made a fully replicated laser beam that could bounce off mirrors like you wanted, and it uses minimal replication

#

The first laser is spawned by one replicated actor, after that all other lasers are calculated and created on their own by the client, so the server never has to send any information about it.

#

the only thing that get's replicated is when a lazer actually hits an object that should do something (which is checked by the server)

#

it only took about 10 mins to make, if what's in the video is what you were looking for then I can send you the code

#

you should be able to have as many mirrors as you want bouncing off of eachother without any problems

graceful flame
#

Oh cool, you didn't have to make anything lol. But also could you test with emulated network lag? Is there any noticeable lag when you enable / disable it? What about when moving around does it lag behind?

short arrow
#

With clients having bad lag the end result of the lazer will always wind up being the same, but ofcourse will take longer to reach the end point

#

same with the box, the color might change slightly late, but it will always end up the same color

graceful flame
#

oh that's close to what I've got going on here, but what I'm going for is more like the lightning gun from quake that also bounces off mirrors for bonus damage

#

So to reduce the client side feeling of lag due to the network having to replicate I make two beams, one is client only and doesn't replicate while the real server one has its mesh hidden for the owner.

#

But then with object pooling it stops working for the client beam because now the server owns them, so I just decided to spawn / destroy that one instead of pooling it.

short arrow
#

the only lag you're really seeing here is client 2 waiting for client 1's rotation to be updated

#

you can't make that feel any better, unless you somehow could predict which way client 1 is going to rotate

graceful flame
#

Im curious to see what you've made though

short arrow
#

sure, maybe it'll help

graceful flame
short arrow
#

@graceful flame
Character: (replicated, has beam component)
https://blueprintue.com/blueprint/3virh7_a/
Mirror: (not replicated, has beam component)
https://blueprintue.com/blueprint/7u3hos1q/
Replicated Box: (Replicated)
https://blueprintue.com/blueprint/x8en_hz3/

#

The lasers are instant and have no log in-between hitting the mirrors because they already exist and are ready to go. none of it requires replication

#

I don't think it can get any less lag free

#

because it's already completely client sided

graceful flame
#

I don't know my way around cascade particles, what does your particle system look like? The sharing website doesn't come with components.

#

I only know Niagara πŸ™‚

loud frost
#

, when a client pick weapon it will only show in server , not in client , can you plaease tell me where it should be a mistake , like in repNotify or ny other thing

rotund cosmos
#

Hey Guys. Are the replicated variables set in PlayerState going to persist across levels when using server travel with seamless travel enabled?

rotund cosmos
# short arrow Si

So I can keep player specific data in it and it will be the same after the level changes, awesome. Ty

dark inlet
#

Hello everyone! Can anyone answer some of my questions about networking in private chat? (dedicated server, collaboration, hosting..)

bitter oriole
#

Feel free to ask here

dark inlet
#

Alright then

#

For reference: the game we're thinking of making is an FPS Multiplayer, something like DayZ (dedicated servers, no matchmaking)
When working with a team, does everyone need to have the source engine built?

bitter oriole
#

As long as everyone understands what they're doing, you can develop with listen server in mind and dedicated is kind of a simplification of that

#

Then each week or so you could freezer multiplayer work, compile the dedi, debug and test that, and resume work

livid holly
#

Hey all. I'm trying to implement a disconnect/reconnect system. I have based on WizardCell 's guide (https://wizardcell.com/unreal/persistent-data/) but I have some differences: in the game I'm working I do not want to destroy the Pawn on disconnect and re-instantiate it on reconnect.

I was able to override some methods in GameMode, PlayerController, and PlayerState, and it seems to work fine for the server; when a player reconnects, if they have an Inactive Player State, the game mode will get its pawn instead of spawning a new one. The server does indeed find the right pawn and associate it with the re-connecting player.

However, it seems like the reconnected player doesn't properly replicate. Actually I have this issue even when disconnecting

#

more details: I want something like a MOBA, where if a player disconnects we have an AI Controller possessing it.
That part is working, however there seems to be a mis-communication between server and client. The newly-spawned AI does properly possess the player, but when it does an action that should be replicated to the clients, it doesn't seem to work.

Also, when I join as a reconnecting player, in the server it looks fine but the new client doesn't see the pawn, as if it hasn't been properly replicated

#

has anyone struggled with that? What is the proper procedure for a disconnect/reconnect involving keeping the same Pawn?

dry orchid
#

thats my code for the action. I dpawning the SpawnCanicaClass from the client to check if the clients rotation was right

#

and it is, but once the server spawn it it does not

#

thats the correct code. Anyonw knows why this is happening?

storm bough
#

I am trying to use custom data in player state (PS_Gameplay inheriting from PlayerState) for multiplayer. I have two variables (Color1 and Color2 used to set tint on mannequin) that are set as replicated, but they do not replicate as I expected or intended.

I have setup with listen serwer and two players, host and one client (two separate computers). I set colors in UI widget for current player only. I resolve player state by GetOwningPlayer->GetPlayerState, casting it to PS_Gameplay and SetColor1 or SetColor2. I have in UI list of players and their colors, retrieved directly from their player states.

When I am on host, change of color of host is visible to me (host) and client.
When I am on client, change of color of client is visible to me (client), but not visible to host.

Intended result is, obviously, that any player can change their own color and that change is visible to all players.

I can only conclude I still do not understand something about replication of properties. Only way I can think of is calling server via RPC and server in turn updating color in PlayerState, but... surely you can do that without RPCs?

livid holly
past totem
#

Only way I can think of is calling server via RPC and server in turn updating color in PlayerState, but... surely you can do that without RPCs?
it sounds like this is exactly what you are missing. no, it's not possible to send data from the client to the server without RPCs as far as I recall

past totem
#

replication only works server -> client, not the other way

#

πŸ‘

storm bough
#

so if I want to do on client something important then I always must do it via server?

past totem
#

well depends on what u mean in important but generally ye

storm bough
#

thanks

livid holly
#

I still have a huge issue with the disconnect/reconnect thing. When reconnecting the client gameplay abilities fail. Server keeps rejecting ClientActivation after the reconnection happens

past totem
livid holly
past totem
#

ok Idk what u mean so I prob can't help

livid holly
#

unreal has those exec commands that simulate a disconnection and a reconnection. If I disconnect the player and try to join the session in the "regular" way, it doesn't work (at least in OSS Null) because it says it already has a named session. But if I use reconnect then it works

vagrant falcon
#

can someone give me a hint how to replicate variables inside of local player subsystem

winged badger
#

Have an Actor replicate them instead

#

You cant replicate ULocalPlayer

#

Or its subobjects

vagrant falcon
#

will it make a trick if i make abstract class of it?

winged badger
#

Nothing to do with sbstract classes

vagrant falcon
#

k thanks

winged badger
#

Teplicated variables font really belong in locsl player subsystem

vagrant falcon
#

i'm making system to manage assets SM, SK and etc

#

with soft refs

winged badger
#

That should definitely not be networked

vagrant falcon
#

i though i will record an array in game mode of assets currently in use and when i'm connecting to server i will sync array and load those assets

#

it should support preload as well

winged badger
#

If its currently in use might as well ise hard refs

#

Preload is different matter

#

But anything doing sync load

vagrant falcon
#

async

winged badger
#

Will flush your async loading

#

And at the moment of connecting, something will sync load something

#

Undoing your system in the process

vagrant falcon
#

damn, how can i bypass it 😦

winged badger
#

Preload does work

#

But that depends on knowing assets in advance

vagrant falcon
#

i was planing to make TMap's like FString, SM inside of data asset that containts all assets data
and preload/load by key

winged badger
#

Then you csn ptrload in lobby anf keep asset pointers hard refd

dark inlet
vagrant falcon
winged badger
#

It doesnt matter, as long as you can do NAT punchthrough

#

Dedi or listen

#

If you preload, you want to keep hard refs after

#

So they dont unload

vagrant falcon
#

mby gameinstance subsystem ?

winged badger
#

Then clear the when no longer needed

#

I use asset manager

vagrant falcon
#

does it work well ? cause last time i was looking on it and it was a little bit complex for me xD

vagrant falcon
toxic dagger
#

Hi, when spawning an actor it doesn't show up on the client it only does for the server.

This is my spawn code:

void APlayerCharacter::SpawnEquippedWeapon_Implementation(UClass* Weapon)
{
    if (EquippedWeapon) return;
    if (!Weapon) return;
    TSubclassOf<AActor> ActorClass = Weapon;
    EquippedWeapon = GetWorld()->SpawnActor<ABaseGun>(ActorClass);
    EquippedWeapon->SetOwner(this);
    EquippedWeapon->AttachToComponent(SceneComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
}```
quasi tide
#

Make sure the actor is replicated.

toxic dagger
#

In the constructor of the actor bReplicated is set to true

worthy magnet
#

I am using a dedicated server and one client sees everything with a lot of lag and the other sees just fine. Why is this?

dark edge
worthy magnet
#

Both on my pc testing in editor

past totem
opal fox
#

im trying to fire this sound and animation on clients, am i doing this correctly?

Im only trying to get the onrep event to do what it says in it, on clients

past totem
signal lance
opal fox
#

@signal lance why must the component be replicated?

past totem
opal fox
#

@past totem very funny dude

signal lance
opal fox
#

i just didnt comprehend it as the component needing replication

#

since it has an owner who is replicating

past totem
signal lance
#

@past totem stop, ty

opal fox
#

ok so the owner replicating isnt enough

#

im gonna try to replicate the component aswell, sec

#

@signal lance thanks dude that seemed to do the trick, i thought i was going insane. Im sure I did read that if the owner of an actor is replicated you dont need to replicate it

#

but I might have misread that, need to double check what the rules are for this

#

says this in the documentation

#

Components replicate as part of their owning Actor.

signal lance
#

Yeah basically all replication is handled through actors, when the actor replicates it also gathers replication data only from its replicated subobjects so keep that in mind

#

It won't replicate anything from a component if the component isn't set to replicate

opal fox
#

I see

#

I also read this

#

Static components do not need to be made to replicate to exist on clients; they exist by default. It only needs to replicate when properties or events need to be automatically synchronized between server and client.

#

Dynamic components are components spawned on the server at runtime and whose creation and deletion replicate down to clients. They work very much in the same way Actors do. Unlike static components, dynamic components need to replicate to exist on all clients.

#

@signal lance appreciate the help, works fine now following those rules

signal lance
#

Yeah static components are ones that are created together with the actor, either added in bps or in constructor

oak prawn
#

I don't have this event, we both use the same plugin?

pine reef
#

Guys, how to replicate a variable to late joiner?

oak prawn
#

I don't have these parts

past totem
#

@oak prawn google advanced sessions plugin

oak prawn
#

if you have the link of this plugin can you send it to me πŸ˜„ @past totem

#

I downloaded this plugin but I don't have it

past totem
#

looks correct

#

maybe u downloaded it wrong

#

maybe u put it in the wrong path

#

UR Project/Plugins/[these 2 folders]

oak prawn
#

there are other things join session create session etc but they are not the only ones

#

I assigned the events myself πŸ˜„

dark edge
royal isle
#

Hey guys. Is there any resource whatsoever on the new Iris Replication system? From what I can see not even the source code has all the needed documentation at this point but I was wondering if I missed something.

chrome bay
#

Not yet, it's still in development

plucky prawn
#

wait theres a new replication system?

royal isle
plucky prawn
#

πŸ€”

royal isle
plucky prawn
#

very nice

#

that experimental tag wont stop me shipping it though

graceful flame
#

Iris will be like this ^ right?

twilit radish
zenith wyvern
#

I feel like I'm doing something wrong. There are a ton of UI actions I want to perform, as well as from other not 'owned' actors, so I have trouble with actually calling things on the server

#

I'm making passthrus on my controller just to call every function, like on the left

#

the right is about to get the same treatment, but hoping for better solution

sinful tree
#

Your inventory component should be using OnRep variables to replicate changes to your inventory. The OnReps can call an event dispatcher that your UI can bind to so it can update itself.
The component, if attached to a player owned replicated actor (like player controller, their controlled pawn, or playerstate) can then RPC to the server itself.

zenith wyvern
#

but, im calling these from ui/buttons

#

so its all calling from a client, which doesnt happen on server

sinful tree
#

Right, so your UI would need a reference to the player's inventory component, and call the necessary RPCs on the component.

zenith wyvern
#

thats what the call to remove is doing right now

#

and inv comp has comp replicates on

#

oh i bet its a function huh

#

it is! ill fix that

past totem
#

Hi, how do I get the local player num?
Without any input this works for the client player, but not for the listen server player, gives this error:
LogOnlineVoice: OSS: Invalid user specified in RegisterLocalTalker(1)

zenith wyvern
#

How can i manage 'local' variables when I have to use custom events instead of functions, without it getting messy. seperate graphs?

past totem
#

collapse nodes ?

#

and you can still use functions, but they have to be after the event

chrome bay
#

Just have the event call a func

#

Quite bizarre how the engine doesn't allow BP functions to be RPCs

past totem
#

ye lol

zenith wyvern
#

Datura, I made it a server RPC on the replicating component, and it doesn't fire after being called in UI

quasi tide
#

Events have to be void

chrome bay
#

ahh yeah for sure

quasi tide
#

Sure they could've parsed the function to make sure it didn't have a return value. But that may just be more work overall πŸ˜…

sinful tree
past totem
#

when checking on the server, what node to check if this player controller is the listen player that's hosting?

sinful tree
royal isle
past totem
#

I will try the second solution thanks

past totem
past totem
#

Listen server:
how can I execute only on the owning client from event tick?

#

so like I have something that I want to run only on the owning client and not the listen server

#

oh, has authority. right.

#

wait but has authority doesn't work if the owning client is the host

#

so I need something else

#

ok I figured it out

steel fractal
#

hi everyone, im trying to figure out why dropping my weapon with physics wont work. The physics works when i enable Start Simulate physics from the details panel. But not when i call this code.

#

well i disconnected mc_drop in the piture but i had it connected when i tried to do it lol, i just removed it to test some stuff

past totem
sinful tree
#

Why not just do these things on the begin play of the item that is dropped?

past totem
#

also physics on MP shouldn't have collision unless you are gonna sync the server position to the client

unkempt tiger
#

Gameplay tags replicate in a it-just-works style, right?

steel fractal
steel fractal
sinful tree
#

Add a boolean to your weapon, set it to "exposed on spawn" and "instance editable", name it something like "ItemInWorld". Refresh your spawn node, you'll now have that boolean available. Set it true.

#

In the begin play, do a branch based on that boolean, if true, run those commands.

#

Oh, and mark the boolean as replicated.

steel fractal
wooden cypress
#

Does anyone know if the Advanced Sessions Plugin can only be used with two people from the same country?

junior temple
#

Hey there, how can I make actor/area appear blue or red depending on which team unit is on it?

dark edge
#

Set team variable whenever someone enters or leaves

junior temple
#

ha just noticed your name

dark edge
junior temple
#

Wait so how does this help me? Whats a team variable and how do they go together? I still dont understand the basics of how this would setup

#

example talks about streetlight changing on delay

quasi tide
wooden cypress
#

oh ok nice ty

dawn ledge
#

@junior temple your team variable could be a bool, int, enum, or however you wish to represent which team something belongs to.

RepNotify is a method of replicating variables across a network, so that the client and server are synced with the same value as best as possible. You should read up on what replication is and how it works. I recommend searching for Cedric's UE networking compendium and reading that

loud frost
#

bReplicateMovement showing error in actor

junior temple
#

I mean how do you even setup multiple teams to begin with before assigning variables and stuff

graceful flame
# junior temple I mean how do you even setup multiple teams to begin with before assigning varia...

You can start out with making your first GameMode and GameState blueprints. Right click inside the content browser >>> Blueprints class >>> GameModeBase and again for GameStateBase.

The GameMode (server only) is where you can define the rules and win conditions of your game. You can think of GameModes like the differences between TDM, FFA, KoTH & CTF.
The GameState is where you can keep track of team scores and round timers...etc

So to answer your question how to setup multiple teams you can define some variables inside the GameMode blueprint to handle the data that makes up what a team is. Number of Players Team A, Number of Players team B. Then you can further define rules with simple booleans such as "ArePowerWeaponsAllowed?" that sort of thing.

Then later when you get around to making the various actors in your level they can reference data from the GameState and GameMode to alter their behaviour.

junior temple
#

I think I understand, but so then how/why would you use gamemode and gamemodebase seperately? Also, how would a blueprint for the gamemode look like for lets say 2 player game like chess with spectator slots as well?

#

and would the gamemode blueprint be on client or server and how would you do that?

graceful flame
#

The GameModeBase is just what you select when you're making your own GameMode.

junior temple
#

oh ok

graceful flame
#

GameMode lives only on the server, but the GameState lives on both sever and client.

junior temple
#

so then I set gamemode blueprint when building a project with the server stuff and it automatically goes to server

#

or do i have to deploy a different thing on the server seperetaly

graceful flame
#

One of the steps is to separate your build into client and server targets, then only the server executable is uploaded to a dedicated server, and the client exe is uploaded to Epic or Steam or whatever.

junior temple
#

so Im building two games basically with two different set of rules?

graceful flame
#

No

junior temple
#

so its not two seperate projects?

graceful flame
#

There's only ever one real simulation and its on the server. Clients are just running their own simulations and replicated data flows down from the server to the client so that on their computer they see the other player characters moving around on their own.

junior temple
#

ok so im not making two seperate projects then

graceful flame
#

correct

junior temple
#

but using one project to upload something to a server

#

then giving the rest of the game to the client?

graceful flame
#

Before you compile your game you have to setup a separate server target if you plan on hosting with dedicated servers.

#

If you are using listen server then there's no need for separate server / client builds.

junior temple
#

no i need a seperate dedicated situation

harsh ice
#

I have created a dedicated server game with aws but how can I create a new session or something after max player join is filled

junior temple
#

and for testing ill prolly be using aws free version

harsh ice
#

I am doing the same

graceful flame
#

Server testing is probably one of the last steps though

#

Because you want a playable somewhat bug free game before you upload and start consuming AWS free tier credits.

harsh ice
#

Now I just need to know how i can create a new session after max player number is completed

junior temple
graceful flame
#

Have a read through that link I shared

harsh ice
#

Aws will give you virtual computer

graceful flame
#

you just edit like one file and then when you compile your game it separates them for you

harsh ice
#

You can run the server there and close the virtual pc

#

You have to put there ip address in your game

junior temple
#

oh ok, I think im starting to get a bit of the picture here

graceful flame
#

Dedicated server setup is probably one of the last steps though, you can test your game with PIE for most client stuff, then standalone mode to test with Epic/Steam integration and hosting / joining sessions then finally a real server build and friends to test with for an alpha.

harsh ice
graceful flame
#

No I haven't started with AWS dedicated server hosting with my game yet

#

I only know the main steps, not the fine details.

junior temple
#

one for the server and one for steam clients

graceful flame
#

Yea, the server runs a headless version of the game. Just a terminal, no graphics.

junior temple
#

that makes sense

graceful flame
#

And since the server doesn't have any graphics to render it can run the game faster without having to require really fast specs. Servers can host multiple instances of the game at once so you can squeeze more out of them for a cost savings.

junior temple
#

and unreal engine is doing all the work for you in producing this version?

graceful flame
#

But there's definitely a challenge in finding out what are the minimum required server specs for your game and that can change depending on how many instances per server you want to run

junior temple
#

what do you mean instances? use chess with spectators as examples

graceful flame
#

I can't just use chess with spectators as an example because that's not a real game with a frame rate and blueprints ticking all over the place...lol

junior temple
#

ah ok fair enough

#

but i mean by minimum specs do you mean how many games in one server?

graceful flame
#

But yea the most important thing to understand is that only the server is running the real game. All connecting clients are simulating a network lagged version of the game on their machines.

graceful flame
#

Since AWS has so many options you have to determine the best option yourself using your completed & compiled alpha version of your game. You ask some friends to join you in a session and see if the performance drops.

#

It might be more cost effective to choose AWS server option (a) and use 10 instances of your game with 10 players per instance or maybe its cheaper to use AWS server option (b) with 2 instances of your game with 10 players per instance and then spin up additional option b servers as needed.

#

That all depends on how demanding your game is for the server to handle without dropping below a playable performance level while under harsh testing conditions. (ex: 10 players all spamming projectiles at the same time, that sort of thing)

junior temple
#

gotcha ok that makes sense, so if its a 2 player RTS game, itll occupy 2 slots per instance (or more if spectators) but the server will have to take the load of all the units, movements and stats?

graceful flame
#

The trick is to design your game in such a way that reduces the amount of work the server has to do while also ensuring that critical gameplay logic is handled only on the server so that cheaters can't run wild.

#

Same thing goes for the data that must traverse the network, you can use things like net cull distance, update frequency rates and relevancy to reduce the amount of data that flows between server and clients at any given moment.

#

Players on other sides of the level don't need to updating each other's data as frequently or at all until they are closer to each other. That sort of thing.

#

Meanwhile the server keeps track of where they are in the world at all times.

junior temple
#

So would that be the replication settings?

#

for the basic stuff

graceful flame
#

So for an RTS game if you have something like fog of war, then the client's don't need to be constantly updated for all units in the game, only the ones visible to them matter, but the server keeps track of all.

#

Replication is when data flows down from the server to the clients.

#

As for how you'd actually go about making that I can't really say because again I only know the main concepts, not the fine details.

junior temple
#

ok

graceful flame
#

Have you made a single player game before?

junior temple
graceful flame
#

okay, just keep in mind that with multiplayer there's also the netbroadcast tick time which eats into the frame budget and can grow rapidly if not kept in check

junior temple
#

how do you keep that in check?

graceful flame
#

By reducing the amount of data traversing the network

junior temple
#

oh ok

graceful flame
#

and by using setting lower update frequencies, using net cull distance, disabling tick, using relevancy

#

You can even do some funky stuff like bitwise operators so you can compress data over the network

junior temple
#

ok so wait, would the logic for the server updating unit movements, be put in the gamemodebase blueprint?

pallid mesa
#

compressing data doesn't affect directly the netbroadcast tick time. Skipping iteration does tho

#

dormancy ~

graceful flame
pallid mesa
#

bandwidth is another story that can get mitigated with quantization, normalization and a side-step to server tick optimization

#

all your advices r coo regardless πŸ˜„

graceful flame
#

I haven't made an RTS game but I would probably use a player controller to issue pawn movements via RPCs

#

The gamemode would be where you define the win conditions. Maybe a boolean such as: AllBuildingsDestroyed? Then whenever a building is destroyed you check if it was the last one destroyed or not and if it was the last one you set AllBuildingsDestroyed? to true on the gamemode which maybe triggers an event on the game state to display a victory message widget on the winning player controller and losing widget on the loser's player controller.

junior temple
junior temple
graceful flame
#

Check out page 14 on the compendium for that

wooden cypress
#

is it possible to test the Advanced Session plugin with 1 computer?

graceful flame
#

Event OnPostLogin

wooden cypress
#

How? I've set it all

graceful flame
#

Two copies of the game running standalone mode, one hosts a listen server session and the other joins.

wooden cypress
#

I'm using steams sub system

graceful flame
#

Exit the editor, right click the .uproject file and choose Launch Game, then do it again.

junior temple
#

@graceful flameThanks for your thorough explanations and answering all questions, this has been quite helpful

wooden cypress
#

Both use the same steam account though

graceful flame
#

You can still test hosting and joining a session but not invites

#

You need two separate machines with two separate steam accounts for testing absolutely everything.

wooden cypress
#

Its finding no sessions

graceful flame
#

Could be due to a lot of reasons

wooden cypress
graceful flame
#

Do you get the steam popup when you launch the game?

wooden cypress
#

Yea I do

graceful flame
#

Did you mark it as LAN?

#

actually nm lan doesn't matter its a listen server

wooden cypress
#

Become a member: https://www.youtube.com/channel/UCFjBMoGhlEum8jRgPvmWpJg/join
Join the {GDR}; Discord server and download my free project files: https://discord.gg/dUm3ZtYDuV
Buy me a coffee: https://ko-fi.com/bluntstuffy
Follow me on Twitter: https://twitter.com/BluntZombie

This tutorial is mostly about how to setup a multiplayer framework in...

β–Ά Play video
#

Then just changed the nodes to the advanced nodes

#

along with other small things required to set up the plugin

#

I can find the session, I just cannot join it

graceful flame
#

Might be something in the log

torn hull
#

Hello !

I have setup a multiplayer game, I'm trying to run this via pixel streaming
once I launch pixel streaming setup and try to connect via chrome ,for the first connection regular game flow works [host/join game via menu]
when I'm trying to connect via another chrome tab , I can see the game map directly,
every chrome tab session should be able to join the game as different player [this is happening when I create another instance of my game and try to connect via chrome],
my case is with 1 game instance 10 or more people joining via chrome need to act as players

can any of you confirm if this is possible, if yes any references would be helpful

thin stratus
torn hull
#

Yep , when i launched second game.exe instance i was able to connect

If we go hosted game perplayer when no of players increase resources to replicate games would be huge so i thought
If via pixelstream can we avoid it

scenic flame
#

I have a (hopefully) basic question to ask. How do you track a player ID across a level load? Since my player controller is remade in the new level, the player ID is also recreated, and so I have no way of knowing who used to be who.

kindred widget
scenic flame
kindred widget
#

Not testable in PIE. This value will be the same for the same player when using Steam or EOS

scenic flame
#

Do you know any workarounds or techniques I could use here?

kindred widget
#

Do you have C++ access?

scenic flame
#

Technically yes, but I am the only C++ dev on the team, so I just know pushing binaries will cause some issues with the others.

I'm not exactly against it, its just going to be a hassle I would rather avoid.

thin stratus
#

Don't you use the UniqueNetId?

#

I have never used the PlayerId for anything

thin stratus
scenic flame