#multiplayer

1 messages ยท Page 143 of 1

dire cradle
#

it's not an issue if only used locally

meager spade
#

i have used it exactly 0 times

#

in 7 years

dire cradle
#

Doesn't mean it can't be used though?

meager spade
#

its meant for split screen

dire cradle
#

If it's not a split screen game the index is always 0

meager spade
#

please don't encourage use of it

#

there are many proper ways to do it

queen escarp
#

could u offer one then in this case :/=?

dire cradle
#

I'm aware, this does least modifications to his code though

quasi tide
#

The widget should already have a reference to the player controller

#

So you get that and then get the controlled pawn

#

Something like Get Owning Player or w/e

meager spade
#

as long as the widget was setup properly yes

quasi tide
#

And if it wasn't - go back and do that.

queen escarp
#

well my parent widget dose never get created so how can i get that then

quasi tide
#

Yeah it does. It's not like widgets just come out of thin air.

#

Somehow, somewhere, you are telling Unreal to construct it

queen escarp
#

well im guessing its being created when the first child of that parent is created somewhere

dire cradle
#

Your child widget IS the parent, plus extras

queen escarp
#

so this would be a way to avoid to get index right

#

true

dire cradle
#

Make sure to plug the player controller to the Owning Player pin when creating the widget

#

Yes that would avoid it

#

You don't need to create a refrence variable for the controller as that node already provides a reference

queen escarp
#

true

dire cradle
#

Unless you want to keep the casted reference though

queen escarp
#

so this would be a proper way ?

dire cradle
queen escarp
#

yeah i want the casted referense

#

yeah i dont get it why it wont work still then :/

dire cradle
#

Did you set the Owning Player when creating the widget?

queen escarp
#

wehen im creating the widget its on an event "owning player" so it should give the right owning player right ?

dire cradle
#

You already got a controller reference in the Start event, you can pass that to Owning Player

#

yes

#

or get a reference to "self", that will also do.

queen escarp
#

sign now i broke it even more

dire cradle
#

Can you show the widget again

queen escarp
#

im getting failed cast from player charcter

dire cradle
#

Do the same thing on this with the delay

#

Possessing takes more than a frame apparently

queen escarp
#

aye that was the delay issue

#

this is so weird

#

on the "player hud"

dire cradle
#

Ideal way would be to use a notify to fire when it has done possessing but this will do for now

meager spade
#

you shouldnt be constructing UI from an RPC though

#

you have many places where you can construct the UI locally

#

without needing an RPC

dire cradle
#

wait isn't it done locally here?

queen escarp
#

its done locally :/?

#

not rpcing it

meager spade
queen escarp
meager spade
#

this is an RPC

dire cradle
dire cradle
# meager spade

Would it be better to call it as a seperate event from the RPC?

queen escarp
#

ok removed that

#

but i have a refff to the player & Controller

meager spade
#

the HUD should just be constructed, regardless, server doesnt need to tell the client to create the HUD

queen escarp
#

thats why its so weird

meager spade
#

make a AHUD class, set it, and create your widgets inside it.

#

this way its all local

queen escarp
#

aye im using custom widgets only

meager spade
#

doesnt matter

#

you can use AHUD as a wrapper

#

to create your widgets.

queen escarp
#

yeah i mean but your taling about the one in the game mode right ?

dire cradle
meager spade
#

its a local only actor

#

that controls HUD elements

#

you can use its beginplay to create your widgets, knowing they are all local

#

(as widgets are not replicated)

queen escarp
#

ok how would i do that

meager spade
#

and you know the playercontroller is valid.

#

as player controller creates the HUD

queen escarp
#

just create the parent one in begin play on controller right ?

dire cradle
#

oh it's the C++ parent of the HUD I see

meager spade
#

make a new actor derived from HUD

#

new Blueprint*

#

set it in the gamemode

#

open it up, and on its beginplay, create your HUD widget, passing in Get Owning Player

queen escarp
#

how?

#

oh wait

#

iognore

meager spade
#

its not a widget

#

its a blueprint class

queen escarp
#

yeah saw that

meager spade
#

ofc there is also additional setup if you require the player character to be set locally

dire cradle
#

What advantage does using HUD gives? is it like a best-practice thing or?
Asking because I never had to use it, if I'm missing something I want to know

meager spade
#

its to make sure all your widgets are local only

#

where they should be

#

its a simple way to do, i have a more advanced way which involves delegates, callbacks, etc so i can avoid the need to poll for certain things (widgets are created when things are ready)

queen escarp
#

hm okey

meager spade
#

but this requires C++

queen escarp
#

ok but for the sake of solving my issue

meager spade
#

make a hud class, set it in the gamemode

#

do what i showed above

dire cradle
meager spade
#

i have no clue whats wrong apart from i saw a bunch of errors

#

likely cause player is not ready when widget created, etc

dire cradle
#

so it works? but you have errors? Then you need to check if variables are valid before using them

meager spade
#

they need to do some polling to make sure stuff is valid

queen escarp
#

no aint working at all :/ not on standard either

dire cradle
#

What's the issue

queen escarp
#

i dont know >.>

dire cradle
#

What is not working as expected?

meager spade
#

you need to show your blueprints

#

all of what you are doing

#

we cant just guess

queen escarp
#

yeah im looking trying to find where the issue is

#

ok

#

the player character is set from this

#

wicth is created from this

#

can u se what causing it :/?

#

@dire cradle@meager spade

lucid badger
#

The ServerTravel method wants a URL as an FString. The Open Level method takes a World object pointer. How do I convert World Object Pointer to URL?

#

I don't want to manually type in strings that is awful

#

I just want to drop a reference to the level and code it to convert to the URL

#

But I can't figure out a way to do so hmm

#

perhaps this hmm testing

dire cradle
#

those run on tick

#

possibly there are bind functions that try to access your variables before they're properly set

queen escarp
#

hmm i have to sleep on this im just digging a bigger hole

#

ty for help ill probabaly pm u 2morrow .;)

lucid badger
tardy quarry
#

There was a good discussion around server migration back in 2022: #multiplayer message

It seemingly ended with the OP going on to do some research and it doesn't look like they ever got back with their findings. We're attempting something very similar: namely we want to pack servers at opportune times both as a means to save server cost but also improve the player experience (more players on a server = more immersion) and we want to do this in a way where the player doesn't know it's happening (meaning we don't take control away from them...ever).

We're to a point where we've got a Sea of Thieves like experience (no loading screen) with a small pop as replicated actors are respawned. We did this by NOT creating a new UWorld at the time of performing a hard travel and while there are obviously a lot of things to consider with this approach, the key was an overridden implementation of UEngine::LoadMap.

Assuming the implementation details of how/when the back-end decides to do a server migration can be abstracted away, I'm curious as to whether anyone has been able to bend Unreal to do a Destiny/Division style of server migration when traveling to/from the same map yet? Any thoughts would be much appreciated.

tardy quarry
#

~~Something that just came to me, Lego Fortnite just dropped not too long ago and I'd be shocked if it's not using some kind of seamless server migration under the covers especially since I'm assuming their servers are long-lived.~~Just fired up Lego Fortnite for the first time, looks like the worlds are client hosted (listen server). The large map size isn't an issue since UE5 uses streaming via world partition. In other words, Lego Fortnite doesn't necessitate truly seamless server migration and therefore Epic / Unreal Engine still doesn't either ๐Ÿ˜ฆ

sinful tree
valid bough
#

Hey all, so I'm wondering if someone can help me with this issue im having. So basically the player has a default spawn weapon to spawn with and so it works when a client is looking at another client, the client can clearly see the other player's 3rd person mesh is holding a weapon. However when the Listen Server joins , which is pretty immediate, I believe what is happening is that the current weapon isn't updated so it causes an out of sync moment and the client views the Listen Server as not holding a weapon. When in fact it should. Here is relavent code for when we join the server.

void AFPSMMOGameModeBase::RestartPlayer(AController* NewPlayer)
{

    if (NewPlayer && HasAuthority())
    {
        APlayerInfoState* PlayerInfoState = NewPlayer->GetPlayerState<APlayerInfoState>();
        if (PlayerInfoState) {
            FVector SpawnLocation = DetermineRespawnLocation(PlayerInfoState->TeamId);
            FActorSpawnParameters SpawnParameters;
            SpawnParameters.Owner = NewPlayer;
            SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;

            AFPSCharacter* NewCharacter = GetWorld()->SpawnActor<AFPSCharacter>(BP_PlayerClass, SpawnLocation, FRotator(0.0f), SpawnParameters);
            if (NewCharacter)
            {
                NewPlayer->Possess(NewCharacter);
                NewCharacter->OnPlayerReady.AddDynamic(this, &AFPSMMOGameModeBase::OnPlayerReadyForInitialization);
                NewCharacter->PrepareForInitialization();
               //i also tried a lambda function , 1 second didnt work and what if i have multiple players, i need to delay this until all players connect???
                FTimerHandle TimerHandle;
                GetWorld()->GetTimerManager().SetTimer(TimerHandle, [NewCharacter]() {
                    NewCharacter->PrepareForInitialization();
                    }, 1.0f, false);
            }
        }

        return;
    }


    Super::RestartPlayer(NewPlayer);


}```

this is driving my mind bonkers because its very inconsistent. sometimes the listen server has a weapon, sometimes it doesnt. If more information is needed please lmk.

EDIT: It also works flawlessly when I debug the process and set break points, so i believe it is a replication timing issue.
#

Here is some more relavent code showing what does what, so NewCharacter->PrepareForInitialization(); calls OnPlayerReady.Broadcast(this)
which calls this.

{
    if (NewCharacter && !NewCharacter->GetCurrentWeapon() && NewCharacter->SpawningWeapon) {
        AWeapon* Weapon = GetWorld()->SpawnActor<AWeapon>(NewCharacter->SpawningWeapon);
        Weapon->SetActorLocation(NewCharacter->GetActorLocation());
        Weapon->SetOwner(NewCharacter);
        NewCharacter->EquipWeapon(Weapon);
        Weapon->SetPickUp(true);
    }
}```

```void AFPSCharacter::EquipWeapon(AWeapon* WeaponToEquip)
{
    if (WeaponToEquip != nullptr && HasAuthority()) {

        if (WeaponToEquip->GetSpawnPoint())
        {
            WeaponToEquip->GetSpawnPoint()->OnWeaponPickedUp();
        }

        // If we have less than 2 weapons, just add the new weapon to the array
        if (EquippedWeapons.Num() < 2)
        {
            EquippedWeapons.Add(WeaponToEquip);
        }
        else
        {
            // We already have two weapons. Drop the current one and replace it with the new one.
            int32 CurrentWeaponIndex = EquippedWeapons.IndexOfByKey(CurrentWeapon);

            //if we already have 2 weapons we drop the current weapon.
            if (HasAuthority()) {
                DropWeapon(CurrentWeapon);
            }
            else
            {
                ServerDropWeapon(CurrentWeapon);
            }

            // Replace the current weapon in the array with the new weapon
            EquippedWeapons[CurrentWeaponIndex] = WeaponToEquip;
        }

        //previous weapon is now the current weapon and the current weapon is the new weapon we are trying to equip.
        PreviousWeapon = CurrentWeapon;


        UseWeapon(WeaponToEquip);
        OnWeaponEquipped(WeaponToEquip);
    }
}```
quartz iris
#

@sinful tree ๐Ÿ˜

hollow swallow
#

for my rts game, where should i keep all my functions to spawn / destroy buildings?

sharp vigil
#

you could make a building manager to manage destruction creation etc

hollow swallow
#

i have a building component on the player controller would that work?

#

or should i use game mode for it?

#

atm the player controller chooses the building they want to place, it spawns one locally as a "ghost" to set position, then when they place it im calling a server function on the player controller to spawn it and destroy the local actor. That starts a timer for "constructing" and once thats done i want to destroy the constructing bp and spawn the actual building bp, just not sure where to put that last little bit from swapping from constructing to the actual building

#

the construction bp wont be able to call a server function itself can it?

grand kestrel
#

@hollow swallow player controller doesn't exist on sim proxy so the other players won't see it. Game state exists on all but of course it's not tied to a specific player. Player state exists on all and tied to a specific player and will persist after disconnection for 5 minutes so probably the right place

hollow swallow
#

That should make saving and loading easier yeah if its on gamestate? (ive never made a save system before))

