#multiplayer

1 messages Β· Page 582 of 1

kindred widget
#

That was my own question.

pastel agate
#

@kindred widget
A player state is moved to an array of inactive player states when disconnecting. It remains there for a few mins (duration can be specified in the gamemode I think)
You can override the copyProperties method on your playerstate to override what is "saved"
The player id copied by default I think.

kindred widget
#

Best example off the top of my head is ARK. Player logs out and their body drops on the ground, stays there for hours, they log back in and repossess same body. Is that something I do based on the PlayerID?

pastel agate
#

I have no idea how ark works, but I would not use that for a long duration like that.
It would "work", but create further problems since you still have to deal with the case that the playerstate was wiped because even a longer timeout was exceeded.
If a server is restarted that array is cleared or if the player joins a different server that one does not know about the player at all

chrome bay
#

@twin juniper if the host disconnects it'll be handled like a network error

#

Which you would usually show a dialog box for like "you disconnected"

#

From a UX standpoint, probs don't want that

twin juniper
#

@chrome bay Even though I implemented OnSessionDestroy and sent the client back to the menu map. The client still crashes if the host disconnects.

#

Am I doing it wrong?

#
    if(Result){
        UGameplayStatics::OpenLevel(GetWorld(),"/Game/ThirdPersonCPP/Maps/Menu",true);
    }
}
kindred widget
#

I get that the Playerstate gets wiped. I don't care about the PlayerState. I care about that specific PlayerID that is supposedly populated by the OnlineSystem you're using, like say Steam. When the player logs in and the new PlayerState is created, and that PlayerID is created, is the PlayerID repopulated with the same ID based on their online system's profile?

#

Can I use PlayerID in the PlayerState to get information from the server's save files, and from Actors to identify what is that specific player's stuff in the game based on their online system login?

pastel agate
#

There is also the UniqueNetId. That one seems to be one you want

rich ridge
#

@kindred widget in case of AiCharacters, when server spawns it , the login and post login functions are not called.

#

So does it matter.

kindred widget
#

Who said anything about AICharacters?

rich ridge
#

I thought you were talking about my use case. Sorry my bad

pastel agate
#

Does anyone know how steam sockets are supposed to work with dedicated servers?
I thought one big benefit is that the steam SendP2PPacket method is used which works using steam ids and channels instead of IPs and ports.
My dedicated server is listed in the steam masterserver list, but it also shows the ip, which makes no sense to me ("addr":"17x.13x.x.5x:27015","gameport":7777).
The netdriver seems to have started without any problems, so I wonder if I made a mistake somewhere...

LogSteamSocketsAPI: Verbose: SteamSockets API: Log RelayNetWorkStatus: avail=OK config=OK anyrelay=OK (OK)
LogNet: GameNetDriver SteamSocketsNetDriver_0 started listening on 7777

chrome bay
#

@twin juniper Look at how ShooterGame handles it

#

@kindred widget The player UniqueID is unique, that comes from the OSS

#

So if a player logs in through Steam, the ID will be different than if they log in via some other service

limber gyro
#

whats the equivalent of #UE_SERVER for the client? #UE_CLIENT?

chrome bay
#

Also because of stupid naming conventions, don't confuse GetUniqueId() with GetUniqueID()

#

The one that returns an FUniqueNetIdRepl is the one you want

limber gyro
#

or can i use #!UE_SERVER

chrome bay
#

!UE_SERVER ?

#

There's no UE_CLIENT in Build.h

#

But then there's no client build target either

#

Just the "normal" one

limber gyro
#

i will try the ! one

#

should work right

twin juniper
#

I thought OnDestroySessionComplete would be called when the host closes the session.

#

Apparently it's called when the session is "completed"? According to ShootergAme

#
 * Delegate fired when a destroying an online session has completed
 *
 * @param SessionName the name of the session this callback is for
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */```
chrome bay
#

@limber gyro It's not strictly speaking the same thing tbh

twin juniper
#

In here they don't even handle the client returning to the menu ```void AShooterGameSession::OnDestroySessionComplete(FName InSessionName, bool bWasSuccessful)
{
UE_LOG(LogOnlineGame, Verbose, TEXT("OnDestroySessionComplete %s bSuccess: %d"), *InSessionName.ToString(), bWasSuccessful);

IOnlineSubsystem* OnlineSub = Online::GetSubsystem(GetWorld());
if (OnlineSub)
{
    IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
    Sessions->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroySessionCompleteDelegateHandle);
    HostSettings = NULL;
}

}

chrome bay
#

@twin juniper It's not, sessions are managed locally - the Server doesn't interfere with the clients' local session

#

BTW, APlayerController literally has a client function called ClientReturnToMainMenuWithTextReason

twin juniper
#

But the question would be.

#

When would that be called.

#

Is what I'mc onfused about.

chrome bay
#

Likely a few seconds before the Server ends and destroys the session

#

Also, AGameSession::ReturnToMainMenuHost() calls that

twin juniper
#

So when my host closes the game, the client's game crashes. And I'm wondering do I handle that inside OnDestroySessioNComplete?

chrome bay
#

No

#

The client shouldn't crash anyway, so you need to investigate that first

twin juniper
#

Ah.

#

It does, so maybe

#

I'm doing something wrong then.

#

Could it have to do with not clearing delegate handles?

#

Because it's weird that they assign delegate handles.

chrome bay
#

It could be literally anything tbh

twin juniper
#

I don't assign any

#

In my code.

#

Yah I'll see if the log file

#

produced anything

#

On the crash

chrome bay
#

but yeah to handle it "gracefully", the Server would call some function that tells the clients to go back to the menu

#

The clients would clean up their own session locally after that

#

And the Server would then end/destroy it's own session

twin juniper
#

Ah okay.

chrome bay
#

Probably a few seconds after notifying the clients to go back to menu so that most of the time it's handled "gracefully" by the players

twin juniper
#

Alright, thank you. I'm going to investigate this crash.

chrome bay
#

I'm not sure what the default behaviour is on a host disconnect but it should probably just return you to the default entry map in project settings IIRC

twin juniper
#

Well I'm not sure if Steam's subsystem plays any roll in it.

#

But that's what I'm using.

chrome bay
#

Shouldn't do I don't think

twin juniper
#

Okay.

#

ALso I'm getting a huge list of these warnings

   Warning: STEAM : Failed to parse settings from key SlotPublicmax value 16
#

Don't know what these warnigns mean

#

But they repeat quit a lot

chrome bay
#

Not sure

#

looks like you're setting some custom meta data on the session settings or something

twin juniper
#

hmm

agile wraith
#

Can anyone help me ?
The problem is that I can create a server (Normal session) but when a friend tries to find a server he cannot find it whereas when I try on the EU project it works. On Android (I have activated the Online Subsystem GooglePlay plugin)

rich ridge
#

@agile wraith there is fundamental problem here..
Both the server and client should use same OSS...
And Android OSS can't run on your server...

agile wraith
#

what should i use as a server?

rich ridge
#

Something like steam or EOS

#

I have zero experience with steam..

agile wraith
#

But when i use Steam advanced session i cant launch the game on android

#

Ok

rich ridge
#

I can't help with steam... Haven't even opened the steam website

#

@agile wraith are you using dedicated server or listen server?

agile wraith
#

Listen server

rich ridge
#

Then it should work, my bad I didn't ask earlier

agile wraith
#

What it sould work ? Steam or EOS ?

rich ridge
#

I m not sure though, but Google Play OSS doesn't allow your to create session and join session.

#

Steam or EOS requires good skill and understanding..

#

If you believe you have good skill you can use either

agile wraith
#

