#multiplayer

1 messages · Page 682 of 1

hallow sand
#

You gave me an idea of what to check by asking what is calling it though, thank you

static lynx
#

How can I create a replicated shooting system? I tell the server to start and stop shooting from the client. The server grabs the socket position for the projectile. Which works fine when stationary, but while moving, it can result in drastic differences between when the vector and the client, and the server vector. For example, during a sweeping single shot. The red shot is the trajectory for the Server, where as the green one is what the client had.

twin juniper
#

You would spawn the projectile only on the server.

#

Why you do it on both client and server

shy hill
#

generating a random password for a server, not sure that's the most optimized way of doing it but it works lol

static lynx
twin juniper
#

You would grab the socket location from client and send it to the server

static lynx
#

So the green line is where the player was looking down the sights of the weapon when it was fired, but the red line is where the server saw it

#

That was my thought as well, with some server side checks to make sure it's relatively close to the server side position to negate most cheating

twin juniper
#

If u take a look at the project

#

I guess games like fortnite does it aswell

static lynx
#

oh yeah? just does a check if within x amount of distance, then valid?

twin juniper
#

They grab location and rotation from client

twin juniper
#

But you can check if the start location is close from the Owner Pawn

static lynx
#

that's my idea as well

twin juniper
#

Also, how u planning to make it accurate to your screen center ?

#

With shooting from the muzzle

#

There’s a small amount of distance where shooting from the muzzle is not accurate

static lynx
pearl fog
#

hello! I have a question about chat
I currently rework some parts of a released game, in this game we implemented a basic chat system using RPCs inside the PlayerController, but I wonder if there's more powerful/better ways of doing so ? I've read a bit about steam lobbies message and it seems interesting but I don't really know if this is adequate (we use Unreal's session system, no dedicated servers or connection by IP)

graceful flame
#

Could try using some kind of cloud database for a chat backend if your data needs to be persistent.

#

Then use the VaRest plugin to send and receive json

cerulean juniper
#

Hey! I just made 2 characters connect in the same Level. I can See both walking as the movement component is already replicated.

however I have a character who can run and walk on walls (all these action are animated), and none of those animations are replicated.

I search on Youtube but only found how to replicate Montages.

Is there a way to replicade the Animation BLuprint or something like that?

dark edge
cerulean juniper
#

so, should I replicate this variable for example? And every other responsible for the transitions?

dark edge
#

You replicate whatever is required on the pawn to drive the animation.

#

But character movement gets weird and is absolutely NOT trivial in multiplayer so you'll have to really know what you're doing to make things behave butter smooth.

dark edge
#

For example the default 3pp character just uses velocity and bIsInAir to drive the animation. That's all replicated by the CMC

cerulean juniper
#

sorry, what is CMC?

dark edge
#

Character movement component. If you have to ask that you're nowhere near getting a multiplayer wall run to behave.

#

But just keep in mind that the animation BP knows nothing about networking. Just replicate what it needs to drive the animations.

cerulean juniper
#

What about changing character's position via action animation.
I'm have some problems. (the client moves, but then its foced back to the initial place)

zinc acorn
#

yo, so i was curious about level blueprints driving certain gamemode values(enemies spawning for example i guess), would level blueprints work for this in a multiplayer setting?

spark owl
#

I'm using AWS gamelift to host servers for my game, I'm getting this issue where even when the AWS session is set to be 24 players max, it is still limited to 16 players by the engine, I checked the log when I tried to join a server that was at 16 players and it gave this error:
Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Server full.
how can I adjust this number to be higher than it's default which seems to be 16?

spark owl
vagrant grail
#

I think I will let people host their own servers but you didn't answer my question, if people could host their own servers, would console players be able to join servers if a put searchbar and stuff like that ?

fossil spoke
zinc acorn
spark owl
fossil spoke
#

We usually define the Player Count within the Command Line Args as a property that GameLift sets for the Server Instances

fossil spoke
#

Set its value

#

MaxPlayers = UGameplayStatics::GetIntOption(Options, SessionOptions::GLOPTION_MaxPlayerCount, MaxPlayers);

#

This is ours

#

Within InitOptions of our GameSession class.

spark owl
#

hmm i'm using blueprints, i use a plugin to interface with AWS, i'm guessing that what you just described is done with c++?

fossil spoke
#

MaxPlayers is also exposed as a Config variable

#

So you can set it via the .ini files

#

DefaultGame.ini

fossil spoke
spark owl
#

ok i see so I can just add "MaxPlayers=24" to defaultgame.ini?