grand kestrel
#

Well game state won't disappear when a player disconnects so it could be correct dependent on your needs. You can always pass a player state to tie it to a player

sweet sage
#

Hey guys, Do ClientTravel requires a map reload on clientside?

#

Can i just reload replicated objects?

#

I want it to be seamless, i have already the code to transfer user data from one server to another on dedicated server

#

But on client side do i need a full map reload if i don`t plan to change player position?

#

Do i need to edit engine source for that?

late flax
#

Any know anything about the PlayerState being invalid on seamless travel?

thin stratus
#

@sweet sage would need to edit the source. Doubt there is much info on what and how.

Connecting to a server is a hard travel by default

sweet sage
sweet sage
#

"Yes, Throne and Liberty does have a phasing system in place. This system manages the number of players actively experiencing the same area in the open world to ensure smooth performance and prevent overcrowding. Here's how it works:

Multiple phases: The same area exists in multiple "phases," essentially copies of the world with overlapping boundaries. Players are automatically assigned to a phase based on various factors like location, party composition, and server load.

Seamless phasing: When you move between phases, the transition is designed to be seamless and undetectable. You might briefly see other players teleport or disappear as you cross phase boundaries, but the overall experience should be smooth and uninterrupted.
"

#

This is what i plan to do

thin stratus
#

But I see you found your answers

modern cipher
#

The macro's function is described in a comment.

twin juniper
#

I have a question. Does PlayerState spawn in the server first, for example in this 2 players - Listen Server game, would it spawn 2 Player State in the server, then replicate down? Or it would spawn 2 Player State, 1 for the real player in client side, and 1 for the real player in server side? Then spawn the other 2? What's the order?

#

Or maybe the game spawn all 4 at once?

twin juniper
#

I have another question, what is the equivalent function of IsLocalController() on the PlayerState? Because in BeginPlay of PlayerState on the client side, PlayerController is not available yet, i can't call IsLocalController. Was i suppose not to call it?

wanton bear
#

I'm not sure but the IsServer node might work in playerstate and be what you're looking for

#

Nevermind I was thinking of player controller, there is a copy for each on every client

jolly siren
#

Is there overhead for using push model with a replicated property that is changed every tick? Or just no reason to since it's always changing?

rapid vigil
#

I have two clients: Control Panel and Screen
The control panel is a widget/menu where I can trigger what happens on Screen.

However, widgets do not replicate and are client-specific I believe? So when I press a button (widget) on the Control Panel-client, how can I ensure it only executes on Screen-client?

#

do I need to tie this up to player controller? I'm curently differentiating the camera on each client by using the Character. However it's just 2x spawn of the same character (not sure how to make player/client 1 spawn CharacterA and player/client2 spawn CharacterB)

#

i know nothing on networking so looking through a few videos to get a grasp of how this ties together. would appreciate if there's any recommendations for specific guides/documentation/videos. There's no actual playing here, only a Control Panel (Client #1) that executes events on Client #2

#

Ok got it working by: Widget gets player controller(1), cast to PlayerController -> call event
player controller executes Play Sequence. Now it successfully only happens on the Screen

queen escarp
#

@dire cradlehey m 8 u there ?

weary mason
#

#level-design message so atm i have to send an rpc from server to client every instance of the instanced static mesh component so there clearly must be a better solution, add to data about the instance to some array, replicate all data with all instanced static meshes to the client with one big rpc ?

cobalt pollen
#

In my new to Unreal c++ adventure, today I learned that you need to DOREPLIFETIME onrep properties ๐Ÿ˜… no idea why I had in my head only regular replicated properties needed that...

azure hull
#

Hi. Does anyone know a good MP performance solution for SetActorRotation in top down game scenario? SetActorRotation is happening in a timer by following cursor. Due to additonal WASD movement not using controller set rotation, even though it's nicely replicated.

pallid mesa
pallid mesa
lucid badger
#

Actors persisted during Server Travel (with SeamlessTravelActorList), are they serialized/deserialized or anything like this? Thinkge

#

Nor do the proper docs

hollow eagle
#

they're not serialized, they just get moved to the new world

#

which involves notifying them that they're being moved, then "renaming" them (which changes their outer to the new world).

#

You can see exactly what happens in FSeamlessTravelHandler::Tick

#

The bulk of it is in the ProcessActor lambda and iteration over the ActuallyKeptActors array further down.

lucid badger
#

Thinkge interesting

#

Do UObjects with a Kept Actor as their Outer also get persisted?

#

Something ain't making it over

lucid badger
#

Hmm yeah that seems to be the issue

#

UObjects attached to my Actor all poof

#

As expected Google is utterly useless at answering this heh

#

How do I persist the UObjects for which my Kept Actor is Outer?

#
  • called on server during seamless level transitions to get the list of Actors that should be moved into the new level
    • PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list
    • (i.e. Object.Outer == Actor in the list)
    • are all automatically moved regardless of whether they're included here
#

Comment on GetSeamlessTravelActorList suggests that UObjects should persist with their Outer

#

hmm but mine are not

#

wtff persisted actors call begin play again

fathom aspen
#

They shouldn't, it means they are not persisting

lucid badger
#

Maybe gamemode is calling StartPlay again

#

And replacing my persisted actor with a new one

fathom aspen
#

UObjects outered to a persistent actor should simply persist

#

I can even go a step further and tell you that it's not just a persistent actor, but really any persistent object

#

Say for example Widgets by default get outered to GameInstance, they persist seamless travels

lucid badger
#

Yep

#

That's what it is

#

GameMode calls StartPlay again when you arrive at the new map

#

In StartPlay I initialize the actor that would be persisted

#

So it's replacing the persisted one

#

Hmm

#

Checking for the presence of the actor before initializing it fixed that problem, but now other problems are popping up with actors wanting to initialize

#

If everything just fires again when we get to the new map then it seems like it's more trouble than it's worth to persist anything Thinkge

#

I'll have to introduce all this logic for checking if we're persisted

#

Seems easier to just dispose and make new stuff

#

Like, OnPossess is getting called again...

#

It seems like it wants to take hte old PlayerState/Controller and attach them to a new Pawn, but... that's not trivial lol

#

If the Pawn/State/Controller are all persisting why would it need to call OnPossess again Thinkge

#

hmm Is this the only way to travel to a new map and bring clients with you? This feels messy and I don't really need any of this.

#

The state that I need to persist is the same stuff that I already save/load to disk and RPC to the server from the client (i.e. client's character state)

#

This persisting actor thing is a can of worms I don't want to open heh

fossil spoke
lucid badger
#

Can I remove things from persistent actor? I don't want playerstates to persist Thinkge

#

Easier to build anew than double code for two possibilities

fossil spoke
#

You can override the function that causes them to be retained and just rewrite it so they arent

#

But the thing is

lucid badger
#

Ooh okay that might work better

fossil spoke
#

They are only persisted to enable you to copy their properties

#

A new PlayerState is always created

lucid badger
#

Bleh. And two exist at once at some point

#

?

fossil spoke
#

Yes but they are easily identified

#

Since they are marked as being old

#

I forget where thats managed. Its likely a flag on the PlayerState itself

#

Which is set during a seamless travel transition

lucid badger
#

So like if I simply do not implement copy props then I have effectively stopped persistence of that actor right

fossil spoke
#

No. It still persists. It just wont copy anything over and be subsequently removed

lucid badger
#

That's what I meant by 'effectively'. It still technically persists but only just long enough to go into the trash

fossil spoke
#

Sure

#

If you care, PlayerStates can also persist for a ttime after a Client disconnects

lucid badger
#

Thinkge okay thanks I'll play around with it and see

fossil spoke
#

They persist in this instance so that you can recover on reconnect

lucid badger
#

Sure that makes sense

fossil spoke
#

If it was due to a network error or something

#

They are thrown into a different list on the GameMode

#

So they are also separate

#

I cant remember how their lifetime is managed after that case

#

They maybe cleared on a level transition

lucid badger
#

Btw when I seamless travel in PIE I get a console error saying I can't server travel in PIE but then it executed the travel anyways...

#

Not error, warning

#

Is that just a mistake warning or is something actually failing

fossil spoke
#

Im not on UE5 but it does support it. UE4 does not

#

So im not sure what nuance exists with it in 5

lucid badger
#

Yeah I'm in 5.3. I read that it's a new feature so I figured they forgot to remove the warning ๐Ÿค”

fossil spoke
#

๐Ÿคท

#

It maybe experimental still

hollow eagle
#

iirc it is and it requires a specific option to be enabled

#

net.AllowPIESeamlessTravel

#

if that isn't enabled you'll get a warning and it'll be a non-seamless travel

#

so... sounds like you're not seamless traveling

fossil spoke
#

There you go.

#

Id be a bit dubious about trusting it anyway

lucid badger
hollow eagle
#

I haven't tested it myself but iirc it's somewhat broken. Easier to test with standalone.

lucid badger
#

Well that would explain some of the misbehaviors heh

#

Okay um I guess I need to start over now that I know I was... not seamless at all Hmmge

hollow eagle
#

You can still use an editor build, just launch client/server as separate processes instead of using PIE.

lucid badger
#

Yeah I already use separate process but I was running the listen in PIE so I'll just do both standalone

#

When I try to use same process it instantly crashes so god knows what same process means

#

I'm guessing it's some nightmarish local mp thing where static variables are shared or something Hmmge

hollow eagle
#

uhh, that's the normal flow

#

and yes, it means everything is in one process

#

gameplay code largely should not be using static variables

#

not when associated with a world, anyway

#

it's not a "nightmarish local mp thing", it's standard practice for unreal. Static data is bad for multiple reasons, one of which is that it will break single-process PIE.

lucid badger
#

Shrugeg It's just a reference to an actor for convenient access. I guess I could stick the reference in GameState hmm

hollow eagle
#

that is indeed a very bad thing to do. Game state would be fine.

lucid badger
#

It's not that bad MAAAN

hollow eagle
#

it is

#

the GC can't see that you have a static reference so you have a dangling pointer when the actor is destroyed, and that pointer persists across multiple sessions of PIE.

#

not to mention the editor itself.

lucid badger
#

The actor is never destroyed

#

It's a manager

hollow eagle
#

sure it is

#

when you exit PIE

#

or if you load a new level without seamless travel

lucid badger
#

Oh. That explains the error that popped up when I started checking if the static variable was set prior to initializing it. It was sticking as set from previous PIE session after that, sounds like Hmmge

hollow eagle
#

yes, do not use static or global variables to store data from game worlds unless you really know what you're doing.

#

Subsystems, gamestate, gamemode, etc all exist for this.

lucid badger
#

Huh so PIE is like... huh that's weird. I wouldn't expect anything to persist outside the session

fossil spoke
#

What does this Actor do? Why do you need a persistent Actor at all?

hollow eagle
#

how is it going to reset it?

lucid badger
#

The actor is outer for all UItemData and UInventory objects. Any time an item or inventory is created it goes through the manager which ... manages them. I.e. when to dispose of them and so on

fossil spoke
#

Ehh

lucid badger
#

The ItemManager doesn't really need to persist though

#

All the items and invs can just be serialized, like I do for save/load

fossil spoke
#

I would expect an Inventory itself to manage the items it contains

lucid badger
#

Then what happens when you move an item to another inventory

fossil spoke
#

What do you mean?

#

They would just broker that between themselves

lucid badger
#

My research led me to believe that changing the outer of an object was a messy and dangerous thing

hollow eagle
lucid badger
#

Instead of having individual items outer to inventories, having a master outer made more sense. ALso helps with syncing stuff to other players

#

It did not seem like outer was meant to be used in that way

fossil spoke
#

The item would just be outered to the world or something and you just manage ownership via some internal variable to the item itself

lucid badger
#

Yea I do that

#

It's just the outer is the manager not the world

#

The manager also provides functions for creating new items/inventories

#

Just centralizes the logic

#

It doesn't really need to persist at all though. I don't need ANYTHING to persist

#

I just need the clients to tag along ๐Ÿ˜›

#

Client is auth on the stuff they bring into the session already, so I can just save/load their state locally

fossil spoke
#

Sounds like an unnecessary approach to me.

lucid badger
#

As opposed to what Shrugeg

#

e.g. if player wants to equip an item, it uses an RPC on the PlayerController to ask the server. Server validates and multicasts from the item manager that the item was equipped and to whom and what slot

#

That multicast can't be on the PC (is my understanding) because the PC doesn't exist for all clients

noble sentinel
#

So Im trying to replicate walls moving randomly, which is an event choosen by level blueprint and sent to wall blueprint, bul walls arent replicated. Whats the problem?

#

Level blueprint:

#

Inside of event chooser repnotify

#

Wall blueprint:

#

wall repnotify

lucid badger
#

I guess everything the item manager does could just be on the game state Hmmge

#

That's more obvious now that it's just a reference sitting there on the game state heh

lucid badger
#

Is GameState privileged in any way in terms of replication order? hmm I understand actors will replicate in unpredictable order, but is GameState an exception to that rule?

#

I'm guessing no since I've literally had stuff replicate before the client even has their playercontroller heh

fossil spoke
#

Actors can define their "priority" over other Actors when replicating, but this only takes effect during network congestion.

#

Otherwise its non deterministic.

lucid badger
#

Same process PIE working now except one curiousity Thinkge In order to raycast from center of screen for interaction, I use

ScreenCenterPosition = GEngine->GameViewport->Viewport->GetSizeXY() / 2; 

With any clients, if Server is PIE main viewport, it gets the center wrong Thinkge

fathom aspen
lucid badger
#

But if server is in separate editor window (but still PIE) then it works fine

lucid badger
#

By syncs I mean just its existence at all, rather than any values updating

#

I've moved all the standalone actor's stuff into game state

fathom aspen
#

Yeah that's a super nice guarantee of the engine

lucid badger
#

Extremely

fathom aspen
#

But of course by replicated is existence and any POD types that were set on the GameState at any frame no longer than the spawn frame

#

So usually it's the existence is what we care about in this rule

lucid badger
#

POD?

fathom aspen
#

Plain old data

#

Basically the trivial data types

lucid badger
#

So stuff that was set in constructor

fathom aspen
#

No, data types like ints, floats, doubles

lucid badger
#

hmm So if there's a TArray on the game state will that not be initialized yet for the client? Is that what you mean? Since it's not a POD?

fathom aspen
#

Well a TArray is a series of things? A TArray of what?

lucid badger
#

Well, UObjects in this case, but I'm just concerned with the array existing i.e. ready for stuff to be added

#

Not its contents

fathom aspen
#

TArray usually replicates its size first and then the actual data

#

Ah then ofc not

#

UObjects are not PODs

#

They get their own NetworkGUID

#

They are uniquely identifiable on their own

lucid badger
#

Sorry let me clarify. If I have a TArray on my GameState and one of my other actors (say a pawn) wants to add stuff to that TArray when it (the pawn) does BeginPlay, I can rely on that TArray existing at all and being ready for additions by that point? Or no? Thinkge

fathom aspen
#

Being ready in the sense of having all elements replicated from the server?

lucid badger
#

No just being ready for addition

fathom aspen
#

Where do you add to the array? server side?

#

Client side?

lucid badger
#

Well, okay, you're right it's actually added to server side Hmmge but this is just a contrived example to understand what you meant heh

fathom aspen
#

Yeah yeah... there's no problem with that

#

If the GameState exists, then every property inside exists

lucid badger
#

But I suppose yeah... since it's actually just telling the server to do it, it's immaterial PepeSpin

lucid badger
fathom aspen
#

Initial statement was about GameState existing client-side, and what data you should expect to be there

#

But yeah GameState will usually spawn before a lot of other actors (player-related ones)

lucid badger
# lucid badger Same process PIE working now except one curiousity <a:Thinkge:978090588920508456...

void UPlayerInteractComponent::OnViewportResized(FViewport* Viewport, uint32 Value)
{
    ScreenCenterPosition = Viewport->GetSizeXY() / 2;
}

...

void UPlayerInteractComponent::BeginPlay()
{
    Super::BeginPlay();

    if (GetOwner<APawn>()->IsLocallyControlled())
    {
        FViewport::ViewportResizedEvent.AddUObject(this, &UPlayerInteractComponent::OnViewportResized);

        if (!IsRunningDedicatedServer())
        {
            OnViewportResized(GEngine->GameViewport->Viewport, 0);
        }
    }
}
#

When running MP on same process, server gets wrong result for Center Position Thinkge

#

Clients work fine

#

OR if I run "PIE New Window" then server is correct

#

But when doing Viewport PIE, server is wrong Thinkge

lucid badger
#

That means PlayerState's existence was synced to player before game state, or at least before game state was made available to that function? hmm

fathom aspen
#

OnRep is not beginplay

lucid badger
#

Ah

fathom aspen
#

Read carefully what i wrote

lucid badger
#

No I get you now, I inferred too much Okay

eternal cedar
#

is there a way to check if FSocket is still connected? GetConnectionState always returns connected

thin stratus
#

@lucid badger didn't read everything but one nasty thing is that OnRep can call before BeginPlay

#

And some seemingly random stuff might fail if the Actor hasn't BegunPlay yet

#

In The Ascent I had to call the OnRep function by hand on BeginPlay and block the OnRep if HasActorBegunPlay wasn't true yet

#

Seemingly random stuff being really all kinds of things. I can't recall sadly but there was no clear reason for, I don't know, material colors to not be set or visibility not being changeable

twin juniper
fossil spoke
#

Since controllers only exist on server and the client that owns it

nova wasp
#

the playerstate has a local role still though

#

and you could just get the netmode etc of the driver

nocturne quail
#

if you run UpdateUI.Broadcast(); on RPC and bind the delegate in User Widget, will it updates User Widget for the owning client?

oak lake
#

Hello. How can I make sure that the component is removed from the clients, but not from the local player?

thin stratus
#

@twin juniper GetOwner would be invalid for all sim clients.
But the owning client could still not have an Owner if the PlayerController hasn't replicated yet.
At least in theory.

#

The sanest things is to use OnRep_Owner or OnRep_Controller if it exists instead of BeginPlay

#

But that's C++ of course

thin stratus
thin stratus
loud pike
#

Hello, how would one replicate On Component Overlap Event ?

thin stratus
loud pike
#

Well let's say I need it to be launched on the server ? and on the client at the same time

thin stratus
#

Usually you have an Actor with some sort of Collision Component.

loud pike
#

I'm having an issue where my WeaponBP Overlaps on the client but not on the server

#

which sometimes results in a miss on server and hit on client

#

but not always

thin stratus
#

A Replicated Actor that is spawned on the Server, that has a Collision Component of sorts, will call Overlap on every instance, given that all instances have the same collision setup.

#

WeaponBP is what?

#

A sword?

loud pike
#

Yes

thin stratus
#

Are you trying to enable Overlaps in some Attack Anim?

loud pike
#

Well i'm doing it in a more scuffed way for now, where I On begin overlap the sword and check if owner has specific tag

#

then do trace

thin stratus
#

But this is during an Anim?

loud pike
#

The anim give the tag

#

and yes

thin stratus
#

What kind of Server are you using

#

Listen or Dedicated

loud pike
#

Listen

thin stratus
#

When the Trace fails on the Server, does the Server look at the client?

#

Because you probably need to change the Update Bones and Tick Pose setting on the Character Mesh if that's the case

#

That is set to only do the full update when rendered

#

If your Listen Server doesn't look at the Client, it might not update the bones etc.

#

It's a DropDown in the Character SkeletalMeshComponent

loud pike
#

I'll have a look that can be it, I use a Collisionbox also

oak lake
thin stratus
#

Given you are already on the owning client to even call the ServerRPC

oak lake
#

How can I remove components from other clients?

thin stratus
#

You would first need to ServerRPC in an Actor that initiating client owns

#

E.g. their own Character

#

And then pass the Server the Character you want to target

#

On which the Server can then call the ClientRPC

oak lake
#

How to transfer the player to the server?

thin stratus
#

Idk how you are currently determing the Character that you want to remove the Component from

oak lake
#

I donโ€™t even define it, itโ€™s just that thereโ€™s no way to do it

thin stratus
#

I don't really know what your overall set up and goal is

#

With the little info you provided, that's all I can give you atm

oak lake
#

Can you tell me what else I need to give?

thin stratus
#

You need to explain what you are trying to achieve and why. Not just that you want to remove a component.
Tell us what happens before and after that. What triggers all of this? Why even does this need to happen?

#

You are determined to remove a Comp from a Player. Which Player? How do you determine that Player?

#

And why even

oak lake
#

I'm trying to remove the skeleton mesh component from a non-local player because only the local player should have it. Everything in event beginplay is deleted. I didnโ€™t determine which player to delete from, I thought it would be possible simply by checking for a local player or through replicated events

thin stratus
#

That calls if the Controller becomes valid (also invalid, but that's beside the point).

#

In theory, you could limit that to HasAuthority, call a Multicast and filter the Multicast via IsLocallyControlled to not remove the local one

#

However

#

If I get you correct, you want to have a Mesh that is only visible to the Local Player

#

So if we both join the game, we only see our own Mesh, not the other of the other Player, right?

#

If that's the case ,you could simply tick the "OwnerOnlySee" boolean on the Mesh Component.

oak lake
#

Thanks, I didn't know this existed. It's my fault that I didn't say it completely, sorry

#

Iโ€™m not used to asking for help, I usually look for everything on the Internet or at random, so I said how I figured out how to solve the problem. Thank you

thin stratus
#

No worries

loud pike
#

Man still have the tracing issue, as the image shows one trace is client and the other the server one, they should be the same but they are a bit off, is it like a latency issue or something ? what should I be looking for

dusk pecan
#

Hey there, is anybody familiar with the "Advanced (Steam) Sessions" plugin and knows why steam doesn't pop up when I start a standalone? I followed all the steps

plucky prawn
dusk pecan
plucky prawn
#

Did you set up the dev steam appid?

dusk pecan
#

Yea it should be setup correctly

#

Copied this into my DefaultEngine.ini

dusk pecan
plucky prawn
#

Dunno what to tell you. Works on my machine

cinder goblet
#

Hello everyone, Iโ€™m looking for general advice on how to handle illegal events which occur due to latency. Here is one of my specific issues:

I have a game involving tiles. Player 1 is allowed to capture a tile by activating one of their pieces which then goes in cooldown. The only relevant rules they have to follow for this example is they must capture a tile which does not contain an enemy piece. The enemy is allowed to place a piece in an empty tile they own.

The conflict:
Player 1 asks the server to capture the tile and is allowed to.
Player 2 doesnโ€™t see this yet and asks the server to place a piece on the tile, which is allowed.
The server then gives the tile to player one and kills the piece, or sometimes will put player 2โ€™s piece on the tile and reject player 1โ€™s capture but still put the piece on cooldown.

TLDR: how in general do I handle mismatches between players because of latency?

dusk pecan
plucky prawn
#

Try packaging it

cursive steeple
queen escarp
#

Question if i set a value in my GameInstance on lets say "main menu(map)" witch uses a Mainmenu_Controller

#

then i load another map

#

and switches the controller to another one

#

if i still cast to same Gameinstance then it should contain the same stuff right

#

since its presisten ?

plucky prawn
#

Check out the persistence compendium from wizard cell in the pins

queen escarp
#

@plucky prawn ok

#

@plucky prawn GameInstance and GameState exist on server and client, though the former isnโ€™t replicated and the latter is.

#

i guess i could sum it upp with this

queen escarp
#

any tips on where i can find the error :/

queen escarp
#

on player controller

#

why ?

oblique arrow
#

Should my possed by call two times when i have only one player ?

queen escarp
#

the game mode can access all clients right ?

#

but only the host can access the game mode since its only server side

fossil spoke
#

@queen escarp Correct

queen escarp
#

@fossil spoke then why would this give null on the clients :/

#

it gives me 2 different controllers

#

and they both have different values in the game instance,

fossil spoke
#

Why are you storing the GameInstance? Itโ€™s accessible globally

#

Via GetGameInstance

queen escarp
#

aye true, its just occupational hazzard

#

the problem is on the clientยดs it gets access none,

#

and i dont get it why....

fossil spoke
#

The GameInstance should never be null

#

Keep in mind that Clients only know about their own PlayerController.

#

You are also accessing the PlayerState incorrectly.

#

Never use GetPlayerState by Index

queen escarp
#

ยดsince it on owning client isent 0 the local one ?

fossil spoke
#

The PlayerController knows about its own PlayerState

fossil spoke
#

You must always try to access them in a deliberate way.

queen escarp
#

hm

#

ok how would i access the player state then :/

#

in this case

fossil spoke
#

As i said before. If you are in the PlayerController BP, it has access to its own PlayerState

queen escarp
#

?

fossil spoke
#

Yes

queen escarp
#

ah ok,

#

and if this is in controller, and begin play sets up game instances then how could it be null

#

since im from the "Gamemode" accessing the login players controllerยดs game instance..

#

or game instance dont inherits from player controller,

hoary timber
#

hey, im learning the basics of replication, and have a bit of simple code -


.h /
    UFUNCTION()
    void OnRep_ReplicatedHealth();

    void HealthUpdates();

    void ReduceHealth(float damage);

.cpp / 
void ATPSMPCharacter::OnRep_ReplicatedHealth()
{
    HealthUpdates();
}

void ATPSMPCharacter::HealthUpdates()
{
    FString HealthMessage;
    if (IsLocallyControlled())
    {
        HealthMessage = FString::Printf(TEXT("You now have %f health remaining."), Health);
    }
    else if (GetLocalRole() == ROLE_Authority)
    {
        HealthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetFName().ToString(), Health);
    }
    if (!HealthMessage.IsEmpty())
    {
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, HealthMessage);
    }
}

void ATPSMPCharacter::ReduceHealth(float damage)
{
    if (HasAuthority())
    {
        Health -= damage;
    }
}```