My skill is bad :(

#

Im debutant

agile wraith
#

Oh pity

#

Thx

rich ridge
#

This service was pathetic.. so I m not surprised it shut down

agile wraith
#

Yes but for debutant is bad

rich ridge
#

Don't know about iOS, but you can explore that .

meager fable
#

I'm adding a health bar widget to my character like this

void ABaseCharacter::BeginPlay()
{
    Super::BeginPlay();
    ServerSetupHealthBarWidget();
}

void ABaseCharacter::ServerSetupHealthBarWidget_Implementation()
{
    MulticastSetupHealthBarWidget();
}

void ABaseCharacter::MulticastSetupHealthBarWidget_Implementation()
{
    UPlayerInfoWidget* HealthBar = CreateWidget<UPlayerInfoWidget>(GetWorld(), HealthBarClass);
    HealthBarComonent->SetWidget(HealthBar);
    HealthBarComonent->SetVisibility(true);
    HealthBarComonent->RegisterComponent();
}

But on the clients game every pawn has a health bar except for the pawn controlled by the server

#

picrel, on the server side everyone has a health bar, on the client side everyone except the server pawn

rich ridge
#

I think the best place to set health widget is when PlayerState is replicated to client.

#

You can skip explicitly calling a function to set health bar.

#

@meager fable

meager fable
#

Could you elaborate? Not sure when or where is player state created and how to I move the widget creation there

#

@rich ridge

twin juniper
#

How would I broad cast a message to all available clients connected?

thin stratus
#

Multicast in a Class that they all have, like the GameState.

twin juniper
#

So create a delegate and implement the delegate in the game state?

thin stratus
#

The Character Healthbar Widget stuff frm @meager fable is wrong in multiple ways.

#
  1. BeginPlay already calls on everyone, so you are basically performing a ServerRPC + Multicast for no reason.
  2. Let's assume you do perform that Multicast, it will only happen for the Players connected at that point.
    So the Server will do this and probably only reach their own Character.
#

@twin juniper Well, if you need a delegate, sure

rich ridge
#

@meager fable inside Character or PlayerController class you can override the OnRep_PlayerState function

twin juniper
#

I mean, would the server need access to every player's game state to multicast @thin stratus

rich ridge
#

And here you can attach health bar

#

@twin juniper server has autonomous authority to everything including GameState, PlayerState , PlayerController, etc

#

Server can access everything

thin stratus
#

Why would you use the PlayerState though

#

You can just do it on BeginPlay

#

Just strip all this RPC stuff

twin juniper
#

So if the game instance, calls a method from the game state, essentially that method would be called on every client right?

thin stratus
#

@twin juniper There is only one GameState and the Server has to execute the Multicast

#

No, it requires a Multicast RPC

#

That "Method" needs to be one at least.

twin juniper
#

Alright thank you for the advice, I"ll look into it.

#

UFUNCTION( Client )
void ClientRPCFunction();

#

So when the server calls this

#

All clients execute it

rich ridge
#

Correct

thin stratus
#

o.o not correct

#

That's a Client RPC. That only calls on the Owning Client

#

There is no Owning Client for the GameState

twin juniper
#

Doesn't every client have a game state?

#

But only the server has a game instance?

thin stratus
#

No

twin juniper
#

πŸ˜•

thin stratus
#

Every Player has a GameInstance

#

It's not replicated

#

Server only has a GameMode

twin juniper
#

Hmm

thin stratus
#

GameState exists ones and everyone has it

#

Read my compendium please. You seem to have a great lack of basis knowledge about this

twin juniper
#

Yes I do

meager fable
#

Moved the code to BeginPlay and everything works fine, thats weird cause I swear I started playing with RPC's because something was broken when calling from begin play lol. Anyway thanks @thin stratus

inner cove
#

Hey @thin stratus I want to thank you for this awesome book you have made, it has really helped me understand the network as there is not a good documentation on unreal’s docs.

rich ridge
#

UFUNCTION( Client )
void ClientRPCFunction();
@thin stratus I m total not in sync, how it won't executive on clients ...

thin stratus
#

@inner cove Glad it helps (:

#

@rich ridge Client makes it a ClientRPC. That executes on a Client if the Actor is owned by one.
The person asked to have an Event call on ALL Clients, which is not achieved by a ClientRPC but by a Multicast.

#

I can't make it any more clear :<

rich ridge
#

My bad, I didn't read it properly

kindred widget
#

I'm not sure if I'm even looking in the right place. I'm trying to use the OnlineIdentityInterface to call GetUniquePlayerId, but even the include for that won't work. I have OnlineSubsystem module added to dependencies but this include fails? #include "Interfaces/OnlineIdentityInterface.h"

#

Never mind, VS mess up I guess. Deleted typical project files and rebuilt and it's fine.

still path
#

Hello! Currently, I have game settings (team names, team ai #, and more) stored in the player instance (details are set at the main menu before the level is loaded). This seems to work fine for single player but online it appears to fail for the server host and for the clients. What is the proper way to set up a game and carry those details thru into the level where it will be utilized?

short cliff
#

Hello everyone & @thin stratus

#

I've been trying to solve a problem for at least 2 days

#

My 2 clients connects the server (server waits in a lobby level) and my dedicated server travel to an actual game level

grand lance
#

has anyone had issues with Launchcharacter causing desync between server and client?

short cliff
#

The problem is; when I do this I can't get a valid player state at the server

#

I'm trying to get the player state from the connected controller but it returns null (since this is a seamless travel, I can't use the PostLogin so I'm overriding these methods; HandleSeamlessTravelPlayer, HandleStartingNewPlayer_Implementation,GenericPlayerInitialization)

#

Do you have any idea why this is happening

peak star
#

I cannot connect to a game on my LAN via the console command "open [ip address]".

#

If that doesn't work then maybe that is why join session doesn't work either. I didnt change anything between the time it was working in 4.23 and the tine it stopped working in Feb 2020 (been trying to figure out how to fix it since then)

jovial cipher
#

Quick question about dormancy

Do awake actors go dormant when not changing?

peak star
#

I can not connect when my PC is hosting and trying to join my Android, nor when Android is hosting and trying to connec to PC

#

Seems like only PC can connect to itself.

gray scroll
#

@peak star yes because you are using a windows OSS

peak star
#

I am using onlinesubsystems null just like i was when the game was working between windows and android

#

@gray scroll before Feb 2020 i was able to play android build apk vs windows build exe with both using LAN in onlinesubsystems NULL

gray scroll
#

yea onlinesubsystem null should work on both

peak star
#

It really was working on LAN but suddenly stopped. IDK how to tell if it is my router or my OS

#

I know steam OSS doesn't work on Android (it won't even build to android if I include that plugin)

#

I don't need my game to work online, just on LAN. Wish I could go back in time to when it works.

soft relic
#

What's the proper way to shutdown a dedicated server? Is the quit function enough to close it?

worldly raft
#

Would anyone know why adding impulse to a spawned item would prevent it from spawning on client but not on server?

tranquil yoke
#

guys, Anyone have an idea how to exclude a plugin for server, and all its dependencies ?

eternal canyon
#

Anyone here use Playfab who can help me out for a sec?
I am trying to setup a login system using the docs
and I keep getting this error:
LogHttp: Warning: 000001292EB46B00: invalid HTTP response code received. URL: https://144https://ea25c.playfabapi.com/52.13.201.178/Client/LoginWithCustomID?sdk=UE4MKPL-1.40.200629, HTTP code: 0, content length: 0, actual payload size: 0 LogHttp: Warning: 000001292EB46B00: request failed, libcurl error: 6 (Couldn't resolve host name) LogHttp: Warning: 000001292EB46B00: libcurl info message cache 0 (Could not resolve host: 144https) LogHttp: Warning: 000001292EB46B00: libcurl info message cache 1 (Closing connection 19) LogTemp: Error: Something went wrong with your first API call. Here's some debug information: Request Timeout or null response
I am using the static IP that playfab says on PlayFab static IP addresses

fierce oriole
#

@eternal canyon your url is messed up

eternal canyon
#

yea i was trying to fix it and i cant figure it out

fierce oriole
#

Hey everyone! Quick question: Im using "ChoosePlayerStart" to assign players to spawn points, but if I spawn 2 clients and have 2 spawn points, one client fails to spawn. If I have 3 it works though! Is this the server occupying a spawn point? Im cycling through the PlayerArray to spawn players

peak star
#

Okay this is weird@gray scroll. I just now built for both device types, windows and android, but this time developer build. And now I can connect over LAN again. What's going on?

#

Something special about shipping builds makes them not work on LAN I guess?

peak star
#

Too bad Google Play Store won't let me publish if it's not Shipping build 😦

#

@fierce oriole I think the default ChoosePlayerStart doesn't check to see if someone's standing in the way of the playerstart it chooses, so it might fail to spawn because the spawn point is blocked.

tranquil yoke
#

Guys, how to exclude plugins for different platforms ?

fierce oriole
#

@peak star if i have 2 players they only both spawn if there are 3 spawn points, like as if, something invisible is taking one before the clients

peak star
#

@fierce oriole Are you using blueprint node to spawn the player pawn?

rich ridge
#

@peak star you can publish the debug build on play Store

peak star
#

And sell it too?

#

@gray scroll Aww man now it doesn't work again. I don't understand why it works only 1 out of 100 times. Maybe it doesn't matter if it's shipping or not after all, except I at least once in a while got it to work in a dev build.

#

@tranquil yoke I'd like to know how to exclude plugins for diff platforms too, but I don't know if you can. If you can, that'll save me from having to maintain different projects for the same game.

vivid seal
#

does Unreliable work with NetMulticast functions? the docs for UFUNCTION say its only valid with Client and Server, but the multicasts are not gameplay-critical so i don't care if they're dropped

tranquil yoke
#

@peak star Thats sad

lost inlet
#

WhitelistedPlatforms?

empty axle
#

@vivid seal yes. I am almost always doing them unreliable

vivid seal
#

How do you guys handle replicating damage events? Replicating health with a RepNotify to update the UI obviously, but what about floating combat text? If I want to use the actual Damage event on clients to see what kind of damage it was, if it was a Crit, etc. I’d need the whole event, not just health replication.
So to solve that I was going to just multicast damage events to all clients to respond to, but then I have that AND the health replicating as well. Is that how you all are doing this kind of thing?

rich ridge
#

@vivid seal this becomes a bit simple if using GAS, for example for crit damage you could apply CritGameolayEffe ft and it can it's own UI data.

#

For every DamageGameplayEffect you can have its own UI data.

#

If you are using traditional float stuff, then you need design your own robust system or framework like GAS.

empty axle
#

@vivid seal yes, you need both of them.

rose egret
#

@vivid seal I guess ClientRPC is enough for you, ClientGotKnifeDamage, ClientGotBulletDamage, etc ...

peak sentinel
#

Is low ping an accurate way to determine if the games networking good or not?

#

Sometimes I get jittering pawns/collision even with a low ping on my projects.

keen linden
#

What's the proper way to shutdown a dedicated server? Is the quit function enough to close it?
@soft relic if u have command line opened, then CTRL+C is enough

#

quit command should be also good

near bison
#

Can I not make server calls from a widget event graph?

#

Update: you can't.
Only PlayerController, GameState and Possessed Pawn can

bitter oriole
#

You most certainly cannot RPC from GameState

#

As to widgets they should not replicate

near bison
#

I'm not looking to replicate a widget, I'm just looking to call an RPC from the widget

#

nvm

bitter oriole
#

That's exactly the same thing

#

RPCs are only supported on replicated actors

#

(that are client owned, if from client)

near bison
#

got you

twin juniper
#

Hey, just to make sure I'm not doing something stupid πŸ™‚

#

When I build the project for dedicated server my entry map should open level 127.0.0.1 (the local loopback)

#

when I build the project for a client my entry map should open level the public IP of the server

#

right?

twin juniper
#

Can anyone help me

#

To solve this glitch

#

I can see it only in client not for server

#

And I don't wish to see it

inner cove
#

Then don't look at it kappa

#

@twin juniper you don't provide much info so i can't help with that

twin juniper
#

@inner cove

#

But I don't wish to see this

#

Actually in real development there is no such object placed

#

But when running in client screen I can see this

#

It is visible only on client screen and for server it is ok and fine

inner cove
#

@twin juniper No, the dedicated server (or the listen-server) must open a level/map with the option listen . Now for the client: 1) If the server and the client are on the same machine then the client can use the 127.0.0.1 IP address to connect, 2) If the server and the client are on different machines but on the same local area network then you will need to get the server's IP of that network (If its windows you open a cmd and type ipconfig and look for the IPv4, if its linux type ip a), 3) If the server and the client must connect over the internet then you will need to port forward the server, find the public ip by going to https://ifconfig.me/ or to a similar website and use that ip to connect! (If i missed something or said something wrong correct me)