fossil spoke
#
MaxPlayers=16```
spark owl
#

ah awesome ok ty so much this is exactly what I was looking for

#

my playerbase will be stoked i'm fixing this lol

fossil spoke
#

👍

sinful tree
vagrant grail
vagrant grail
#

Please ping me if any answer

dark edge
#

If you have to ask the question, you won't be doing dedicated servers.

vagrant grail
#

I'm gonna ask it differently to see if it helps :
If in my game, I let people be able to put the ip of their own servers (so not on their client but through a server provider so the session is always open and people could join), could consoles people join too through a search bar and typing the name of the server shows you the surver and you can join it (like in minecraft) ?

winged badger
#

having players run their own servers doesn't prevent cheating in any way, shape or form, it just changes how they do it, slightly

#

and you either need a matchmaking service that will let public servers register, then provide their information to players, or your own custom matchmaking servers to allow cross platform play

vagrant grail
#

@winged badger yeah sorry I know that allowing custom servers won't stop cheating (but that's ok in a way as my game isn't based on skill or other important stuff).
Do you have names of matchmaking services. I mean isn't something in Unreal to do that ? Also would people on consoles be able to find those hosted servers by people ?

twin iris
#

anybody know some good multiplayer tutorials that actual build a working project

#

ping me if you know some

thin stratus
#

Hm I'm not sure that's the correct answer haha

#

AWS is mostly for hosting and not necessarily something to register sessions for matchmaking

#

Guess EOS in combination with AWS could do the thing, specifically if they want cross platform matchmaking

bitter oriole
#

And no, Unreal doesn't do matchmaking - your console does

#

That's how they see the subscription money

sinful tree
#

Correct me if I'm wrong, but I think Epic Online Services can be used to help with matchmaking. I imagine you'd have a server create a session when it starts up that people could join into. Clients could then look up the sessions and you can have the engine filter results as you wish (possibly including by name, if you use some regex magic). As far as cross-platform, that I don't know, but EOS does support consoles too.

dark inlet
#

Hello, I'm trying to implement a save/load system inside a multiplayer game. I don't know why my PlayersDB variable returns 0 when called from outside of PlayerJoined,RefreshPlayers or the LoadGame function. While getting the varibale inside those events/functions works, trying to call it from 1 Pressed doesn't work. Here is my blueprint.

rapid bronze
#

Index 0 will always return the first player in the array when run on server

#

While if you use it on client it returns itself

gleaming kite
#

what's the best way to destroy an actor that a client has "picked up"? I know there's running a multicast on the player controller but that doesn't feel like the best option.

chrome bay
#

Just destroy it server-side

gleaming kite
#

gotcha, thanks! i feel kinda dumb i didnt think of that.

dark inlet
rapid bronze
#

You're reading Red from server, Green from client

dark inlet
rapid bronze
#

RPC?

Run On Server

dark inlet
# rapid bronze RPC? Run On Server

Sorry for the dumb questions, I'm pretty new to multiplayer. So you're saying that I should create a Custom Event thats set to Run On Server where i plug in theSaveGame function, then call that Custom Event from the key press?

rapid bronze
#

Key 1 Pressed -> Custom Event with Run On Server -> SaveGame

rapid bronze
#

Where is that at?

#

What BP is that

dark inlet
#

ThirdPersonCharacter

#

If that's what you mean

rapid bronze
#

How do you save?

dark inlet
#

As I said, if i connect a Print String with the PlayersDB lenght anywhere here, it prints 1. So it works there.

#

RefreshPlayers is a multicast

rapid bronze
#

It's weird to handle it in the ThirdPersonCharacter tho

dark inlet
#

Got any better tutorials? I would gladly follow them.

rapid bronze
#

You many wanna have it in the GameMode / GameState iirc and have logic there for saving

#

Client should have nothing to do with saving if an online game

#

Server should handle it all

#

Pretty sure there's something in the logic too that's not going well

dark inlet
#

It's meant to be a Host-Join multiplayer.

rapid bronze
#

Then the Host will be the server handling it in the GameMode, no real difference

#

You can hold custom data in GameState for saves if you want other players to know about states

#

GameMode saves -> calls refresh on GameState

#

Since everyone knows about the GameState all the time

#

And it holds an Array of all PlayerStates

#

For example I have in GameMode OnPostLogin logic that initializes a save slot for a player and loads character if they already have one, then it updates the GameState list to let everyone know that the player came online and such

#

It should not require too much hassle, just a normal save state and you can still use the data from the saves to do anything like store them in an array or update it

#

Think it in steps, for example

Player Logins -> Check if they already joined the server before -> If they do check if they have a character -> If they do load it, if they don't spawn them / character selection -> Let everyone know about the data if you need to through an Array in the GameState or such

For example if a player is logged on they will be present in the Array, if they are offline they will not

#

If you use any subsystem you can use their ID as identifiers and save slots

dark inlet
#

I do

#

I see... Tho you explained it pretty well, which i appreciate very much, any tutorials on this approach? I'm surely going to stumble upon many errors or thinks that i have no idea how to do...

rapid bronze
#

Not sure if there are any tutorials tbh, I just did it all myself with JSON, but I imagine there should be?

#

My best advice is to just abstract it into smaller code and don't worry about letting other players know for know

dark inlet
#

Alright, I'll see what I can do. Thank you very much! If anything, I'll ask again here.

rapid bronze
#

This is how my abstraction looks

dark inlet
#

I see. Thanks.

vagrant grail
#

Yeah I know about AWS, but it's not answering my question : If I let people be able to host their own servers (they purchases anywhere) to host a game, would console players be able to join ? YES or NO ?

bitter oriole
#

And as you might be aware, crossplay is a recent business

vagrant grail
#

yeah but it's not only about crossplay, as crossplay usually the servers belong to the company making the game and in this case the servers are the player's ones

bitter oriole
vagrant grail
bitter oriole
#

It's the stuff you learn after signing a NDA

#

So if you want to know the crossplay policy for a console - which is probably something like "yes but here are our terms for it" - you have to get in touch, sign the NDA, etc

#

One leak from the Epic v Apple shitshow supposedly had crossplay be a paying option

#

Or plan for the answer to be no and at best you'll be pleasantly surprised later

sinful marlin
kindred widget
#

If it is a replicated object, it will never be a proxy on the server. The role will always have authority. Simulated and Autonomous proxy just differ in the way they are meant to replicate things. Simulated is pretty much controlled by values replicated from server. Autonomous usually relies on a client uploading values to the server to be replicated for other clients to simulate, though some values can still be server authoritive. Character is a good example of this as it is an autonomous proxy for the client possessing it. Their control rotation's pitch is sent to server, and other clients use this to drive their own local anim offsets. The character also relatively moves freely on the client except when it goes too far and server corrects it. This keeps the autonomous proxy from constantly overriding the client, which would make the user feel like they're always fighting against the server.

bitter oriole
#

ROLE_Authority is pretty much 100% of all server-side objects

#

ROLE_Authority is on client for every unreplicated object

#

Because everything on the server is authority

#

100%

#

This check is about more than "are we on server"

#

It's "do we have no remote player and are on server"

#

Or single player

#

Good move

ancient adder
#

How do you make "specific player" work when running Execute console command node? typing quit and providing the controller doesnt make the client quit the game

rocky night
#

HI Guys, sorry for the mess. I try in a Multiplayermatch to stop movement.. I call this from the Actor (a Capsule) which overlaps with the Player. It works alone ut when i try it in Editor 2 Players Listenserver, it crashes..

#

both players inherited from th ebase character

sinful tree
rocky night
#

Its a Keyevent

#

I use a interface (Key F) @sinful tree

sinful tree
# rocky night I use a interface (Key F) <@218956378654507008>

So you have something on your player controller or character that calls an interface that then triggers the event that feeds into the gate's "Enter" pin? Nothing is replicated from client to server? is there any specific cases in which it crashes? Like does it work once, or just not at all, or does it crash when you overlap, or when you trigger the interface?

winged badger
#

install editor symbols for debugging, reproduce the crash and c/p the callstack

muted perch
#

I'm having some trouble with sending data to the player controller

#

I'm trying to make it so the character, before it gets destroyed, it gives the inventory array to the player controller and so the next time the character gets spawned it will get the inventory from the player controller

#

Here is my code for updating and receiving inventory:

#

Should I use the player state instead?

rocky night
rocky night
minor nova
#

I'm trying to debug an issue in my project regarding TearOff. When a character dies, they have TearOff called on them. Stepping through with debugger, TearOff only ever gets called once, but every time a client hits the now-dead, torn off character, it has TearOff called on it again for some reason. I traced back to UActorChannel::CleanUp, where bTornOff apparently doesn't hold its value of true, and so it keeps calling TearOff on the character. Does anybody know what might be going on here?

fossil spoke
minor nova
fossil spoke
#

That is weird

jolly siren
#

What do you mean by "hits"?

minor nova
#

This is the relevant call stack every time the client attacks the dead character

#

There's an attack gameplay ability. Does some melee hit detection and deals damage to the character that gets hit

jolly siren
#

And your death event isn't getting called again for the dead character? Where is TearOff getting called when a client hits the dead character? On the hitting client or the server?

minor nova
#

Yeah that's what's really weird. When my client hits the dead character, the breakpoint for TearOff never gets hit

#

I've searched my entire codebase for calls to TearOff and they dont show up anywhere

jolly siren
#

Also while debugging this, remember that after tearing off an actor the client becomes the authority

#

Why do you think it's getting called multiple times then?

minor nova
#

I have absolutely no idea, lol

jolly siren
#

Those statements seem to contradict

#

oh 😛

minor nova
#

I do a search for TearOff() on my entire project and the only hit is the one I have a breakpoint set on

#

I suppose it may be a complication caused by GAS?

#

The attack ability is local predicted, it may be related to that hitting a torn off actor

gleaming kite
#

I am using an array in a player state to store item references for an inventory but the array just clears itself of all items in it after ~30 seconds. Is this normal behavior?

This is how I am setting the array :

#

And this is how I'm printing it:

#

Here's my initial output:

#

Then my output after picking an item up:

#

Then finally my output after ~30 seconds:

pearl fog
#

wow

#

just found out that you need to multiply PlayerState's Ping by four to get the correct value

#

because for some reasons the engine takes ExactPing, rounds it and divide it by 4 before sending it out 🤔

jolly siren
#

@pearl fog It does that so it can fit it into a uint8 for optimization purposes

kindred widget
#

Because by default FNames are 12 bytes. That size is excessive since they can quite literally usually be represented with nothing but a few bits. Internally FName is nothing but a couple of uint32. So they're packed down into those bits for networking.

small tartan
#

Basic question . Is there more proper way to access PlayerState on Character creation than seconds delay in Event BeginPlay? Somehow whit OnRep:s inside the PlayerSate? Not managed to do that successfully.

sinful tree
small tartan
#

cd ..

thin stratus
#

That also exists in the Pawn/Character

#

Just keep in mind that the cpp version of OnRep doesn't call for the server. So you need to find a different call for that one

twin juniper
#

Is there a way to prevent no-spread, no-recoil cheats ? I could replicate it but it would be useless since this is the kind of value we only set one time

unkempt tiger
#

depends on how you do spread*

#

if its purely clientside then not really, if its serverside then definitely (but at the cost of very bad jank), if its somehow clientside (eliminate jank) and serverside (for extra validation) then its win win, but the implementation isn't trivial

twin juniper
#

recoil is done locally, adding value to yaw/pitch input

twin juniper
#

and i'm only planning to do it for hip fire so no need to add cheat verification on it

unkempt tiger
#

sorry I talked more about spread, no-recoil cheats are arguably impossible to prevent 100%

twin juniper
#

or does the opposite

#

applying recoil after projectile but checking after projectile launched if recoil values are good before applying them

#

if not override or just ban the guy ?

unkempt tiger
#

I dont know, what if the user is counter acting that recoil with inputs?

chrome bay
#

Usually you aren't getting rotational updates from the client in-sync with their firing RPCs, so it's very hard to actually validate

unkempt tiger
#

How do you plan on validating that?

chrome bay
#

No just by moving their mouse

#

How do you tell what's a cheat and what's a legitimate input

unkempt tiger
#

and even if with macros, how can you the developer tell the difference?

#

it's impossible to do

twin juniper
#

Moving mouse does not modify the recoil values

#

so ?

chrome bay
#

No but it modifies where you're aiming

#

Which as far as server is concerned is the same thing

#

Depends on your implementation I guess

unkempt tiger
#

unless you've got a magic mouse hardware API that encrypts inputs to prevent macros

twin juniper
unkempt tiger
#

yep

twin juniper
#

but anti cheat does detect macros software

#

they generally hook mouse functions from win api

#

but anyway

chrome bay
#

Generally for detecting input hacks all you can do is run an anti-cheat software

twin juniper
#

at the beginning of the discussion*

unkempt tiger
#

yeah, or you can have some not-at-all-trivial validation layers in your game code that give player a trust score and solve the problem with a 'soft' solution, a bit like what Valve does

chrome bay
#

It depends how your recoil is implemented

#

If it's the usual way, I.e. just rotating the camera up, then you can't do anything to detect it because the player will just counteract it with the mouse anyway

#

And also those tiny rotations are way to sensitive to network error

twin juniper
chrome bay
#

Be safer to tick it instead IMO

twin juniper
#

i already tested by tick 😄

chrome bay
#

recoil for us is essentially "add some rotation to camera after firing"

#

And since bullets go where camera is facing, it directly affects where shots go

#

But the rub is, the players look direction is a) heavily quantized and b) sent by the character movement component

#

So it's not perfectly accurate or in-sync with the firing RPC's server-side

twin juniper
#

compensating player mouse movement

chrome bay
#

So while we do check the player is shooting from their location + rotation, we have to allow tolerances

twin juniper
#

yeah true

chrome bay
#

You also have to allow for players literally spinning on the spot

#

Players can turn some 60-90 degrees in a flash like it's nothing

#

Validating where they're looking is pretty impossible to do accurately

unkempt tiger
#

yeah, rotations aren't stateful, they are part of the input

#

so you cant do any over-time checks on them trivially, in my setup rotations are 100% client auth

twin juniper
#

So there's no safe way to check recoil

#

😐

#

Does games like PUBG and Fortnite prevent that ?

#

(taking them as example since recoil is important in those games.)

chrome bay
#

Unlikely IMO

unkempt tiger
#

best they are probably doing is their own version of anti cheat

#

slap that in and crossing fingers is likely the best approach 😄

twin juniper
#

Argh

#

anyway even if i tried to prevent that

#

there's macro

#

👍

#

so yeah impossible to prevent

#

im wondering if anti cheats does detect macros from "verified software" like razer and logitech

#

🤔

kindred widget
#

@twin juniper Things like this cannot be prevented by the server. It's too hard to do. Too much latency, not enough fresh data. That's likely one of the major reasons that Epic bought out Kamu. Client side cheat prevention is the only realistic way to handle that appropriately if it means that much to you.

twin juniper
#

hi guys i have a headache now can someone help me?!!!. I maybe at wrong direction but how do I replicate variables with COND_OwnerOnly if my pawns are simulated and my controller possess RTS camera?

void nest
#

@sinful tree Sorry for pinging. But i'd like to follow up on the question regarding the deleted pawns on disconnect.

After a lot of debugging and testing, we finally found the exact circumstance a pawn is still getting deleted despite all the overrides we made. **When a player crashes ** is when it happens. As long as a player disconnects, even with alt-f4, pulling internet cable, whatever won't cause deletion of the pawn. But when a player is possessing the pawn and then somehow crashes that's when the pawn still gets deleted.

We've also done some further investigation and saw some really strange stuff happening when a player crashes. For example, even logout in the gamemode which is normally always triggered is NOT triggered when a player crashes. Even more interesting, when a player crashes, his pawn's actor doesn't even trigger the destruction event which again in normal circumstances will always fire no matter what. It's almost as if there is a hidden overriding super delete that only gets used when a crash occurs on a connected client. Like the engine trying to aggressively delete everything the player was connected to without even using the regular deletion methods that are inherited down from AActor to APawn. it's like a delete that doesn't even exist in AActor.

Any idea what this strange behaviour is?

silent valley
sinful tree
# void nest <@!218956378654507008> Sorry for pinging. But i'd like to follow up on the quest...

In my instance, I started with a fresh Third Person template, no other changes other than removing the PawnLeavingGame() call from the player controller in C++ as I had mentioned in my previous post about this.
The game wasn't packaged, but I wasn't running in editor - I ran the server and two clients from the command line.
All pawns were spawned on the server and were marked to replicate.
When testing I tried these methods:

  1. Forcing a crash using the console command "debug crash"
  2. ALT+F4
  3. Shutting down the console window for the client (which should be a graceful quit)
  4. Shutting down the process for the client in task manager.

In all test cases, my controlled pawns were not being destroyed when the client that was controlling them left the game. The pawns remained in the game and could be repossessed by the remaining client that was still connected to the server.

That's about all I know. :/
I don't really have the time to package a server and client build to test if that may make a difference, but I sort of doubt it would.

void nest
#

Hey thanks for the in-depth testing results! Much appreciated. This is very useful information for us 🙂

#

We're planning to do more testing today to get to the bottom of this. I'll def share the results of our upcoming tests and if and when we finally fix the issue.

#

Could you maybe share your .cpp and .h code for your adjusted controller?

#

Would love to compare with our own code

#

Perhaps we screwed something up

#

Also, another test that might be helpful is using the low entry extended library node called "crash"

#

I think this crash might be a bit more serious than the debug crash command

sinful tree
#

It's pretty much just completely overriding the existing PawnLeavingGame() function and just putting in an on-screen message.

.h

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "CPP_PlayerController.generated.h"

/**
 * 
 */
UCLASS()
class ANIMATIONASSETS_API ACPP_PlayerController : public APlayerController
{
    GENERATED_BODY()

public:
    // Server only
    virtual void PawnLeavingGame() override;

};

.cpp

#include "CPP_PlayerController.h"

void ACPP_PlayerController::PawnLeavingGame() {

        if (GEngine)
            GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("The player controller has a pawn, and it should still exist!"));
}
void nest
#

Thanks! 🙂

sinful tree
#

I have that plugin... lemme give it a go.

void nest
#

Your code looks pretty much 1/1 with our code except for the debugmessage

#

The thing is though that this code works as well. Just not when a player crashes.

sinful tree
#

Seems like the crash node with the low entry works fine on my end too.

void nest
#

Hmm ok very interesting

#

The thing is that the deletion happens on our dedicated servers

#

So maybe it's something linux build / package related

#

We haven't tried it in editor yet

#

We'll try that next

sinful tree
#

You're also sure your player controller is set in the game mode / your player controller class you're using inherits from your C++ player controller?

void nest
#

Yup, checked that a lot of times as well

#

But 100% sure it's the correct controller

sinful tree
#

Blergh... Sounds super frustrating.

void nest
#

Yeah haha

#

It's one of the last remaining (but sadly very gamebreaking) bugs in our live game

#

But at least I'm happy we are able to recreate it now on our end. Because up to now our players reported the bug a few times per week as it doesn't happen THAT much, but enough for people to be annoyed by it

chrome bay
#

Is there a Steam Callback which is called when a user hits "Join" in Steams built-in Server Browser?

#

By default it launches the game with a command line option, but clicking it with the game open does nothing atm, so need to intercept it

bitter oriole
#

There isn't

#

You need prediction/rollback/replay on owning client, and interpolation on spectating clients

#

Yes

halcyon totem
#

is it possible to have smooth rotation with no lag when using üse Controller Roation YAW unchecked?

#

for some reason I keep jittering when rotating

#

if its a limitation in unreal, like something in the movement component of engine is stopping it from working, can a c++ plugin fix it so it doesnt lag?

sinful tree
#

You probably don't want something to send RPCs on tick as reliable. You're asking for trouble if you do so as you can end up flooding the network fairly easily.
I think you need to change your OnReps so that you're not manipulating the turn of the character that sent the request.... Otherwise it's like:
Client1: Moves mouse changing rotation.
Client1: Sends to server "My Rotation is X"
Server: Ok, setting your rotation to X
Client1: Moves mouse a bit further, increasing their local rotation.
Client1: Sends to server "My rotation is now Y"
All Clients receive the FIRST replication, including Client1: Set rotation to X -> Client 1's rotation is now what it previously was, even though they've moved their mouse further and should be at position Y.

winged badger
#

there is also no point in sending RPCs on Tick as reliable, as if the network stutters, Tick when it starts working again will send updated information before the RPC sender has any idea that original RPC failed and needs to be resent

shy hill
#

hey everyone, I'm developing a simple multiplayer game that uses steam and p2p servers and I'm facing random glitches that seem to be caused by latency or packet loss (character rotation / sprite is sometimes not updated, or jittering movement). I'm trying to understand what can cause these gliches but I dont have much expertise when it comes to server optimization or multiplayer in general.

  • What would be the right way to tackle these glitches ?
  • Is there any documentation / tutorial that can help understand and optimize the numbers on the screenshot ?
  • Am I even looking at the right numbers to try to fix latency issues ?
limber gyro
#

i have a bit of a weird issue, when i compile the server and try to add the "-log" to the end of the shortcut the console doesnt show when i open the server, any 1 seen this before?

#

i cant even see the server process in the task manager

#

nvm its actualy closing so fast the thing doesnt even have time to show up

bitter swift
#

is it heavy for clients to load Navigation? I assume there must be a reason since it's normally false

chrome bay
#

Server does all AI navigation usually, so you may not need it

gleaming kite
graceful flame
pallid moat
#

have anyone tried something like: TArray<FSlotArray> ? FSlotArray is subclass of FFastArraySerializer. I have tried this, but the function in FSlot PostReplicatedAdd or PostReplicatedChange never executed.

#

but If only replicate property FSlotArray in InventoryComponent, PostReplicatedAdd and PostReplicatedChange will work

slate flower
#

When developing multiplayer is it better to use CPP or can you get away with using Blueprints?

kindred widget
silent valley
#

Is there a way to replicate playing an animation on an object in the world? So that the object is always in approximately the same state on all machines?

This is for a door opening, etc, so it's important that it's synced, and some of the animations may take some time.

I guess replicating the playtime and lerping towards that might work, but wondering if there's anything built in.

oak oracle
#

Hey there commutiny . I am replicating a stucture with user data such as Name and Image .When the game starts player downloads image from internet and sets it into structure .
In the server side it works absolutely fine . images gets set . but clients cant get that image , at the same time Name gets replicated absoluetly fine ! why is that happening?

bitter oriole
#

Well, does the image data exist on clients ?

oak oracle
bitter oriole
#

Okay, I understand that, but that's not what I asked

#

What is the image? A texture asset in the content browser ?

oak oracle
#

structure got another variable . "Name" which is string . and i can get it absolutely fine

#

image is dynamic texture 2D

#

from "Download Image" node

bitter oriole
#

Alright, then there's your problem : you have to replicate that data

#

When you replicate a texture you just replicate an identifier to it, because textures usually are on every client already in the game data

#

You should download the texture on every client instead

#

Just replicate the URL and download when the URL changes

oak oracle
#

oh . okey got it . i ll try to do that \

#

thanks mate alex

fierce grove
#

Can you write the same network code for both dedicated and peer to peer ?

#

So it would work on both

bitter oriole
#

If you mean listen server, then mostly yeah

#

You can definitely do it

chrome bay
#

ShooterGame does it

fierce grove
#

That was my guess.. event server validation bits ?

bitter oriole
#

Just a matter of correctly decoupling "server or client" from "locally controlled or not"

fierce grove
#

Yep !

bitter oriole
#

As long as you don't write your code assuming all machines have a local player controller, or assuming all players are remotely controlled, there's no huge trap

twin juniper
#

hey all, I want to create a virtual meeting space, which others can join e.g. from a browser, where should I start?

ancient adder
#

Hello, when doing rpcs in blueprints do i have to pass the controller from client to server so i can know who to reply to?

dark edge
#

Why would an RPC imply any sort of reply?

ancient adder
#

Im doing a login system with rpcs, like when a player types username and password he sends them to server with rpc, am i doing it wrong?

#

i want the server to replay to client that the login failed or successeded

sick acorn
#

Hello, I encountered a strange "bug"
When it is called on the server, everything happens, but on the client it does not always work like this

bitter oriole
#

No of course not

#

You can have variables replicate over multiple frames

sick acorn
bitter oriole
#

Maybe all of those received in that frame but in real world conditions if you change three variables on the server, you could get them over 3 frames

#

Yes I am

#

Replicated variables only guarantee that they will replicate A) correct values, B) at some point

#

There are no guarantees over A) order, B) intermediate values (1 2 3 could replicate as 1 then 3 without replicating 2) or C) consistency of different variables

#

Consistency can be enforced through an Atomic structure

#

The answer is also 7 years old so it's not exactly a great reference, but okay

ancient adder
# bitter oriole The server needs to send a Client RPC to reply

yes, but how do you tell the server to which client it should rpc?, for example client1 requests login, when the server is done verifying how does it know which client it should rpc to tell it succeeded or failed? for me i pass the client controller thro the rpc so the server knows to which client it should reply to, what i want to is is this the correct way to do it?

bitter oriole
#

So there is nothing to tell the server here

ancient adder
#

I still dont get it, lets say you want to start "exchange/trade" with another player, how does the server know which player you want to exchange/trade with? how does it know which client it should rpc to send the exchange/trade request?

bitter oriole
#

Read the doc

ancient adder
#

yes thats right

wicked lodge
#

Does anyone know why when I try to call a RPC function from client to the server I get No owning connection for actor? Using C++

bitter oriole
bitter oriole
#

== can only RPC on Pawn, PlayerController, actors owned by those

ancient adder
#

but when you send a trade request to a specific player, you tell the server, and the server must know to which client it should rpc to send the trade request"a pop up UMG"

bitter oriole
ancient adder
#

thats what i do, i pass the object thro rpc, but is it the way to do it?

#

i mean is it a bad thing?

bitter oriole
#

It's pretty much the best and most obvious way

#

You could pass the pawn instead but that's dumb

#

The player ID from player state maybe ?

#

Just use player state

ancient adder
#

i pass the pawn lmao

#

so player state

#

noted

nocturne iron
#

I have a bunch of custom, non unreal engine, datatypes that I need to replicate. I thought I would just throw them all in a ustruct and use the NetSerialize function, but I am not able to find any documentation on how it is used? Does anyone happen to know of a good resource for figuring that out?

chrome bay
#

You can look at some the engine types that implement NetSerialize

#

Such as FHitResult for e.g

#

or FRepMovement

nocturne iron
#

Ah ofc!

#

Is there a NetDeserialize as well?

#

How do I deserialize data after serializing it with NetSerialize?

nocturne iron
#

So currently I have this:

USTRUCT()
struct FChessMoveReplicationData
{
    GENERATED_BODY()

public:
    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        Ar.SerializeBits((void*)OriginSquare, sizeof(Caissa::Square));
        Ar.SerializeBits((void*)TargetSquare, sizeof(Caissa::Square));
        Ar.SerializeBits((void*)CapturePiece, sizeof(Caissa::Piece));
        Ar.SerializeBits((void*)Type, sizeof(Caissa::MoveType));

        bOutSuccess = true;
        return true;
    }

public:
    Caissa::Square OriginSquare;
    Caissa::Square TargetSquare;
    Caissa::Piece CapturePiece;
    Caissa::MoveType Type;
};```
#