In this case, my understanding is that OnRep function is called only on the client, and it does indeed work only when the ReduceHealth() is called on client, but not on the server, but, the debug message is shown on both Server and Client, and that makes it hard to understand what's going on and if things are working right, so is this how it is, or should it only appear in the Clients window? I hope this makes sense
fossil spoke
#

@queen escarp You need to remove that Delay node

#

@hoary timber In C++ you need to call the OnRep manually yourself for the Server.

Seeing as you arent doing that, you should get a single call on the Client.

hoary timber
#

ah I think I see what my issue is actually

#

i just looked at the code again and I think since I add the debug message outside of if statements it does just get shown on both

fossil spoke
#

Since you guard it with IsEmpty

queen escarp
#

what would that do :/ ? isent a delay good if multiple joins

hoary timber
# fossil spoke Since you guard it with IsEmpty

ok I just looked up some forums thread and apparently in editor the onscreen debug messages show up on every instance, regardless if its a client or server, or another client, so i guess solved..

fossil spoke
#

Dont ise Delays if you can help it. They cause more problems than they solve.

queen escarp
#

even if its a retriggerrble delay ?

#

hm mkey

fossil spoke
#

Either or doesnt matter the effect is the same

queen escarp
#

but since im setting the reffs inside the controller and casting to controller On post login"