ruby rock
#

Hopefully an easy question. I have a function that I call from a keystroke to equip a characters weapon. Works fine in MP. However, if I try to call this from BeginPlay within my Character it doesnt work. Feels like I have an ownership problem??

kindred widget
#

@ruby rock Beginplay in the character should work fine. But if you're doing it on beginplay in the character, you might as well just do it only on the server with a SwitchHasAuthority where ownership doesn't matter.

ruby rock
#

@kindred widget - thanks, that works

limber gyro
#

Does any one know whats the best way to make the server start with a random map?

#

does UE4 have any kind of built in suport for that?

lavish igloo
#

Can someone help me with creating multiplayer

dark edge
#

Just press the create multiplayer button

kindred widget
#

@limber gyro As in choosing a random map to play from or more like creating a procedural map?

#

If it's just a random map. Make a small array of your maps, and just do Randomintinrange from 0 to (ArrayLastIndex or Array.Num() - 1) Use the random int to get that index from your array and open that map.

#

Can the server get a connected client's FUniqueNetId?

chrome bay
#

yep

#

from their PlayerState

#

Or you can query the online identity interface with a controller ID

limber gyro
#

@kindred widget but i cant just open that map, since the server.exe is running in a VM

#

foe example if i run that in the "beginPlay" equivalent of the gameMode, it will create an endless loop

kindred widget
#

You could either use the GameInstance(Does that exist on dedicated servers?) to store a variable of map found, or the actual map string and check if it's in the desired map. If not, find a new one. Or make a super simple map that it can load, and use that specific map to select a random map and load it.

solar stirrup
#

Is there an event that's fired when an actor becomes net relevant again? Possibly before notifies are fired?

limber gyro
#

Ye that idea of a "map selector map" occured to me but i wanted to see if there was anything better than that

kindred widget
#

@chrome bay By that second one, the online identity interface. That is the same as this, right?
TSharedPtr<const FUniqueNetId> UniqueNetID = IOnlineSubsystem::Get()->GetIdentityInterface()->GetUniquePlayerId(1);
Because running this on the server with a client connected doesn't work. Only GetUniquePlayerId(0) works, 1 never does. I can see both the server and client's different IDs if I run that on each screen with index0, but the server can't seem to see both by using index 1.

chrome bay
#

I would get it from the player state tbh

#

You could get it from the net connection maybe

kindred widget
#

In the PlayerState, that's the PlayerID?

chrome bay
#

It's first gathered from UWorld::NotifyControlMessage

#

No

#

UniqueId

#

Which is an FUniqueNetIdRepl

#

Oh maybe GetUniquePlayerId in the OSS is only for local/split-screen players

kindred widget
#

Ah. I missed that variable! Kept looking at the UObjectBase function by the same function name.

chrome bay
#

yeah it has the worst naming convention imaginable

#

damn annoying

kindred widget
#

@chrome bay One last general question about this. If I use this to identify players and their assests/stats etc. How do I write this to a savegame, and on reload of the server compare this back to the logging in player's UniqueID? Do I need to save the string thing I read about, and use the function to turn it back into a pointer on server load? I can't save the pointer itself, because it'd be invalid once the map changes or the server is shut down and restarted right?

chrome bay
#

I believe they have some kind of "as string" function or something yeah

#

Actually I think internally it's just raw bytes

dense knot
#

Hi everyone. I have a map with 25 AI agents each of whom calls the AAIController::MoveTo method at three-second intervals. The dedicated server is on and the number of players is two. The problem I have is some of these agents suffers from time to time an abrupt movement correction like a kind of teleportation. Everything works well in stand-alone mode without any agent teleportation. Does someone know why this issue can happen in multiplayer mode?

twin juniper
#

Hey, out of curiosity, since I'm sure there's a good reason for it, why does GAS use floats for attributes?

rich ridge
#

For precision

#

Applying 0.5 damage, int can't do

#

One more reason I can think is some of the UE4 components are designed to work in range of [0.0, 1.0]

#

Example progress bars..

twin juniper
#

I suppose UE probably has some compression for floats over network as well perhaps

#

it does make things simpler I suppose

winged badger
#

unreal usually uses compression over network only when it would make absolutely no sense not to do so

#

by default

#

rest is up to you

#

(see FHitResult for example, it has few varieties of FVector_NetQuantize)

twin juniper
#

I see

inner cove
#

The begin play on the level blueprint will run on server and on clients when they load the level?

regal sand
#

My Team is having trouble with this movement in our BP template; This is causing a lot of problems in our game. Why do we need to sync player movement on the server; if it is replicated by default?

bitter oriole
#

"replicated" is a simple word for a very complex process

#

But basically you need the entire environment for movement to be synchronized

halcyon warren
#

Problem is, the local player position gets reset if you have a bad connection

twin juniper
#

CAN ANYONE TELL ME IF I WISH TO ROTATE AN ACTOR AND HOW CAN I FIXED ITS ONE END

regal sand
#

@bitter oriole Is this movement system required? Or can we default back to the ue4 default movement?

bitter oriole
#

If you're using character, it's the only multiplayer capable movement in UE4

eternal canyon
#

ue4 default movement is replicated out of the box

#

and in my experience to change speed i had to do it on the client and server at the same time

halcyon warren
#

hm

bitter oriole
#

Yes, that's how you have to do it

eternal canyon
#

or they start fighting each other

regal sand
#

Good to know.

inner cove
#

@twin juniper what do you mean?

twin juniper
#

these are 2 different meshes and I wish to change its orign point around which rotation takes place

#

@inner cove

#

hope you got it

#

I want to change pivot

#

@chrome bay I solved the client crash for when the host disconnects by creating a delegate for Engine->OnNetworkFailure()

#

Then in the delegate call UGameplayStatics::OpenLevel

inner cove
#

@twin juniper that’s not a multiplayer related question

twin juniper
#

no I mean rotating around a point

#

which is not at centre

inner cove
toxic schooner
#

im testing my game with average latency on both client and server (30-60ms) and im getting considerable lag on the client. When i use netstat it says my ping is 265 which seems really high. Im not really sure how latency and ping relate, but I thought average ping is around 30 and not 265. Is it normal to be lagging at 265 ping, but 30-60 latency?

quick flint
#

this is crashing my game server

#

has anyone any idea?

twin juniper
#

If you have a replicated variable in a player controller because player controller is on the client and the server it should be replicated? or not. Not really sure.

inner cove
#

yes @twin juniper

steel vault
#

Stupid question. I am using two bone IK by sending up the effector FVector locations unreliably quite frequently to be replicated to other clients. Is there an effect on me using worldspace locations (FTransforms with positions that can reach well into the 10s of thousands for x,y,z) vs. relative locations which are much smaller in range? The reason I ask is because I need my effector locations to stay stationary on character rotations which works perfectly with world space values, but is a living nightmare with relative. If there is an alternative that allows me to do that with relative values that anyone knows of, I am also all ears.

#

So I guess the question is two part, but mostly I want to know if larger vectors sent up frequently will significantly impact performance or two bone IK in general vs. the smaller relative vectors being sent.

inner cove
#

Is it normal that i am seeing only 1 player controller on the world outliner when I play with 2 clients? That's so weird.

gilded vapor
#

@steel vault the calculations with floats will be the same regardless of the actual value of the float (aside from 0, 1, and 2, which may have some optimizations)

#

@inner cove PlayerControllers are not replicated

#

If you're viewing it as a server would I believe you should see both though

inner cove
#

@gilded vapor ahh so the the world outliner see what the client 1 sees?

#

let me check

gilded vapor
#

I believe it depends on how you launch your game either "As Client or AsListenServer"

inner cove
#

yeah you are right, if i play as listen server i can see 2 player controller

#

i thought that the world outliner shows what the server sees no matter the net mode

gilded vapor
#

You definately want to be able to view what the client does as testing, so its useful to have a client view

inner cove
#

yeah that makes sense

gilded vapor
#