How is this supposed to go both ways, am I missing something?

#

Oh, so SerializeBits deserializes as well?

#

Ah, right, that seems kinda misleading.

#

But thx!

#

Thx!

modern cipher
nocturne iron
#

I know, I like being a bit explicit with specifying access specifiers, one for functions and one for variables for each specifier. Just for clarity.

cyan bane
#

On my client I've got 2 cubes that are attached and welded to each other, however when moving the child jitters a lot. Any suggestions??

cyan bane
#

I made a bp with 2 cubes, using Begin Play I "Attach component to component"

#

I did this in a fresh third person templated game just to make sure i didnt break something

twin juniper
#

have you checked the "is replicated" checkbox on the meshes of the cubes?

cyan bane
#

Yep

twin juniper
#

try untick it

#

I checked that box on my player character while testing networking and it caused ALOT of jitters

cyan bane
#

The issue with turning that off is that the objects are no longer in sync with the server

#

Because the server and client are simulating differently

twin juniper
#

How do you plan for the cubes to move? are they meant to be physics objects?

cyan bane
#

For testing I made the 2 cubes have an ice-like physics material so that players can push them by walking against them.

#

They jitter while being pushed and while not being pushed but still moving

#

*One jitters (the child)

#

They are physics objects yes

pastel escarp
#