#

i need some time to let it set up ?

fossil spoke
#

No you dont its all sequential.

#

Please dont use them.

queen escarp
#

ok

#

then any ideas why its not working :/

fossil spoke
#

Did you remove the delay?

queen escarp
#

yeah

fossil spoke
#

Ok well observe the results. What error specifically are you getting now

queen escarp
#

well now the ui dont spawn even for the host

#

its being created in the controller

fossil spoke
#

Yeah you shouldnt be making the UI in the PC.

#

Use the HUD class

#

To initialize UI

queen escarp
#

so i have to make a actor that spawns the hud and put that actor as the HUD class ?

fossil spoke
#

No

#

The HUD class is a special class created by the PC automatically

#

You override it on the GameMode

queen escarp
#

yeah i did but its not a widget its a actor or (Hud) class

fossil spoke
#

Yeah

queen escarp
fossil spoke
#

So you use the HUD class to spawn the widgets like normal

queen escarp
#

so its basicly a parent holding the widget right

fossil spoke
#

Yeah

queen escarp
#

ok and how do i access the hud ?

fossil spoke
#

You dont need to?

queen escarp
#

huh, if i want to get functions from the player hud widget inside the HUD ?

fossil spoke
#

If the HUD is creating the widget, it has access to it.

queen escarp
#

