#multiplayer

1 messages · Page 220 of 1

dark edge
#

hell if I know, that's a whole nother can of worms lol

#

But it shouldn't be a part of the networking if you already are syncing the state that matters (bone hp)

#

It's just decoration

twin juniper
#

So can I just not make the GAS variable NOT replicated since it's not needed... This would be a waste of network bandwidth, right?
(I do not need them client side since they are enemies and collisions happen only on the server)

sinful tree
#

@static owl Working in multiplayer

static owl
sinful tree
#

Slight change... move the movement node to its own event and ensure the fail and finish re-call the node. Additionally make sure the "Use Continuous Goal Tracking" checkmark is checked. Without these options the AI will sometimes stop behind the player at some point.

Another thing to add to it would be checking for actual line of sight as you probably want the angel to only stop if something has eyes on it and if they're within a certain distance- right now so long as a character is facing the angel it would be considered being "looked at" regardless of how far away they are.

static owl
sinful tree
#

You could, but the angel still wouldn't take walls into consideration.

agile meadow
#

so my chat system is working, but i also want to log the chats for moderation purposes in the future. i dont have any server architecture yet so i dont have any way to really hold the chats for now, but i want to prepare for the future when i do. is there any way i can sort of simulate saving stuff on the server persistently using the tools i already have, that i can then just access later for actual logging?

the GameModeBase is a persistent server actor right? could i just make an .ini file config category for that and i can serialize the chatlog there, or just put an array there that stores some strings representing the chatlog and then when i have server architecture i can figure what to do with it then?

fossil spoke
#

Use the GameInstance. The GameMode can change depending on the Level.

#

Or better yet a GameInstance Subsystem

twin juniper
#

make it work only for the said server

agile meadow
fossil spoke
#

Correct

#

Its also created for a Dedicated Server

#

Not really anything to do with Client/Server

#

It has the same lifetime as the application itself

#

Application meaning, the executable

#

So opening a Dedicated Server, starts a single Gameinstance

#

For that Dedicated Server

agile meadow
#

got it

#

so if the game is always online and players join into it, each player will have their session GameInstance and the server will have one for the entire lifetime of the game? as long as i dont switch servers or anything

dark parcel
#

Why do you call it session game instance?

#

What's that got to do with session

agile meadow
#

just to specify the kind of timespan im referring to. a player usually closes the game after they are done in a few hours

dark parcel
#

Game instance is created when you run the application and gets terminated when you alt f4 or exit the application.

agile meadow
#

im just separating it in my mind because a server is on for a lot longer

dark parcel
#

Switching server is not going to change your GI

#

It's life time is between when the application is run and when the application is closed

agile meadow
#

right i know, i meant the server itself switching servers, which involves closing it i assume. im not being technical with my syntax

twin juniper
#