How to fix homing projectile glitchy movement on the client side ?

nocturne iron
#

I am trying to send my newly created struct with custom NetSerialize function through a Server RPC, but the serialization/deserialization don't seem to work?

USTRUCT()
struct FChessMoveReplicationData
{
    GENERATED_BODY()

public:
    FChessMoveReplicationData(Caissa::Square originSquare, Caissa::Square targetSquare, Caissa::Piece capturePiece, Caissa::MoveType moveType)
        : Move(Caissa::Move(originSquare, targetSquare, capturePiece, moveType))
    {
    }

    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        UE_LOG(LogTemp, Warning, TEXT("Replicated, %i"), Move.Type);
        Ar.SerializeBits(&Move.Type, sizeof(Caissa::MoveType));

        bOutSuccess = true;
        return true;
    }

public:
    Caissa::Move Move;
};

template<>
struct TStructOpsTypeTraits<FChessMoveReplicationData> : public TStructOpsTypeTraitsBase2<FChessMoveReplicationData>
{
    enum
    {
        WithNetSerializer = true
    };
};

Out:

...
LogTemp: Warning: Replicated, 4
...
LogTemp: Warning: Replicated, 0
...
oak jewel
#

doors - repnotify or replicated

#

@ or dm me please

sinful tree
dark edge
sinful tree
# dark edge How do you handle transient stuff driven by Repnotify? Like the door opening an...

It really would depend on the design of the level I suppose.... Like if the player is starting in a location far enough away from the door, or the net relevancy distance is great enough, it doesn't really matter if the animation plays on their end again as it probably wouldn't be seen or heard.

If you're that worried, I guess you could replicate the position of the door instead / the play time of the timeline controlling it, or whatever else you want so that it's more in sync with what is actually happening.

meager spade
#

i do a multicast for door opening/closing

#

then the state keeps it open/closed

#

using a state here can also cause issues

#

i take the chest example: You multicast the chest opening (playing fx, etc), and you use a state to determine if its open/closed

#

another way for things which take a long time, is using a struct to represent to the current state, which gets updated by the server, but this is only if something takes a long time and its possible client will see door closed when its still opening cause they missed the multicast

gleaming kite
#

Sorry to thread jack a bit, feel free to respond over me, but does anyone know the best practice for replicating responsive client side events?

I have a flashlight that I want to toggle, I would like the client to set its on/off state locally so it feels responsive no matter the connection. Right now, I have the client set their light state, then run a nep notify on the server to replicate the state to other players. The only issue is that with the "Bad" network simulation, since the client lags behind, the server sometimes overrides the player and flips the state causing a weird glitchy effect. Is there any way around this?

dark edge
golden fulcrum
#

Howdy I had a question I was wondering if anybody knew of any ways to debug why my compressed flags from my FSavedMove weren't being sent from client to server?

gleaming kite
dark edge
#

Just skip the owning client when replicating bLightIsOn

#

Press button -> turn light on -> RPC to server

gleaming kite
#

perfect thanks!

rocky kestrel
#

I'm creating multiplayer building system and I want to spawn preview mesh only locally but when call function from that mesh it comes visible and use collision to all

#

How do I make that?

rocky kestrel
#

Like when spawned it call spawn actor from class(server) self

dark edge
#

Spawn local actor.
When ready to make it solid.
RPC to server.

rocky kestrel
#

Okay!

royal vault
#

calling server travel is duplicating my ui

#

how do i fix this

#

my ui is fine prior to calling it

#

ui is duplicated

golden fulcrum
#

top fucking kek; I figured out why my flags weren't being replicated

harsh lintel
#

Since it's a TSharedPtr I cannot make this variable replicated, how could I go about replicating it to clients?

cerulean juniper
#

Hey guys, I having a hard time trying to add force to a character.
As it depends on math equations and uses camera position to calculate some points, the client and the server are getting different values.

I just wanted to calculate everything on client and then send these values to the server to replicate down to other clients. (honestly, I do not think I should do this)

Any ideas?

dark edge
sinful marlin
#

Is there a way to control which actors get replicated to which client when spawned on the server?

#

E.g. Server spawns Actor's A and B. Actor A is replicated to Client A only, Actor B is replicated to Client B only.

#

I see that SpawnActor ends up calling AddNetworkActor, which (I'm assuming) calls AddNetworkActor on all the connected NetDrivers so I'm not sure how I would prevent that from happening. For context I'm simply try to have individual loot drops similar to Borderlands, Diablo, Grim Dawn, etc. but I felt like spawning them directly on the client woulda been bad.

#

Individual in the sense each player has their own drops and it is not shared with other players.

hollow eagle
#

network relevancy

#

either have the drops be owned by the player they're for and set bOnlyRelevantToOwner = true, or implement custom relevancy.

sinful marlin
#

Ah, thank you.

royal vault
#

destroy sessions isnt workin
in c++ or blueprint

bitter swift
#

After I enabled Nav for clients I'm having trouble making FNavPathQueryDelegate variable on client side. Works fine on server though.
Does anyone know how to solve this issue?

lost inlet
#

this line doesn't look like anything

#

is this a debuggame build?

#

and not really multiplayer related

bitter swift
#

It's not multiplayer related? It works fine on server, but not on client.

lost inlet
#

there's no networking involved with navmesh

#

I saw you repost it in #cpp with no additional info so 🤷

subtle veldt
#

how to do basic networking

#

Most of you probably either started with the very limited native Blueprint Nodes or fell back to using Plugins like the Advanced Sessions one.

subtle veldt
#

maybe use advanced sessions

bitter oriole
#

Did anyone ever tried to change the default map at runtime? When you browse to a new server and it fails, you are brought back to that default map - but I'd like to change that during gameplay so that it's not the main menu, but the map previously on. Can't seem to find a way in engine source - UGameMapsSettings has a setter but the engine gets the default object, not an instance...

old knot
#

hey guys, i'm working on a multiplayer game. i have a character and a drone. i want to possess the drone and then unpossess . possessing the drone works fine but i cant unpossess drone. can you help me ?

#

also after possessing the drone, other clients can not see drone's movement

wheat grail
#

Just to make sure TEnumAsByte as a parameter is expected to don't work in RPC functions. Right?

fierce grove
#

Any idea on why it's never valid?

#

doing this in PlayerController

stiff ledge
#

Hello!! I need your help with an issue i have. I create a widget and add it to an actor let's say like a panel. It suppose to saw some images to the player from their folder. My problem is that i didn't manage to replicate this so every player could saw the same image on the panel when a player change the image. Could anyone help me?

fierce grove
#

ahah lol I know that come on ... nvm I'll find out why I can't get unique net ids to be valid ...

cyan bane
#

I'm having an issue where when 2 objects are welded together the child object jitters when the parent moves, I took a short video of it

#

This occurs in a fresh third person template too, so it's not my game

#

In the video i push the parent, and the 2 cubes slide because i changed their physical material to be more like ice. So the jitter isn't caused by the pushing.

dark edge
#

@old knot Handling possession and unpossession of pawns should be the PlayerControllers responsibility.

#

Also whether or not other ppl can see the drones movement all depends on how you're moving it. You need to make sure the movement is replicated fine.

full knot
#

Hello

#

I understand very well that the gamemode is server only and can neither be fetched nor modified from the client directly

#

but I have a question - how does the client know which gamemode it's currently playing then ?

#

For example depending on if I'm playing Deathmatch or Onslaught or Assault, this will affect what actors the client spawns and handles (vehicles, flags, nodes etc), which is probably dictated by the server - but the client can also display gamemode specific UI, and so on, so surely the client has a barebones version of a gamemode it can access?

#

For a moment i thought this was the gamestate, but since you're not actually forced to have a different game state for each gamemode, i suppose it's not that

dark edge
full knot
#

How does it work? Does the server simply dictate everything to the client, like every widget to display or hide and so so, or does it give to the client some metadata about the gamemode in some way ?

dark edge
#

I wouldn't even bother making a separate game mode probably, either subclass a master game mode or just make it a enum. Depends on how different your modes are

#

Like if it's Conquest and Big Team Conquest, just parametrize that

full knot
#

Let's talk about the Unreal Tournament use case rather than about my personal project

#

I'd rather understand how it's "supposed to be done" rather than how i'm going to do it in my specific implementation 🙂

#

In unreal tournament you have deathmatch, capture the flag, many gamemodes and usually each map is gamemode specific. But some maps can have multiple gamemodes, so the client can not necessarily determine what gamemode is currently played from the map alone

#

Does that mean that they have an enumerator built in with every gamemode type and the server sends you the current enum so the client knows what to expect? It sounds unlikely to me but I don't know

dark edge
#

The client doesn't need to know the actual game mode class, it just needs to know the name of the mode. Something like that.

GM_CTF would have a field Text GameModeText = "Capture the Flag" and pass that to GameState

#

They should have called it game controller and game state to parallel player controller and player state

sinful tree
nocturne iron
#

This is a repost, but I still can't figure out why this happens?

I am trying to send my newly created struct with custom NetSerialize function through a Server RPC, but the serialization/deserialization don't seem to work?

USTRUCT()
struct FChessMoveReplicationData
{
    GENERATED_BODY()

public:
    FChessMoveReplicationData(Caissa::Square originSquare, Caissa::Square targetSquare, Caissa::Piece capturePiece, Caissa::MoveType moveType)
        : Move(Caissa::Move(originSquare, targetSquare, capturePiece, moveType))
    {
    }

    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        UE_LOG(LogTemp, Warning, TEXT("Replicated, %i"), Move.Type);
        Ar.SerializeBits(&Move.Type, sizeof(Caissa::MoveType));

        bOutSuccess = true;
        return true;
    }

public:
    Caissa::Move Move;
};