exactly

#

and how do i acess the hud

fossil spoke
#

The PlayerController has a function to GetHUD

#

If you need the Widget, then store it in a variable on the HUD

queen escarp
#

yeah but look at my screenshot its giving error :/ ?

fossil spoke
#

That tells me nothing lol

queen escarp
#

oh wait sry,

#

im dumb

#

the self need to be the controller obvi..

fossil spoke
#

When expressing you have an error, dont just say you have an error. Actually copy and paste exactly what the error says.

#

We cant guess what errors you are having

queen escarp
#

yeah gotcha

#

ok so this is the new error

fossil spoke
#

Why are you getting a different class to call Start on the UI?

#

The HUD should do that after it creates it

#

Id like to help further but i have to bounce. Apologies.

#

Ill check back if i can.

queen escarp
#

this is the problem*

#

ah ok np

#

cy

tame kraken
#

Hey, how do we know what is the worst network conditions we should test our games in?

cobalt pollen
# tame kraken Hey, how do we know what is the worst network conditions we should test our game...

Think of this question as "how many players do I want to include/exclude". You can't support every condition (for most games... unless it's async turn based expected to be played over multiple days ๐Ÿ˜…). I'd say most gamers understand for a fast paced game anything over 100ms ping and they're going to have a worse experience and at 150-200 start to be unplayable. Packet loss I have no idea.

hollow eagle
#

the "bad" network simulation preset is a good place to start.

#

and even a little bit of packet loss can cause havok. You're never going to have a good experience in a realtime game with a lot of packet loss, what you want to ensure is that the game doesn't break down entirely under those conditions.

tame kraken
#

Yea I thought they are good guiders for that.
But Unreal engine gives us the choice to make it exceedingly much worse, which made me think if there is any point from trying these harsher settings ๐Ÿ˜…

cobalt pollen
#

I would just make sure your state doesn't break

tame kraken
#

yea packet loss can neuter the RPC's ability to send information, unless it is reliable

#

thankfully I haven't failed to receive a reliable RPC yet but I've made the packet loss so bad it couldn't get to begin play, or it might need more time than I gave it

tame kraken
cobalt pollen
#

I'm just a hobbysit who is learning myself I don't recommend anything ๐Ÿ™‚ I meant testing your current logic though not adding checks at runtime. A reliable rpc should in theory handle packet loss but does your state logic use them correctly even if out of sequence etc

tame kraken
#

I just observed this failure where my rpc to possess the pawn didn't pass with the bad network condition, so it is what has prompted me to ask the question

#

so now that reliable rpc has solved it, I should rely on it?

#

I understand that you are just a hobbyist, so are most of us.
What we need is the experience of the developers at the real multiplayer games to see what are their approaches ๐Ÿ˜„

hollow eagle
#

reliable RPCs are for things that you absolutely must be received at some point.

#

the choice of whether to use it is the answer to the question: is it ok if this doesn't arrive?

#

It's not really more complicated than that. Reliable RPCs have an overhead, they aren't "free", so you should only use them on things that actually need it.

lucid badger
#

It's hard for me to picture an unreliable rpc. Can you give an example? The only thing I can think of being okay to be unreliable would be replication of variables since those will likely just try again shortly

#

But that's not an rpc of course

hollow eagle
#

most reliable data from server -> client is going to be via replication rather than RPCs in the first place
Any "instantaneous" events that are purely visual/don't impact gameplay should almost always be unreliable.
Basic client movement input is generally unreliable - it is sent super often and if you end up dropping packets then movement is going to be impacted regardless.

#

There's very little that actually needs to be reliable, most things are covered by replication or aren't actually that important.

daring bear
#

Is there any reason that a large FFastArraySerializer array (say 30 000 FFastArraySerializerItem item entries) would kick a connecting player?

hollow eagle
#

logs should tell you the disconnect reason, but if I had to guess it's simply way too much data to send at once.

fossil spoke
#

Have 3 TArrays with 10k elements instead of a single with all 30k for example.

daring bear
#

After doing some more testing, it apears to break at 3500 entries, approx, and the entries are AActor*'s

#

I can bucket it no problem, but 3500 seams odly small to me

fossil spoke
#

What on earth are you doing making 30k actors

#

That are replicated

daring bear
#

They arn't replicated, just the stably named refrence is

#

(and that all technically works fine, it just boots connecting players if there are >3500 entries in the list)

fossil spoke
#

What are these Actors?

#

What are they doing?

daring bear
#

Essentially static mesh actors

fossil spoke
#

For what

daring bear
#

In this example. they are "map chunks" which statically remain still and connecting players are fed a list of which ones to toggle on / off

#

Walls, pipes, ladders, fence,s etc.

#

The system works perfectly fine for connected players, and also works fine for late joiners, untill the Array gets to >3500 entries, at which point new connecting players successfully connect and then are removed

fossil spoke
#

Im guessing this is some sort of procedural world generation?

daring bear
#

These specificly are map placed actors, but yeah the analogy extends to procedural generation

fossil spoke
#

So the level and all its Actors are prebaked. However you are replicating a list of all Actors in the level that need to "toggle on / off"

daring bear
#

Yeah

fossil spoke
#

Why

daring bear
#

So that they can be toggled on / off during gameplay, and those map changes can be replicated to existing and late connectors

fossil spoke
#

What does the toggling do?

#

Whats its purpose

daring bear
#

Hides the mesh / disables the physics (to emulate the map chunk being destroyed)

fossil spoke
#

What Im trying to understand is why isnt this just managed by the Client entirely.

#

Based on proximity?

#

Why do you need the Server to tell the Client what to Toggle?

#

You arent explaining what the Toggling is FOR

#

Your telling me what toggling is doing.

#

Not what its for.

daring bear
#

I dont think proximity based toggling is appropriate here, TLDR eventually a player is going to pick up an item, or destroy a chair, or a door, etc for example

#

that "destroy" action is stored in a list, the list is replicated and replayed on connected clients