2 different server, but 1 single .txt.... (that's the problem i think)

dark parcel
#

When chat msg is committed, if dedicated server -> write the msg to a txt file. Call it a day

fossil spoke
#

A Server doesnt switch servers

#

A Server is a server, it cant switch to another server like a player

agile meadow
#

........! i mean whatever game instance is running on the server, if i have to change the server for some reason that players are using

fossil spoke
#

Huh

#

?

agile meadow
#

nvm

#

ignore it

fossil spoke
#

If players move servers, then they are no longer on that Server....

twin juniper
agile meadow
#

i dont mean the players

fossil spoke
#

You literally said Players

dark parcel
agile meadow
#

i said "that players are using"

#

it doesnt matter. just forget it

#

i meant connecting to

twin juniper
fossil spoke
#

If you want centralized access to the same data across machines, you have no choice but to setup some sort of pipeline for accessing that data.

#

You cant just magically have a single .txt doc that they all read and write to on a different machine

dark parcel
#

Just write to the same file. Though I don't know how to do that as newbie. I don't imagine a file can be written when it's currently open by something.

I probably won't use txt at that point

fossil spoke
#

He asked for a temporary solution

#

Writing to a text doc on the local machine, for each Instance of a Server is pretty much as temp as you can get

dark parcel
#

Yeah maybe just api call to a data base 🤔 if you want to store every chat msg to a source

agile meadow
#

yeah right now i just wanna store the data, and later i can send it from the server to whatever database i create

fossil spoke
dark parcel
twin juniper
fossil spoke
#

Writing to a DB is pretty much standard.

#

Research that

twin juniper
#

then sharding it?

fossil spoke
#

🤷 whats that got to do with it?

agile meadow
#

whats sharding

twin juniper
#

i mean, the DB needs to be on all servers then? no?

dark parcel
#

No

agile meadow
#

the database can be on a single server

fossil spoke
#

Dude just start simple

twin juniper
#

DB are using ssh?

fossil spoke
#

Stop trying to overcomplicate it

#

Go setup a free DB with AWS and try writing to it

static owl
sinful tree
vapid gazelle
#

Is pretty much everything client-side predicted in games like Fortnite nowadays, including things like switching weapons?

I'm assuming that once you have the rails for it (IIRC Fortnite is all GAS-based) there's practically no reason not to execute everything on the client first (IIRC there are some exceptions like playing an enemy player death animation which can be real confusing if rolled back) and let the internals reconciliate if necessary, including things like switching weapons, opening doors, drinking a potion, and other operations that might be not as latency sensitive? You gain the immediacy of the game reacting to you and not having to wait any amount of ms?

fossil spoke
#

there's practically no reason not to execute everything on the client first

#

This is entirely wrong

#

There are lots of reasons not to.

#

Predicting Damage and Hit FX, depending on your game can degrade the play experience.

#

For example, Damage Numbers

#

Or health bars

#

It is a worse experience, to see nice big red numbers, only for the Player you shot to not die, because your hit was rejected.

#

Seeing a player magically regain health might cause you to think they are cheating

vapid gazelle
#

Yeah, totally fair. I called out the death corner case there, I remember hearing about that one exception in particular, makes sense.

fossil spoke
#

Generally speaking, you only want to predict what you need to.

#

To make the experience feel responsive for Players inputs

#

A hit result is not an input

#

Firing a Weapon is an input

#

The hit is a result of that

#

Even then, you might choose not to predict because prediction is difficult.

#

For example.

#

We dont predict the throwing of projectiles

#

Like grenades

#

Players literally dont notice the difference

#

Especially when you author your animations to assist in hiding the latency

#

Like the hand throwing anim, covers the location the Grenade will spawn at with enough time that it just looks good enough

#

Blizzard doesnt predict throwables in OW for example.

#

They did a talk on Network stuff and they did a whole section on prediction and they mentioned this.

dark parcel
#

I'm in dilemma with slow moving projectile atm.

Right now, at least visually as I have not work on damagem. The client will spawn the projectile straight away for responsive feedback.

The server version will lag behind so the client may hit something on their machine but in server the projectile may miss.

Let's say I want to favour the Client under certain treshold (75 ms for instance).

In theory, it would be satisfying for the Client as they hit what they hit in their world. But visually the projectile will miss in other people machine but the enemy is hit and play the impact animation despite the projectile not landing on the enemy.

What can I do to address this?

fossil spoke
#

@dark parcel In the UT prediction code, they actually adjust the Client Predicted throwable to match the replicated master from the Server over time.

#

So eventually, the Prediction matches the Server

dark parcel
#

👀

fossil spoke
#

This can be helpful in situations like that

dark parcel
#

Thanks, I would look at it

fossil spoke
#

But obviously comes with its own problems

#

Its not useful in high ping scenarios

vapid gazelle
#

@fossil spoke all very helpful tips, much appreciated.

fossil spoke
#

150+ for example

dark edge
dark parcel
#

My attempt to reconcile makes me think the projectile will just rubberband backward or snap somewhere. I gotta look at the UT code

dark edge
#

It feels a lot worse to miss on your screen when it should have hit than to be hit on your screen when it should have missed

fossil spoke
#

Its all tradeoffs

#

Unfortunately there is only so much we can do

#

Someone has to lose

#

And by that I mean, someones experience has to change

dark parcel
fossil spoke
#

Its all about what you are willing to accept on behalf of the players.

dark edge
dark parcel
#

For the damage, I can do client hit with time stamps. Send to server, rewind in server and check if the hit is valid. But it doesn't address the visual part.

dark parcel
#

Yeah I am fine with the trade off, just want to ask what you guys usses

dark parcel
dark edge
fossil spoke
dark edge
#

The only person who can be unwound is the predicting client. They can hit and have the server say "nuh uh"

fossil spoke
#

As far as we have feedback for it, Players dont notice the difference

dark edge
#

since they and their actions are in the future WRT everyone else on their end

fossil spoke
#

Even at higher pings

dark parcel
#

Kinda feel unacceptable to me

dark parcel
#

0o

fossil spoke
#

2 seconds?

dark parcel
#

Opps

fossil spoke
#

Thats a long time lol

dark parcel
#

Well RTT of 200 seems noticeable

fossil spoke
#

Thing is, are you expecting a large majority of your player base to be at that high of a ping?

dark parcel
#

Not really, but it gives me clearer picture when testing

fossil spoke
#

You have to weigh up that against the cost of development and the end result

static owl
#

@sinful tree Dude I appreciate you, made my night. Gonna study this and keep it in mind for next time!!!

#

Works perfectly!!

dark parcel
#

Yeah, thx guys. Will look at all the trade off and see what gives the best experience.

fossil spoke
#

You should look into the UT code though, you might be able to apply some interpolation to the slave (predicted) after the master (replicated from Server) comes down.

#

Which helps line it up after the fact

#

For smoother hits

#

While maintaining prediction instant feel

dark parcel
#

Is the proj available at the launcher?

fossil spoke
#

On github

#

It will be in AUTProjectile I think

#

Will also want to look into AUTWeapon

dark parcel
#

Will do

twin juniper
twin juniper
fossil spoke
#

Thats offtopic for here.

dapper stream
#

can I get a sanity check on my understanding here for multiplayer replication regarding event dispatchers & functions?

You're not able to replicate Event dispatchers, but if you have functions which call those dispatchers, and those are called on the client and/or server (whichever is appropriate), then clients would have those same delegates fire on their game. Right?

If I'm trying to oversimplify or being unclear lemme know just trying to make sure I have it right in my head

dark parcel
#

Event dispatcher called to object that subscribe to it.

#

Just think of it this way. In my machine, if I am not subscribed to an event dispatcher, it's not going to be called

#

First understand that each machine run their own instance of the game and their own script.

#

Calling event dispatcher will just call it on the machine the code is executed.

dapper stream
#

Okay, that makes sense. I wanted to make sure I wasn't like.. way off with it 🙂

dark parcel
#

I mean saying replicate event dispatcher sound very off

dapper stream
#

I'm sure that gets infinitely more complicated when the world is not in the same state as the default load of the level, but I'm guessing that's a different problem

dark parcel
#

Every player have their own world

agile meadow
dark parcel
#

It's your job to make them communicate in a way that their world seems to be shared

dapper stream
#

yeah I think the words I was using there are wrong, but in my head I was thinking, regardless of replication, will each instance be able to receive notifies locally

dark parcel
#

You can just create a subsystem for your specific system or use case.

#

Like loading screen or save system where you need a GI object like life time.

#

Instead bloating your main GI you just make a subsystem and place your logic there.

fossil spoke
#

There are many reasons.

agile meadow
#

ah makes sense. for some reason i thought there was one subsystem per system, but this makes more sense

fossil spoke
#

You can make as many as you like

#

There are also different subsystem types

#

You should read up on the documentation.

#

They are very useful

agile meadow
#

alright i will, thanks

dark parcel
#

Player 2 have no business with other people event dispatcher

#

It's completely irrelevant, as the player 2 wouldn't know any delegates from other machine.

agile meadow
#

the docs are rather lacking, like always.
can i assume that all subsystems that inherit from UGameInstanceSubsystem will automatically be initialized without adding it as a member to my GameInstance?

sinful tree
dark parcel
#

Docs very clear on how they are initialised and how to get the subsystem

#

Don't overthink it

agile meadow
#

alright

#

i get confused easily, and i do overthink things. ill just trust that it works

dark edge
agile meadow
#

if i use the Server UFUNCTION specifier, even if im not RPCing, then it will only be called on server instances of the object right?

#

ah ROLE_Authority is what i need

dark parcel
#

@agile meadow very different usage?

agile meadow
#

yeah found out that doesnt work for this

#

apparently i need to do a check in ShouldCreateSubsystem

#

and i just found that there is a nice dedicated macro for that

dark edge
agile meadow
#

i want to have a server instance log some stuff

#

clients dont need to use it

#

seems right

dark parcel
#

@agile meadow this is for compiling, how are you gonna test in pie?

agile meadow
#

no idea, thinking about that now. i had to look up what these even were since i dont know much about if/else directives

#

i should probably find a way to not do it at compilation

dark parcel
#

You can chose to not include when your game is ready but for testing I wouldn't worry about it.

#

Just have the server to do the logging with switch has authority branch

agile meadow
#

GameInstanceSubsystems dont have HasAuthority

#

so i need to find an alternative

dark parcel
#

The function would be called during the game.

E.g. button press -> route to controller -> server rpc -> get my logger game instance -> write to text file

agile meadow
#

well, youre smarter than me.

#

that sounds good!

dark parcel
#

Nah, and this is just simplifying it. Though I don't think overcomplicating logging is worth the time.

twin juniper
#

logging inside of unreal?

dark parcel
#

Ideally you want data base if you plan to keep the data in one place.

agile meadow
#

yeah thatll be for the future when i actually have a server

#

and thats where i will also keep my Trie to filter stuff.

#

do i need to do this? no. it could be fun though, it could be!

flat sparrow
#

Anyone know what happens if you try to spawn a BP actor on the server that isn't loaded on the client? Will it just not spawn on the client?

pseudo wagon
azure hull
#

Hi. Got question about FastArray (FFastArraySerializer), if you have one FastArray within a FastArray, would it work properly? Or it is not recommended to have FastArray property within FastArray?

#

I've just encountered were I've got inventory array and within each item want to add attributes tarray as FastArray due to it having a lot of bits in a single net frame.

#

Was wondering if FastArray within FastArray would perform well.

lament flax
#

first, dont use USTRUCT_BODY, its super old

#

use GENERATED_BODY for all types

lament flax
#

fast arrays have overhead and use more memeory that regular Arrays, so its not always the best solution

azure hull
#

Well fast array seemed like a good thing for inventory. And works well, now just want to reduce bits and best lead for the issue is attributes which is a regular array, not fastarray.
So that's why I was wondering if it's okay to do the nested one.

azure hull
# lament flax i wonder whats the nested fast array for

Each item got a different attributes, rather then keeping a list of all the attributes within and managing values, figured to try getting array struct which defines the amount of attributes. Works well, only thing is the bits now.

chrome bay
#

If you do what you've done there, it'll just serialize as one gigantic blob

#

Or potentially just like a regular TArray/struct property

azure hull
cyan marten
#

It works, but it’s there a way to choose what loading screen to show? I mean is it possible to choose what loadscreen to show?

chrome bay
#

Tl;DR, fast array inside fast array does not work

compact mesa
#

hey have you solved this multiplayer problem with World Partition specially in build Version.
in Editor everything works perfect. having same problem here.

#

World Partition Problem with Multiplayer Build
I'm able to host and join game and everything works perfect in Editor.
but in build Not able to Join WorldPartition Level
And can join all other regular levels works perfect after build also.
Something is going wrong in Build. Specially with World Partition Level...

austere halo
#

Hey guys, quick question about using reliable RPCs vs RepNotifies... I have a multiplayer card game where the player has 3 different arrays to describe where their cards are: in the draw pile, their hand, or the discard pile. I was syncing this over the network with RepNotifies, and then when the clients get notified, they are updating a widget that represents their hand accordingly.

The issue is that I want to have animated events for when the player activates a card, or discards a card, or burns a card. I can't really think of a great way to do that only using RepNotifies. Would there be any significant downsides to just making the whole thing work through reliable Multicasts that fire when a user draws a card, plays a card, et cetera?

snow trail
#

im conflicted about where to ask this but, (roughly) how can you replicate chaos vehicles and implement client prediction for them?
i just tried multiplayer in the default unreal vehicle project and they dont replicate well by default unless im missing something, alongside having delay on inputs since there appears to be no prediction (aside from movement, movement seems to work fine but turning and even the chassis rotation dont work)

id be also fine with a client-authorative system if that's easier to work with and doesn't have many issues besides cheating risk (game isnt competitive, meant to be played with friends)

it's also worthy to mention i own smooth sync, got it for free years ago on the unreal marketplace lol
so i was wondering if i could just use that instead of making my own client-authorative system if i were to go with the second option

viral forge
#

Hey everyone! The replication of the pawn that the client possesses is facing an issue. When the server possesses the pawn and flies, everything replicates correctly for the clients. However, when the client possesses the pawn and starts flying, it only appears to move for the client. For other clients and the server, it stands still. I would appreciate it if someone could help resolve this issue. All necessary checkboxes for movement replication are enabled.

dark edge
#

First state:
Hand Burn
AB C

2nd State:
Hand Burn
A BC

You see that, you know you burned B out of hand. Play the animation.

#

You could have parallel multicasts but it is very much doable with repnotify

dark edge
viral forge
#

The flight control is taken from the Unreal Flying BP asset, which is available when selecting project creation.

dark edge
#

show it

#

also show how your inputs get to the movement component or whatever is doing the moving

viral forge
dark edge
#

Yeah that won't work networked as it's set up

viral forge
#

Currently, only Possess and Unpossess are replicated from the client's side. However, I don't understand how to replicate the movement.

dark edge
#

If you wanted to modify that to "work" in a multiplayer context you'd need to make sure your inputs make it to the server.
The server would then do the moving.

#

It'd look more like this.

Tick -> if has authority -> move based on speed values (same as before)

Input -> run on server event (passing over the input values)
Run on server event -> set the speed values

viral forge
#

Alright, I'll give it a try and get back to you.

dark edge
#

Basically keep in mind that replication is SERVER TO CLIENTS ONLY

#

and the only way a client has to talk to the server is through run on server events

viral forge
#

Something like that?

#

Thank you so much! Everything works. There's just a 0.2 second delay. Is there any way to fix this?

crisp copper
#

what is the equivalent node in UE5 to the "get current player ID"?

austere halo
# dark edge First state: Hand Burn AB C 2nd State: Hand ...

Hey, thanks for the reply. Yeah in that situation what has happened is pretty clear, but there are other cases like a card being played (thus moved from hand to the discard pile) vs a card moving another card to the discard pile without the user having played it. In cases like that you can't really tell what has happened just through the state of the current lists

#

You would need a lot of different lists to track all the different things/states that could happen to a card, and it seems messy versus just sending a reliable RPC like DiscardCard(). I guess either way is workable but just finding it hard to reason about the tradeoffs

swift sorrel
dark edge
crisp copper
dark edge
crisp copper
dark edge
#

What's the context of this code, the pawn?

crisp copper
#

a character, but oh, is it really that simple? i spent 2 hours on google

low phoenix
#

Is it bug that the onbreakevent of a constraint is not firing reliably? I have seen two mentions on the forum. So looks like I am not the only one. I'm on 5.4. Pretty annoying to work around this in multiplayer.

vapid gazelle
#

Are RPCs marked as reliable the only ones guaranteed to eventually complete when there's packet loss? Is it fair to say that regular property replication makes no such guarantees?

dark edge
#

you aren't guaranteed to get intermediate states

#

If it's state, use property replication

fierce egret
#

I have a repnotify variable in blueprint. Its function doesnt trigger at player connection, is it normal?

#

I mean, it triggers only if server changes its value. Doesnt it also supposed to trigger at initial?

dark edge
fierce egret
#

No, should it be?

#

Oh, it triggers if i change value once before connection

#

Cant i make it trigger initial even if server dont change the value?

dark edge
#

just do the same thing at BeginPlay maybe

lone forge
#

What's it replicating, if nothing has changed though?

dark edge
#

if it's some sort of setup code

fierce egret
lone forge
#

Yeah sounds like a beginplay/construction script type of thing

#

Note also that sometimes repnotify fires before beginplay

dark edge
#

If it's stateful that's really no problem

#

doesn't hurt to set a color twice

lone forge
#

Maybe the paint will start to drip..

glossy gate
#

Hi! I have a question.
How can I achieve to have the deck of the cards to stay like the selected box in every instance of the clients? Like, I want every client to be in front of the deck, not in the right, etc.

I thought about calling in the StartGame function of my game from the GameMode to the function of my PlayerController:

void ATPlayerController::AdjustDeckAndPilePosition(ATDeck* Deck, ATDiscardPile* DiscardPile)
{
    FVector PlayerLocation = GetPawn()->GetActorLocation();

    FVector DeckOffset = FVector(-150, -10, 12.7); 
    FVector DiscardPileOffset = FVector(-150, 10, 12.7);

    FVector DeckLocation = PlayerLocation + DeckOffset;
    FVector DiscardPileLocation = PlayerLocation + DiscardPileOffset;

    Deck->SetActorLocation(DeckLocation);
    DiscardPile->SetActorLocation(DiscardPileLocation);
}

But this changes the deck in all instances. I call it 4 times (for each player controller) and it ends with the last position of the deck. I have only one deck spawned in the gamemode so I don't know how to keep the decks synced in the game with the same cards, but with a differente location and rotation

daring gorge
sinful tree
agile meadow
#

when im only one player, my textbox works perfectly, but multiple PIEs makes it act incredibly odd. if im on standalone, both clients will work. if i use either of the server options (Play as Client or Play as Listen Server) then this bug happens, but only when i have 2 open

#

any thoughts?

#

im getting multiple different versions of my textbox or something, and they interact in different ways

sinful tree
#

Yea it looks like more than one copy of the UI is being created and added to the screen.

agile meadow
#

if it were a replication issue then it would happen when i only had one client right?

sinful tree
#

UI and client interactions with it have nothing to do with replication usually.

#

On what event and in what class are you creating the UI and adding it to the viewport?

glossy gate
# sinful tree Why not have the deck as an actor and place it once? If there's additional info...

Isn't it what I'm doing? Like, I'm not sure I understand you.

I have this function that spawns the Deck:

void ATGameMode::StartGame()
{
    TObjectPtr<ATDeck> Deck = GetWorld()->SpawnActor<ATDeck>(DeckClass, DeckSpawnTransform);
    Deck->InitializeDeck();
    TObjectPtr<ATDiscardPile> DiscardPile = GetWorld()->SpawnActor<ATDiscardPile>(DiscardPileClass, DiscardPileSpawnTransform);

    if (TObjectPtr<ATGameState> TGameState = Cast<ATGameState>(GameState)) {
        for (TObjectPtr<ATPlayerController> PlayerController : TGameState->GetPlayerControllers()) {
            if (TObjectPtr<UTHandComponent> HandComp = PlayerController->FindComponentByClass<UTHandComponent>()) {
                HandComp->DealInitialCards(Deck);
                HandComp->SetDiscardPile(DiscardPile);
                TGameState->SetGameModeState(EGameModeState::DealingCards);

                PlayerController->AdjustDeckAndPilePosition(Deck, DiscardPile);
            }
        }
    }
}

In here then I call for every player controller the AdjustDeckAndPilePosition(Deck, DiscardPile);

I place the actor once don't I?

agile meadow
#

in my default Character pawn class

#

this is on begin play

#

which, i remember being told to not do that earlier. i can move it to the HUD

sinful tree
glossy gate
agile meadow
#

ok after a bit of finagling i initialized my UI in my HUD, and managed to still make all the stuff in my character work. now the problem doesnt seem to be showing up anymore

#

kinda weird it works like that

#

idk why

vapid gazelle
# dark edge If it's state, use property replication

Understood, thanks for the tips.

Trying to figure out the patterns for the game so that property replication that's delayed or out of order in a lossy environment doesn't permanently bork the game state, but that it eventually heals once all of the requests have made it. The out-of-order part is tricky.

dark edge
dark edge
#

it IS the game state

vapid gazelle
# dark edge it IS the game state

There's state that reacts to state, e.g. a certain property being replicated triggers things to be made visible/invisible on the client that received the replication, this visibility state not being itself replicated and being custom to who you are in the game, stuff like that. Second order state of sorts.

glossy gate
dark edge
dark edge
#

if it's path dependent then thats different

#

You are typically best off making as much as can be stateful and driven by state, the rest is where the difficulty lies, stuff like smooth movement etc

glossy gate
dark edge
daring gorge
dark edge
#

deck and pile position can just be done on client

glossy gate
dark edge
#

What is deck and pile position a function of, the game phase?

#

either playing or not

glossy gate
#

I've done it there because it's where I spawn the deck

#

don't know where I should do it if it's not there

dark edge
#

It's just race conditions all over the place. If the deck is a replicated actor let it just set its position based on locally controlled pawn position on begin play

glossy gate
#

now workssss!! thanks a lot.
I'm new to multiplayer and I read the basis and see examples but I'm not familiarized with the structure sometimes and I do messy things while I'm practicing. thanks for enlighten me with the thinking :)

bleak lily
#

hey so i have an actor i want to spawn from a server call which is essentially a pickup that you can drop onto the map but

#

What I noticed was that when a client drops it, the values i pass through don't stay but exist on the server

ripe glen
#

anyone know why on linux unreal engine i receive the packets from my udp server but on windows i dont. on both platforms wireshark shows the packets but the game doesnt see them on windows only.

#

This is bugging the crud out of me

#

It’s a custom tcp/udp server client system by the way does unreal use winsock or winsock2?

ripe glen
#

going back to linux, this was the fix "if(SizeUdp > 0 || UdpSocket->HasPendingData(SizeUdp))"

#

That made it work under windows instead of using Peek I added HasPendingData and it said okay let’s go

dark parcel
#

@bleak lily code?

tame kraken
#

Hello, can someone guide me on how to do the replay feature in a multiplayer context without needing the client to exit the server's session?

analog yarrow
#

What do you guys think of Druidmechanics multiplayer c++ course?

cobalt notch
#

what happens if a client calls a client rpc? just a regular function?

cobalt notch
cobalt notch
#

It's real time but a bit silly practically.

thin stratus
#

Problem is that NPPs inner State structure isn't really the most optimized one for Inventories.

cobalt notch
snow trail
#

im testing voicechat with loopback by Launching the game and this is the sound i get, i have no idea what could be causing this, does anyone do?
(you can hear my friend on discord, but the glithced sound is supposed my voice loopback)

thin stratus
cobalt notch
thin stratus
#

You didn't change the way NPP works though and that's not really suitable for Inventories.

cobalt notch
thin stratus
#

Also transactions between 2 Simulations or even 2 Instances of a Simulation are pretty annoying with base-NPP, as each Instance runs its SimTick and then "shuts off" and can only be altered by writing to the pending state.

cobalt notch
thin stratus
thin stratus
cobalt notch
#

Yeah its' stupid but now I can do abilities on this easily. It's not suitable for Inventory at all.

cobalt notch
cobalt notch
#

And to be honest I've seen many people who do courses do not make actual games 'cos life is too short and they're not full games as such so practically there's many missing things in courses when it comes to larger games. I did the UE5 C++ Developer course and a bit of the MP course ages ago.

#

So it's unavoidable to do youtube tutorials or courses or 3 hour long unreal streams but you gotta spend a good % of your time developing really.

cobalt notch
cobalt notch
thin stratus
cobalt notch
cobalt notch
analog yarrow
thin stratus
cobalt notch
#

I have 82 courses on Udemy right now which is pretty hard to do practically but many are blender couress

analog yarrow
analog yarrow
#

i have some ue and zbrush courses

cobalt notch
analog yarrow
#

i found that alot of the problems i get in blender i could search up, and i also have a freind in with many years of experience, and has industry freinds

analog yarrow
#

also i have a small job on the side of my school

#

oh and i got it cheaper actually

cobalt notch
analog yarrow
#

i got a discount from a link

cobalt notch
#

I only buy Udemy courses when they're $10

analog yarrow
#

only 14 dollars

cobalt notch
#

Those courses are totally worth it if someone bothers to do them.. I just did the normal C++ developer course and I do multiplayer already 'cos I taught myself. As long as you do some sort of foundation then it becomes self learning after this. Initially it's very confusing so courses are good to do.

#

You do not need all those courses to make your dream game and even if you do all of htem there's many missing things you'll have to figure out or learn elsewhere. However once you get that confidence and know where to find information and how to solve problems then you're on your way and can just focus on your game.. do not need all those courses really.

analog yarrow
#

im also getting desperate to start the project

#

but im new to multiplayer sooo

#

there still some way to go

cobalt notch
#

In the end I own 82 courses on Udemy but I spend most of my time doing videos in Russian translated to English 'cos nobody else posts those things. Just start your project now and do courses on the side to upskill or well keep your project ticking along slowly and then just do that most of the time. Also then you can implement things which you learn but courses are a bit bad for this 'cos its better to just get the course done with than to improvise too much.

#

For courses you have to set aside whole months.. this is the issue.. I was doing blueprints multiplayer initially which was kind of limited so I did one of his C++ courses and this took me more than a month and then I just focussed on my game full time after this.

#

Most of the things I need aren't even in courses or those are outdated 'cos Epic keeps releasing new features daily and some of those courses are in UE4 even and some of these technologies will change drastically like Gas will probably be obsolete 'cos it's bloated and there should be better ways.

analog yarrow
#

alot of advice, thank you 🙂

cobalt notch
grand kestrel
lost inlet
#

not sure if predicting inventory transactions even needed NPP

cobalt notch
# grand kestrel Is your goal to learn NPP/inventory, or to produce a predicted inventory system

Well it was for learning and it works but this wasn't such a great idea 'cos everything must Tick and I ended up having to do RPCs anyways. I could use this in real life by just making things tick during the transactions but it's just overengineering. I can probably get the same results without prediction. Oh 🤦‍♂️ I can't just disable ticking because then the whole simulation falls apart so it's totally useless in the end.

cobalt notch
gritty cloak
#

hey there im trying to hook up a way so when anybody joins a multiplayer lobby they get given a set game mode on random

#

so far i got this

lost inlet
#

this has some oddities. a replicated PlayerList but it's a list of controllers that only exist on the owning client or server anyway?

#

is this specifically a lobby "gamemode"?

#

also a game mode is just for the server and you have one game mode at a time

grand kestrel
glossy gate
#

I have the start game function of my card game to spawn the deck and the discard pile. it initializes the deck and I don't know if it's also the right place to deal the initial cards.

void ATGameMode::StartGame()
{
    TObjectPtr<ATDiscardPile> DiscardPile = GetWorld()->SpawnActor<ATDiscardPile>(DiscardPileClass, DiscardPileSpawnTransform);
    TObjectPtr<ATDeck> Deck = GetWorld()->SpawnActor<ATDeck>(DeckClass, DeckSpawnTransform);
    Deck->InitializeDeck();

    if (TObjectPtr<ATGameState> TGameState = Cast<ATGameState>(GameState)) {
        for (TObjectPtr<APlayerController> PlayerController : TGameState->GetPlayerControllers())
            Deck->DealInitialCards(PlayerController);

        TGameState->SetGameModeState(EGameModeState::DealingCards);
    }
}

Then the call from the Deck->DealInitialCards() executes this:

void ATDeck::DealInitialCards(const TObjectPtr<APlayerController>& PlayerController)
{
    if (TObjectPtr<UTHandComponent> HandComponent = PlayerController->FindComponentByClass<UTHandComponent>())
        HandComponent->DealInitialCards(this);
}

The problem that I have is that instead of dealing the cards from the client representation of the deck, it deals the cards from the server location of the deck. I don't quite understand how to make it work.

lost inlet
#

yeah don't use TObjectPtr for local variables

#

that's just for UPROPERTY fields

#

though I'm not really sure what you mean

#

like the "representation" of anything is up to you on the client really

gritty cloak
#

how should i set it up

#

im basically making a prison escape multiplayer and im wanting two roles guard and prisoner and im using seperate controllers for each

glossy gate
glossy gate
lost inlet
#

raw pointer for everything but UPROPERTY fields

#

and yeah I think this is a bit specific to your game. not really having any luck decyphering what the actual issue is

glossy gate
#

well, thanks anyways :) I'll try to figure how to make it work