template<>
struct TStructOpsTypeTraits<FChessMoveReplicationData> : public TStructOpsTypeTraitsBase2<FChessMoveReplicationData>
{
    enum
    {
        WithNetSerializer = true
    };
};

Out:

...
LogTemp: Warning: Replicated, 4
...
LogTemp: Warning: Replicated, 0
...
full knot
#

If Caissa::Move Move; is not a UPROPERTY it might not get replicated, isn't it that ?

meager spade
#

you are only serializing, not unserializing tho

#

you need to check if the Ar is reading or writing

nocturne iron
#

That would not make sense, the reson i am doing custom serialization is that i can't make it a UPROPERTY.

meager spade
#

and serialize/unserialize

nocturne iron
#

someone told me that it works both ways?

winged badger
#

look at FHitResult::NetSerialize

nocturne iron
#

@twin juniper

winged badger
#

its an excellent example how to do it

meager spade
#

i mean it might work, though i have never worked with "non UE4" types or standard prims before

#

though why are you not using the engine stuff? what is Caissa ?

#

would it not make more sense to use the engine rather than fight it? or is it an external lib?

nocturne iron
#

It's a external lib for doing some of the computation.

meager spade
#

right

#

normally people make wrappers

#

so it integrates nicely

nocturne iron
#

I know, that's in a sense what this struct is.

#

It don't make sense to do a complete wrapper.

meager spade
#

your log is also before the serialize bit

#

did you try logging after?

nocturne iron
#

lol, true xD

nocturne iron
#

i don't know why i moved it

meager spade
#

i am pretty sure UE4 requires UPROP even with custom netserialize

nocturne iron
#

FHitResult::NetSerialize's SerializeBits is just called in the function scope?

#

And uint8 is just a typedef of unsigned char

#

My Caissa::MoveType is typedef of uint8_t...

#

should be the same?

#

Yeah; but mine dose not work xD

#

??

#

What is this voodoo xD

#

ohhhhhhhhhhhh

#

I will need to use serializebits on other types right?

#

Like uint16_t

#

everything is bits xD

#

makes sense

meager spade
#

like packing bools into a single byte instead of 1 byte per bool

nocturne iron
#

right; i freaking hate this syntax xD

random verge
#

Is there any suggested tutorials for learning the Network Prediction plugin (other than digging through GAS)?

fluid summit
#

Hi! one question with maps on multiplayers.
I know that hey can't be replicated, but does that also mean that i can't use them only on the server side?
I want to do some math on server side using maps, the client doesn't need to know about this at all.

fluid summit
#

i'm using blueprints atm, i'm using a map of
<CustomType><Float> should that be okey?

#

i'm getting 0 lenght on the server side when i try to check on the map, but ok lenght when checking on client

sinful tree
fluid summit
#

ok, i'm gonna check for the problem somewhere else then

random verge
#

Actually wtf. I could have swore they added basic TMap replication a while back but I'm still seeing a bunch of people saying they can't be replicated.

fluid summit
#

Actually i think it may be the map on my case

random verge
fluid summit
#

yeah, on my case is that the Map on the server side is empty, but not the same on the client

sinful tree
#

How are you populating the map?

fluid summit
#

okey, it's not the replication of the map problem on my side, i found the error.

#

not related to the map on itself, but how it's filled

fluid summit
eternal canyon
#

But remember a lot of it will change

random verge
#

I don't see an examples folder in the engine. Do you mean NetworkPredictionExtras?

#

There's some interesting stuff in there thats right up the alley of what I'm interested in

molten drum
#

Hi everyone, not sure if this is the right room to ask or not but does anyone know how to pass a dynamic material instance from client to server? I keep getting null values. For context there is a widget slider that sets the material instance and a server call to spawn the actor. The user also selects the mesh and that part works but the materials do not. I have tried storing them in the game instance and the player state

meager spade
#

you can not

#

you need to make them on the server

#

you should send the data to the server so the server can reconstruct the material

molten drum
#

so send the slider values from the widget to server and build material there?

#

the intent is for each player to have their own color setup, how would I link it back to the player

foggy idol
#

when you load a map with options i.e. ?pancake=true, how do you access those options in the loaded map ?

foggy idol
#

you can then use a repNotify to watch the data for changes

old knot
foggy idol
#

you could just turn on movement replication and move it server side

#

or implement your own method to interpolate between updates of the drones location i.e. an unreliable multicase every x seconds (idk about the performance of this though)

oblique junco
#

Does anyone know how you would go about handling multiple levels on one dedicated server?

Think Minecraft. Players can be in the overworld, nether, end, etc. I'm trying to achieve something like that but have run out of ideas.

Another problem is that my game has endless worlds with modifiable terrain so I think that rules out level streaming. Would UE even be viable for something like this?

sinful tree
# molten drum the intent is for each player to have their own color setup, how would I link it...

When you say color setup, I'll assume you mean like being able to customize a visible color on their character in some way.

You should store the slider value somewhere that is pertinent to the player, so either the playercontroller, playerstate, or the player's character. Player's character only works so long as you're not destroying the player's pawn, otherwise you'll have to reset the colors every time you spawn a new pawn for the player. Playerstate works great in this case as the value will last so long as the player remains in the game, however, if you have it set up as a replicated variable, whenever the value changes, all players will always receive the updates unless you have some custom relevancy set up for the variables themselves, so it may be a bit more network traffic to have it on the playerstate vs. the character. Finally, on player controller it doesn't make a lot of sense since other client's can't read the value when they themselves need to reconstruct the material on their end as the playercontroller only exists on the owning client and the server, so you'd have to put it somewhere else anyway in order for others to see the value.

So when you've confirmed your colors on the client end, you send the slider value to the server VIA an RPC. The server can then set it in a replicated variable on the playerstate, or on the player character. If you have this variable set up as a RepNotify, then you can use that function to construct the material and set it on the player's character.

molten drum
#

Thanks @sinful tree I will give that a try

royal vault
#

bruh

#

destroy sessions

#

is broken

#

in both c++ and blueprint

#

4.27

#

pls help

sinful marlin
#

Called from:

#

Idk how much that helps you (if at all lol)

bitter swift
#

When we set something to Replicate Movement, does that broadcast the location all the time as a tick or only when the actor changes location?
Is there an article where I can read more about this in detail?

sinful marlin
harsh lintel
#

I have a replicated FString that is made from a Json object, the FString is only replicated once since it only changes its value once during the game and is also a very small Json object, but I was told that having a big replicated FString could cause network issues, although I wasn't told why, anyone knows why it would be an issue? I could only think of a bandwidth issue

left marsh
#

Hello! I am going through the Tom Looman tutorial and am on section 10. How should I choose whether to do replication via a RPC or via changing a replicated property? Tom used a Struct that was consumed by a function in the client, which seemed odd to me.

sinful marlin
vivid seal
left marsh
#

Isn't there a lot of overlap there?

vivid seal
#

yes, there is. there's a lot of times you could use either one

#

one thing to keep in mind is net relevance though. if someone becomes relevant 5 minutes from now, are the replicated properties enough for this new client to see the same game state as everyone else?

left marsh
#

I'm making an exploding barrel right now. My initial instinct is to make a "Explode" function and RPC it.

vivid seal
#

you'd probably be better off using a replicated property and a RepNotify function, because if someone doesn't see the explosion, they should still see the barrel as "exploded" later on

left marsh
#

I haven't gotten to net relevance yet. That's where it filters stuff that's too far from the local pawn, right?

dark edge
#

Basically if the barrel exploded 10 seconds ago, would it matter at all? Would it change anything about the game's state

left marsh
#

I see. bExploded is a more permanent change and is better handled that way?

dark edge
#

If your barrel is despawn after exploding then sure, use an evenf

vivid seal
#

yeah, using a variable means that anyone who sees the barrel after the change will see that it has already exploded. if you used an rpc instead, then someone came along later they would see the barrel as un-exploded. if your barrel is going to disappear after the explosion, you could use the rpc though, since you wouldn't ahve to worry about what happens afterwards

dark edge
#

There's a pretty smooth continuum along which you can think of something as being a state or an event. If you think about it, the change in state is an event.

#

So is it more important to say the door is open, or is it better suited to say the door just now opened

#

I tend to prefer state as much as possible

left marsh
#

Ahh, so a player that joins after the explode event would not see the debris unless I used a replicated variable.

vivid seal
#