fossil spoke
#

Right

daring bear
#

The system works perfectly fine, and at scale - but for some reason late joiners are kicked once that array of changes hits approx 3500 entries and Im wondering why

fossil spoke
#

Ok well to me it sounds like you need something like the following instead.

#

You would need a per chunk manager

daring bear
#

This is what im doing

#

but once the list of entries hits 3500, the connecting client crashes, and that confuses me

fossil spoke
#

I would expect that way there is only going to be a few hundred at maximum Actors per chunk manager

daring bear
#

I suppose thats possible, i just assumed it would be able to handle an initial replication of a bit higher then 3kish considering at runtime it can hit 30k+ without any problems

#

Cheers though, I was supposed to chunk it anyway I was just being lazy, but if i have to, then thats what ill do!

fossil spoke
#

This is not a typical thing to do, which is why your running into issues.

daring bear
#

yeah of couyrse

#

course*

rain condor
#

Any idea how to make a simplified turn in plce?

fierce adder
#

Someone give me a link to the guild for dedicated servers without Lyra

#

Pls

barren patrol
#

Hello, noob question here. When I spawn a new replicated actor on my server there is a big delay before it becomes visible on the client. Even in PIE with zero latency. Any tips on why my replication is so delayed?

#

I am spawning an enemy NPC and it will "pop" into the screen after being alive for up to ~3 seconds.

queen escarp
#

why cant i get game instance its responding Null

chrome bay
#

Why would you get that from the controller anyway

queen escarp
#

i would want that specific players instance

woeful ferry
#

Just like how a client can't get the game mode

queen escarp
#

oh..

lost inlet
#

What are you trying to do?

#

Because the player controller seems like the appropriate thing anyway

queen escarp
#

hm can i get a player start point within player controller ?

chrome bay
#

You can't access any actor on that clients local game instance unless it was replicated by the Server or part of the map

flat night
#

hello, I have a question that I've been trying to figure out for a while and I don't know if I am doing something wrong, or if there's something I am missing. Server is top, Client is bottom.
On the video you can see how I press Start from the Server and it begins a ServerTravel when there are two players in the Lobby. Then, a UI appears still in the same Level. Then, the Server connects to the Level and I add another Loading Screen to the PlayerController on BeginPlay. The Client is still loading, and when it finally loads, it's just standing in the center of the world. Then after a while, it finally gets the info and spawns a PlayerController that plays the Loading screen, then after 3 seconds, the GameMode MatchState changes and it replicates to get rid of the LoadingScreens and the game countdown starts.
I do not understand how I am suppose to mask that time the Client has entered the level and is loading. There doesn't seem to be any way to add something on top to hide it, I tried also adding it in the Level BP, but that also played when the Loading was finished.

fair latch
#

It takes some time to call posses and call begin play in networked environment

#

Just hide the process with loading screen
I have a subsystem for my loading screen and i simply tell it to remove the loading screen from playercontroller::acknowledgepossesion
Level bp is the wrong place to even attempt it. The more delay there is, the longer it takes for begin play to get executed

torn gulch
#

If the playerstate is not to be used in the AI Pawn because the player state exists to be replicated... Then what should we use for an AI Pawn?

#

We need to identify who the pawn belongs to, and other characteristics, even if it is AI, right?

queen escarp
#

On "host" im getting Fail 1

on "Clients" im getting Fail 2

#

:/ ? ideas ?

flat night
chrome bay
#

Players need to set/manage their input contexts locally

fair latch
#

If your loading screen is fake then its not gonna work. You need presistence loading screen that survive between level. That way you can get a ref to the loading screen and fade it away once the player is ready

queen escarp
#

@chrome bay this would be a workaround ?

fair latch
#
  1. Presistence loading screen
  2. On acknowledgepossession (client rpc from the server) remove loading screen
thin stratus
queen escarp
#

@thin stratus oh, would that basicly be the same as the image or a more efficient way ?

thin stratus
#

Better cause you save the RPC

#

It's a callback for when the Controller changes, including locally

#

Needs IsLocallyControlled though cause it also calls on the Server

fallow kettle
#

Hi!! Actually I am trying to package the project for the server... initially when I built it, it was around 600mb which has reduced to around 100mb... should I be worried about that... coz all I changed was added a new map to the package list and changed the default gamemode, default server map and gameinstance๐Ÿ˜๐Ÿ˜ I tried uploading the build once but it failed

cedar nova
#

Please help me solving this problem

fallow kettle
cedar nova
#

No but stuck at cook project

flat night
barren surge
#

I'm trying to replicate a UObject* inside a of struct (which is inside an AActor). The struct's primitive fields replicate fine, but not the UObject*. If I lift the UObject* up a level to the AActor, replication then also works.

This is roughly how I thought using "Registered Subobjects List" would work:

void AMyActor::CreateState()
{
    MyStruct.MyInt = 5;
    MyStruct.MyObj = NewObject<UMyObject>();
    AddReplicatedSubObject(MyStruct.MyObj)
}

Is this paradigm supported?

fierce adder
#

Someone give me a link to the guild for dedicated servers without Lyra pls

vestal bobcat
#

How a dev enviroment should be set up when it comes to using dedicated servers ? Do you create installed builds from a source version and prepare one server/headless package for the server and one client build for the users ? Does any documentation exists on that issue ?

chrome bay
#

See also net.SubObjects.DefaultUseSubObjectReplicationList

#

Also make sure the object uses the actor as the outer

twin juniper
#

I have a question, OnRep_Controller only run on clients, right?

chrome bay
#

ye

fluid prawn
#

I have a c++ question with an example inside UObjectBaseInit() but I've have seen this done in other functions.

{
... inside UObjectBaseInit func UObjectBase.cpp
    void InitAsyncThread();
    InitAsyncThread();
}

From my understanding inside the function it's defining the prototype right inside the function and then calling it. Because it's defined in the CPP its private. Where is this codes implementation? I only see it defined Inside AsyncPackageLoader.cpp. I assume this code is linked at compile time so that's the actual implementation used right? Side note this is used for creation of async for loading packages (uassets etc)

barren surge
drifting heath
#

I'm having a super weird issue (C++).. I have a BeginPlay in my character actor triggering a LoadCharacter() function, which, as it is named, loads the character from a save. My saves are always client side, so it should reject the server from invoking it, but allow the client to run it. The problem is, it only ever runs on the server. I made sure that a separate server launches in the background, and that I'm in client mode, but it still only ever runs on the server. Any ideas?

#

I added a breakpoint in Rider in the LoadCharacter function but it only ever breaks on the server

#

Ahh nevermind, it's running on the client but only breaking on the server.. had to read my logs.

crisp shard
#

when doing sprint/stamina in multiplayer, when it comes to character movement speed would you want to set this variable on a specific server event? or is the character movement component already replicated where i can set it right off of the input action? i'd be doing server events to set addtional varaibles and doing the stamina but when it comes to simply setting/changing movement speed what is the proper way to set this?

fair latch
#

@crisp shard you will need to switch the flag. Look up delgoodies character movement component video in youtube.

Sprinting in multiplayer required cpp because you cant switch the flag in bp

crisp shard
fair latch
fair latch
crisp shard
fair latch
#

Put it simply you will get rubber banded

#

A lot of youtube tutorial doing bp sprint on multiplayer is a scam

crisp shard
#

do you think i could pull it off w zero cpp coding ?

#

i'd legit just copy it

#

pull it off, as in, do the custom cpp coding

barren patrol
#

How much delay should I expect between spawning a new NPC on the server and it's arrival on the client? I am seeing NPCs pop in super late on my client, even in PIE.

fair latch
#

If you copy everything, then you should be able to sprint. Why not

crisp shard
#

yea that's what i meant

#

but im just not sure how i'd do it

#

i'd like to expose it to a plugin/node that i could use to do it

#

that would be sick

thin stratus
#

@chrome bay Fun little follow up on the RelevancyTimeout.

There is a hardcoded +1 second "timeout" above that. UE only checks IsNetRelevantFor after 1 second since last time relevant. Before that it always counts is irrelevant.

If one sets the RelevancyTimeout to < 1.0, it will cause ALL replicated Actors to flip between relevant (if relevant) and not.
Even GameState, WorldSettings and such :D

I will test tomorrow if I can alter that behavior in the Engine, at least for some Actors.

bright lynx
#

I have tried every possible combination i can think of and no matter what i do all options are dropped when doing an open host:port?opt1=a$opt2=b and it is just ?Name=mypcname. (i am printing the options in gamemode:Login override to validate) Im losing my sanity. Does anyone have a reference or link i can read that may explain the circumstances that would cause this?

lucid badger
#

Is there a consistent way to ID which player (number) you are in PIE/same instance multiplayer? Save Slots are shared between server and client which is a pain in the ass and I'm trying to think of the simplest way to split that up Thinkge

#

Local Role is no good as it would only work with 1 client

#

Actually even standalone will share the save game folder

#

Uggggh

#

What a tremendous pain in the ass. I can't imagine why they did it this way.

#

Each player should have a totally separate folder Madge

#

Now I have to have my save game code be completely different for development versus shipped build

queen escarp
#

its rotationg like crazy :/ ?

#

ideas ?

rancid wren
#

need help with the physicalanimation component during server travel. how do i disable the component

barren surge
lucid badger
barren surge
queen escarp
#

why would this not work on the client ?

#

a client only show 1

fossil spoke
#