cobalt notch
gritty cloak
#

this is what i have now i just cant get it to set the controller class for that player

#

wait wrong one

#

this is the correct one

cobalt notch
gritty cloak
#

i use two different player controllers

cobalt notch
#

These are pretty hard to see without a magnifying glass but you seem to be not getting all controllers or anything like this.

gritty cloak
#

i have something working

cobalt notch
#

The scrollwheel has been invented

gritty cloak
#

lol

#

so how would u suggest i get it to do the player controller i want

cobalt notch
#

Aren't you already doing this? Save the role on the controller maybe instead of hte gamemode.

#

I still ahven't seen your screenshots properly but you seem to be on the right track. You got the controller, then set the type.. now you have to possess or spawn that which doesn't seem to be in your screenshots so I can't say.

gritty cloak
#

i have it spawning in the pawn now but it only spawns in the one even tho they are both there and i no longer have animations but the animbp is still set up

cobalt notch
gritty cloak
#

okay so it own picking 1 role i fixed that out

#

it just now isnt doing animations even tho they are connected to the player

cobalt notch
#

It's not really visible to be honest can you actually read the text inside the purple boxes?

gritty cloak
cobalt notch
# gritty cloak

You should honestly know how to debug this easily before attempting multiplayer 'cos you're gonna hit many roadblocks in this.

#

You can just print the role or whatever and this has nothing to do with animations so that's not related to your issue. Just check those classes are actually assigned based on what those nodes say by doing print text if nothing else.

gritty cloak
#

animations is fixed

#

i think i get it working now let me do a check

#

the only issue i have now is that its showing both of the widgets on both screens i only want it one per person not twice

cobalt notch
gritty cloak
#

me very stupid lol this is my first multiplayer game

#

i may of figured out why ts doing it

cobalt notch
#

UI should be on client only. If you're doing any UI things on the server then put that on client.

gritty cloak
#

i have got that fixed

#

the only thing i want to also set up is that there is always atleast one prisoner one guard

cobalt notch
gritty cloak
#

the last thing i wanna do is keep the controllers equal in the server so say i have 4 players in the lobby i have two of each controller

glossy gate
#

I'll try to simplify my question to see if with that someone can help me:
I want to know the client location of an actor, instead of the server location. anyone knows how can I achieve that?

dark parcel
#

use the switch has authority to filter who can run what

#

Authority = Server (for the most part)
Remote = Client

sinful tree
# glossy gate I'll try to simplify my question to see if with that someone can help me: I want...

If you want to know the location of a replicated actor on the client then you can simply get the location while running on the client.
If you want to know the location of a replicated actor on the client while executing on the server then you'd have to rely on the client to tell the server what the location is unless it is also replicating its location in which case you'd normally rely on the server's value.

If this is still in regards to your deck positioning, you probably shouldn't be utilizing the location this way in the first place. Card positions are normally something that can be simulated and the positioning of the actors can be done completely client side where the server just indicates what changes are coming through and clients can figure out what it would look like on their own end.