(For me its usually because I spawned something incorrectly and am getting duplicates, but thats cause I'm a noob who forgets to check Is_Authority noob)

inner cove
#

so another question i have is, i am making a BR and i want when the player X kills the player Y then the player Y dies and views the camera of player X and since i want to make it the "unreal engine way" how should i do it? I tried spawning a spectator, possesing that , setting its view target to the killers pawn and destroying the character that died but that messes up the things on boths sides, it likes setting both clients to use a spectator pawn!

kindred widget
#

@inner cove Most likely the RPC gets dropped because the actor is set for destruction at the same time. You might want to move the RPC to the pawn's controller instead of the pawn. Then you can toss the pawn away.

inner cove
#

Okay, let me give it a try @kindred widget

#

@kindred widget Nope, that doesn't work at all!

blissful gust
#

hi guys, how can I create sessions with password?

thin stratus
#

I would assume by simply specifying via custom setting that it's password protected. And then sending the password on connection to the server and the server can check in PreLogin or Login if the password is correct. Not sure that's the number one solution though

soft girder
#

whats up with character begin play and listen server

thin stratus
#

Hm?

soft girder
#

beginplay to is locally controlled is very odd

thin stratus
#

Because that's too early to check

#

Characters aren't possessed on BeginPlay

#

At least not on clients

#

That's what you have events like OnPossessed for

soft girder
#

ive been using a .2 delay

thin stratus
#

Yeah worst solution haha

soft girder
#

im gonna have to rebuild this pile of crap lul

thin stratus
#

Never use delays to counter stuff like that

soft girder
#

so onPossessed

#

cool

thin stratus
#

Yeah calls server only but allows rpcs

#

So if you need the client to do stuff in BPs you can do a client rpc there

soft girder
#

ok

#

thanks for the heads up

#

this should save me

quick flint
#
[2020.10.27-22.19.37:299][  0]LogStreaming: Error: Found 0 dependent packages...
[2020.10.27-22.19.37:300][  0]LogLoad: Error: Failed to enter /Game/Maps/RetrieveTheBioWeaponContainer: Failed to load package '                                                                                                             /Game/Maps/RetrieveTheBioWeaponContainer'. Please check the log for errors.
#

my server crashes on linux from this

#

but no errors on windows server

#

anyone know how i can fix this? 😦

inner cove
#

@thin stratus since you are here and I haven’t got an answer yet, could you help with this #multiplayer message

soft girder
#

does the game instance exist for clients and server?

#

i thought it was for everyone

signal lance
#

every client and server has a game instance but it's not replicated

#

exists locally

peak star
#

Game instance can be thought of as the game running on your device. No other device can see it or its variables, but the game instance and its variables exist as long as the game is running. Almost everything else gets destroyed when you open another level. But game i stance and its variables live until the app closes.

#

Game mode only exists on the server. Game state exists on all devices and can replicate. (Already replicates playerstate actors but not playercontrollers- those only live on their own devices and the server)

wild mantle
#

i have different materials of colours how would i give each player a random material/colour?

peak star
#

@wild mantle use Create dynamic material instance node during runtime in a blueprint, and set vector parameter by name on that material. The material must have a parameter node inside it that controls the color

#

If you change the parameter on the master material or regular material instance then it will change it for all surfaces that use that material but dynamic instances are new ones created at runtime and are individual from the others.

wild mantle
#

i kind of got it to do that, i just looped through each player controller and generated a random index in a material array and applied it to the material but it didn't replicate even tho it was server side with multi cast

peak star
#

Wheb you create dynamic material then I think it auto assigns the New dynamic instance to the material slot you indicate on the static mesh component

#

Replicate the function call or replicate the dynamic material instance? I only got it to work by rellicating the function call that creates the dynamic material instance. I Passed color in as params to the multicast function

#

so every device makes the same random color for that actor

#

Or you can choose random color on the client side of the.multicadt event handler so it looks different to everyone

wild mantle
#

the node to the left of this is a foreach looping through player controllers and this is all inside a function that replicates

#

oh so replicating all this is pointless

#

the random generation is done outside locally and then the final set material is acc replicated only inside a function

peak star
#

Depending on the effect you want. If you want the chosen color to be consistent across all devices looking at that actor then you need to choose the color on the server and pass that down to the multicast to be set on the client side

wild mantle
#

this is all on the server

#

the blueprint is only available to the server

peak star
#

That is how I did it for my game. Chose color on server but actually set it on the clients

wild mantle
#

this is inside an interface blueprint btw is that ok?

peak star
#

I couldnt get the material change itself to replicate

wild mantle
#

ah ok

#

same

peak star
#

I dont know if interface can do it but probably can if the thing that implements the interface is itself a connection owning actor such as playercontroller, pawn, or gamestate.

#

I mean for multicast

wild mantle
#

how would i pass the color to clients

#

sorry im still new to this

peak star
#

Well when you create custom event node you can add input parameters to it when it is selected in your blueprint graph editor. Pane on the side

#

I had trouble passing a whole color so I pass the red green blue and alpha as separate params

wild mantle
#

so i can just use a switch has authority node

peak star
#

Yeah that should do it

wild mantle
#

is that possible in umg interface?

peak star
#

Yes I think so. If not then the isServer bool should be there and you can use that

wild mantle
#

ah yh switch has authority isn't there but is server is

#

thank you

peak star
#

I think the reason authority switch is not there is because umg widgets are not actors

#

They don't live inside the level as actors but instead are slate brushes that live in the game viewport

#

But isserver just checks whether the device youre on is the server

#

Not sure how it knows but I use it in my umg

#

Materials are also not actors but can be members of components on actors

#

And role authority, role simulated proxy, and role autonomous proxy are all actor roles I think

#

@thin stratus if youre still around, I cant get the cowboy multiplayer shooter example to work over LAN on Android. It doesnt seem to be able to see the pc host.

I know it is possible because i had another game project do it and play android vs pc on LAN but this isnt working on multiplayer shooter project on 4.24.3

#

Wonder what I am doing wrong or if it is the fault of android OS update or something out of my control like that.

#

Or how to find out

wild mantle
#

ah that makes sense

#

yh i think i got an idea on how to do it

#

btw

#

the code i sent u earlier

peak star
#

Ok

wild mantle
#

ty

grand lance
#

what's the best way to handle instant rotation for characters? i tried setting actor rotation on client and send RPC to server to set new rotation. however, i get corrections happening a lot. Do i need to extend character movement component. Also i'm using Gameplay Ability System. I have a Top down game and using GAS for attacking with melee. I get the mouse position and use that to instantly rotate my character towards mouse. I do set rotation before i activate gameplay ability

summer tide
#

In #2 play as client, I see both of the player cams with one of the player. Any idea what's wrong?

vocal cargo
#

not sure if I understand your question, but I think you need multiple player starts?

#

and set which player to start in your World Settings / Game Mode

summer tide
#

I have that

#

Is there a way to visually debug networking?

#

Or what's going on in the scene during multiplayer

eternal canyon
#

c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(48,43) : error CS1010: Newline in constant c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(49,94) : error CS1010: Newline in constant c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(50,43) : error CS1010: Newline in constant c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(51,85) : error CS1010: Newline in constant c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(52,36) : error CS1010: Newline in constant c:\Users\ewn11\Documents\Unreal Projects\paragon 4.25\Source\paragon.Target.cs(53,16) : error CS1010: Newline in constant anyone know why I woudl get this error?
This is c# and i am trying to integrate GSDK

grand lance
#

are you using \n in a string?

#

use \

#

use "\"

#

wtf lol i cant double type \ \

peak star
#

Try usong triple backtick to encapsulate code maybe that will allow double backslash

#

\\

#

For discord chat i mean

grand lance
#

\\

#

nice

#

didn't know discord did that

eternal canyon
#

wdym

#

and no im not using /n string

hoary hornet
#

Could someone explain why my text is not updating over the network? I Have a variable named Value that is bound to the text of the widget, when the player right clicks the widget in game it updates locally but for some reason it does not update for everyone on the server.

#

It's supposed to update Value by one evertime someone presses the button.

fossil spoke
#

Because Widgets dont Replicate, they also dont exist on the Server.

#

They are Client side only.

hoary hornet
#

Thanks for the PDF, I'll give this a read.

kindred widget
#

Even beyond networking, traditionally Widgets are only ever used to get information to display from Actors or to call events directly in actors that do gameplay logic. The same generally extends to networking from UI. Put the RPC or replicated variables in an actor or ActorComponent, and use the UI to tell that actor to RPC, or get the replicated variables for display.

flint belfry
#

Is there a limit to the amount of players in a multiplayer game for the oculus quest?

empty axle
#

@flint belfry I haven't heard of a player limit for any platform

fringe sinew
#

This is going to sound so dumb but when an actor replicates, do all the stuff stored inside it replicates too? Or it only replicated the variable inside it that are marked to replicate?

bitter oriole
#

Only the variables marked for replication

fringe sinew
#

Yeah, I need more sleep.

inner cove
#

Is the PlayerState the best place to store things like the player FireRate ?

peak sentinel
#

i think if FireRate is related to weapons code it should be stored in weapon

#

as a replicated variable of course

#

but if its a universal value, for example if its being changed by players level, strenght etc. might be stored in playerstate

inner cove
#

πŸ‘Œ

limber gyro
#

does any one know what happens when some one tries to connect to a server that is loading a map?

wind garden
#

My guess would be you cant. As the server will only listen after it loaded the map. If its still streaming it in, it should work fine.

limber gyro
#

well i need to make sure that everything is loaded before the players attempt to connect

#

how do i do that? is there like a status in the server that i can change?

#

i need to fetch some info from the backEnd before people can join

#

right now everything works fine, i am getting the info before any player can connect because it only takes like 1 or 2 seconds but i was wondering if that would be a problem if my map takes a while to load when i add the actual assets

chrome bay
#

Just don't advertise the session until the server is done

#

That being said, seamless travel handles all this just fine

wind garden
#

You have to do that in C++ there are some events you can hook into, which are not exposed to blueprint. I dont know the correct namens from the top of my head. But there is something like prelogin. Were you can decline the login of a client.

random nymph
#

How to prevent colliders moving on server that are lerped to replicated position on client from launching the client character into air with massive force?

royal rampart
#

hey guys, quick question, I have a ball that is supposed to go through a ring. The ring needs to detect the ball going through the ring (ring is filled with a collisionmesh) but is not supposed to bounce off the ball (the ball needs to go through the ring and explode after 0.2 seconds)

#

these are my settings for the collisionmesh inside the ring

#

and this is how I set up the connection in code.. but the OnCollisionScoringMeshHit function only get called when I set it to this..

#

but that bounces off the ball 😦

#

( and the ball that needs to go through is a physicsbody πŸ˜‰ )

twin vault
#

are you sure that works

#

i dont remember right now, but maybe you neeed physics collision if you want overlap events with a physics object

royal rampart
#

nono indeed, if I want it to work with block I need to enable collision again haha

#

oooh so also with overlap?

#

okay wait ill try it right now πŸ™‚ thanks for replying

#

I think I already tried that tho haha

twin vault
#

i mean the Collision enabled: query and physics

#

and set to overlap

royal rampart
#

😦 no it doesnt work haha

#

I think OnComponentOverlap doesnt work for this for some reason

twin vault
#

how are you testing, have a breakpoint inside the function? whats your function like in C++

royal rampart
#

is does get called with Block, but never with overlap

#

i really dont get whyyyyy haha

twin vault
#

\πŸ€” are you sure you compiled your codee lol

royal rampart
#

I am relaunching the editor from code rn haha

#

so now it should a 100% be compiled lol

#

aaaaa this is driving me crazy, the thing is.. it works fine in blueprints haha

#

can I use GetOverlappingActors in tick or is that really bad?

#

because that works haha

royal rampart
#

OMG

#

this wasnt checked in the ball blueprint

#

it's fixed now

#

yeeey

limber gyro
#

@chrome bay i cant do that, i am using playfab as my backend and i am not sure how it works tbh

#

but they will match my players and just send the ip:port and then they connect

chrome bay
#

The only issue I know of is a pretty major bug that occurs when a server re-travels to the same map while a client joins

#

Which Epic don't have a solution for, apparently

#

But the answer to that is to have more than two maps in ya game

limber gyro
#

the way i have my things set right now is, i call a playfab function to get the info as soon as possible, as of right now ive never had a case where the server never had gotten the info before every one joined

#

BUT if loading itself takes too long it might

rose egret
#

how do I disable physics interaction of CMC ? I have cube with bSimulatePhysics=1 and don't what the character be able to push it.
btw I tried bEnablePhysicsInteraction=0 and it did not

limber gyro
#

whats CMC?

#

you probably need to set your collision channels so that the cube avoids the player, also this should be asked in either BP or C++ if its not multiplayer related

bitter oriole
#

If you don't know what someone is asking about it's probably safe to not answer

limber gyro
#

just trying to help i guess

#

also CMC could stand for character movement component so i dont think i am wrong

chrome bay
#

You can't disable physics interaction per-object with CMC

limber gyro
#

why would he need to disable physics interaction of the movement component in the first place? he can just make the character capsule not colide with anything that is not static?

chrome bay
#

I assume the object still needs to block the character

#

But yeah, not sure. Just disable character collision on the object if not

#

Give it a different collision profile

#

I've just realised what OP said

#

bEnablePhysicsInteraction means the character won't push physics objects

#

It doesn't mean the physics object won't bounce off the character capsule

#

So yeah, you need to disable collision between the character and the object

limber gyro
#

maybe he could try setting the weight and friction of the cube really high?

chrome bay
#

doesn't matter with CMC

rose egret
#

by changing collision channel my character can pass through the box. (its door actually)

chrome bay
#

Well yeah

#

But why would you make a door simulate physics is my question

limber gyro
#

indeed

rose egret
#

I feel like if bEnablePhysicsInteraction is false it doesn't push the box but character and the box still collide and small jumps and jitter happens

chrome bay
#

Yeah it will do

#

You can't have physics enabled, then have two objects that block each other not push the physics object

#

The physics engine will try to resolve the collision and push them apart

#

bEnablePhysicsInteraction in the character is purely to allow the character to push physics objects, since it's not a physics object itself

#

It won't affect collision

rose egret
#

I want to make a door just like apex legends, I currently made a basic with sweep . but apex legends door is way more professional than mine.

#

and btw its dedicated server and competitive game so players can stuck between the door

limber gyro
#

apex doors have 2 states i think

#

first is the regular "non physics" mode

#

and then u break it, it starts simulating phycis with a very low threshold on "sleep" for the physics

#

so i think u want your door to "sleep" very easily when it stops

chrome bay
#

doors shouldn't be physics objects

limber gyro
#

i am not sure if sleep is the right therm, but basicly unreal has an option that makes the physics simulation stop when the object reaches a certain limit on movement

chrome bay
#

That's all you need really, just don't make it a physics object

kindred widget
#

In Apex, It just opens the opposite direction based on where the person who 'opened' it is standing and continues to 'sweep' move the door until it's closed, for situations like a box or something blocking it open.

limber gyro
#

and then when u hit it again it simulates again and goes to sleep agains

#

well ye, making it move and then stoping when it hits something can also work to simulate what apex is doing

rose egret
#

πŸ€”

raven heron
#

UPO

rose egret
#

in apex legends if u open the door and shoot or push at it it moves

raven heron
#

Do u know a good 3d modeling site?

rose egret
bitter oriole
#

The UE4 marketplace

raven heron
#

I found some but they cost thousands

inner cove
#

i feel like this channel became a "general"

raven heron
#

lol

#

Thanks stranger

dusky urchin
#

Hi, How to save and use inventory on multiplayer ? Better with game instance ? Savegame file or other ?

#

I have a static mesh actor array for now

#

Because my item is all droppable

inner cove
#

Saving it locally would be very bad in my opinion because 1) Players can modify the file and alter the records, unless you implement some sort of encryption (which again is not 100% safe), 2) If then player switches machine, format his pc, etc... he will lose all his inventory. The best approach would be to have a backend with a database and a rest api and the game server would send requests to that api to retrieve/save the inventory.