@queen escarp An Actor that doesnt have a NetOwningConnection cannot send an RPC to the Server.

#

It seems this is an interactable door.

queen escarp
#

yeah

fossil spoke
#

Ideally you would have a generic "interaction" system that the Player manages. When the Player interacts with an interactable, the Server would be notified of that interaction by the Player (via the PlayerController, which is the NetOwningConnection).

#

This would then lead to the interactable, in this case the door, being opened on the Client via replication.

#

You can also "predict" the opening of the door on the Client by allowing the Client to set its open state locally

#

So you dont have to wait the latency time for it to open via replication.

#

Obviously that would involve implementing correction incase the Server rejected the opening for whatever reason. But thats all likely a bit complicated for you at this stage.

#

So I would focus on implementing a generic interaction system instead.

#

There are plenty of examples online.

queen escarp
#

hm gah,

#

aye, but it works on the host, thats whats weird

#

?

fossil spoke
#

The Host is the Server

queen escarp
#

aye

#

dose a Character have NetOwningConnection ?

fossil spoke
#

A Pawn that is possessed by a PlayerController does, because the Owner of the Pawn is the PlayerController and the PlayerController is the NetOwningConnection.

queen escarp
#

ah ok

fossil spoke
#

Any Actor that is Owned by a NetOwningConnection (PlayerController or another Actor owned by a PlayerController) can send RPCs

queen escarp
#

and making the player "possess" the pawn and rpc is that an option ?

fossil spoke
#

You can setup an "Open Door" RPC on the PlayerController if you like

#

And route that action that way.

#

But thats not very generic as if you want more types of interaction actions later, you would either need a generic system or add more and more specific RPCs to each action.

queen escarp
#

hm.

#

kinda weird i never had this issue before >_>

#

but i kinda get what your saying i suppose

fossil spoke
#

If you have a simple, limited scope game, you might not need a generic interaction system.

#

But thats unlikely.

#

If you start to need more than 2 or 3 unique interactions, then you need a generic extendable system to handle all cases.

queen escarp
#

gotcha

#

hmm

queen helm
#

I have problem with testing multiplayer game with SpaceWar ID, if there are 3 players connected to the server, the server can't be found by anyone else. Is it limitation of SpaceWar or I am doing something wrong? I'm using UE 5.3

fossil spoke
#

Only sessions with open slots will be returned.

#

By default AFAIK.

queen helm
#

I have NumPublicConnections set to 10 so it shouldn't be a problem?

fossil spoke
#

Yeah not sure then

rigid yew
#

Hi, I have local multiplayer / split screen project and I want to change switch between players in runtime. project uses one keyboard and when user press a specific key it should start to control other player. Is there any suggestion for that ? Project is not a game project. I want to achieve like 3Ds Max's grid layout.

sweet sage
#

For a multiplayer mounting system is there any cons having the horse on same actor as the player?

#

Is using multiple actors better?

#

(The mount is an item that will never have a world version outside of a mounted character)

fossil spoke
#

Like a WoW mount?

sweet sage
fossil spoke
#

If its that simple then probably creating its Skeletal Mesh on the Players Pawn would be enough.

#

Probably doesnt need to be its own Actor

sweet sage
#

Can i have any problem?

fossil spoke
#

Since it would only really be increasing base speed and possibly allowing you to fly

#

Which is all doable with a single Pawn

sweet sage
#

Maybe it can change mesh size also

#

(capsule)

fossil spoke
#

Sure if you need it to, thats also possible.

#

The Crouch function does that for example.

#

So resizing the Capsule for the CMC is doable.

sweet sage
#

Thank you

#

I will do it that way

fossil spoke
#

Good luck ๐Ÿ‘

grand kestrel
valid bough
#

I am having an attach to component error where in the server I equip my weapon and it attaches but its very inconsistent but I basically spawn my players with a default weapon and attach it to my weapon slot component on the 3rd person mesh. Sometimes its correct but other times its in the middle of the air but still attached! i know its attached because it is doing the idle animation as if it is.

valid bough
green delta
#

how do you set target view with blend in mp?

bright lynx
#

I have tried every possible combination i can think of and no matter what i do all options are dropped when doing an open host:port?opt1=a$opt2=b and it is just ?Name=mypcname. (i am printing the options in gamemode:Login override to validate) Im losing my sanity. Does anyone have a reference or link i can read that may explain the circumstances that would cause this?

fossil spoke
#

Why are you using a console command?

quaint rain
#

Could use an assist on GameInstance.

I have an api call that returns a sessionID, that ID is stored as a variable on the GameInstance before the player opens a level and connects to a dedicated server.

On the GameMode for the dedicated server, I try to read this sessionID during Event Handle Starting New Player.

For reasons that I do not understand, the GameMode cannot find that variable on the GameInstance. What am I doing wrong?

fossil spoke
#

Meaning.

#

Only 1 GameInstance exists for every machine.

#

Which also means that you cannot reference a GameInstance across processes.

#

So you storing a value on a Client, wont be accessible by a Server.

quaint rain
#

But a open level should be the same process, yeah?

#

Ahh

#

I get you.

fossil spoke
#

Because the Client and Server are entirely separate processes on entirely different machines

#

If you want to pass information to the Server about a connecting Client, use the Options string.

#

Its available when you call OpenLevel for example

#

Which is how you generally connect to a Server

#

It takes the form Option1=Value1?Option2=Value2...

#

You can parse this in the GameMode

#

For a connecting Client

quaint rain
#

That's helpful. Can you point me to any documentation on parsing options? Or help me with the syntax to pass and store a variable?

fossil spoke
#

There are helper functions in Blueprint for this AFAIK

#

You should be able to reference them for assistance with C++

#

As far as other documentation goes, Im not sure if any exists.

#

But its pretty straight forward.

quaint rain
#

Haha okay, any idea what one of those helper functions might be called? I'ma C++ noob, but I'll give it a try.

fossil spoke
#

PlayerName=Sandwyn?SessionId=1237912409?SomeOtherData=SomeValue?

#

This is what it might look like

fossil spoke
#

It will be somehting like ParseOptions

quaint rain
#

Excellent, really appreciate the assist!

fossil spoke
#

๐Ÿ‘

thin stratus
#

Wrong channel... Sry

normal valley
#

hiya! i have one developer running a source version of engine 5.3.2 and another stock 5.3.2 from epic launcher. it seems like they are "incompatible" due to different network versions. we want to be able to connect to eachother via the editor.
if i make a binary build of the editor, will they have the same version?

flat night
# fair latch Hard travel kills widget. I preserve mine by making the uwidget a tsharedptr. S...

I finally managed to get the Loading Screen working with a BlueprintFunctionLibrary
I found this thread that explained how to do it and it works great https://forums.unrealengine.com/t/multiplayer-how-to-set-a-persistent-loading-screen-while-connecting/371222/16
I tried doing something similar with the Subsystem afterwards to see if works, but maybe my code for removing wasn't great, so it didn't do that properly.
But in any case, I understood tha tthe whole issue was with persistant Loading screens being needed, and all I was doing was setting things to controllers and whatnot. Thanks for your help!

Epic Developer Community Forums

For anyone who comes to this I had to edit @Vanoricโ€™s answer a bit. Source/MyProject/Public/DynamicFunctionLibrary.h #pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "DynamicFunctionLibrary.generated.h" class MyProject UDynamicFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() ...

dark parcel
flat night
#

what's hard travel? Sorry, I am not familiar with some of the terms

dark parcel
flat night
#

That's what I used it for, yeah
It spawns a Widget on the screen of each player and on certain conditions I remove it(in this case when both players are ready, with a possessed pawn and controller)

sweet sage
#

Testing with low rotation rate

#

But moving on input diretion is not realistic for a mount anyway

sweet sage
#

This is what i want to do

#

The lion don`t move baaws on player input but on lion forward

lost tinsel
river hound
sweet sage
sweet sage
#

Look

#

It works for what i need

#

but not finished

#

The movement is using mount forward vector

thin stratus
#

Toying around with custom values for some actors for how fast NetRelevancy applies and while it's almost instant, I could swear there is still some random delay.
And the delay doesn't get bigger when higher ping fwiw (which I think makes sense).

#

I don't really want to predict that Actors become non-relevant

#

The Valorant post isn't really clear on if they use NetRelevancy directly, if they did their own thing and modified the engine or what they are doing.

#

They do say the sent some "Hide" and "Unhide" "commands", which makes me believe they just hide the actor until the 5 seconds are over and if the actor becomes relevant again before actually despawning they unhide the actor.

Not sure if that's an RPC though or locally predicted. Locally predicting this is kinda shite, cause I don't even have all the info due to ping at the right time if I'm unlucky.

And an RPC is also still somewhat delayed. Will test it anyway but well.

thin stratus
#

Maybe this causes the problem if I go back and forth too often

// if it is relevant then mark the channel as relevant for a short amount of time
if ( bIsRelevant )
{
    Channel->RelevantTime = ElapsedTime + 0.5 * UpdateDelayRandomStream.FRand();
}
#

AHA

#

Had to put the hardcoded value that was previously 1 to -1 (or -0.5 I guess) and now it's instant

twin juniper
#

LoL Cedric have problems too. I have only seen you solving people's problems.

flat night
#

hey everyone, I have this mechanic that uses the Thumbstick input to calculate a curve.

void ACluckCharacter::RotateCharacter(const FInputActionValue& Value)
{
    
    if (bDisableInput) return;
    
    const FVector2d ThumbstickInput = Value.Get<FVector2d>().GetSafeNormal();
    
    StickVector = FVector(ThumbstickInput.Y, ThumbstickInput.X, 0.f).GetSafeNormal();```