glossy gate
# sinful tree If you want to know the location of a replicated actor on the client then you ca...

how should I be doing it instead? like, I don't get how to simulate the positioning of actors.

In my game mode I just wanted to call to the function of the deck that deals the inital cards to all the players, but the location of the deck where the cards should start doing the movement it's the same for the 4 clients even thought the 4 clients have different deck locations. I guess it's because it's getting the server location, but I don't know how can I get the local one.

In the video (if you look the 3rd client it's the most obvious one) it spawns on the location of the server one

sinful tree
glossy gate
# sinful tree Uncheck replicate movement on the actor. On Begin Play of that actor, set its l...

that's what I done with the deck and that's what make the deck work and be in different places for the clients (the all have it on the second column of the cards)

but the problem it's on where the cards start to move.
the function I use to move the cards do this

    GetWorld()->GetTimerManager().SetTimer(MoveCardTimerHandle, [this, TargetLocation]() {
        FVector CurrentLocation = GetActorLocation();

        FVector NewLocation = FMath::VInterpTo(CurrentLocation, TargetLocation, 0.1f, 0.1f);
        SetActorLocation(NewLocation);

        if (FVector::Dist(NewLocation, TargetLocation) < 1.f) {
            GetWorld()->GetTimerManager().ClearTimer(MoveCardTimerHandle);
        }
    }, 0.01f, true);

it gets the currentlocation of the card and it's here when the code returns the server location instead of the one of the clients

sinful tree
#

Are these cards that you're spawning replicated?

glossy gate
#

yes

sinful tree
#

Do they have movement replicated?

glossy gate
#

nope

sinful tree
#

Are you moving them on begin play to the desired start location on each client before running your timer?

glossy gate
#

no. but the cards are at 0.f attached to the deck

#

so whenever the decks move cards should follow and have the same location isn't it?

sinful tree
#

The original location of the cards would likely be wherever the server thinks it would be rather than where the clients have the deck.

#

You can check this by logging the location on begin play to verify.

glossy gate
#

okeyyy, yeah. I spawned 2 cards to debug and all cards in the 8 logs that returned from all clients, etc, have the same location as the server deck (I expressed myself very bad asjdahdj)

glossy gate
#

I called this code on the GameMode when I spawned the Deck

void ATDeck::InitializeDeck()
{
    Cards.Reserve(52);

    // Create cards and set textures
    for (int8 i = 0; i < Cards.Num(); i++) {
        ATCard* NewCard = GetWorld()->SpawnActor<ATCard>(CardClass);

    // Attach cards to deck
    for (int8 i = 0; i < Cards.Num(); i++) {
        ATCard& Card = *Cards[i];
        Card.AttachToActor(this, FAttachmentTransformRules::KeepRelativeTransform);
        Card.SetActorRelativeLocation(FVector(0.0f, 0.0f, 0.2f * i));
        Card.SetActorRelativeRotation(FRotator(0.f, 0.f, 180.f));
    }
}

there I attached the cards and set the relative location. so, on the begin play, which location should I give to the cards? like, every card would have a different Z

exotic wasp
#

anyone here ever used the ProjectileMovementComponent's interpolation? im struggling to get it to function at all. the root component is getting moved fine, but the interpolated visual isn't moving

native axle
# exotic wasp anyone here ever used the ProjectileMovementComponent's interpolation? im strugg...

In your projectile actor
In BeginPlay call

ProjectileMovementComponent->SetInterpolatedComponent(VisualRootComponent);

Override the actor's PostNetReceiveLocationAndRotation and call

if (GetLocalRole() != ROLE_Authority)
    {
        const FRepMovement& LocalRepMovement = GetReplicatedMovement();
        const FVector NewLocation = FRepMovement::RebaseOntoLocalOrigin(LocalRepMovement.Location, this);
        ProjectileMovementComponent->MoveInterpolationTarget(NewLocation, LocalRepMovement.Rotation);
    }
exotic wasp
#

my static mesh's root wasn't being set for whatever reason

twin juniper
exotic wasp
#

if you have bad packet loss and you're activating them in an unreliable RPC, that could cause it

twin juniper
exotic wasp
#

where are you applying the initial velocity? and where is the component getting activated?

twin juniper
exotic wasp
#

where is it getting activated?

twin juniper
exotic wasp
#

on server or client?

twin juniper
#

server

#

ActorType* Actor... = GetWorld()->SpawnActor<ActorType>(...);
Actor...->InitializationSetup() -> setup the velocity for instance

#

maybe there's a force option that I'm missing or the constructor is not correct:

    ProjectileMovement->InitialSpeed = 0;
    ProjectileMovement->UpdatedComponent = BoxComponent;
    ProjectileMovement->bRotationFollowsVelocity = true;
    ProjectileMovement->bShouldBounce = false;
    ProjectileMovement->ProjectileGravityScale = 0.0f;
compact mesa
clear mango
#

Do you know some good YouTube tutorials to know how to make a multiplayer video game (in the style of Fortnite for example)

lament flax
#

no tutorial will be able to show this much

#

break your game logic into pieces and search for details for each of them

lament flax
#

how do i replicate a streaming level ?

#

i expected it to be reped by default

#

i guess i need to rep my streaming params and stream it locally

proven pagoda
#

In my character movement settings I have settings established so the player doesn't rotate towards input, my game uses Lyra strafing animations primarily so I always have my player facing forward center. On my server this is no issues, but on clients it rotates the player to face input and then snaps them back facing forward. The client simulated proxy doesn't snap at all, this is only an issue on the owning client locally controlled. I'm not sure what other settings I should replicate or where I could look next to stop this from happening only on the controlled client

#

This causes insane stuttering issues with the less ping you have. The higher ping I simulate, the orient rotation to movement takes longer to snap back to forward from the server correction

#

I might have to comb through all my code and see if I set it anywhere in code accidentally maybe but I only remember messing with it in blueprints

crisp shard
#

loaded Q, but how difficult would it be for a none cpp dev to make a dash movement ability in cpp ?

#

for mp of course

twin juniper
#

'none cpp dev' ?

crisp shard
#

i don't know cpp at all, but i'd be willing to attempt it, is what im saying

#

should say "non"

lament flax
#

im trying to rep a streamed level from server to client
tried to use OptionalLevelNameOverride, on server
and tried to spawn it on server AND client

in both case it doesnt work

muted pewter
#

I have a dedicated server running on locally on my machine. I have setup everything correctly i.e default server map and everything but the problem I'm facing is as soon as i join the server using open 127.0.0.1:7777 cmd the player connects and then instantly disconnects from server. Here's the logs:

#

Any solution for this will be much appreciated as I have already searched through internet but no viable solution was found

#

If I change the default server map to some default map like thirdperson map or OpenLevel same issue happens so this problem is not related to level
Edit: Figured out the issue as I was USing BP_ThirdpersonCharacter as pawn it was not getting included in cooked assets and was not present on server as Its in StarterContent Folder so this was creating a Checksum Mismatch error due to which connection was not getting established

lament flax
nocturne vault
#

I'm trying to stop the player mesh from going under the ground when they crouch. the capsule height changes correctly for clients, but the player mesh doesn't stay in the correct location. During the timeline, it seems like the player mesh stays above the ground, but after the crouching timeline finishes, it goes under the ground. Do I also have to set the mesh's location somewhere else after the timeline finishes?

nocturne vault
edgy bison
#

guys is BeginPlay too early to call an RPC?

thin stratus
# nocturne vault I'm trying to stop the player mesh from going under the ground when they crouch....

There is some offset that the movement component or the character saves iirc. Not sure if one can update that from BPs. I'm not at my PC and also won't get to it anymore today but you could try to look for something along the lines of mesh, base, offset, cache etc.

If this isn't exposed then you can only really make them crouch via the build in functions or you gotta touch c++. The code you have there is already gonna cause corrections though.

thin stratus
edgy bison
thin stratus
#

Is the array not replicated?

#

If you RPC anyway you may as well just call the function on both on BeginPlay, without RPC or Authority check

lament flax
#

exiii

#

was wondering where you were at 😅

thin stratus
#

BeginPlay is usually too early for Client and Server RPCs as the actor may not be controlled/owned by said client yet

edgy bison
thin stratus
#

I guess you don't use c++?

edgy bison
#

Yes blueprints I mean Object blueprint

thin stratus
#

Yeah I know. With c++ you could replicate them.

#

But either way. You can't RPC there. You can only RPC after the Owning Actor of the Component has a valid Client as Owner.

#

E.g. if the Component sits on the Pawn/Character, you'd need to wait on EventPossessed

edgy bison
#

Ah I see, thank you so much for your help!
do you know any event I can use in the character blueprint that isn't too early for such thing?

thin stratus
#

Yeah, Possess(ed)

edgy bison
lament flax
#

Cedric, could you give me a bit of insights for streaming levels in MP?

I tried various ways but i cant find a way to make the leve visible (or loaded) on client

#

In my style of game the server manages the loaded/unloaded levels, and the client should only receive without managing it separately

edit: finally found how to do it

hollow ridge
#

Hello,
I've a question about replication (I'm using blueprints).
I've implemented an ActorComponent (AC) called "Interaction" to Linetrace for Actors that implemented a specific interface (BI_Interactable).
If the player presses the Interaction-Key the "InteractWith" gets called via the interface - Once from the client and directly afterwards via RunOnServer with the interacting actor and target.
Now I'm testing around with an dialogue system and want to create and show a widget on interaction and get some "problems" depending on the netmode.
If the gamemode is set to "Play as client" it's fine, because I can use stuff like "Switch Has Authority" pretty easy.
But if I use "Play As Listen Server" I've the problem that:

  1. I can't really use "Switch Has Authority" well, because the host is the server in that case and I need to create a widget for the host as well. (Thought about checking if it has a player controller and is locally controlled, but that doesn't solve the following points)
  2. Events get called twice, because the first "InteractWith" is called as server and then 2nd call with explicit "RunOnServer" is called as well.
  3. If I remove the default "RunOnServer" Method on my "InteractWith" I don't find a good way to call RPC's on the TargetActor, because it's owned by the server. Do I have to ping pong between the Pawn <-> Actor to call RPCs?
  4. In case the non-host player (regular client) interacts with the actor and it sends the regular call + the RPC (RunOnServer) it will create the widget for the client but also for the server, because it has an controller and is locally controlled. (and "Switch Has Authority" can't avoid that as well.)
    I'm feeling like I should'nt fire a "RunOnServer" on "InteractWith" right behind the first client call, but I don't know how I would handle events that need to be performed on the server then. (e.g. destroy actor, play some animations, whatever...)
    Do I have to ping pong between the pawn/pc and actor then?

Sorry for that text and I hope that I could make my problem clear. I'd be grateful for some advice ..Feel free to DM :D

sinful tree
# hollow ridge Hello, I've a question about replication (I'm using blueprints). I've implemente...

Yes, you'd need to RPC to the server on a client owned actor or component of said actor, and any communication back to that specific client would probably need to be done VIA RPC on the same actor/component, or be done VIA a multicast or replicated variables on the actor.

For a dialogue system, I'd recommend only RPCing what is necessary - like the player selecting a game altering choice - and before registering that choice you verify on the server whether or not the client can make such a choice at that time. If you are free to walk up to an NPC for example and talk to them just to get a bit of their backstory or details that they may repeat, but it changes nothing of the state of the game, that doesn't really need to use any networking. You could just have the client attempt to speak to the NPC, handle the widget creation locally, determine the dialogue that should be displayed locally, and when they make a choice that would trigger something that needs to be networked, then you'd have some kind of RPC to the server at that point.

exotic wasp
proven pagoda
#

How bad is DelayUntilNextTick ? I'm running into an issue where I disable UI menu buttons for using and equipping items after they send the server RPC until the FFastArraySerializer updates which fires this delegate which reenables all the buttons to use or equip the next item, however the server executes the entire loop of disable buttons, use item, broadcast and reenable buttons in 1 frame so the server UI buttons stay disabled unless I DelayUntilNextTick then the server's buttons work again

#

Would it be better to include an authority check and only disable buttons on clients over this delay?

ivory vortex
#

Hey all, what are the pros and cons of using the listen server to act as a dedicated server? Will I run into trouble with network relevancy?
The reason why I’m considering this is because compiling UE source for dedicated server is a giant pain in the butt, and recently there is a compile error in datasmith that I don’t know how to resolve and I don’t even want to use datasmith.

dark parcel
#

The main difference between liste and dedicated server, listen server render the graphics too. So most of the computation will be wasted.

You will end up being able to support less player.

#

If you are going to deploy servers in service like aws it's unthinkable to not use dedicated build

#

You will pay more for no reason

sharp hamlet
#

Hey all, hope you all are good. I am currently in a beta-testing phase with my multiplayer shooter game (using AWS Gamelift servers), 14 players joined my PlayTest last night, all was good, the FPS was 180, the ping was 25. But as the match progressed with time, the FPS is getting dropped and the ping is getting increased. After 10mins, the FPS is now 25 with ping over 250. What seems to be the problem here? Where do I look to identify the fault? Just tell me if this a server problem or something wrong with game coding

ivory vortex
tardy fossil
#

i really wouldnt bother trying to engineer a listen server to work as a dedicated server unless its a temporary testing reason imo

mystic crown
#

what should i do for projectile : replication and Net dormancy

abstract arch
#

is playerState->GetUniqueId() always 48 byes ? or does it depend on the platform (e.g. steam / playstation network, etc) ?

lost inlet
#

it will depend on the platform, and Steam is even internally a uint64

#

which is ...64 bits

#

it's easiest to convert to a string and not to make too many assumptions about how short the string is

abstract arch
#

yeah I need to send it to a database which has a max size of 45bytes 😦

lost inlet
#

is this a db you control?

abstract arch
#

in a way yes, but there is a whole api that would need to change, plus I still would need some max size

#

so preferably I would get a short version of playerState->GetUniqueId()

lost inlet
#

well a steam ID as a string will look something like 76561197978484843, which is 17 chars, I'm sure there's a ToString version that'll also put the platform in front of it eg. STEAM:, so an extra 6 chars there if you want that

#

I think EOS identifiers are pretty long

abstract arch
#

but playerState->GetUniqueId() would be unreal's wrapper around the different variants of the platform IDs ?
I wonder if that is always 48, seems to be the case for a local desktop test DESKTOP-[someid]-[another number]

lost inlet
#

well that's the null OSS

lament flax
#

if i add a Pawn weak ptr to a replicated array
is it possible that on client onrep, the entry is added, but still null ?

#

can the Pawn ptr still not be reped ?

chrome bay
#

yep

#

same with non-weak ptr

#

If/when it becomes a valid actor, you'll get another OnRep

lament flax
#

well i didnt expect that

#

thanks

real ridge
#

Guys how correctly replicate player movement ? my player is Plane and I am doing it via RPC but something going wrong , was doing it like this but its not best practise when i dont use branch it doesnt work at all

cobalt notch
real ridge
#

:/

cobalt notch
real ridge
#

:d

real ridge
#

Idk if it's then helpful

cobalt notch
real ridge
real ridge
cobalt notch
#

Also multicasting is bad for movement. You probably have some other bugs if removing the branch is causing you issues. just remove hte branch and do this properly.

#

Do an OnRep variable instead of Multicast as you do want this to run for everybody and it's not slower.. you are running as two clients and they are all running this seperately. It doesn't matter if its slower on yoru machine 'cos they'll be on seperate machiens. It's supposedt o be slower means it was working. Faster means it's not working..

#

That's if the Actor Movement variable isn't replicated.. youc an tick replicates movement which may just solve htis then it will work with just this one function without the multicast or branch. Otherwise you will have to do a seperate variable and use an OnRep to update this on all the clients. If it didn't update on any clients then they do not know where your player is so it needs to be for everybody. If they're too far it won't replicate to them do not worry. Okay Good luck I hope this is clear.

real ridge
#

and make it work :/

real ridge
#

but i first need find out this

#

when I am replicating just movement from keyboard its working fine which is little bit confusing 😄

#

but keyboard is using add actor local rotation

#

and ofc movement function for moouse is on event tick

#

i had working prototype but it was laggin there was some problem and planes were flying little bit wrong so I am trying fix it

cobalt notch
cobalt notch
real ridge
#

its working with just server call but i send you video whats happening same problem like before / that lagg i need solve it

#

i tried record it, small laggs while you watch / another player, its happening only when mouse movement is activated so when i use set actor rotation to replicate, when i disable it and planes use only keyboard movement all is smooth af

#

maybe u will now understand my issue better

cobalt notch
# real ridge i set this

Yeah that's a tricky problem. You can set the position on the client before sending the RPC should solve the lag issues. but then the server will reset the position and your player is ahead at this time. You can try the Mover component instead of making your own. Its a bit dodgy too at the moment. Otherwise you can try the above and see what happens but I think it will be popping when the server RPC fires.

real ridge
cobalt notch
#

There isn't any good solution to this.

real ridge
#

all good

#

in time when i activate mouse movement and use set actor rotation its broken 😄

#

so i think RPC is not bad at all

#

its like rotators battle there idk

#

do you see little lagging at first video?

cobalt notch
cobalt notch
#

Atleast iwth character movement component the replication is automatic and maybe a bit smoother htan what you'll achieve

twin vessel
#

I have a replicated component. Im binding a component's function to a delegate, only if HasAuthority is true.
The bound function is getting called on client too when the delegate is broadcasted

Shouldn't it be called on authority only?

real ridge
cobalt notch
#

Floating Pawn Component isn't replicated and that's not easy to do smoothly. Epic didn't get this right till today. So good luck if you can. Unreal wasn't made for Pawns 'cos Unreal Tournament doesn't have Pawns and neither does Fortnite and all the Car and Airplane Games probably had to make their own movement components or used other engines. There's only rocket league really lol.

cobalt notch
real ridge
#

crying while reading all this which already i know hahaha

#

i need solve it somehow

#

fml

real ridge
#

game days are near i need fix it haha

cobalt notch
# real ridge crying while reading all this which already i know hahaha

I have pawns in my game but I'm using experimental technologies which do not work properly. You are just setting rotation twice you need to add it to the transform and then the setactortransform changes the rotation as well. I do not think you're adding the mouse rotation to this SetActorRotation so it's not replicationg it.

real ridge
cobalt notch
#

Besides this with AI it will work fine in singleplayer atleast. People do not know if its lagging or not they will think they just missed 'cos the game is too hard.

real ridge
real ridge
#

it

#

but i believe this will be solved

#

😄

cobalt notch
# real ridge idk idk i am debugging all day finding wahts the biggest diference between using...

If you do not care about cheaters and want 100% smooth movement this is a trick you can do.. you can just set the position immediately on the client and send a server rpc which does nothing but sets a replicated variable "Transform". Setting this Transform trigggers an OnRep on all the clients except the one which sent the RPC. Then the other clients update the position of this Pawn. So your own player is moving at 100% speed and the rest of them get he updated position. Everything works 100% smoothly unless people cheat. If people do cheat you can probably figure out some other solutions like storing previous transforms on the server and checking if they seem valid but all this is a bit of effort to do and not how Unreal is designed.

#

Otherwise you have to use Network Prediction like I'm doing but that's all experimental and Epic might abandon it before my game is done.

cobalt notch
# real ridge i get

Oh if you want to use this trick you'll have to send the Actor* pointer to the server and this also needs to be replicated with the transform so a structure would be best for this. Otherwise the other clients won't know which actor position to update. It's a bit tricky but not that hard if you think about this. Actually this is probably what most AAA games would do and the cheaters just do not know this.

cobalt notch
cobalt notch
lament flax
#

in the PIE viewport when i detach myself can i select a world to preview ?

quasi tide
#

Yes

#

Thank you for coming to my ted talk

lament flax
#

where is the setting ?

quasi tide
#

If I recall correctly - should be somewhere in the world outliner. It has been a hot minute since I've done it though.

lament flax
quasi tide
gritty cloak
#

hey there i have a fully setup steam multiplayer game but for some reason whenever i try create a session it opens the level i want normally but once i make it a listen server it trys to open up another level even tho its not set too

#

its a problem with setting it up as a listen server it breaks and idk how to fix it

dark edge
#

Show some code so people don't just have to guess

gritty cloak
#

this is the code i use to create the session

real ridge
gritty cloak
#

and when i try create a session i get this error like its just to open up a different level even tho thats not the level set up

#

and it only does it when i set it up as a listen server

#

im very confused on why it does this and its the only thing stopping me from being able to continue with creating the game as my whole game relies on multiplayer working and i dont seem to undertstand why im getting this

#

this is the code im using to create the session im using steam advanced sessions plugins

gritty cloak
#

it keeps trying to open up the editors default map even tho its set to open up the game level and it only does this when i do it as a listen server which it needs to be listen server for multiplayer

gritty cloak
#

now it dosent even wanna open the level

clear zephyr
#

can someone please show me the proper way to run the trace on server properly i know this is the wong way

fossil spoke
#

Executes on All
Executes on Server

#

You are currently running the Capsule Trace on All

dark edge
#

WHEN and WHERE

waxen apex
#

Question: I have my Weapon as a separate Actor which I connect to my character during runtime, in multiplayer, how do I reference the specific Weapon Actor's mesh owned by its owner character?

Because I tried using GetActorOfClass, but that just got the first one spawned in, not the one owned by the character

fossil spoke
waxen apex
#

the character does spawn it

#

using a componet

#

hold on, let me get the code

fossil spoke
#

Then im not sure exactly what your issue is?

waxen apex
#
In Component.h

UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<ALegacyWeapon> Weapon1;

class ALegacyWeapon* Weapon;
In Component.cpp
void UEquipmentSystemComponent::ActivateWeapon()
{
    AActor* GetOwnerReference = GetOwner();
    AHeroCharacterFramework* HeroActor = Cast<AHeroCharacterFramework>(GetOwnerReference);
    UAbilitySystemComponent* ASC = HeroActor->AbilitySystemComponent;
    check(HeroActor->AbilitySystemComponent);

    Weapon = HeroActor->GetWorld()->SpawnActor<ALegacyWeapon>(Weapon1);
    Weapon->GiveAttacks(HeroActor->AbilitySystemComponent);
    Weapon->GiveSkill3(HeroActor->AbilitySystemComponent);

    Weapon->WeaponMesh->AttachToComponent(HeroActor->GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, Weapon->WeaponSocket);
    Weapon->WeaponMesh->SetRelativeTransform(Weapon->AttachTransform);
    Weapon->ActivateWeaponDual(HeroActor);
    OnActivateWeapon.Broadcast(HeroActor);
    

}```
fossil spoke
#

So can you rephrase your question?

waxen apex
#

Because the current reference I have is by class, I need to get the reference for the owned weapon during runtime for a cast

fossil spoke
#

class ALegacyWeapon* Weapon;

#

Just expose this?

#

That is the Weapon refernce

clear zephyr
# dark edge WHEN do you want to do this trace?

this is a trace that appears when i grab a ledge for a climbing system i got it to work right on single player but another movement action is not replicating properly so i figured i might need to do the line trace and that might be whats causing the replication to fail

waxen apex
fossil spoke
#

Probably just want BlueprintReadOnly

waxen apex
#

alright

exotic wasp
#

anyone here tried to use the network prediction plugin with GAS anytime recently? are they still basically entirely incompatible? is NPP even in active dev?

fossil spoke
#

AFAIK its not in active development, more of a side project that got moth balled 🤷

dark edge
# clear zephyr

So you want to do the trace each frame when in climbing mode, right?

exotic wasp
#

hmm. so it seems like mover 2.0 can use either NPP or chaos physics. anyone had time to play around with mover in either of these systems?

dark edge
clear zephyr
dark edge
#

ok so what's the problem?

#

just gate it by HasAuthority to make sure it's only happening on server

#

if that's your goal

clear zephyr
#

it wasnt working on client in the vid the character dont move

#

so do i need to add has authority

dark edge
#

Well your original question was how to do the trace on server

#

whether or not that's what you want to be doing is another matter

clear zephyr
#

yea because i seen it another way where you have start and end pins on the server event and hooked the trace that way but i wast sure the right way to do that

gritty cloak
#

when i create a session it opens the level fine but when i open it as a listen server it opens a level that dosent exist like one of those starter levels u get when u make a blank ue5 project idk why its doing this does anyone know how to fix this

grand thorn
crisp shard
gritty cloak
gritty cloak
#

Want me to show u the maps set up just incase it is set up wrong

#

let me get a short clip on whats happening

#

this is what its doing

#

i now get this i havent had it before

#

and this

ivory vortex
#

Is there a point in removing delegates from OnComponentBeginOverlap or OnComponentEndOverlap in multiplayer when a client disconnects?

gritty cloak
#

i havent had a problem with doing any of that cause when client leaves they are disconnected from the server so their collisions dont exist

crisp shard
# gritty cloak and this

hard to tell what might be the root but i have had the OSS errors before, but im not longer using steam so not sure what exactly the fix could be

gritty cloak
#

i was gonna switch to using epic but my game is going on steam so it needs to do steam

crisp shard
#

a bit more work to setup i'd say but you could easily use EOS and still have steam

gritty cloak
#

should i switch to EOS isntead then

crisp shard
#

lmao i can't answer that for you

gritty cloak
#

ill do a switch and see if it fixs everything

crisp shard
#

persoanlly, i did not want to struggle too much with that side of things so i went with EIK (it's a paid plugin) that helps with the integration of EOS

#

best part of that plugin is the support, they are always willing to help answer your questions and they are kind of tailored for noobs like me

gritty cloak
#

im gonna have to do full EOS as rn i dont have funds to get EIK

gritty cloak
# crisp shard EOS is cross platform

so im using EOS just using epic online services atm and everything is set up correctly but im not getting the epic overlay even tho its set too and it logs in to the account as i had a print string to check if it was successful or not

crisp shard
gritty cloak
#

that is what im double checking now

crisp shard
#

not sure if you need that to test , but pretty sure it's needed before you do the auth login

gritty cloak
#

yeah its all set up correctly

crisp shard
#

i've never used epic overlay so not sure

gritty cloak
#

im gonna enable two eos plugins see if this fixs it

#

that didnt work i went on chatgpt and changed my ini file so gonna see if this fixs it

cobalt notch
# real ridge damn i tried this but not working going take nap sleep maybe tommorow will be be...

Turn off the Replicates Movement tick to avoid the Server overwriting this becuase youre replicating your own transform instead. This onrep will run on the server as well so put that HasAuthority false to prevent this from running on the server. Maybe when it updates on the server as the actor movement is replicated so it overwrites the clients but you only want to update it on clients. ALso you will need a struct to do this properly as you need the Actor pointers. Right now your onrep will set actor's own Transform but you want to set it for the moving actor's Pawn on other clients. I hope this makes sense, to do client side the onrep moves the sender on all clients, so you need to also plug the sender Actor pointer into the SetActorTransform. I can write this for you in C++ if you want. It maybe tricky to replicate the struct in blueprints but it may work.

cobalt notch
#

You'll need to RPC the transform and Actor pointer both to the server then the server puts these values in a replicated Struct which calls the onrep on the clients where you update the actor position plugging in the Actor pointer to update just this actor. Also exclude the server and calling actor so it doesn't update it's own position or exclude them in the replication conditions.

real ridge
#

my brain cooked from looking in it since yesterday i almost had solution locally it worked but when I built server/ client and test it on dedicated it jittered again, if you have spare time and want u can send me it in dm and i will try thx 😄

cobalt notch
# real ridge my brain cooked from looking in it since yesterday i almost had solution locally...

Ok if you can't solve this in a day or two I'll write a plugin for you. Just follow the detailed instructions if you can create a struct and replicate it then problem solved. You can create the struct inside the Pawn and have a Pawn pointer inside this. The server puts the Pawn pointer and Transform in the struct which replicates to clients who immediately update this player position before the server fills and replicates this struct again. So this struct will always contain the latest updated client. Otherwise you'd need an array of structs to store position of each player which is harder to do.

real ridge
# cobalt notch Ok if you can't solve this in a day or two I'll write a plugin for you. Just fol...

i just kinda think problem is not lying in replication there are 2 rotations battling each other seems like thats why jittering i also did execute movement function only on client side then replicate rotations but also happened makes not sense for me that if i disable connection and dont use movement function / which use mouse and i just play with keyboard it works perfectly i cant come up to real problem

cobalt notch
real ridge
#

cant think anymore

cobalt notch
# real ridge cant think anymore

Take a break then do this tomorrow. Just understand the algorithm I told you, It's easy to do. When you send the transform the rotation will be included in this too so you do not have to do anything extra.

#

If you do this blindly then you will get nothing but bugs.. You have to just understand what I told you first about how this struct works and who is sending it to who.

#

On the client he is updating his own location and rotation normally in the movement and then sending the Transform to the server which includes everything, the server just sends this to the other clients to set this Pawn position. This is only updating clients and is not server authoritiative but will be instant. The actual actor transform is not replicated in this and so you should turn off replicates movement on the actor.

real ridge
#

Do you thik its possible to try make testing code like this via blueprints only?

cobalt notch
#

You need a struct which you add to the actor and this struct is replicated to everybody. Then the pawn just sends it's own transform and pawn pointer to the server in an rpc as normal arguments. Then the server fills this struct with these values and this is replicated so the OnRep can be used to set the position from this struct. See Easy!

real ridge
#

i can do c++ but now i dont have mood :ddd

cobalt notch
real ridge
azure hull
#

Hi. What's the proper way to send different game configs from the lobby to the actual game level? So far I know that I can send some data through GameMode event OnSwapPlayerController, when saving data for the host PlayerController. But are there any better ways? Like sending GameState info from Lobby to the level or GameMode info?

fossil merlin
#

Q: I have an AI that you can toggle to follwo the player. It works as expected, even if multiple clients are spawned in. However, when it dies, the late joiners only see the body at it's spawn position. I've got it set (bIsDead) on a RepNotify, but it still defaults to it's spawn location to the late joiners. Any ideas?

sinful tree
# azure hull Hi. What's the proper way to send different game configs from the lobby to the a...

You can send some parameters as options when opening the level and reading the options in the game mode. You can also tell it the level you want to use by using the "game" variable, but I believe this requires the full path to the game mode you want to use, or setting up an alias in your DefaultGame.ini as outlined in this forum post:https://forums.unrealengine.com/t/changing-gamemode-at-runtime/81504/5

fossil merlin
#

AI MoveTo

sinful tree
#

And you have the actor set up as replicated and replicates movement?

fossil merlin
#

I do. It works great for players already spawned in, just not late joiners. They see the body at it's original spawn position.

#

It seems that it's other spawned items, as well, I noticed, but the dead body is my priority at the moment.

sinful tree
#

Are you spawning a body, or are you just using the AI Actor (like, just using the same actor that was moving around but is now defeated and dead on the ground)

fossil merlin
#

Just killing the AI actor. They are already in the world.

#

They ragdoll

#

It seems to work fine (as far as the location) for late joiners if they're still alive...just when they're dead and then join is it an issue.

sinful tree
#

Are you disabling anything when you put them into a dead state?

fossil merlin
#

The collision capsule...but now that I say that 'out loud', that may be my issue...

#

Nevermind...I'm just setting it 'no collision'

sinful tree
#

It has to do with the ragdoll. I believe it's because when you ragdoll a mesh, it is no longer tied to the location of the actor.

fossil merlin
#

UPDATE: Everything works as expected if the AI pawn is SPAWNED at begin play..just not when placed.

sinful tree
#

Putting in a small delay before triggering the ragdoll on your onrep will make it work correctly, but that's not the way to handle this... trying to figure it out.

#

Ah interesting.

fossil merlin
#

If you happen to figure it, do let me know. For now, spawning the AI in from the level BP will work as a workaround.

sinful tree
#

Disable this on the placed actor:

#

This prevents the client from loading their own copy first and then it becomes linked across the network. Instead, the replicated version will come down and have the correct position to begin with.

fossil merlin
#

It appears that some of the functionality is broken if that is unticked.

#

Is there a counter-bool I need to set on the BP if I unset this on the world isntance?

sinful tree
#

That same option appears on the blueprint itself, but disabling there would ensure that any placed instances are not loaded on the client's end with the map loading.
If you're having trouble with functionality by unchecking this option, that's an indication that you may be using something about this actor in the level blueprint, or you have some other race condition that's trying to retrieve a reference to that actor before it exists on clients.

fossil merlin
#

I'm still exporing what might be causing that - thanks for helping me think through that @sinful tree

gritty cloak
#

hey there i am trying to use steam advanced settings plugin for my multiplayer game it connects to steam perfectly fine but whenever i try do a open level node of my create advanced session node it fails to open the leve linstead it defualts back to the level before im using this code

#

this is the code i used to add steam to be called

azure hull
sinful tree
gritty cloak
#

i can send a video of what its doing if that would help

#

this is what its doing

#

okay so putting "?listen" fixed it

#

spent 6 hours on this and that was the fix geez i feel stupid

#

thanks dude

#

i just dont know if it fully works now intill i have my mate who lives in the same country as me to be able to test if it works or not

keen adder
gritty cloak
#

sadly not my laptop cant run my game i tried

keen adder
#

You can host the game on steam pretty easily and then test on any 2 computers

#

It cant run the game or cant run the unreal editor?

#

At minimal settings it should be able to run the game off steam. Even if you have to make a new empty map just to test basic stuff. Having 2 conputers will make the process much easier going forward. 😄

twin vessel
#

I have a replicated object that i'm creating on server, and right after i am setting a property on it.
Is there a way to make sure that when the object replicates it already has that new value of the property?

keen adder
#

Nope youll need to replicate the value as well

#

Though you can make the object hidden in game by default or set hidden in its begin play, and then reveal the object when it gets the proper rpc/notify

twin vessel
#

Thanks

cobalt notch
twin vessel
# keen adder Nope youll need to replicate the value as well

Ok apparently my problem is another.
The property is replicated, and when the client receives the object, the property is already set.
The issue arises from the fact that the OnRep for that property is not called as soon as the object is replicated
Which confuses me, since the property DID already replicate by that time

#

In short:

  • i have a replicated object with replicated property.
  • I create object on server and set the property right after.
  • When the object replicates, a delegate is called, and at that point the property value is the one set on server.
  • But the OnRep of that property did not get called yet.

Is there a delay between when a replicated variable is replicated and the OnRep is called?

keen adder
#

Oh sorry i see you did make the onrep function

twin vessel
#

Yup, the OnRep function is getting called just fine on clients, but apparently later in time

keen adder
#

Reliable = true?

twin vessel
#

There is a point in time where the property did replicate, but the OnRep is not called yet

twin vessel
keen adder
#

Sorry yeah my brain wasnt on lol

#

I do think there would be a bit of delay between object creation and the onrep

keen adder
twin vessel
#

What would hidden do to a uobject?

keen adder
#

Sorry I thought you meant 'object' as a generic term for a 'thing', like an Actor

twin vessel
#

Nope

keen adder
#

Is there a more specific problem you're having?

#

I imagined it was an actor being displayed before it's mesh was setup or something

twin vessel
#

Just the fact that apparently i managed to run a function consistently after a property is replicated but before its OnRep is called

#

And i rely on that OnRep for initialization

keen adder
#

On the remote side?

twin vessel
#

Yes

keen adder
#

Yeah you'll need to adhere to that initialization, so your object is treated as if it doesn't exist until it happens

#

Similar to how creating an actor will call it's BeginPlay before your next line of code even runs

#

you can probably sneak in code right after the object is created, but before you've even set it's replicated var

#

In real world scenarios that might not even be possible, but always safe to force all function calls to fail until your onrep has ran

#

with an "IsInitialized = true" variable in the onrep or something, then check that in other functions

lament flax
#

after maybe 30s of going in a straight lines my client doesnt see the floor static mesh of the level i stream in.
its weird because

  • other actors are loaded (maybe its because they are reped, unlike the floor static mesh)
  • the server is next to the client, so it should be relevant
dusty halo
#

Anyone has some good info or tutorial how to handle Procedural Mesh Component collision? I have procedural map generator tha uses PMC as ground, but I'm struggling with collision for client

crystal crag
#

If you want to have a set time a match runs, and you want to support late joiners (they see the synced time left), then would a rep notify still cover that situation? Or would the rep notify not run because they are joining and the value hasn't changed?
Basically I am trying to avoid making the server send (every second) an updated time value from the game state, because that definitely cannot be a good way to do it.

#

Or would you just set values to initially replicated and skip the rep notify?

sage cloud
#

Greetings! I'm working on a simple little multiplayer tag game to learn Unreal, and am trying to figure out replication, and was hoping someone could point me in the right direction.

I'm trying to track the "it" status as a boolean on my PlayerState, to then change the player between two colors (altering materials on my character), where ideally other players will also see that that player has changed colors (denoting the "it" status). I'm using a debug input to trigger this, but so far I keep encountering the issue where the other player doesn't see the color change. I know this is a replication issue, but am struggling with how to navigate it. I've tried using RepNotify (PS is calling a custom event that triggers a change to a material variable with RepNotify on, OnRep function casts down to character to change materials) but my problem persists (color only changing for the player who hit the debug button). I'm sure it's some simple thing I'm missing here.

Thank you for any help you can render!

sinful tree
sage cloud
#

Current setup, on PlayerState:

knotty bane
#

i have a interaction system setup that works with mutiplayer but when multiple people interact with it nothing happens, if one player looks at it it works perfectly find, is there a better way to do this maybe?

sinful tree
sinful tree
knotty bane
#

this is a actor that on interact you pickup the phone, works perfect but when 2 players look at the phone you cannot interact with it, looks like it cannot handle mutliple players looking at the same object, hopefully i explained it right

knotty bane
sage cloud
sinful tree
# sage cloud Maybe this is the issue? The two things I posted are the entirety of this curren...

Variable replication only occurs from the server to clients so any variables that you want replicated to clients must be set while running on the server.
If you're doing a debug key press, that key press only triggers on that instance which may not be the server, so it would only be setting that value on the instance of the game that pressed that key, meaning no others would know about it.
If you want to let the server know that you pressed that key, then you'd have to send an RPC to the server (An event marked as Run On Server) and do so on a replicated actor or component of such an actor that is owned by the client making the key press. Once running on the server, you can then set any replicated variables on any classes you desire and they will replicate.

Other events like overlaps can trigger in more than one instance, and you will likely want to use a Has Authority node and ensure the Authority is the one executing the code.

sinful tree
knotty bane
#

but on both things when 2 players look at that object neither of them can interact with it

#

so if i straigh pull a print string out from the interact it only prints when 1 player is looking at it and interacting, when more people use it nothing happens

sinful tree
sage cloud
# sinful tree Variable replication only occurs from the server to clients so any variables tha...

Thank you for the extremely detailed, informative answer! This is definitely what I was looking for!

I set my "IGotTagged" event on the Player State to be "Run on Server" for "Replicates" and it now seems to work (albeit with a short delay between the button-press and the color-change on the screen of the player pressing the button). Regardless, I think I'll call that good enough for now, thank you very much!

knotty bane
#

you see the overlay material go away when the other player gets close so the same with interacting because focused and interact event are on the same interface

sinful tree
#

That seems like you may be doing your trace on tick for all characters... You probably only want that executing if the character is locally controlled.

knotty bane
#

i do call that trace on event tick ye

#

how do i implement that if you dont mind me asking

dark edge
knotty bane
knotty bane
sinful tree
#

It's not about 1 for all characters, it's just that every client executes that tick function for all characters, thereby, every character that exists in the game was performing that trace. Now that you have that branch and islocallycontrolled, that ensures only a locally controlled character will execute the intraction trace function.

#

which should only ever be a single character on any instance of the game.

gritty cloak
surreal fox
#

if I make my game without considering network delays (high ping) then how hard it would be to fix it later on?
Will i have to rewrite all the code again?

gritty cloak
#

That's something I gotta fix too

sage cloud
#

Continuing my little Tag experiment: I'm working on the event that triggers when the two players collide, to check which of them are it and/or in the cooldown after having tagged someone, and to make appropriate updates as a result.

I seem to be encountering an issue where when the character tries to get the player state of both themself and the character they collided with, both of these checks return with the same value (being the player state of the player owning the actor calling the event). Simplifying this, when Player 0 (server) tries to get the player state of the character they collided with, it comes back as P0's player state, which is clearly incorrect.

#

This is all on the player character.

Thought process:

  1. Check for collision
  2. See if it was another character that we collided with
  3. If it was, get their player state, to check if they're It (since I'm having "It"-ness live on PS)
  4. Get my own player state, to call the event to process all this, passing along the information we just got from the person we collided with

But again, it looks like when I try to get the PS of the other character, it's returning the current character's PS instead.

#

Thinking about this more, a Blueprint Interface maybe is the right tool to use (haven't done much with them yet), but I'm still curious about why this Cast to Player State isn't working the way I'd expect it to.

kindred widget
sage cloud
kindred widget
#

Right. But interfaces aren't a solve for casting. They're both just communication tools. If the playerstate is invalid or the wrong one, the interface won't be able to do anything differently than a cast will.

sinful tree
# surreal fox if I make my game without considering network delays (high ping) then how hard i...

It really depends on what you're doing and how important it is to gameplay.
An example would be client prediction of things like shooting and movement. If you don't have client prediction of things that a player would normally expect a fast response, then the player probably won't enjoy the game as it'll feel sluggish and slow to them. You probably won't have to rewrite everything even if there is some lagginess to it with poor network connectivity as not everything will feel terrible with a bit of lag. At the end of the day, there's only so much you can do for players that have not so great internet connections that will always have high latency.

nocturne vault
#

On begin play, I'm hiding the player mesh above the legs for the locally controlled player (playing as first person). For the host it works, but not for the client because it seems there is a delay before the mesh is loaded or valid. If I put a delay and then hide the mesh, it works... but from what I understand, people have said it is bad to rely on delays. Is there a way to see when a client or their mesh is loaded?

nova wasp
#

Only owner see etc

#

as for the mesh being loaded it depends on how this is created... is this a mesh referenced by their pawn?

nocturne vault
# nova wasp I would suggest using OwnerNoSee instead

I was doing that, but I want to be able to see the legs. I was setting it up where I created a second skeletal mesh of just the legs and clothes attached to it, but figured maybe it would be too much for every player to have a second pair of legs, 1 for owner no see and the other for only them to see

#

then I was thinking about just hiding the mesh above the spine bones

nova wasp
#

It would be easier to have two sets of skeletal meshes, one for third person and one for first person

#

I'm not really sure how to just hide parts of the skeletal mesh but that would be alright I think?

nocturne vault
#

Hide Bones by Name

nova wasp
#

I forget if it just zero's out their scale or not

nocturne vault
#

this is how it looks like

#

which is what I was trying to achieve with having a second skeletal mesh for the legs and clothes, but was thinking this might be more efficient, and the locally controlled player just hides their own

#

the client sees the host as the full body mesh

sage cloud
ancient adder
#

Anyone implemented custom NetDeltaSerialize? Looking for examples

I'm not sure if my setup is correct, But It seems I need to handle packetloss and sending large data as chunks

I managed to handle the packetloss but can't figure out how to send large data as chunks, I don't understand how the OldState and NewState works

I believed that I only get the last state acked by the client as OldState but it's not always the case, I still get the NewState as OldState in the next NetDeltaSerialize call even tho the data with that state didn't reach the client yet or was lost

sinful tree
# sage cloud So do you think it's an error in the player state reference? I'm still not sure ...

Collisions can happen on each character, and of course, on each instance of the game
For a multiplayer game of tag, you would only care if the collision:
A) Occurs on the server
and
B) The collision is happening with a player that is currently tagged as "it", as you only care to change the state of anyone if a character who is "it" has collided with someone, not any of the other character that are not it.

To ensure that you're running the logic on the server, use a Has Authority and use the authority output of it on the collision event.
To ensure that you're only running additional logic that relates to tagging someone being it, check on your collision first if "self" is the one that is it. If they are, then you can change the state of both playerstates of the character that detected the collision (self) and the one that they collided with (other actor).

lament flax
#

after maybe 30s of going in a straight lines my client doesnt see the floor static mesh of the level i stream in.
its weird because

  • other actors are loaded (maybe its because they are reped, unlike the floor static mesh)
  • the server is next to the client, so it should be relevant
nocturne quail
#

UEnum property replication has some typical issues?

    UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_MontageTypeToPlay) EMontageType MontageTypeToPlay;
    UFUNCTION() FORCEINLINE void OnRep_MontageTypeToPlay();
void AArmaCharacterBase::ServerReload_Implementation()
{
    MontageTypeToPlay = EMontageType::E_MagReload; 
    OnRep_MontageTypeToPlay();
}

void AArmaCharacterBase::OnRep_MontageTypeToPlay()
{
    PlayMontage(MontageTypeToPlay);
}

void AArmaCharacterBase::PlayMontage(EMontageType MontageTypes)
{
    switch (MontageTypes)
    {
    default:
        break;
        case EMontageType::E_MagReload:
        PlayAnimMontage(Weapon->GetMagReloadMontage());
    break;
        case EMontageType::E_BulletReload:
        PlayAnimMontage(Weapon->GetBulletReloadMontage());
    break;
    }
}
#

my issue is the montage only play once on client, and on server it plays every time when i reload

#

logically it should on client/server both, since i am using OnRep

chrome bay
#

why *FORCEINLINE *

nocturne quail
chrome bay
#

That is a bad habit and you should remove it

#

but also, a value only replicates if the Server thinks the client has a different value, and you only get the OnRep if the value is different to what you have locally.

nocturne quail
#

Ok, and is it related to the issue?

surreal fox
nocturne quail
lost inlet
#

also what the hell is that switch

#

why is the default case first

nocturne quail
#

i tested using uint8 MontageType and it works fine

#

switching on digits

#

but i want to use a logical type related to montage type, = EMontageType

chrome bay
#

Unless you have a "none" type, one of those will be the default, so a client will never play it

#

This feels like it should be unreliable multicast instead

nocturne quail
chrome bay
#

Unless you want players to suddenly trigger montages when they get within rep range

#

Well that's at least one problem then

nocturne quail
#

so i have to have the none and set it to none first and then reset to the state i need?

chrome bay
#

normally you don't replicate animation stuff directly. you replicate the overall state of the weapon and the clients manage their animations locally themselves

nocturne quail
#

in my design i am using registered C++ AnimNotifies for reloading weapons

#

when the montage ends it calls the notify to actually update ammo

#

and it calls an event to do this from the equipped weapon, weapon checked if the event instigator is server then update ammo, else return

#

so it means, montage play on both sides, server/client but the ammo update response only validated from the montage that server play

nocturne quail
#

update:: adding none state doesn't solved the issue

void AArmaCharacterBase::ServerReload_Implementation()
{
    MontageTypeToPlay = EMontageType::E_None; MontageTypeToPlay = EMontageType::E_MagReload; 
    OnRep_MontageTypeToPlay();
}
chrome bay
#

that won't do anything

nocturne quail
# chrome bay that won't do anything

i guessed it was already EMontageType::E_MagReload; so setting it back to the current state don't replicates... that why setting it to none and then back to EMontageType::E_MagReload; could solve the issue

#

but it doesn't

nocturne quail
#

yeah, the onrep calls playmontage only once on client.

LOGS:

First reload attempt:

Server : Character : OnRep_MontageTypeToPlay
Client : Character : OnRep_MontageTypeToPlay

Second reload attempt:

Server : Character : OnRep_MontageTypeToPlay
void AArmaCharacterBase::OnRep_MontageTypeToPlay()
{
    PlayMontage(MontageTypeToPlay);
    LogValidity("Character ", "OnRep_MontageTypeToPlay");
}

void AArmaCharacterBase::LogValidity(const FString& ThisName, const FString& ThisMessage)
{
    FString RoleString = HasAuthority() ? TEXT("server") : TEXT("client");
    UE_LOG(LogTemp, Warning, TEXT("%s: %s on %s"), *ThisMessage, *ThisName, *RoleString);
}
real ridge
cobalt notch
lament flax
#

jambax do you have any knowledge of level streaming meshs not displayed for clients (but other reped actors in same level are)

real ridge
#

maybe i need test it via server not running localy two clients

#

but i doubt

#

and its executing like this

cobalt notch
cobalt notch
# real ridge maybe i need test it via server not running localy two clients

No that shouldn't matter. Two clients is better and works fine. It looks okay to me I can't really say. It should work unless you did something or some bp limitation? Check the Pawn names to see who's exectuingt he onrep and the value of the transform and if the server is setting this.. lots of print nodes or debugging 'cos it all looks okay.

cobalt notch
# real ridge this is set skip owner, rep on player should befine too

Oh also has not authority before sending the server rpc or the server may be executing this on himself.. you have to ensure none of this is happening in the wrong places or it will just override the value. So do some debugging to figure out whta's happening. I can't say this from the screenshots but put this check. Server rpc shuld be sent only by the client, and onrep should exclude the client and server is what you want.

cobalt notch
real ridge
#

i had to delete changes and go again something broke

nocturne quail
# chrome bay normally you don't replicate animation stuff directly. you replicate the overall...

solved for now

UPROPERTY(ReplicatedUsing = OnRep_bWantToOnRepReload) bool bWantToOnRepReload = 0;
UFUNCTION() void OnRep_bWantToOnRepReload();
UPROPERTY(Replicated) EMontageType MontageTypeToPlay;

void AArmaCharacterBase::TryReloadWeapon()
{
    if (HasAuthority())
    {
        if (!IsValid(EquippedWeapon)) { return; }

        if (EquippedWeapon->CanReload())
        {
            MontageTypeToPlay = EMontageType::E_Reload;

            bWantToOnRepReload = !bWantToOnRepReload;
            OnRep_bWantToOnRepReload();
        }
    }
    else
    {
        ServerTryReloadWeapon();
    }
}

void AArmaCharacterBase::OnRep_bWantToOnRepReload()
{
    PlayMontage(MontageTypeToPlay);
}
#

so it is confirmed that UEnum has typical replication issues with On_Rep method

dark parcel
nocturne quail
#

thats not working on clients

#

so i use now a bool property as a helper to call that onrep on all with a replicated uenum property

#

thats works fine

#

another option to use int++ instead of bool

dark parcel
#

I will keep in mind if I run into the same problem, thanks

cobalt notch
# real ridge i had to delete changes and go again something broke

If this doesn't work then because you're using the same struct variable for all the players so the players are also overriding this in the server rpc if two players send this in the same frame. Now you'd think the struct will be updated and replicated but when this gets overriden in teh same fframe it may just send it once I do not know.. probably.. so an array would definitely work but then you hav eto do a whole Tarray of this struct on the player and you do not know how many players might join so then the server rpc has to fill this by creating a new struct for every pawn if the pawn pointer doesn't exist in this TArray or update the existing transform. TMap would be easier than TArray but that doesn't replicate easily so finding rows in this will be hard. Ideally you'd add and remove pawn structs to this when players join the session in the gamemode etc. but you can also just add new pawns in the rpc but you'll have to do a for loop to check every entry. You can probably just leave any pawns that leave the session int he array and figure a better place to add remove them later. You could probably sell this if it works even if it's not very secure.

lament flax
#

after maybe 30s of going in a straight lines my client doesnt see the floor static mesh of the level i stream in.
its weird because

  • other actors are loaded (maybe its because they are reped, unlike the floor static mesh)
  • the server is next to the client, so it should be relevant
nocturne quail
cobalt notch
#

Blueprints discord is an indie developer and owns a car, C++ lives in his mom's basement and the last was never heard from after or his Multiplayer game.

nocturne quail
#

for my fire logic i am using this method uint8 = ~uint8; for replicating shots , so what it actually does in my design?

UPROPERTY(Transient, ReplicatedUsing = OnRep_RepShot) uint8 RepShot: 1;

bool AWeapon::Fire()
{
    if (CurrentAmmoInClip > 0)
    {
        CurrentAmmoInClip--;
        
        FireTrace();
        
        RepShot = ~RepShot;
        
        OnRep_RepShot();
        
        return true;
    }
    return false;
}
#

it changes and replication works correctly

#

i just want to know is i am destructing it in a live scene?

lost inlet
#

and what advantages is this supposed to have over a multicast RPC?

nocturne quail
nocturne quail
#

or this RepShot = (RepShot == 0) ? 1 : 0;

sage cloud
foggy forum
#

I can't seem to find any documentation on the GameNetworkManager, but i'm hoping someone can fill me in on whether I can override what seems to be the default behavior of spawning one? I don't have any networking in my project so if I can get rid of it I'd like it.

fossil spoke
foggy forum
fossil spoke
#

Are you using C++ at all?

foggy forum
#

Yes, I have a mix of c++ and blueprints.

fossil spoke
#

It looks like the GameNetworkManager is defined on the WorldSettings and is luckily public, however its not exposed anywhere to the editor.

#

Its instantiated in AGameModeBase::PreInitializeComponents()

#

So if you override that function

#

Before you call Super

#

Set the GameNetworkManagerClass property on the WorldSettings to nullptr

#

It will cause it not to spawn.

#

What the consequences of doing that are, I have no idea.

#

Its not likely that its expected not to exist.

#

So you could end up causing problems doing this.

#

But thats just a guess.

foggy forum
#

lol yea I don't want to do it without knowing the consequences. Just seems odd that it's forced to exist when the game is not networked... And there's so little info online about it from what I could find. Oh well, guess I'll leave it.

fossil spoke
#

Its really just a settings class

lost inlet
#

Gotta save those bytes

quasi tide
foggy forum
grand kestrel
serene kestrel
#

I die a bit inside every time I see how much boiler plate is needed just to do something simple like modify max move speed lol

grand kestrel
#

Don't be fooled, CMC is incredible and we're truly lucky to have it. But yeah the monolithic nature of CMC makes it really painful to learn.

#

One of the biggest things I've learned in my current job is having predefined states is better than being able to set specific values from a game design perspective. It keeps your game feeling cohesive and allows players to familiarise and build muscle memory. So the best thing to do is tuck it away in a plugin exactly like this.

In fact I'm thinking about making a plugin to expose CMC or any other actor for designers to work with. A pretty UI that's easy for them to interact with and images to demonstrate the effect properties have etc

serene kestrel
#

Aren't the "pre-defined" states just a way of packing up "specific values"? For designers, I feel like having the flexibility to experiment/prototype different movement behaviors without needing an engineer to pour hundreds of LoC or more just to do basic stuff that won't cause net corrections is such a missed opportunity. Haven't looked at the Mover2.0 code yet, but hoping its way more flexible than what the current CMC is, because I've wasted so much time customizing that thing at this point.

grand kestrel
#

You can change the values tied to the states if that wasn't clear

#

The debuff functionality I added just now can be used for buffs too, so that's any speed gain or loss covered. It supports multiple levels too.

#

Generally having a sprint and walk on top of that is a great starting point. It includes stamina as well. I go a step further and add stroll for patrolling AI or "stacked" penalties that put you into a walk state

serene kestrel
#

The question is how many of those things can you do without needing to write c++? The repo you linked has separate characters for each of the Sprint/Prone/Debuff, and the debuff is just a single hard coded type.

grand kestrel
#

One thing I really dislike with CMC is they used the term "walk" instead of "run" or something more generic (move wouldn't be appropriate either), which feels like they didn't anticipate people adding a walk state lol

grand kestrel
#

The way it is now is not how it's intended for you to use

#

I will add Walk also

#

Let's clarify one thing though, a net predicted character movement that lets designers add their own systems to prediction in BP will never reasonably exist

serene kestrel
#

The point I guess I'm trying to make, is that Movement is such a pivotal part of most games, and having the CMC require heavy c++ customization to add the usual suspect type modes that any game might want to include overall makes it seem like a really difficult base to use for any Game Designer. They basically need to be tied to a gameplay engineer to customize things, this usually ends up being lots of one off pieces being added (similar to what your repo has) and with each new request, requires more c++/engineering time. Would just really love if Unreal shipped with a more pluggable and designer friendly movement system by default.

grand kestrel
#

Yes of course you need an engineer for net predicted movement, it's fortunate designers can even be involved in the creation process, which is thanks to blueprint

#

But engineers don't want this exposed to BP because the performance cost is too high and characters are critical

#

Making sub ticked calls to BP functions isn't a good idea

serene kestrel
#

Agree with the last point, but I could imagine a system (maybe Mover2.0 is more like this) where each movement mode is implemented with some kind of UObject base class. Then you could have some simple rules about how movement transitions between these modes and allow designers to override it in blueprint. For prototyping, designers could implement full movement modes in blueprint and since it's prototyping the cost isn't as problematic. Once you decide, "yea we like this idea, lets make it more performant", an engineer could then basically just translate that into some c++. I think it would also be awesome if there was some kind of value modifier system similar to the root_motion sources but for changing things like friction, crouch amount, walk slope, acceleration, turn speed, etc with prediction built in. I think just having those two features would go a long way helping people make what they're trying to make a lot easier.

#

Basically if we had a version of GAS that actually worked with movement the way people always think that it does, that could solve a lot

grand kestrel
#

Yeah mover is on the right path. Our designers don't really need us to prototype with CMC though. We give them ways that aren't expected to go into a shipping build

serene kestrel
#

I seen so many people want to make a simple Sprint ability, then realize it's never going to work right unless they write a bunch of c++

grand kestrel
#

I remember that rabbit hole many years ago

#

So I learned C++ lol

dark edge
#

@grand kestrelis Mover predicted (heh) to be easier to integrate with GAS or is it just another prediction ecosystem?

grand kestrel
vapid gazelle
#

Could use a little sanity check of my understanding here:

Say I'm replicating two properties A and B and I'm always updating them in that particular order on the server. Am I correctly understanding that I'm not actually at all guaranteed that the replications my clients receive are in that particular order, only that they will eventually be delivered? My understanding is that duet to packets being dropped or perhaps packets being suddenly routed differently, there's no guarantee that A will always replicate before B, and I should never build my client-side logic to expect that?

grand kestrel
#

If you really need ordered properties then replicate a TArray

vapid gazelle
grand kestrel
vapid gazelle
# grand kestrel You'd just make your own struct to do that

Gotcha. There's nothing in UE's replication that says "nope sorry you cannot have a TArray inside of a struct if you want to replicate the whole struct"? As in, there's no limitation around TArray needing to be the top level container for replication to work?

grand kestrel