yeah, or someone who was not net relevant (like you said, the barrel was culled, so they wouldn't get the explosion rpc) at the time

dark edge
#

Yes, it depends on how you were to implement whatever happens after the explosion. If, after exploding, you destroy the barrel actor, then a late joiner would just see the lack of a barrel, which is sort of the state. You would be replicating the lack of something, by destroying it

left marsh
#

That helps me a lot. So if they only saw the aftermath and not the event, I would need a replicated function that only does the permanent changes (smoke, debris) instead of the instant effects.

#

The tutorial asks that I change the color rather than destroy the actor

vivid seal
#

yeah so in that case, since you want people to see the correct color whether they saw the explosion or not, you'd want it to be a replicated variable, since everyone will get the variable eventually, but the rpc only happens once and if they miss it they won't get it again later

left marsh
#

"If they miss it they won't get it again later" this helps a lot.

#

It seems like in this case I'd need both?

vivid seal
#

well, have you learned about RepNotify yet?

left marsh
#

RPC for playing the explosion particle on the client, the replication function for changing the color

#

Haven't learned RepNotify yet.

#

Just Replicated and ReplicatedUsing

vivid seal
#
UPROPERTY(ReplicatedUsing=OnRep_bIsExploded)
bool bIsExploded;
UFUNCTION()
void OnRep_bIsExploded()
{
  if (bIsExploded)
  {
    //Play explosion, set color.
  }
}

RepNotify is ReplicatedUsing

#

the snippet i posted does have an issue, but you could get around it by replicating the bIsExploded as a struct with an explosion time as well

#

the issue being that right now, anyone who comes in later would have the explosion play as soon as they saw the barrel

left marsh
#

That's a thought. If the explosion happened more than XX seconds ago don't play the visuals

vivid seal
#

yeah

left marsh
#

hmmm

vivid seal
#

or you could do like you suggested

#

RPC the particles, replicate the color

left marsh
#

I think so. All the other explosion effects like force will be on server.

vivid seal
#

no guarantee that they get there in the correct order if you do it that way tho

#

shouldnt matter much but something to keep in mind for other use cases

left marsh
#

Order shouldn't matter in this case. They will happen close enough together

#

Thanks for the tip.

vivid seal
#

one thing that's nice about using replicated structs is that you know all the properties you change at the same time on the server will get there at the same time on the client

#

its useful for certain things that need that concurrency

left marsh
#

Ah that's some good thinking.

#

I imagine a project will accumulate lots and lots of those special structs?

vivid seal
#

depends on what you're making. i've been building an ability system for a while and it does have a bunch of that going on, for example my casting state

USTRUCT()
struct FCastingState
{
  GENERATED_BODY()
  
  UPROPERTY()
  bool bIsCasting;
  UPROPERTY()
  TSubclassOf<UCombatAbility> AbilityClass;
  UPROPERTY()
  int32 PredictionID;
  UPROPERTY()
  float CastStartTime;
  UPROPERTY()
  float CastEndTime;
}

In this case, any of this information arriving on its own (before some of the other fields) would be nonsense. I don't care what ability class is casting if i don't know whether i'm casting or not. I don't care whether i'm casting if i don't know when that cast starts and ends. In this case, i need the entire struct at the same time to make sense of it on the client.

#

mostly what clients do with that info is make a cast bar widget, which wouldn't really work without all of this info (except predictionID, thats used for other stuff)

left marsh
#

You're making your own? Did you already decide not to use GAS?

vivid seal
#

i started on it before i heard about GAS

left marsh
#

dang. Lots of people do that

vivid seal
#

then i tried to learn GAS and ran into a lot of stuff that i had either already implemented, or that I'd have to mess with internally to make GAS do what i wanted, or i just didnt need

#

plus its a great learning experience trying to implement it myself

#

i think the biggest one is that i wanted cooldowns to default to a charge system by default which was kind of a pain to setup in GAS since it wasn't supported by default

#

also calculations for certain things I had already worked out a specific way I wanted to do, and GAS had a totally different way of handling

left marsh
#

A charge system like can use X times before cooldown? Makes sense

vivid seal
#

well, more like a rolling charge system, like wow uses. when you use an ability it uses x charges of it, and the cooldown starts, but you can keep using it until you run out of charges. when the cooldown finishes it restores x charges and then if you're not at max charges it rolls over and restarts the cooldown

#

using gameplay effects for that was more complicated than just writing the logic for it normally imo

vagrant grail
#

@bitter oriole Hi, I just found out that Steam has an API to have dedicated servers (of course it costs money, but it's pretty cool)

maiden ermine
#

Question about multicast rpc: I should be able to Mutlicast from a dedicated server with an RPC on my GameState, so that the clients all get the RPC, is that correct?

fathom aspen
#

True

oak oracle
#

Hey guyzzz, i got a bit noob question !
I got a login page and registration widgets, when you register it saves all user data into save game , and when u login obviously gets and compares data from save game , but it only works for server side , on the client side i cant login even if data correct . Is it because i am loading and saving into savegame from Gamemode ?

thin stratus
#

Probably

#

You would have to RPC the data to the server

#

Not really how one would make any sort of login and registration system but I guess it would work

twin juniper
#

how u guys handle ur projectile on weapon, are u creating it on firing or creating it with weapon and just doing Activate() on the projectile component when firing ?

#

I know both are possible but what is the best approach actually

untold summit
#

Hello, i was wondering, is there any way to make Unreal work with peer to peer multiplayer?

thin stratus
thin stratus
bitter oriole
untold summit
#

Well, i would like to players host their own rooms and let people join them, i thought a peer to peer would be great for that

bitter oriole
#

Unreal doesn't do peer to peer but "have one player host the game" is just the listen server feature

#

The hosting player just acts as the authoritative server that other players connect to

#

Drawbacks include performance, easy cheating for the host, and everyone gets booted if the host alt+F4's

untold summit
#

i see, thanks

oak oracle
#

hey guys . On play as listen server i got weird stuff.When i host a game its absoluetly fine . but when i join to hosted game, character spawns as default pawn , with all that flying movement . I have checked game mode , its all fine . So any ideas why it might happen ?

old knot
#

I also changed it to character but nothing changed on other clients

twin juniper
#

Does anyone know of a way to replicate render targets?

#

No matter what way I seem to try, I can't get them to replicate, something is passing through, but it always seems to just be a blank render target.

#

by blank I mean, when the client tries to pass the render target to my player controller, there's nothing there...

#

It just becomes an invalid object

kindred widget
twin juniper
#

I know I use them in materials 😅

kindred widget
#

I think this needs context. What is your endgoal with trying to replicate it?

twin juniper
#

I have the player drawing on a notepad using this render target, the render target is used in a decal material that I overlay on a notepad mesh. I also use the render target on a widget that uses an image that uses a UI material.

#

So I want the player to have his drawing replicated on the notepad mesh to other players when they draw

#

The player uses the widget to draw onto

#

That's where I put the update notepads function

kindred widget
#

Is your notepad itself an actor?

twin juniper
#

Nope! It's just a mesh I have attached to the character they can pull out at any time

#

it looks like this, the white part is the note pad widget and the block is my notepad mesh

#

I draw onto that note pad widget, and I just want the decal material that's on the block to be replicated

kindred widget
#

Part of the issue with replicating a rendertarget texture is that textures are larger assets. They take a lot of data to represent. For instance if you have a 32x32 texture, you're already at 4,096 floats to represent that tiny texture. Before compression that's 16,384 bytes of data required to display that accurately.

twin juniper
#

wow, that will totally tank. Maybe there's some other solution to this

#

that sounds like a better solution!

#

I'll give it a shot

kindred widget
#

At the absolute least, compress the pixels that the player draws on into an array and redraw those on the other side if you want close to perfect. You can drop 25% of that off if you aren't using alpha, and you can probably compress all colors down to a byte or less if you're not using a color wheel and have specific colors to choose from.

twin juniper
#

It works but for some reason the lines that are drawn on the material are really dim. Also I cannot seem to get it to replicate from server to client, which is really weird, but I can get it to work from client to server.

#

Ah okay, let me give that a shot, I was doing it twice like this:

verbal tendon
#

Owning client to server means Client->Server RPC works, but you are missing the part where you multicast send it from Server to all connected clients

twin juniper
#

I realized that I put the thickness incorrectly on the draw line size, that's why it was so dim 😅

twin juniper
#

This is my widget blueprint:

#

the below is my server, but the above is my client, for some reason I still can't get it to replicate onto the client when I draw on server

#

I'm thinking it's correct, but it's not working. Following this graph, I'm starting at widgets/HUD -> going to player controller (depending on if I'm server or client I call different events) but have it running on server -> my pawn which is where I'm calling the functionality.

#

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhh I get it 😅

#

I don't need to call "all" on player controller, that's just where I run on server so that I can call multicast inside the actual class I want

verbal tendon
# twin juniper This is my widget blueprint:

You always want to call the "run on server" function. To reduce the headache, if it's executed on server it'll just run, if it's exectued from the owning client, it'll RPC to run it on the server

#

It's about keeping the logic clean

twin juniper
twin juniper
#

I can clear up my player controller by using a gameplay ability instead 😅

forest flint
#

hello. what is the best approach to make opening doors in multiplayer, but with many states, not only open-closed? like in RDR2, but not on collision. I want a player can control the door angle via button. I was thinking about adding a bone and make this with animation, or controlling door mesh rotation.

graceful mango
#

Hi! Is there any event when actor is replicated to the client for first time? (Client only event)

kindred widget
#

@graceful mango BeginPlay will run when an actor is first initiated on a client.

graceful mango
#

Thanks

#

Reliable RPC will be trying to arrive until its done even if actor isnt yet replicated?

kindred widget
#

Not sure on that one. Possibly. I know normal non reliable multicasts won't, in fact those being sent at actor creation time pretty much never play on clients because they tend to arrive before the actor replicates. Reliable may act different.

#

If it's a state thing, it's probably better in an OnRep.

graceful mango
#

Thanks

keen kraken
#

Hello! i have a question is there a way to know the last replication timestamp of the UObject (i have a parent actor which handles the relication) in the sense i need to check (on client) if object was altered (some new values were replicated).

#

is there an easy way or i need to create my own "OnRep" to cover all possible changes? and write timestamp there

verbal tendon
keen kraken
#

or is there an "global" (universal) OnRep event

dark edge
#

Or just turn on replicate movement and just rotate the door mesh or a parent scene component of it.

short arrow
#

Anybody know of a method to determine when a player has successfully loaded after a seamless travel?
(Currently I'm relying on delays to just give everyone enough time but of course this will always be a bad and unreliable method)

keen kraken
#

make a player send an event

#

if server got a event (rpc call from client) then hes loaded

#
  • add some timeouts
short arrow
#

I need to know the player has finished loading and is connected. I think you're suggesting something like a ready up system where a player can press a button to notify the server that their ready. That's impractical for me

#

It should be automatic :/

keen kraken
#

...

#

why should someone press a button?

#

you do it automatically according to your rules of "player is loaded"

#

for example

#

in playercontroller tick

#

you check some stuff if it's "true" you stop the check and send an rpc to server, or send the rpc until you got an response

#

which would be more reliable

#

but don't do logic on server which relies on all players to load or as i said, do a timeout for player

#

if player didn't load in a minute

#

kick him/do a fail w/e

short arrow
#

Player Controller beginplay is not reliable, and neither is event on possessed. I understand the method you're suggesting but I'm worried it's possible for the player controller to send a packet to the server even if it hasn't finished loading everything

#

But that's probably a different problem, I'll go ahead and try your method and see if it works

keen kraken
#

just make sure what server doesnt crash from this

#

then it's not a problem, close potential abuses

#

i mean client can send at any time random data

forest flint
kindred widget
#

@forest flint If it's an actor. You can just OnRep the float. Make the actor's tick move the door to the variable's server set state. Once at that state, disable tick on the actor. In the OnRep, enable tick. In fact you can probably optimize that further by just using a byte That gives 256 angles to use and most doors are under 180 degrees So you get 256 0.7 degrees difference between each. Which is more than enough for the state of a door opening and closing.

dark edge
forest flint
#

ok, thank you both 🙂

short arrow
#

Does anyone know which one is generally quicker for players with bad ping?

Rep notify or A Server Reliable RPC ?

keen kraken
#

not sure but imo should be closely the same, if it's crucial you need to test it yourself.

chrome bay
#

Neither of those things are related really

#

For one thing a server RPC is going from client->server

#

A rep notify is client-only, and indicates a property replicating to the client from the server.

short arrow
#

Then maybe I am not as familiar with the names as I thought. By RPC I was referring to server telling the client to run an event (marked as reliable)

#

And yeah it's pretty important to receive the information asap as it's running a time limit

chrome bay
#

That would be a client RPC

#

ping affects properties and RPC's the same way

#

If the change is stateful, it should be a property with a rep notify

#

If it's just an one-off event that doesn't change anything, it can be an RPC

verbal tendon
chrome bay
#

TL;DR the implementation really depends on what is is, rather than what the players' connection condition might be in

short arrow
#

That wouldn't be it, it's champion select. The gamestate decides when the countdown begins for how long players have to pick. I've got it nice and synced up and the server always makes sure everyone is ready before the countdown begins

#

for some reason rep notify is just not reliably notifying clients

chrome bay
#

The simple way is to replicate a single timestamp, with a timer that is roughly synchronised to all players. The engines' built-in "ServerWorldTimeSeconds" from the gamestate will do the trick

#

Players show the countdown in the UI, and so long as they locally think they have time, they send the RPC.

#

When the server receives it, it checks the time and allows for some minor tolerance (including the players' ping) + a "fudge" value to account for jitter

#

You can't time it perfectly, so there's no point trying

#

Just time it reasonably

short arrow
#

by the rep notify not being reliable I mean it sometimes fires and sometimes it doesn't. So some clients never start the countdown

#

I've got the timer pretty reasonably synced, when it actually fires...

chrome bay
#

It would fire on two conditons:

#

a) the property isn't sent because there isn't enough bandwidth

#

b) the property has the same value on the client

#

A will self-recover after some time has passed (so long as the server actually thinks it has to send it ofc)

#

B will happen if the client is messing with the replicated value locally

#

Wouldn't fire I mean

#

So ping isn't the issue

short arrow
#

It was B. That was the issue, you're the man hypers

chrome bay
#

You can resolve it another way in C++ using REPNOTIFY_Always which will call the OnRep even if the property has the same value currently.

#

but

#

The Server won't even send the property if it thinks that's the value the client has anyway, so just bear it in mind

#

An easy way to get around it is to make the property a struct and increment an internal counter

undone plinth
#

If I take a replicated actor and then attach it to another replicated actor should it still replicate?

plain torrent
#

Hi all, really hoping someone can help me with an issue getting a client to posses the spawned pawn when connecting to a multiplayer session. I've attached a few screenshots showing my SetupClass function that calls in Begin Play & the event definitions and one showing the issue I'm having. The correct pawn spawns however the client is not attaching. If someone is able to point me in the direction of what I'm doing wrong I'd be eternally grateful as this has been stumping me for a couple of weeks now.

eternal canyon
#

That pawn doesn’t exist on the server

#

And generally I would recommend u look at some more tutorials/docs on replication and multiplayer

verbal tendon
plain torrent
#

so this works fine, now the client spawns the pawn twice?

verbal tendon
#

So you get two spawns on client because your server spawn replicates to the client, and the client also spawns one

ember vine
#

if i'm having server managed replicated components, when is a good time to initialize them - beginplay ?

rocky topaz
ember vine
#

i'm moving stuff like health off the character to a component so i can reuse it on other actors

#

so ideally asap

rocky topaz
#

where was it initialized on the character?

ember vine
#

constructor and rep var

limber gyro
#

how do you go about debuging random disconects?

#

i have an issue that might be related to a plugin but i am not 100% sure

lost inlet
#

any clues in the server log?

limber gyro
lost inlet
#

well did you see what in the plugin emits the error and if it's anything to do with networking?

limber gyro
#

the plugin was processing a heartbeat form the backend

#

and it failed

#

but i am not sure if that is suposed to kick players

#

both players timedout after that

#

ogPlayFabGSDK: Error: Failed to parse heartbeat [2021.12.23-23.01.41:420][312]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection..

#

i am assuming its a possibility

#

maybe it blocked a thread or something? i dont know enough to make an educated guess

lost inlet
#

well it's timing out not kicking

#

are you sure it's not an issue with the server itself?

limber gyro
#

i have no idea

#

the logs only show that

lost inlet
#

well those 2 in quick succession isn't that encouraging

#

it's almost as if the server momentarily loses internet connectivity

fathom aspen
#

PlayerState is a client-owned actor right?

limber gyro
#

thats what i was assuming

lost inlet
limber gyro
#

does it not exist in both places?

fathom aspen
#

Cool thanks!

#

And I suppose the game state is owned by the game mode right?

fathom aspen
lost inlet
#

you can check GameModeBase.cpp for that

fathom aspen
#

Yep, thanks!

lost inlet
#

doesn't look like it has an explicit owner but it's not particularly important for the game state

#

as you wouldn't really have a client/server RPC on it

limber gyro
#

my server log is throwing some warnings with splines, complains of a node, so i thought i would add an authority switch in the spline construction, but now the spline meshes dont show in the editor, is there a better way to do this?

fathom aspen
lost inlet
#

"server" owned? it probably just has the world as its owner rather than another actor

#

and how isn't the GS initialisation code useful?

fathom aspen
#

It has nothing owner related

fathom aspen
lost inlet
#

yeah so it's probably owned by the uworld it's in then

#

though why are you so fussed about the owner of the GS? I understand for the PS as you might want RPCs on it

fathom aspen
#

Haha no, it's simply for general knowledge

royal vault
#

destroy sessions isnt workin

#

in c++ or blueprint

#

Everything works
It can be searched
And joined
but can’t be destroyed
No matter what settings
Ue4 4.27
creating and destroying the session in c++ didn’t change anything
oss is steam
Doesnt destroy in Pie or standalone or build
Says can’t destroy null online session despite clearing being in a working session

limber gyro
#

anyway u can print whats inside that session value?

#

just to make sure it is indeed null

#

or if ur just trying to destroy the wrong variable

#

just a wild guess, never worked with sessions

cyan bane
#

Is there a somewhat elegant way to replicate the position of a select few bones on skeletal meshes? All I can think of is to periodically multicast positions.

quasi tide
#

Running into an issue that I can't quite put my finger on. My weapons are dynamically created via the OnConstruction method in c++. It goes through some parts and then if it has a valid part, it'll spawn the appropriate mesh component for it. Upon spawning, it will also rotate the component by 90 on the Z axis. This is so that it aligns properly with the arms.

On the right side is the ListenServer and on the left side is the client. As you can see, it looks like the client is rotated a bit more than what it should be. Without rotating the weapons, the weapon faces completely to the left. So, I figured it was being replicated correctly, but when the weapon was being constructed on the client side, it was getting an extra rotation call. So I tried to just check if we are the server, if so, rotate the component, otherwise, don't. None if it worked. I have tried using IsServer() method from the UKismetSystemLibrary, tried checking HasAuthority(), GetLocalRole() == ROLE_SimulatedProxy, GetLocalRole() == ROLE_AutonomousProxy, GetRemoteRole() == ROLE_SimulatedProxy, GetRemoteRole() == ROLE_AutonomousProxy. None if it actually seemed to fix my issue. I have tried disabling the "Run under one process" flag in the settings menu as well. I'm drawing complete blanks here.

When I spawn the actor with the SpawnActor node in BP, on the server side, I pass in self for the Owner and Instigator pins as well.

Does anyone have any other things that I can try?

meager spade
#

construction script might run before your have the values set

#

i normally set the modular parts up at beginplay or postnetrecieve

chrome bay
#

yeah construct script runs before replicated vars are set

#

Got PostNetInit too for a one-time initialization

meager spade
#

^ thats what i meant

#

PostNetInit haha 😛

quasi tide
#

The reason I was goin' with the construction script is so that I can still place the actor in the world and the parts are updated while building out the level. Does it work the same way with PostNetInit?

chrome bay
#

PostNetInit is later than construction script

#

Generally you need both paths, construction script for server, post net init for clients

meager spade
#

@chrome bay i am hitting a weird issue with the built in CMC jump

#

and i cant work it out

chrome bay
#

Had a similar sort of experience recently trying to generate sub-objects from a replicated property

chrome bay
meager spade
#

yeah i know, i am in the same timezone haha

chrome bay
#

haha

#

You said it locks you to 1 jump though? Not seen that before :/

meager spade
#

heres the video, i am still jumping at the end

quasi tide
#

Okay, so the flow is probably as such:

  1. Server spawns actor -> OnConstruction is ran on the server
  2. Client spawns in -> Receives the replicated weapon, but not its stats?
  3. Now that the client has the weapon actor, the server sends the stats, which adds to the stats of the weapon?
meager spade
#

its sent in the initial bunch

chrome bay
#

The flow is:
-> Server spawns actor -> OnConstruction runs on Server
-> Client receives actor, spawns it, runs OnConstruction
-> Replicated properties are copied in

meager spade
#

its just OnConstruction is called before the props are set

chrome bay
#

So if you are relying on replicated properties in construction script, it won't work

#

Hmm that vid is odd :/

#

UE5 mischief?

meager spade
#

right maybe, but i compared to ue4.27 code

#

and nothing looks different

chrome bay
#

hmmf

quasi tide
#

Just the rotation of the mesh component. Which, is a replicated prop I guess, just natively.

meager spade
#

it could be my GA, but its very very simple

#
{
    if (HasAuthorityOrPredictionKey(ActorInfo, &ActivationInfo))
    {
        if (!CommitAbility(Handle, ActorInfo, ActivationInfo))
        {
            return;
        }
        
        ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get());
        Character->Jump();
    }
}

void UKaosGameplayAbility_Jump::InputReleased(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo)
{
    if (ActorInfo != nullptr && ActorInfo->AvatarActor != nullptr)
    {
        CancelAbility(Handle, ActorInfo, ActivationInfo, true);
    }
}```
#
{
    if (!Super::CanActivateAbility(Handle, ActorInfo, SourceTags, TargetTags, OptionalRelevantTags))
    {
        return false;
    }

    const ACharacter* Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get(), ECastCheckedType::NullAllowed);
    return (Character && Character->CanJump());
}

void UKaosGameplayAbility_Jump::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility)
{
    if (ScopeLockCount > 0)
    {
        WaitingToExecute.Add(FPostLockDelegate::CreateUObject(this, &UKaosGameplayAbility_Jump::CancelAbility, Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility));
        return;
    }

    Super::CancelAbility(Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility);
    
    ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get());
    Character->StopJumping();

}```
#

see really simple

chrome bay
#

hmmm

#

Is there an "EndAbility" where it stops jumping? I'm not super familiar with GAS

meager spade
#

thats in the Cancel at the end

chrome bay
#

Maybe it gets caught out one time not calling StopJumping at just the right time?

#

ah kk

meager spade
#

but ResetJumping is called

#

all the time

#

and that log prints

#

but the currentcount is always 1

chrome bay
#

hmmm

#

yeah.. no idea on that :/ the infrequency suggests possibly horrid race condition?

meager spade
#

i tried to only call Jump locally

#

and it happens even quicker

#

and i know the ability ends

#

and StopJumping should call ResetJumpState

quasi tide
#

So, in the OnConstruction method, would I just do my server check there at the start and nope out if it is a client? Then in the PostNetInit, proceed only if client? But both functions would pretty much be running the same code otherwise?

meager spade
chrome bay
#

essentially yah, PostNetInit only runs on client tho

meager spade
#

hah so only server is calling ResetJumpState

#

client is not..

chrome bay
#

didn't even think of that 😄 thought it was standalone

meager spade
#

best to turn on cmc logging i assume

quasi tide
#

Hmm - it's even more prominent now 🤣

chrome bay
#

Hah. So it's a correction issue then?

#

man

#

wonder how long that's been broken in FN 😄

meager spade
#

yh

#

Without my change the count is incorrect when you are corrected in the air. It would be 1 after correction, but it should be 0.

#

urgh :/

#

but it seems UE5 does not have this PR

#

..

quasi tide
#
    // inside of OnConstruction/PostNetInit
    if (Barrel != nullptr)
    {
        USkeletalMeshComponent* NewMesh = NewObject<USkeletalMeshComponent>(this);
        SetupSkeletalPart(Barrel, NewMesh);
        NonNullParts.Add(Barrel);
    }

    // this is the SetupSkeletalPart method
    if (Part != nullptr)
    {
        SkeletalMeshComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
        SkeletalMeshComponent->SetSkeletalMesh(Part->SkeletalMesh);
        SkeletalMeshComponent->SetCollisionResponseToChannel(ECC_Interact, ECR_Block);
        SkeletalMeshComponent->RegisterComponent();
        SkeletalMeshComponent->SetWorldRotation(FRotator(0.0f, 90.0f, 0.0f));
    }

So, the top one is the part that runs in the OnConstruction/PostNetInit methods. The bottom is actually configuring the part. The individual weapon's BP (say like, BP_AR15) has a bunch of the parts filled with Data Assets. I use those DA's to assign the parts. Is there anything here that jumps out at ya'll that can create my current issue?

meager spade
#

are you replicating anything?

#

like the NonNullParts, etc?

quasi tide
#

Nope.

meager spade
#

what is barrel

quasi tide
#

Just the actor as a whole and some ammo counts. But nothin' about transforms, other than what happens automagically

meager spade
#

in my game, the server sets the "WeaponItemDefinition"

#

then in OnRep_ItemDefinition, i setup the gun

#

this is a pointer to the data asset

quasi tide
#

Barrel is of type UBaseBarrel which is a data asset

meager spade
#

@chrome bay putting that fix in, solved it

#

got air corrected, and can still jump

quasi tide
#

Hmmm - can't figure this out. Might just need to take a break, been at it for like 3 hours now.

#

I'm not relying on any replicated props, no custom ones at least. Just that SetWorldRotation call in the OnConstruction script.

twin juniper
#

I'm having this really strange behavior with this function for drawing onto a canvas. I can't get it to work on this multicast event. Here's what I've figured out so far using print strings:

  • I know the arrays are passing through on this multicast event, they're not empty. (yes it's coming in through server only event on player controller)
  • I know this draw canvas function works with two arrays like this (I used two dummy arrays and just drew something on it at begin play).

Anyone know what's going on here and why it doesn't work?

#

omllllllllll i see it, I have the same array connected to both the points 🤦‍♂️

#

This is what I get for working on a small monitor 🤦‍♂️, I was stuck here for like 30 minutes

slate patio
#

Quick question can you use predict projectile path by objects on the client side and get hit info. For some reason it works perfectly on Server end. but get no info from the client

thin stratus
#

Hm, I wouldn't see why not

#

That should just be a series of line traces

#

I would suggest you look into the function to see why it could fail

#

Hard to tell

winged badger
rose pilot
#

Hi all, I packaged development server and launched in my local machine and when I join using open 127.0.0.1 from my editor then I can join the game hosted on the local machine. However when I built the development apk and try to connect using open 127.0.0.1 or 192.168.0.1, I cannot join the server from my android. My pc and android are connected over same wifi. Why I am not able to join?

dawn marten
#

2 different machines, 2 different steam accounts - I can see the server session and try to join, but then I get a ConnectionTimeout after 60 seconds.
can you see why in the logs? https://ghostbin.com/UZo4v

#

is it maybe because I'm still using 480? i guess not

young spoke
#

I have a anim notify on my animation blueprint which calls a function a sprint FX function on my character blueprint. This sprint effect is just a camera shake. However, the function is called on all characters and all clients play the sprint FX. Any reason why that might be?

keen kraken
#

Hello! i asked yesterday but not sure i got an answer or a clue. is there a way to "hook" global OnRep_notify event for an object? the purpose of it is to know when any of the object attributes has changed, without needing to set every callback manually + it may interfere with the logic, so to make it good you would need be able to set 2 onrep_notify callbacks but i think this is not possible and i don't really want to.

chrome bay
#

PostRepNotifies?

#

@keen kraken

#

Unsure without context

keen kraken
#

yes it seems to be what i need thanks!

quasi tide
#

@chrome bay So, I returned to my issue a bit later and I still was unable to figure out the rotation issue. For refresher if needed: #multiplayer message

This screenshot is after putting the weapon building inside of PostNetInit and putting the execution of OnConstruction behind an authority check. I've tried not rotating the components at all, instead rotating the entire actor as well, on spawn from the Spawn Actor node. That didn't work either. Do you have any other possible things that I could try? I'm completely out of ideas here.

The part that I'm still confused on is the order of execution in this case. It doesn't rely on any onrep variables, so step 3 shouldn't come into play. Unless UE considers the initial rotation of a component an onrep thing.

cyan bane
#

What's the console command to see position error corrections?

jolly siren
#

@cyan bane p.NetShowCorrections 1

meager spade
#

@jolly siren you on 4.27 with splitg?

jolly siren
#

Essentially yes, we work off of master

meager spade
#

you got hit with the jump bug where you get corrected whilst jumping?

#

or do you not use default "jump"

jolly siren
#

Did the change in that thread fix it? We use the default jump

quasi tide
jolly siren
#

ah okay thanks for the link

quasi tide
chrome bay
#

Hope Epic are gonna hotfix that tbh

meager spade
#

np, just weird.

chrome bay
#

Pretty debilitating

jolly siren
#

It looks like the suggested fix has issues as well

It would be great if we can have a better fix for this as the JumpCurrentCount value with this workaround gets bugged if you get corrected in the air, but at least the CanJump function returns true to let the Gameplay Ability activate.
meager spade
#

yeah but it still allows jump to function correctly after correction

#

which is better than hard locking

#

comment on it, get them to acknowledge, and maybe they will find a proper fix

jolly siren
#

Or we can just fix it 🙂

meager spade
#

problem is when you get AirCorrected, client just ends up with 1 in the jump current count

#

if we can force client to set that to 0 during correction

#

its all good

#

or decrement it

jolly siren
#

We could do that in UCharacterMovementComponent::ClientAdjustPosition_Implementation

cyan bane
#

does "p.netshowcorrections 1" not show physics object corrections?

jolly crag
#

in a multiplayer game, what are my goals for these numbers here

#

like what should i be aiming for in a game with 4 players?

#

listen server with 3 clients

#

sometimes frame and GPU hit like 70

#

and screenpercentage set to 10 or 100 make little to no difference

#

in the numbers...visually it makes things look like poop

jolly crag
#

on gpu and frame?

#

i wish i understood the profiler better...i doubt the GPU is actually the issue its a RTX 2080 Ti..going to check the numbers with ray tracing turned off

#

😆 rtx 2080 ti is a 1718$ card...i asked here because running standalone as a single player doesnt have these spikes...its only happening when i have multiple players

#

so was wondering what the acceptable numbers were that i should be aiming for in my case

#

thanks, have a nice day

slate patio
gaunt cliff
#

I have a function that "spawns" the inventory of the player on the server, and I have a delegate to broadcast the event so that the UI can update the inventory, however the broadcast event happens only on server not on clients

I tried creating a Multicast function that specifically broadcasts the event to the clients, however that doesn't work either

{
    if (Projectile && GetLocalRole() == ROLE_Authority)
    {
        Inventory.AddUnique(Projectile);
        
    }
    BroadcastProjectileAdded(Projectile);
}

void ARPGCharacter::BroadcastProjectileAdded_Implementation(TSubclassOf<ARPGProjectile> Projectile)
{
    OnProjectileAdded.Broadcast(LoadProjectileDataFromClass(Projectile));
}

meaning, once on the blueprint side of things, I print Hello, it only gets printed on server and not clients

gaunt cliff
#
/**
    * [server] adds a projectile to inventory
    * @param ProjectileClass    Projectile to add
    */
    void AddProjectile(TSubclassOf<ARPGProjectile> Projectile);

    /**
    * [client] used exclusively to broadcast Projectile Addition to Inventory
    * @param ProjectileClass Projectile to add
    */
    UFUNCTION(NetMulticast, Reliable)
    void BroadcastProjectileAdded(TSubclassOf<ARPGProjectile> Projectile);
carmine ember
#

Anyone know if RepNotifies are called for events that happened leading up to a player joining a session?

winged badger
#

its how they work

#

if property was changed repnotify triggers

#

during initial replication

carmine ember
#

I mean if someone opens a chest and then 5 minutes later a new player joins the server. Will a repnotify be invoked to notify of the update that happened 5 minutes prior to joining the server?

winged badger
#

if you coded it that way, yes

#

if you are doing simple repnotifies to trigger effects

#

your looted chest will open, your dead enemies will raise so they can play their death montage, doors will open.. .etc

#

as soon as player joins

carmine ember
#

I'm using repnotifies to replicate the state of an actor. Whether its picked up, dropped, placed somewhere

#

so the question is will UE4 invoke the repnotify when the player connects?