That Vector is set to be Replicated. Then I use in a Component that I use to do all my calculations for combat and send it to the projectile I am shooting. The problem is that it seems to work only for the Server, and doesn't replicate to the Client. I think this is the only time I use a parameter from the character and it doesn't seem to work, like I said, all the rest of the stuff is done in a component. I am wondering if anyone has had an issue with trying to replicate something like this? For the setting I do it like this:

```c++
FORCEINLINE FVector GetStickVector() const {return StickVector;}```

```c++
 void UCombatComponent::CalculateCurveShot()
{
    FVector StickVector = Character->GetStickVector();
        UE_LOG(LogTemp, Warning, TEXT("StickVector length On_Rep, %f"), StickVector.Length());```

and when checking the Log, I can see it always gives me a 0 value on the Client.
tardy quarry
oak lake
#

Hello! Tell me why the cursor does not turn off in multiplayer, but in single player everything is fine

bright lynx
# fossil spoke Why are you using a console command?

i have tried that and client travel via player controller. I am not using steam or epic online services so i dont need / have an online service to connect through, and simply need to pass the users unique id from my auth system when connecting

flat night
tardy quarry
# flat night I see, yes it is an input function. Exactly why I was wondering how to handle th...

IMO there's no right answer here as there are a lot of things to consider. But to unblock yourself you could start with making ACluckCharacter::RotateCharacter a server-side RPC meaning that method will run server-side only. StickVector will then replicate down to all the clients. You can use a rep notify on that replicated variable as a means to inform your client that the value has been changed server-side and do what you need to do from there. You'll likely run into other issues, but this may be a good starting point.

sinful tree
flat night
pale void
#

Any multiplayer experts know if its possible and how to replicate this? Using this in abp, and its not auto replicated since its from pawn movement

sinful tree
# pale void Any multiplayer experts know if its possible and how to replicate this? Using ...

Create a replicated "Vector" variable with replication enabled on your pawn.
Create a Run On Server event with a vector input.
Event Tick on Pawn > Run On Server Event, feed in the "Get Last Input Vector" value.
Run On Server Event > set the Vector variable you created to the value passed in from the event.

You now have a replicated variable on all clients that contains the value from Get Last Input Vector on the client that's controlling the pawn.

sinful tree
lucid badger
#

I have the exact same requirement and my vector is only rpced on a movement input (i.e. when the vector changes)

#

Like this--make sure you include the second zero-out on Completed or the last value will linger after movement stops. Also just ignore the other nodes ๐Ÿ˜›

sinful tree
# oak lake Yes

Begin Play fires on all clients, so if you're creating and adding widgets there on begin play, that means each time a player joins the game, you could be adding UI to the local client when you don't need to be.
You're better off creating it in your HUD class or in your Player Controller.

oak lake
lucid badger
# hollow eagle most reliable data from server -> client is going to be via replication rather t...

Sorry for the delayed reply, only just caught this.

I'm having trouble wrapping my head around this response. If I have some crucial event, like a player has equipped an item in his inventory, there's several things a client has to do in response to this event (i.e. update equipment component's equipped items list, update equipped item's "OwningEquipmentComponent" and "EquippedInSlot" variables, moving/destroying/creating UI widgets to represent the change in state, any effects, etc.). That screams multicast RPC to me--I can sync it as one atomic event, with all the needed info as parameters to the multicast, all at once.

How would you do that via replication instead? And why? Mark the equipped items list, and the two variables on the item itself as replicating? Then I'd also need to replicate the itemslist of the inventory the item came out of, and the variables on the item for OwningInventory and InventoryPosX and InventoryPosY, and only after ALL of these various things have replicated to the new state can I react and update UI elements? Thinkge

hollow eagle
#

none of that screams RPC at all

sinful tree
#

Stately things = use a replicated variable.

hollow eagle
#

equipping an item probably means putting an item in a replicated variable in an array or some other structure

#

every other event can key off of that

lucid badger
#

It can't though

hollow eagle
#

sure it can

lucid badger
#

I Just explained, did you read what I said

#

It was very long and you responded instantly

hollow eagle
#

because I've built inventory systems plenty of times before

#

nothing you're doing is unique

lucid badger
#

If I move an item to an inventory slot then I need to know what slot, and if it's rotated

#

I need 4 variables to move an item to an inventory slot

hollow eagle
#

and that information has to be stored somewhere

#

and that somewhere can be replicated

lucid badger
#

But replication is chaotic and unpredictable order

twin juniper
#

He got the muscle memory

hollow eagle
#

so?

#

first, that's not inherently true. Second, that's a problem you have to solve.

lucid badger
#

I did solve it by using RPCs Shrugeg

#

It works great and I can't understand why I would break it up into this complex system

hollow eagle
#

it's not complex

#

why can't all of this information be held in a single struct that you OnRep

#

you can even guarantee atomicity

lucid badger
#

Like a history of actions?

#

But why

hollow eagle
#

no

#

the actual storage of the item

#

can store this information

#

and be replicated

#

it isn't some separate data storage

#

it's all one place

lucid badger
#

Every time someonem oves an item, create a struct to represent the action, add this to a list of actions and those are replicated, okay that works but why

hollow eagle
#

no

#

what is storing the item

#

where is it being stored

#

what owns that information

#

and why can't that information be replicated

lucid badger
#

If it's in an inventory, it's position is defined in:

Inventory's ItemList
Item's GridX, GridY, Rotated, OwningInventory

hollow eagle
#

so why isn't the item list replicated

#

and why isn't the item itself replicated

#

this data already exists

lucid badger
#

Why does itm ake more sense to replicate the whole item than to just announce the whole change that happened? Hmmge

#

And what happens if GridX replicates before ItemList

#

I have to code in a 4-way wait-and-go

#

For all 4 things to replicate?

#

Then I can react?

hollow eagle
#

why does it matter?

hollow eagle
lucid badger
#

I already handle joiners by sending them the current state of all items when they join Shrugeg

hollow eagle
#

which is horrible

lucid badger
#

It's a load screen

hollow eagle
#

you're going to have a fun time overflowing the reliable buffer that way

lucid badger
#

It just comes as one array

#

Of structs

hollow eagle
#

so why isn't that array of structs simply marked as replicated

lucid badger
#

The structs are serialized item data

hollow eagle
#
UPROPERTY(Replicated)
TArray<FMyItem> Items;
lucid badger
#

They'd have to be deserialized

hollow eagle
#

why are you serializing anything

lucid badger
#

Items are not structs

hollow eagle
#

the engine already knows how to replicate objects

lucid badger
#

Because I was already serializing stuff to save to disk

#

So player can just send his save game to server and get his items loaded in as he joins

#

And server sends back saved item datas to unpack Shrugeg

hollow eagle
#

and you've created more work for yourself that way

#

you've apparently already done the work so that point is somewhat moot, but I'm not talking about the work you've already done

#

I'm telling you how such an inventory would be designed from the start.

lucid badger
#

I know and I'd like to understand because I do not currently

hollow eagle
#

replicating an array of items is dead simple.

#

It's a few lines of code.

lucid badger
#

Yes but reacting to changes

hollow eagle
#

Is not hard

lucid badger
#

is my concern

hollow eagle
#

Once again: atomicity can be a guarantee you make if you really want.

#

and that assumes you even need it

lucid badger
#

So in the example of an inventory item being moved (potentially from one inventory to another), where exactly am I reacting to the change in state

hollow eagle
#

does it really matter if two items overlap only on a client for a couple of frames?

lucid badger
#

Yes whihc

hollow eagle
#

any

#

all

lucid badger
#

...

#

I don't know what hat means ๐Ÿ˜›

hollow eagle
#

OnRep the struct that contains positional data.

#

OnRep properties in the item object.

#

Anything you need to react to

lucid badger
#

Right but I need ALL the properties

hollow eagle
#

So OnRep them all?

lucid badger
#

So I onrep every single one and mark some "ok this one is ready?" thing and then fire when all are ready?

#

That sounds like a lot more work Hmmge

hollow eagle
#

why do you need to know that

#

once again: does it really matter if two items overlap only on a client for a couple of frames?

#

and also once again: you can guarantee atomicity with a struct + NetSerialize

#

so no, you don't need to check every property

#

atomicity even comes free with iris, but I won't tell a beginner to use that.

#

you need to know when every property changes, but you don't necessarily need to wait for every property.

#

and in fact with a struct containing most data you don't even need that - you just need to know when the struct itself has changes.

#

Furthermore you've locked yourself in a situation where it is difficult to replicate the items themselves. What if you have an item that needs unique logic that needs to replicate some info between client/server? Are you going to hardcode that as part of your player controller or character? Are you going to spawn an actor to act as a data channel (which you'd have to wait for on a client anyway)?

lucid badger
#

Hold on brain is cooking, putting the relevant variables on the item into a struct so it goes as one is making some sense Thinkge

hollow eagle
#

but once again: you don't even need that for many of the fields you've mentioned

#

who cares if your grid positions are slightly wrong for a frame or two

lucid badger
hollow eagle
#

Until you have persistent data you need to store.

#

Data that may not fit into an attribute.

#

GAS doesn't and isn't meant to store everything