dusky urchin
#

Okay, so if i do this, in game, i have to send this item to the server files or databases at each time the player pick up or drop’item ?

inner cove
#

You will have a unique ID for every item that the game has and when the player picks an item then the game server would make an API call to the backend to tell it that the player with the ID xxx picked up the item with the ID of yyy.

bitter oriole
#
  1. is only true if you don't enable Steam Cloud Save for example, on Steam
#

You probably don't want your game to require always-online servers forever

dusky urchin
#

It will be an online game i think

#

So all save online

bitter oriole
#

You should think twice about it

#

The costs are high and you'll need to pay years after the game stops selling

dusky urchin
#

Maybe a solo mode but just for dev test

inner cove
#

@dusky urchin what type of game is it?

dusky urchin
#

MMORPG

bitter oriole
#

Alright, I'll skip this one

royal rampart
#

how can you spawn an actor (server and client)

#

this doesnt work 😦

#

(it's multicasted)

inner cove
#

Does the server runs this code?

#

ah

royal rampart
#

yesyes

#

I think my m_ActorToSpawn isnt correct

#

that is supposed to be a TSubclassOf<AActorYouWant> m_RandomName right?

inner cove
#

I don't have that much c++ so maybe someone else could help with that

royal rampart
#

haha thanks for trying πŸ™‚

inner cove
#

@royal rampart FVector Location(0.0f, 0.0f, 0.0f); FRotator Rotation(0.0f, 0.0f, 0.0f); FActorSpawnParameters SpawnInfo; GetWorld()->SpawnActor<AProjectile>(Location, Rotation, SpawnInfo); this is what i found

hybrid zodiac
#

@royal rampart Is the actor replicated? If so then you only need to spawn on the server, and the client will automatically spawn its own copy once the replication goes through

#

No need for multicast

royal rampart
#

ooo okay okay πŸ™‚

#

and yes I tried PanTrakX, still no luck haha

hybrid zodiac
#

The same goes for destroying an actor. Destroy on the server only and it will go through to the client πŸ™‚

limber gyro
#

so i am tryong to make my server start with a random map, my base idea was to make a new map and in the begin play of that map just get a random number and open a map according to that random number, the random works fine but the node "open level" doesnt, what do i need to do here?

#

if i untick the "run dedicated server" it works does that mean that it is working on the server but not on the client?

inner cove
#

Have you tried running it as a standalone? because unreal multiplayer in editor has some limitations.

limber gyro
#

im gonna try that right now

eternal anchor
#

can server and client have different game modes on the same map ?

inner cove
#

clients don't have a game mode, it exists only on server

royal rampart
#

heyyyy I have another problem haha

#

when i attach the ball to the SocketLocation, it attaches in a completely different location

eternal anchor
#

@inner cove that's what I read.. but HUD class if defined in in GameMode

royal rampart
#

but when i print the socketlocation, it is correct (green dot)

eternal anchor
#

so client At least to have load CDO of game mode to get it

#

though I probabaly overthink it, might be enough to create two blueprints one with hud and one without ;

inner cove
#

@royal rampart have u tried previewing the ball in the skeletal mesh editor (or however its called)?

#

Actually its the Skeleton Editor

royal rampart
#

so I can attach a mesh in there?

#

wait a sec

#

ill try

#

i dont know how to do that

inner cove
#

On the Skeleton Tree right click the socket and you should see the options there if I remember correct

royal rampart
#

I clicked create mesh socket haha

#

is that what you mean? xD haha i hope im not fucking up stuff for my artist haha

#

tadaaa

#

can I leave it as a mesh socket?

hybrid zodiac
#

Yes, leave it as a mesh socket. Make sure the mesh you're attaching it doesn't have an offset or something. I've had that before where the mesh when imported from Blender had some offset to it

royal rampart
#

nono there are no offsets, it worked yesterday but for some reason it doesnt anymore now 😦

#

is it possible that the server doesnt know the correct location or somethin?

#

i changed the grabbing logic a little but the attach function is the same as yesterday

hybrid zodiac
#

Ah yeah it could well be. If your mesh is set to "tick visible" then it won't refresh on a dedicated server, the socket will be where it is in the T-Pose

#

I had this issue with a melee system, on the dedicated server the characters just T-Pose so hit detection was broken

royal rampart
#

well the ball always shows up in the same place when I grab is and it is not the t-pose position haha

#

haha lol

#

this is the code

#

and it's the same as yesterday, my artist says he didn't change anything regarding the bones so it's my fault..

hybrid zodiac
#

Interesting

royal rampart
#

but the function is literally the same

#

like wtf

#

i can even check through source control that I didnt change this function haha

hybrid zodiac
#

Try setting all attachment rules to "snap to target" and see what that does

royal rampart
#

scale and rotation are find, it's purely the position

#

already tried it haha

inner cove
#

have you checked if the "BallSocket" exists? maybe your artists changed the naming? just random thoughts

royal rampart
#

nono if you scroll up, youll see it is still there

inner cove
#

ahh yes

royal rampart
#

but the thing is.. it is attached to the BallSocket, but the BallSocket-"bone" is like longer haha

#

because the ball moves along with the hand movement

#

it must be something really obvious

#

😦

inner cove
#

When a variable is set to RepNotify, does also the server run the OnRep function or only the clients?

royal rampart
#

only clients I think

bitter oriole
#

Yup

peak sentinel
#

have you guys heard anything about replicated floating pawn movement on 4.26?

hybrid zodiac
#

@inner cove Yes only clients run it, but you can get around this easily by just calling the OnRep function manually when you change the variable on the server

#
{
   if (HasAuthority())
   {
      ReplicatedVariable = newValue;
      OnRep_ReplicatedVariable();
   }
}```
soft girder
#

keyframe sockets?

#

is there a way or do i need to add bone

soft girder
#

virtual bones are not the answer for us either

#

got a big issue here. we need to attach a thruster particle effect to a socket on wither wing but need the ability to rotate this socket in the animation

hybrid zodiac
#

@soft girder You can't animate a socket, but I believe you can modify its relative location and rotation in code

soft girder
#

damn

hybrid zodiac
#

What you will need to do is create a separate bone in your skeleton and then animate that

soft girder
#

we have a backup plan doing something like you just said

hybrid zodiac
#

The bone doesn't have to be rigged or anything

#

It's really just there to act as a parent for the socket

soft girder
#

is this something that we need to go back to blender for

hybrid zodiac
#

Yes, just go back to Blender and add a new bone. As mentioned, it doesn't have to be rigged so it should be a fairly simple job

soft girder
#

ok

#

will this affect all the animations we have created already?

hybrid zodiac
#

No

#

Make a backup of course, but it shouldn't affect it

soft girder
#

ok

hybrid zodiac
#

Just parent the new bone to whichever one makes the most sense (one in the wing presumably) and then you can just modify your animation to include key frames for the new bone, which will be fore your thruster effect

soft girder
#

ok

hybrid zodiac
#

I assume you require the particle effect to rotate independently of the wing?

#

If you run into problems you can try the Animation channel πŸ™‚

soft girder
#

kk thank you

inner cove
#

GameMode has some important functions that’s aren’t exposed in blueprint and c++ takes literally 3-4 minutes to compile in my machine for a single line of code changed 😡

soft girder
#

vs2019?

inner cove
#

yes

peak sentinel
#

Is using interfaces to control vehicles makes sense in replication? or are there better ways?

#

other way is possessing the vehicle but not sure if its a good idea since gameplay framworks sucks about it when it comes to replication...

#

vehicles are not the main idea of the concepts, they are just included in very small duration of gameplay

#

just need a simple controller

#

but still i want to take advantages of chaos on 4.26 and vehiclemovementcomponent

#

oh...

#

i totally missed the part player pawn is controlling the vehicle (driving), the actual controller class doesnt belong to vehicle..

unkempt tiger
#

can someone confirm my understanding please: the replication graph does not actually optimize any bandwidth / networking, it only optimizes the server's CPU usage while iterating actors during networking protocols... and only improves scenarios with lots of actors that need networking

#

is this correct?

near bison
#

Do you guys have any suggestions on how I could implement a "days passed" mechanic in my game?

There are 2 levels: Day and Night, that the players keep traveling to and fro. How would I keep one variable that persists across levels that does NOT reside in the GameInstance? (I want the server to possess this)

inner cove
#

you can use the Options parameter when traveling

near bison
rich ridge
#

@unkempt tiger it do optimizes the bandwidth, the whole reason why replication graph was invented is to reduce bandwidth, fortnite have 50k actors and all replicating..
Let's consider one player spawned at one end of map, he doesn't need to know what is happening to actors on opposite side of map.. he is only interested in actors arround him in his sight of radius

inner cove
#

@near bison ohh then this must exist only on OpenLevel i guess

near bison
#

That's not very convincing πŸ˜“

#

lol I think I got it. but unreal has it SLYLY mentioned in the corner of their documentation

inner cove
#

@near bison btw the server and every client has their own GameInstance and its not replicated so even if the server store it there, only the server could access it.

near bison
#

that'll work the same for dedicated servers as well right

#

also quick question: individual variables on gameinstance can be replicated?

inner cove
#

that'll work the same for dedicated servers as well right
@near bison yes

#

also quick question: individual variables on gameinstance can be replicated?
@near bison no

#

Game instance is only aware of its own executable. Does not have any connection between server and clients.

near bison
#

@near bison no
@inner cove ok so on traveling, I should first extract the variable from game instance on the server, (somewhere, preferrably in game mode or game state) and then I'm good

#

got you. Was just clearing up some small confusions

inner cove
#

@near bison yes, before traveling you should set the variable on the GameInstance and after traveling you can get the variable from there.

near bison
#

perfect man. thanks so much

#

It would honestly make more sense if Options existed on servertravel, but it's fine I guess

#

This doesn't make semantic sense, because technically this variable is initialized on all clients for no reason

inner cove
#

Haven't tried the seamless travel but this should work as well, but i don't know what cons it has

near bison
#

Haven't tried the seamless travel but this should work as well, but i don't know what cons it has
@inner cove I've tried. GameInstance persists across seamless travel and works, no problems.

inner cove
#

@near bison no i didn't mean with the GameInstance, i meant if you set this variable somewhere else like the GameMode

#

the GameInstance is created when the game launched and destroyed once the game shuts down so it persist even when you change levels.

unkempt tiger
#

@rich ridge thanks for replying, but isn't that behavior already implemented with the Actor:IsNetRelevant(Player controller) function?

rich ridge
#

Just imagine you would have to iterate over these 50k actors to set it

lilac raven
#

hey guys, for some reason servertravel isnt working on my teams game build, but works in PIE, any idea why? thx

unkempt tiger
#

Yes, thats a lot of CPU iterations, but the eventual bandwidth result should be the same, no?

rich ridge
#

And you need to keep track of which actors too who became relevant every frame

#

Can you handle that in every frame...

unkempt tiger
#

Probably not, but again, only from the CPU side

#

not necessarily network side

#

the ability to call Actor->IsNetRelevant basically promises that all actors will be networked to a certain client as long as they are relevant to him

#

which is what the replication graph does too, so as far as what gets networked - it should be about the same, the question is at what CPU cost? How are those actors iterated every frame?

#

Hence my question

#

Which I'm afraid, remains

rich ridge
#

which is what the replication graph does too, so as far as what gets networked - it should be about the same, the question is at what CPU cost? How are those actors iterated every frame?
@unkempt tiger no replication graph doesn't work like this.

#

There is a official stream on replication graph where they explained their use case as per fortnite

#

In rep graph the map is divided into grids..
And the actors replication is decided on basis of grid relevancy to player..

#

You can specify the grid size as per your game requirements

inner cove
#

The Replication Graph eliminates the need for Actors to evaluate each connected client individually, solving the CPU performance issue without sacrificing the client experience

unkempt tiger
#

Yes, what PanTrakX quoted

rich ridge
#

^

unkempt tiger
#

From this I understand that

#

the issue that replication graph comes to solve is that of CPU performance, not networking performance

rich ridge
#

No it's both

#

Like I gave an example from fortnite..
The actor which is 5 miles away from player won't be replicated to him at all

#

Saving bandwidth for you

inner cove
rich ridge
#

Saving network cost..

#

@unkempt tiger most of the players they die in 2 minutes, so its waste to network , cpu to replicate entire world to players

#

Replication graph was invented to address these issues

unkempt tiger
#

you still didnt explain how replication graph optimizes bandwidth usage, you keep going back to the CPU example

rich ridge
#

I already explained

#

It only replicates actors from grid which are relevant to any player

unkempt tiger
#

I understand the example you gave me, and I replied with IsNetRelevant doing the same kind of behavior as far as what gets networked is the issue

#

afaik the grid can be equivalent to any spatial check the IsNetRelevant code does

rich ridge
#

If you can achieve your requirements by IsNetRelevant, it's fine

steel vault
#

Is there anything wrong with/strange about replicating a camera? I'm trying to use the camera's position and rotation for some calculations, and I feel like instead of making two UPROPERTY's I should just tick the replicates on the camera and then I should be good to go, no?

bitter oriole
#

Replicating the camera would do nothing in itself

#

You need to write code to synchronize clients and server, too

steel vault
#

A camera attached to a character though? I ticked it on and it seems to move now.

bitter oriole
#

If it's attached, sure, it's just replicated as existing and attached

#

Relative movement won't replicate though

steel vault
#

Gotcha. I suppose that's just default for projectiles and characters because they have movement components attached usually which deals with all of that for you.

bitter oriole
#

Exactly

#

Character movement component is like 20,000 lines of netcode

steel vault
#

So easy a baby could write it /sarcasm

inner cove
#

kappa <- Emoji for sarcasm

#

πŸ˜›

steel vault
#

I'm old school πŸ˜‰

#

Is there any cost savings to not including components on simulated proxy characters. I.E. if you know it isn't a locally controlled character, can you not attach a camera and other components that are usually only used because you are the owner of that character? I imagine if you had maybe 30 characters on screen each with 3 less collision capsules or components that aren't being used that would help a lot? A little?

#

And to target more specifically, a character with two MotionControllers, certainly doesn't need them on the simulated proxy, so would it help to remove them or is it fine to just let everything ride.

cunning relic
#

Yes I would think that you're correct, however I imagine for something like the camera component it's setup in such a way that there is little to no overheard to having it on non-locally controlled characters.

#

I would imagine other components created by UE4 are similiar

bitter oriole
#

The camera might be replicated to owner only

steel vault
#

For my setup at least, I have a collision capsule attached as a component to my camera, when I turn on the debug draw, the simulated proxy has the collision debug draw on, so still exists on the simulated proxy character I would assume. It's not replicating anything, but I was curious if having more components like that in general would effect performance at scale over having simulated proxy characters without any of that.

rose egret
#

they take memory but in comparison with other stuff its not much, if u have 30 characters in your game you surely have more than 300 static meshes in your level,

#

and cpu performance its just a little transform math (calculating local2world, aabb, ..)

steel vault
#

Ok, so in general, unless those things are doing some crazy work on tick or something it's probably fine to keep them attached for proxies.

rose egret
#

I myself like to not spawn redundant stuff but it doesn't worth it, don't like to get weird bugs in future πŸ™‚

#

😁

#

for instance in my FPS I have 4 components for FP and 4 components for TP (root scene component, weapon, scope, laser, suppressor, ...)

cedar finch
#

At the beginning of my game in the BeginPlay event I call an event that runs on server and sets a "RepNotify" boolean variable to "True". But all other players still see the value as "False". I can use an "InputActionEvent" to execute the exact same logic and then other clients can see the value as "True". So why is it that "Event BeginPlay" isn't setting it for all other clients?

unkempt tiger
#

Anyone here familiar enough with the built in character movement component? I'm really wondering what its approach is for networking states

#

From a first glance at the code it seems that the state of the player (position, not sure about orientation) is a replicated property that's being replicated about 100 times a second

#

But from experience (played a couple of games etc) it seems that orientations of players (especially when spectating their first person camera) are really smooth at 144 FPS, meaning it has to be interpolated somehow

#

Which is confusing, because I know that the character movement component relies on extrapolation of player state (by assuming non-changing inputs), meaning a state gets set as soon as it arrives etc etc

#

But how does an extrapolated player state work with an interpolated player orientation?

#

I know that the valve networking model is quite different, in the sense that the player (simulated proxy, that is) is interpolating states across a buffer of 'future' information

unkempt tiger
#

@dull lance I'm more focused towards simulated proxy replication

#

owning client -> server replication is just a stream of inputs and server -> owning client is just a state update, none of which really require smoothing (of course other than prediction)

#

but how do simulated proxies do it?

winged badger
#

they teleprot the capsule and interp the skeleton

peak star
#

Did they fix the problem where you can't join a game on Wifi from Android?

hollow eagle
#

@dull lance nope. Biggest change is the default to Chaos instead of PhysX but that doesn't really change anything about the programming side of things.

#

speaking of which... looks like preview 6 was just pushed out

#

err 5

#

it apparently got better in preview 2 or 3

#

my stuff isn't too physics heavy so I haven't noticed any problems even in preview 1

vivid seal
#

im replicating arrays of uobjects using replicatesubobjects in an actor component. this works fine. however, when it comes time to destroy one of the objects, i need to replicate it one last time to alert clients that object is going to be destroyed and pass some information. i did this by having a separate array of "RemovedObjects" that are objects no longer valid but still awaiting replication one last time.

then, in ReplicateSubobjects, i was calling ReplicateSubobjectList on them (as i am with the other arrays), then clearing the array. however, if i do this, the client never gets that last batch of replicated data.

if i instead do a hacky workaround and add a 1 second delay before clearing the array, everything works perfectly. the objects go into the RemovedObjects list, they are replicated again, then after 1 second they are removed completely and destroyed.

i'm trying to figure out why calling ReplicateSubobjectList and then immediately clearing the array AFTER replicating it causes the replication not to occur

#

in the same function

#

i figured as much, i just have no idea how it DOES work lol

#

so there's no way to do in 1 frame:

  1. Move an object into an array of objects to be replicated.
  2. Set a Replicated value inside the object.
  3. Call ReplicateSubobjectList on the array (which in my head meant getting all of the data that needed to be replicated from objects in the list)
  4. Clear the list so these objects will not be replicated again.
#

i just mean they won't be considered for replication again. after this property changes and the client gets it the object is essentially done, it's good to be garbage collected or destroyed or whatever, im not using it anymore

#

i just use the OnRep of that property for the client to fire off any logic before destroying it

#

its for a buff object, and its just a struct saying how/when the buff was removed

#

i wanted to use onrep in case there are issues with relevancy. like if client a sees client b has a buff, but client b is out of relevancy range when the buff is removed, client a wouldn't receive the multicast, so client b would still have the buff (but it would be a null pointer?) when he comes back into relevancy

#

i think i fucked up the structure though

#

the buff array itself on the component isnt replicated, just the buff objects, and then they tell the client version of the component to add themselves to the client array

#

with array replication, is there a good way to tell what was added/removed to the array when the onrep fires, or do u have to compare it to the previous state of that array

#

so the server manages an array of stuff that clients should be deleting, and the clients OnRep delete, how does the server know the clients have received it and remove it from the array

#

i guess the things that led me here were this:

  • the buffs need to be uobject. struct doesn't have enough functionality for everything i could possibly want to do with a buff, actor i was told will be way too heavy on the network to replicate if i spawn lots of them all the time.
  • the actual application and destruction of buffs, as well as all the parameters passed to the buff on the server should also be available on clients
  • array replication seems kind of inefficient in that every time an array is replicated, i would have to compare it to the local version of the array, find the differences, and then determine what happened (something was added, something was removed, stacks were gained, duration refreshed, etc.)
  • properties within the buffs themselves need to be available on both client and server, such as stacks and duration
#

so my solution was:

  • when a buff is created on server, it replicates its "creation event" which will pass all the data needed to make the buff on the server to clients
  • OnRep for creation event on clients, the buff notifies the client buff component that it exists and it needs to be added to the ActiveBuffs array
  • client side delegates are fired in the buffs component so that things like UI can react
  • when a buff is updated (stacked, refreshed), it replicates a LastApplyEvent, similar to creation event, which does basically the same things
  • when a buff is removed, it replicates its "RemoveEvent" which will pass the data that describes how it was removed (dispelled, player died, timed out, etc.)
  • buff then notifies the client buff component that it has been removed
  • delegates are fired, etc.

and that all works exactly as i wanted except that i don't have a good way for the server to know that the clients have confirmed the buff is removed and no longer need updates about ti

#

other than jsut setting a random delay and then removing it from concern

#

is there some kind of "OnReplicationDone" callback i can hook into in an actor component to know when replication has happened?

peak star
#

So now it seems like android can work with pc over LAN using open ip address console command as long as I start the PC exe with -nosteam -port 7777

Maybe it is just one of those lucky days whete it works and the command line args dont make a difference? My ini is set to use Online Subsystem null. Steam oss Plugin is NOT installed

vale ermine
#

So when character movement is replicated. Actor rotation is replicated. But if character movement is disabled actor rotation is not replicated?

sharp star
#

Hello. I have a listen server and two clients. I would like to ask how can you add a client variable to a server array?

rose egret
#

whats the esiest way to disable actor dick for dedicated server ?

vale ermine
#

remove component

empty axle
#
PrimaryActorTick.bAllowTickOnDedicatedServer = false;
twin juniper
hybrid zodiac
#

@sharp star If the aim is to ensure the array is synced between server and clients, why not just make the array replicated?

sharp star
#

@sharp star If the aim is to ensure the array is synced between server and clients, why not just make the array replicated?
@hybrid zodiac I did but it did not work.

#

Server still says 1 length

hybrid zodiac
#

Oh I see the problem. BeginPlay is run on server and all clients, so the clients add one entry themselves, then the server sends them another

#

Make the array replicated, and in beginplay just add the values to the array but only if has authority is ture

#

that way, server controls what is in the array and replicates to clients so its all in sync, clients dont do anything themselves]

sharp star
#

So, just that one?

#

But I don't think the clients will be able to add their own variable to the server's array?

hybrid zodiac
#

So you want the array synced across server and all clients, but clients can request to add entries?

sharp star
#

Yeap

hybrid zodiac
#

Ok, so then just add a reliable server function to add a new value

#

It will then be replicated back to everyone

sharp star
#

3 clients printed: 2 Length
Listen server printed: 1 Length

bitter oriole
#

What's the class used here ?

sharp star
#

An Actor class

#

Then I tested using a PlayerController

#

Still didn't work

hybrid zodiac
#

You removed the has authority check again

#

What is happening right now is this:

bitter oriole
#

Which actor class

#

Is it in the level, is it replicated..

sharp star
#

The base

hybrid zodiac
#
  1. BeginPlay executes separately for server and clients
bitter oriole
#

A server actor will have beginplay before any client can connect

hybrid zodiac
#
  1. Each client and the server add a value into their copy of the array
#
  1. NetMulticast from the serve then broadcasts the servers value, so the clients add ANOTHER value
#

So for clients, "ShareValue" is run twice

#

That's why you need "Has Authority" so that ShareValue is only run on the server

sharp star
#

This time, the clients printed 0

hybrid zodiac
#

There you go, so what happens now is each client in Beginplay requests a new integer from the server to be added to the array

#

The array is then replicated back to the clients

#

Server has authority over the contents of the array

#

What is the purpose of the integer array? What are you trying to achieve with it?

sharp star
#

Each player has a unique code and I want them all to be shared to each other

#

Testing it first with random integer since I don't know how to make random codes yet.

winged badger
#

if they are random, server can just assign them

#

doesn't need a client to tell it to do it

hybrid zodiac
#

Yeah, you can scrap my Request New Integer function then, just have a random number added to the array in begin play, but only if Has Authority is true

#

Put it in the PlayerState

#

In fact you don't need an array in that case

sharp star
#

Uhhm, I tried the images and still 0,0,0,1

#

Also, Has Authority is true?

#

How do you set that?

hybrid zodiac
#

Just have a replicated integer value called "Player Code" or something, set it in BeginPlay but only if HasAuthority is true

#

This is in your PlayerState blueprint

sharp star
#

Oh, I'm going to use player state?

hybrid zodiac
#

Now every player when they join the game will be given a "Player Code". This player code will be shared with all other players too

sharp star
#

I was just using one actor

hybrid zodiac
#

If you want the code to remain unique to the player across their play session, this is the best way to do it

sharp star
#

I see

#

I will try that

#

Thank you

#

I'll try to find a way to call functions from player state

hybrid zodiac
#

The Player State class is basically all information you want on an individual player that should be shared across all other clients

#

So in this case, their unique code

#

But you could also use it to hold things like their current score, if you want a score board for example

#

Or whether the player is currently dead, their name, etc.

sharp star
#

Thank you!!!!

#

I will try that

hybrid zodiac
#

You're welcome πŸ™‚

twin juniper
#

Question: Does pktlag only introduce lag from the server end? what is the command to do the same from client or introduce latency both ways?

#

Oh wait, I think I only issued the command on server, never mind

glad sedge
#

Been a while - Role < Owner is accessing a private bariable

chrome bay
#

use GetLocalRole()

glad sedge
#

Ah thanks

quick flint
#

How would you guys handle a 'reconnection' button? Imagine a game like Overwatch or league of legends, a player disconnects, their power goes out, but you want them to be able to reconnect. How would you implement this? My current thoughts were to store some sort of environment variable, a file, or some other sort of piece of information on the players local machine that would essentially just store the connection string, and once the match is over, that connection string would be deleted from their PC. What would you guys do?

inner cove
#

@quick flint no, because then the player can just delete this file and start a new game

quick flint
#

Of course

#

What would you suggest?

#

Building a 3rd party api is out of the question imo

bitter oriole
#

Well you kind of will need one here

#

If you want to force players to rejoin, as opposed to giving the option, then you need to have your own matchmaking, I'm not sure you can store state using e.g. Steam matchmaking

#

If it's just an option a save file with the session id is perfectly fine

inner cove
#

^ Exactly

quick flint
#

I was using my own matchmaking

#

but i decided to move to EOS

peak star
#

Is there a way to make the packaged executable behave as if it was run from command line with -nosteam -port 7777 arguments, without the user having to type those in each time?

inner cove
empty axle
#

can you have conditional replication in GetLifetimeReplicatedProps if the condition is different per blueprint default and never changed at runtime?

inner cove
#

and on the target you would pass your command line arguments @peak star

peak star
#

That's how I'm doing it right now, @inner cove but is there a way to do it that doesn't involve the end user even knowing they need to choose the shortcut instead of the bootstrapper exe alone? End user meaning average customer who bought my game and just wants to hit the windows Start key and type the name of my game and choose the top result to play.

empty axle
#

so you have

UPROPERTY(EditDefaultsOnly)
bool bReplicateSomething;

and that differs based on different blueprint assets? But it is not changed at runtime

chrome bay
#

@empty axle per-blueprint class yes, but not per-instance

inner cove
#

@peak star i don't know about that and the docs suggest this way i sent so maybe its in your hand to make some guide/documentation for the game on how they should run a dedicated server (i guess that its a dedicated server because you asked on this channel).

#

@peak star i think you will have better luck asking that on #packaging

inner cove
#

A Quit Game node run on a dedicated server will shutdown this dedicated server instance?

#

Just tested it and it works ^

twin juniper
#

How can I handle host migration when the listen server closes/disconnects?

chrome bay
#

Make the server choose a suitable replacement host, tell all players who it is, they try to join that player when the session disconnects

#

It's not straightforward though

twin juniper
#

So when the game session begins, the listen server should instantly choose a suitable client as a replacement in case of a disconnect?

#

And shares information with that client. Then when a disconnect occurs, that player becomes the new host?

chrome bay
#

something like that I guess. You will still have to transition to a new session and level I suspect

twin juniper
#

Okay. Well if there isnt much existing resources done on this I can try implementing my own system for it.

inner cove
#

On a multiplayer game where do you spawn the HUD/UI (if there is)? On the begin play of the PlayerController or somewhere else?

#

(I do it on the begin play of the player controller, just want to see how others do it if maybe there is a better way than how i do it)

rustic spruce
#

the player array type is player controller

inner cove
#
  1. Only the server posses a GameMode object so custom events should not replicate
rustic spruce
#

oh

inner cove
#
  1. Set the SelectionCharacterWidget to replicate on owning client
rustic spruce
#

thanks :)

inner cove
#

np πŸ™‚

rustic spruce
#

well i'm confused how i can replicate the HUD then

#

hmm

inner cove
#

you cant

rustic spruce
#

oh

#

well how can i show the same HUD for each players?

inner cove
rustic spruce
#

ok thx

dark edge
#

@rustic spruce don't replicate the hud, replicate whatever data drives the HUD.

#

In a racing game, you wouldn't replicate data about the speedometer, you would just replicate the speed and then everyone would drive their own speedometer with it.

unkempt tiger
#

does it make sense networking entire HitResults from the server to clients via multicasts whenever a bullet hits a player, to display impact effects?

#

it seems like a lot of bandwidth

#

but Im having trouble coming up with something else

winged badger
#

FHitResult is fairly efficient

#

but you can get away with a packed vector and a packed normal

unkempt tiger
#

Yeah, phys material as well

winged badger
#

replicating names is never efficient and maps don't replicate πŸ˜„

unkempt tiger
#

perhaps also the bone name to attach to, which I've already mapped to be a uint8

winged badger
#

it goes over as string

unkempt tiger
#

yeah, like an agreed upon cache

steel vault
#

Best practices question: If I'm sending up some data unreliably on tick (or very quickly) and that data is a bunch of vectors and rotators, is it more efficient to send up one big struct with say 5 transforms with 1 RPC call, or would it be more efficient to have 10 RPC calls with each of these values separated out? The reason being: say if 8 of these values do not change and you write logic to not RPC call if the value has not changed, but 2 of them do change you will end up sending the struct with all 5 transforms, when instead you could have just sent the changed value. The real question is, is it more efficient to have a larger amount of unreliable RPC calls with smaller amounts of data (1 vector or 1 rotator) or is it more efficient to have less unreliable RPC calls with a more data: one bigger struct with all of the data encapsulated regardless of maybe only one of them being different?

clear sand
#

How would you use those 5 transforms? And will you need rest 4 transforms if you already have latest one?

#

ATankNoMore is right - best use build in replication and only use reliable RPC calls when you want to get response for sure

steel vault
#

Replicating the variables and setting them on server is not an option. These are input values taken from the locally controlled client. They have to be sent up to tell the server what to do. The question isn't whether or not they should be reliable, the question is, if they are all unreliable and they all need to be sent up, is it better practice to send all of them in a struct with one RPC call or separate smaller chunks with more RPC calls assuming that sometimes the RPC doesn't need to be called.

wheat magnet
#

i need console command, not code

steel vault
#

Ok, so in general with a large amount of data (10 floats and 3 transforms) being sent up unreliably, it's better practice to combine them and send all at once instead of having 13-16 RPC calls.

#

I'm also wondering if a struct is even the right way to go. I know @winged badger is always recommend Fast arrays or things that have better serialization, but I'm not sure that would fit the bill for this situation.

fallow shadow
#

Hey, does anyone know how to show a widget to a specific client?

steel vault
#

@fallow shadow send a client RPC from the server owned actor/character telling it to show a widget I would think.

fallow shadow
#

So the command should be executed with a custom node set on server?

steel vault
#

Or you could simply set a replicated variable like a bool on that replicated actor and then in the OnRep function for RepUsing you can do the action as well. It's essentially the same thing.

fallow shadow
#

well, it didn't work....(The server node choice)

steel vault
#

Can you show your setup?

fallow shadow
#

yea

winged badger
#

@steel vault i have heatscan weapons that can fire multiple projectiles and penetrate

fallow shadow
#

just a moment

winged badger
#

i batch the payload for each hit and send it with a single RPC

steel vault
#

Do you batch them into a struct or a fast array?

winged badger
#

struct, if its a RPC

#

fast array isn't made for RPC payloads

steel vault
#

Ok thanks for the clarification

winged badger
#

its not the better serialization its per item callbacks on clients

#

that make it awesome

fallow shadow
#

Inside the widget(I use this to call the the other function in the player that spawns the widget that i need to show only on a specific client)

steel vault
#

You should never call any type of RPC from a widget

fallow shadow
#

oh let me transfer everything onto the player then.(The player blueprint)

steel vault
#

UI in general is never and should never be replicated.

#

Do all of that type of logic inside the player or player controller

dark edge
#

@steel vault what's the context? What exactly are you trying to do.

steel vault
#

Are you referring to my unreliable struct? @dark edge

fallow shadow
#

Same result again

dark edge
#

@steel vault I meant to tag FanMan rather.

fallow shadow
#

I am trying to get a widget to show on only one client!

#

Also i am running a dedicated server

dark edge
#

@fallow shadow but the context is an invite to party tho, right?

fallow shadow
#

what do you mean?

#

uh, yea

dark edge
#

I would do a party invite like this.

  1. Client decides to invite someone, they call an event on server called InvitePlayerToParty which passes over the playerstate they want to invite (clients can't see other controllers)
fallow shadow
#

i am sorry, what do you mean they can't see other controller?

#

That's the flow i should follow?

dark edge
#

On client you can only see your own controller.

#

So anyways, however you do it, you should end up with the sender and receiver of the invite in the GameMode or another server side actor

#

You could also do it all in the server side of the player controller, if you have a server side way of selecting the invite recipient.

steel vault
#

If you are choosing a player on a client, you should send a server RPC to let the server know who you are trying to invite, then the server decides which player to send it to like Adriel was saying and then calls a client RPC on that server side player.

dark edge
#

Anyway, you end up with the sender and receiver PlayerControllers or PlayerStates. You then run on client the logic to pop up the right dialogue boxes for each PlayerController

#

@steel vault ya exactly, you tag them by PlayerState or the Pawn since you can't see their controller. Server-side you can use that to find the controller

#

Wherever the party system lives, it should be on server so it can see everything. Once it has the sender and recipient, it calls a run on client on their PlayerControllers to pop up the widget.

fallow shadow
#

okay but i have a question. I want the invite to happen through a widget. And i spawn that widget inside my character on a multicast node. Should i swap that node to a server one instead?

#

so everything related to it should be on server nodes?

dark edge
#

Never multicast the spawning of a widget. Never do anything network related regarding widgets. They don't exist over the network.

#

Network the behind the scenes stuff that causes them to show/hide

steel vault
#

I'm more accustomed to C++ than BP but what I think your issue is in your code is that you are trying to send a Server RPC on an unowned player. You need to send the server RPC on your locally controlled player sending the player ID of who you are trying to invite basically.

fallow shadow
#

okay so hold on let me give you the full story because not giving it is not helpful. I right click into a character and then a widget pops up with a few options. The first option is to invite them to your party. If i have understood correctly all of the above part should not happen in replicated nodes!

dark edge
#

@fallow shadow yes, that's all client side

fallow shadow
#

Also, i should create an event on server which will then call the other player to whether accept or decline the offer. Let me go back and read about the widget because that part is a bit blurry

steel vault
#

So instead of saying clicked player->SendServerRPC do Player->SendServerRPC(ClickedPlayerID).

dark edge
#

When you click invite, that's when your PC or Character calls a run on server event with a reference to the Character or it's owning PlayerState you want to invite

steel vault
#

Yea your code is wrong because you are calling an event on an unowned player

fallow shadow
#

alright. Let me try and fix all this!

#

Also, how do i "own" a character? Do you mean possess?

dark edge
#

@fallow shadow no, the connection/PlayerController automagically owns the player it is possessing.

#

Where are your parties gonna live?

fallow shadow
#

You mean where will i store the players in party?

dark edge
#

Ya

fallow shadow
#

I was thinking of an array

dark edge
#

I'd recommend GameState