#multiplayer

1 messages Β· Page 704 of 1

chrome bay
#

Yeah but then the OnRep is still called server side, which is stupid

#

Since nothing is replicating

near bison
#

then I guess do a hasAuthority check?

chrome bay
#

You can workaround it, it's just silly that it works differently in each domain

near bison
#

still sounds unnecessary though, you're right

#

two takeaways:

  1. update repnotified vars only on server, 2) hasAuthority check if required to run repNotify only on clients
pallid mesa
#

++ BP's onrep also get called when the variable doesn't change ie: setting the number 7.f twice to a float var πŸ€·β€β™‚οΈ (I thought this wasn't the case, got me all surprised actually)

chrome bay
#

lol fabulous

near bison
#

does anyone build games with BP at all?

pallid mesa
#

it's a tool

chrome bay
#

It's certainly used. Just IMO has a low ceiling when talking multiplayer in particular

crisp wraith
#

Yeah, I am currently using owner of the actor component as outer. What do you mean by crashes, is it fine replicating UObjects from server to clients or should I rather choose another method?

near bison
#

no I mean full games.
I'm building one right now...not seeing too many issues

near bison
chrome bay
#

It's definitely been done I think yeah

near bison
#

it's definitely irritating that I don't have access to PlayerArray in GameState for like the first 2 seconds

pallid mesa
#

Galaxy in Turmoil runs most of its logic in BP's and it's a multiplayer game...

#

it doesn't scale very well, but it runs okay

near bison
#

It's got mostly negative reviews

pallid mesa
#

mhm, yeah it didn't do very well x'D

#

but anyways, it's an example that it's indeed possible

chrome bay
#

Def possible, just... tedious

#

And yeah scaling up becomes an issue, doesn't matter if it's a simple game though

near bison
#

scaling up means?

#

yeah I'm building a simple board game

chrome bay
#

Like lots of players or high-complexity game etc.

near bison
#

we're going blazing fast with BPs

chrome bay
#

Yeah that's probably fine tbh

pallid mesa
#

oh also BP multiplayer got some gotchas

near bison
#

such as/

pallid mesa
#

because of UE initialization code

#

waiting for PS and whatnot

#

things that aren't exposed in BP's

crisp wraith
chrome bay
near bison
#

BPs for board games seem fine to me πŸ™‚

pallid mesa
#

oh you will in the UI for sure

near bison
#

oh god

#

such as?

#

what UI?

chrome bay
#

The difficulty in BP is coding around the inherent race conditions you get from the networking system, they're quite easy to get around in CPP because you can override a lot of engine behaviour - but in BP a lot of that is not exposed.

pallid mesa
#

^ correct ^

#

can't remember all the examples

#

but for example GS replication

#

your PC is alive in the client and the GS isn't yet anyways

#

so u have to wait for it

chrome bay
#

Basically you can never rely on an actor to be around when you access it, so it boils down to a lot of events etc.

pallid mesa
#

in BP's you can do this with a simple waiting loop or sm

#

but yeah the correct way to do it is to hook on begin play and propagate existence

near bison
#

incredibly tedious

pallid mesa
#

in C++ you can use other hooks that ease your job

near bison
#

such as?

pallid mesa
#

as the non-virtual setplayerstate

#

that cannot even be overriden in C++ 😭

#

well one example is onrep_playerstate in the character (i believe it was)

chrome bay
#

It could be anything really

pallid mesa
#

but yeah these are just implementation details...

#

if you get any of these just come here and ask

near bison
#

yeah

#

exactly

pallid mesa
#

it's tough for starters

near bison
#

2 second delay works for me now...probably will switch to propagating event from PlayerState in the future

chrome bay
#

It's one of those things you can only get your head around once you start experiencing it really

near bison
#

why

pallid mesa
#

rather than 2 second delay, loop it

#

loop the delay until is valid

#

it's an atrocity, I know, but it's safer

near bison
#

like, a while loop? how would I write this?

opal fox
#

Think just finding a good mix of bp - cpp works fine

near bison
#

and what am I actually waiting for?

chrome bay
#

It can be useful (and this is commonly the approach in CPP also), to create just a core system you can access from anywhere at anytime - and it contains some global events you can bind to

pallid mesa
#

is there any online BP editor I could use to show you?

chrome bay
#

E.g. "PlayerStateReceived", "GameStateReceived" etc etc

near bison
#

probably just a diagram would do

opal fox
#

Ive found it nice for most base classes created to just define as much as possible in C plus plus and then extend outwards from blueprint

near bison
#

can I use the PostLogin event?

pallid mesa
#

@near bison enjoy 🀣

near bison
#

How can I do isValid on a playerStateArray

pallid mesa
#

uh what do you want to do with the ps array?

#

ah u want to check if every member in the array is there,right?

#

then instead of doing isvalid

#

do array.length == quantity

near bison
#

but how do I know the quantity before hand?

pallid mesa
#

is it predefined?

#

or what do you need exactly

near bison
#

well it's predefined for now

#

but might be different well into the future

#

it's a board game

opal fox
#

just loop the array and check if the content is valid?

chrome bay
#

Presumably you want whatever it is to respond to players being added/removed dynamically

#

Which will happen

#

If players leave, join in progress etc.

pallid mesa
#

right, there is no a BP handler for that afaik, but you can do postlogin

#

but that's not for PS's

chrome bay
#

I think GS has overrideable functions for players being added/removed no?

pallid mesa
#

also only server

#

actually not sure, I know for a fact they are there for C++

chrome bay
#

Can't remember if they are BP event funcs

near bison
#

i cant find a player added node in GameState

pallid mesa
#

sheesh x'D

chrome bay
#

Oh lel, yeah it's CPP only

near bison
chrome bay
#
virtual void RemovePlayerState(APlayerState* PlayerState);```
#

Would be useful to have an event by default tbh

pallid mesa
#

yes well james, at least they are virtual x'D

near bison
#

but how long do I delay for?

pallid mesa
#

u get the array and do length == whatever number

chrome bay
#

Just an example of what I meant by having a central object that has events:

{
    Super::AddPlayerState(PlayerState);

    if (UHT_WorldEventManager* WEM = UHT_WorldEventManager::Get(this))
    {
        WEM->NotifyPlayerArrayUpdated(this);
    }
}

void AHT_GameState::RemovePlayerState(APlayerState* PlayerState)
{
    Super::RemovePlayerState(PlayerState);

    if (UHT_WorldEventManager* WEM = UHT_WorldEventManager::Get(this))
    {
        WEM->NotifyPlayerArrayUpdated(this);
    }
}```
near bison
pallid mesa
#

the if branch

pallid mesa
#

i find it a pretty nice idea, might steal it πŸ˜„

chrome bay
#
{
    check(IsValid(InGS));
    checkSlow(InGS->GetWorld() == GetWorld());

    ConditionalBroadcastNetworkReady();
    OnPlayerArrayUpdate.Broadcast(InGS, InGS->PlayerArray);
}```
pallid mesa
#

aaah I see a delegater 😎

near bison
chrome bay
#

Then you can do fun stuff like this:

{
    Super::NativeOnInitialized();

    if (!IsDesignTime())
    {
        UHT_WorldEventManager::NetReadyExecute(this, UHT_WorldEventManager::FOnNetworkReady::FDelegate::CreateUObject(this, &UHTG_DropzoneUI_WavePanel::NetSafeInitialize));
    }
}```
#

And not have to worry about UI trying to access missing stuff all the time

pallid mesa
#

badonkers

#

actually this could pretty well belong to the engine

chrome bay
#

It should be tbh

near bison
chrome bay
#

Might dump this somewhere

near bison
#

is so dumb

pallid mesa
pallid mesa
near bison
#

gamestate

#

when all the players are connected, I want to shuffle their turn order. that's why I'm calling a simple function on gamestate

pallid mesa
#

ah! aaah! okay

#

not exactly the problem i was trying to solve

#

but it works aswell in that case

#

🀣

near bison
#

well, yep

#

and only once this turn order is setup, will I fire an event

#

that enables everybody's UI

#

ez. lol. game the system

pallid mesa
#

gtg now! good friday

near bison
#

thanks @pallid mesa and everybody else πŸ™‚

pallid mesa
#

James, if you remember, ping me when you post that stuff! πŸ˜„

pseudo merlin
#

thanks!

hard hinge
#
 Malformed_Packet: Received packet with 0's in last byte of packet
#

What does this mean?

#

I'm using online subsystem steam

#

It's very difficult to debug server issues on Linux

#

This error cannot be searched for sadly

#

Errors should be searchable

young lily
#

I used the search string

Received packet with 0's in last byte of packet

hard hinge
#

Yeah I found that eventually

#

Sadly it's not helpful yet.

#

Trying some stuff

dark edge
#

If the missile is a REPLICATED ACTOR then the clients will see it too when it spawns on the server.

little finch
#

No, online multiplayer

dusky yoke
dark edge
#

The launcher (which is a replicated actor) spawns missiles (which are replicated actors), whos movement may or may not need to be replicated (depends on if they move in such a way that can't just be predicted by their initial transform and velocity)

#

How many missiles are you talking?

#

How you do it will depend on if it's a couple missiles or hundreds or thousands

winged badger
#

you generally don't destroy replicated Actors server side right away

#

hide them, turn off their collisions, turn off their tick, and set their lifespan for a few seconds

gleaming kite
#

I feel like im doing something wrong but how do I set a class to use a certain player state? Trying to have a certain player state for each character

dusky yoke
#

Aah, Im firing 4-8 missiles, but I'll try to add a higher cull distance value to test it out @dark edge - I gotta do the same thing for my characters as I want their gunshots to be heard across the map πŸ˜…

hard hinge
#

CLOSE_CONNECTION_DUE_TO_SECURITY_VIOLATION(this, ESecurityEvent::Malformed_Packet, TEXT("Received packet with 0's in last byte of packet"));

Whenever I try to connect to my dedicated server, I get this warning printed and the connection is lost.

#

Has anyone seen this

deep shore
#

if an actor contains a camera component that is active, but has no player as its view target, is this a large amount of wasted resources? are resources wasted by the server only, or does this also hurt clients?

#

the logical solution is only activating the cameras when a client is set as the view target. but I seem to be having an authority issue that prevents clients from activating/deactivating cameras unless they are set to auto-activate.

#

activating the cameras on the server does not activate them for clients, according to print strings. but activating them on clients has no effect.

fathom aspen
#

Honestly I wouldn't care about this too much if spectating can happen to often in my game, as the overhead of activating/deactivating would be higher than leaving them as is(at least that's the case in our game)

fathom aspen
deep shore
#

they are working fine for clients if set to auto-activate. which is fine by me, except there’s a lot of cameras and i’m worried about the performance costs

winged badger
#

the only cost for not used cameras is their transform updates and tick, if anything runs on it

winged badger
#

you should not be worrying about performance until you have something that works

#

and then only if the performance is terrible

#

later on, you use profiler, see whats costing a lot and try to optimize it

fathom aspen
#

Fair enough, makes total sense to me

winged badger
deep shore
#

that helps. thank you!

dark edge
winged badger
#

Problem with spawning a replicated Actor that spawns 6-8 other replicated Actors is that it all works nicely on empty test level

#

then it breaks when there are couple of hundred replicated actors around

#

evaluating Actors for replication takes time and CPU on server

dusky yoke
winged badger
#

and then you get a short lived Actor, like your missiles, and it just doesn't get its turn to replicate to clients before its lifetime already expired on server

#

and then clients don't see missiles

fathom aspen
winged badger
#

as long as server can provide good predictable target information at the time it spawns whatever launches the missiles

dark edge
#

same for your gun bullets

winged badger
#

you can have that information replicated inside the launcher actor, and have the clients spawn missiles locally themselves

dark edge
#

Be warned, if you have air drag in your projectile calculations it WON'T be predictable compared to a pure ballistic trajectory.

winged badger
#

none of my pickups or interactable actors are actually replicated, i have a network manager actors with fastarrays replicating few hundred actors each

fathom aspen
#

So you spawn most of the stuff locally on the client

#

i have a network manager actors with fastarrays replicating few hundred actors each
I have seen this mentioned quite a few times. Never used FastArrays myself, but should look into them at some point

winged badger
#

they are still netaddressable

#

as i need a pointer to the actor replicated as part of the fastarrayitem struct

#

but we spawn entire level locally on clients, then network it afterwards

fathom aspen
#

I see, they are netaddresable from the fast arrays

winged badger
#

no, they are net addressable because all machines spawn them in exact same location with exact same name, and IsFullNameSupportedForNetworking returns true

#

we also add a small... "hack" to make the engine behave as if they were loaded from the level, instead of spawned at runtime

dark edge
winged badger
#

and even if you could, relevancy behavior of destroying non relevant replicated actors would bury you

dark edge
#

In our case the only actors that would need to be replicated are doors etc, things that move.

#

All the level geometry can be derived from the seed

winged badger
#

we spawn 50k actors procedurally on larger levels

#

around 3000 of those need to replicate during gameplay, and that is where network managers come in

#

we also spawn them from seed, ofc

#

there are a few traps along the way

dark edge
#

Ours is a top down tile-based system, using WFC for map generation. So really, we won't be doing generation on the client but just replicating the tilemap and every machine interprets it into meshes etc.

winged badger
#

you can't replicate any of the procedurally spawned actors to clients until clients have completed procedural generation

#

when you set bNetStartupActor and bNetLoadOnClient true

#

unreal will assign them static NetGUIDs (last bit in the guid is static/dynamic)

#

unreal then also expects that when it sends a NetGUID for such an Actor that client, which has loaded a level at this point, has that Actor already and can Ack the NetGUID

#

if client didn't spawn the Actor already, they will still be NetAddresable, but you won't be able to open the ActorChannel

#

as in ServerOpenDoor(ADoor* MyProcedurallySpawnedDoor); would work just fine

#

but if you relied on the door to replicate its open state, client would be able to pen the door, but not see it opened

dark edge
#

Does this sound gross or ok? This is the current model.
On travel to a new map (nothing is actually loaded, we have 1 persistent level and that's it)

  1. Server generates tilemap.
  2. Server and client interpret tilemap into meshes etc. Most of the level is there by now, besides actual actors that do stuff.
  3. Server spawns replicated actors (doors, enemies, interactables)
winged badger
#

it works, but can be improved

dark edge
#

All of this is hidden by a "travel" phase. The gameplay loop is sorta like Diablo with it's town -> dungeon -> back to town paradigm but it's spaceship -> surface -> back to spaceship

winged badger
#

if you used the same seed to spawn the replicated Actors generating their name as they are spawned with FActorSpawnParameters

#

setting bNetLoadOnClient and bNetStartupActor to true

#

and letting the clients spawn their own versions of those replicated Actors

#

with IsFullNameSupportedForNetworking returning true for those Actors

dark edge
#

So what do I end up with, a replicated DoorManager and CharacterManager and BulletManager etc?

#

instead of 30 replicated doors and 100 replicated characters etc?

winged badger
#

and IsNetRelevantFor on those Actors returning false until client RPCs that it finished spawning the level

#

you could have clients spawn the replicated Actors themselves, and just have them replicated after that

dark edge
#

I don't really see what advantage that gives me though, there's no hurry in the spawning really.

winged badger
#

with us, the level takes 10-15 seconds to spawn on a fast PC, if we had to replicate those Actors, it would be minutes

dark edge
#

oh ya in our case it takes like 2 seconds lol

#

you might have a lot bigger level

winged badger
#

but generally

#

(generic case)

#

if you had a FFastArraySerializer with FFastArrayItem that has a TWeakObjectPtr<AMinorReplicatedActor> and a TArray<uint8> ActorState as members

#

and that AMinorReplicatedActor (or interface) had a PostReplication function in it

#

you can wire a PostReplicatedChange/Add in FastArrayItem to call that function on the Actor the struct has a pointer to, passing in that ActorState as an argument

#

and have those MinorReplicatedActors be responsible for encoding and decoding their state from an array of bytes

#

which would in turn allow you to turn their replication off, or in your case set them dormant

#

and when they'd need to replicate something, they'd encode their ActorState, update their FastArrayItem and MarkItemDirty in the replicated NetworkManager that has the FastArray

#

and the replication callbacks from FastArrayItems would cause those Actors to update on clients

dark edge
#

Yeah that sounds like a crap ton of work lol. Maybe we'll hire that out if it gets to that point.

winged badger
#

i got it working in 2 days, without having done it before

#

and it had side benefits, like with few network managers, you can configure their NetPriority and NetUpdateFrequency to be higher

#

making the replication feel much much more reliable

obsidian gyro
#

I have a problem where The client can see the host's full head/gun rotation, but the host can't see the client's head/gun rotation, the clients bullets(which are shot from the rotation of its camera) are never able to shoot upward or downward because the host sees the clients head as not moving up or down, how do I fix this?

dark edge
#

So if I get what you're saying, this is replacing the regular replicated properties system with network managers that replicated some state as bytes to be interpreted by whatever actors.

winged badger
#

even unreal a significant network load

#

you don't have to use array of bytes

#

depending on how many different actors you need done this way

#

you can have a fast array for each actor type, if you have few enough

#

then you don't need to encode or decode anything

dark edge
#

ActorState is the payload though right? That's what's being replicated around?

winged badger
#

yes

#

and i run several different fastarrays inside network managers

#

one fastarray handles interaction, one handles damage/death, one replicated gameplay tags, 4th replicates buffs

#

and a more complex actor can actually use all 4 of them, each replicating one aspect of that actor

#

as there are like 300-400 different actor classes we replicate in this manner

fathom aspen
#

Wow, seems like you created your own replication system...hands down!

winged badger
#

the TArray<uint8> is the form that can generically handle any data, so it was easiest to use as an example here

dark edge
#

Seems like this would mesh with Subsystems pretty decently

winged badger
#

sure, but you don't actually need a subsystem, as network manager here has only one resposnibility

#

and splitting that responsibility with a subsystem just muddles the code

dark edge
#

If your BuffNetworkManager also did all your Buff logic it'd be pretty close

winged badger
#

yeah, but i don't have a BuffNetworkManager

dark edge
#

All roads lead to ECS i suppose

winged badger
#

i have a NetworkManager that has 4 FastArrays

#

the callback logic is inside the FastArrayItem structs

dark edge
#

How do you do movement then?

winged badger
#

things that replicate movement replicate normally πŸ˜„

#

they don't run via network managers

#

replicating several hundred moving Actors is doable

#

replicating several hundred moving Actors while you have several thousand non moving replicated Actors cluttering the NetBraoadcastTick is not

dark edge
#

If we ever get replicated Subsystems there might be an interesting endgame there. I really like just having lots of dumb data on objects and letting a manager do all the logic. It seems like the manager would also be the optimal place to handle the networking as well.

#

Our projectiles work like that, they're just data in a subsystem.

winged badger
#

only subsystem i see happening replicated is a GameStateSubsystem

#

it wouldn't be too difficult to create either

#

you need an ActorChannel to replicate it, and none of current available subsystem Outers are Actors

#

the only one that makes sense, and can guarantee it will be around is GameState, with GameMode not being replicated

#

could in theory pull it off on ALevelScriptActor, too

#

unreal has a nasty habit of swapping the Outer on a replicated subobject to be the Actor that replicated it via its channel

#

so while you could in theory put AWorldSubsystemReplicator Actor on the level, and have it gather and replicate all instances of WorldSubsystems you have running, client side those Subsystems would end up being A - Additional instances in addition to client run ones, and B - that WorldSubsystemReplicator, and not the World would be their Outer

dark edge
#

I suppose a component on GameState would make more sense then a subsystem

winged badger
#

which is still not insurmountable, provided you stop those Subsystems initializing on clients

#

you would not be able to access them via GetWorld()->GetSubsystem<T>() without additional hackery

#

but they would work

#

(like manually inserting them into World's subsystem collection during the AWorldSubsystemReplicator::OnSubobjectCreatedFromReplication

severe nymph
#

Anyone ever ran into a situation where a replicated server spawned AI thinks it's in the air on the client (spamming true/false)

#

but stays false on server?

#

default walking mode is navmesh walking

winged badger
#

you probably have MovementMode NavMeshWalking on server and regular Walking on client

severe nymph
#

what?

#

movement component is replicated by default

#

including this property

winged badger
#

so server correct teleports it onto the NavMesh, which is typically 30 UU above the actual floor

#

and then it starts falling to the floor

#

and CMC doesn't really do much replication directly

severe nymph
#

ok?

winged badger
#

so set your MovementMode to NavMeshWalking on client on say, BeginPlay

severe nymph
#

its one of the most expesive things in the netstack

winged badger
#

and it should fix it

severe nymph
#

when profiling

#

but ok ...

winged badger
#

oh, its sends plenty of RPCs, but its entire replication is wired over the Character

severe nymph
#

the thing is

#

if your familar with networking

#

when you spawn on authority

#

which is server

#

you don't actually have a net load client version

#

to be "out of sync"

#

to set a "different" walking mode on

winged badger
#

i agree it should be in sync

severe nymph
#

as your relying on the "replicated" actor

winged badger
#

but i have seen that problem before

#

unreal engine is not perfect

severe nymph
#

I have a feeling the recast is hosed

#

and nav needs to be regenerated

chrome spear
# winged badger when you set bNetStartupActor and bNetLoadOnClient true

Just curious about this. In this sort of situation with a net static actor. How do you differentiate an on rep being once the actors come back to relevancy or has been in relevancy? Because with a dynamic one or with net load on client off it will always retrigger the begin play, right?

severe nymph
#

net load on client just means the client has a copy on net load which calls "client begin play"

chrome spear
#

It also causes the client version to be removed when you’re out of range

severe nymph
#

meaning any "states" shouldn't be init on begin play

chrome spear
#

Because static net actors stay

winged badger
chrome spear
#

But they’ll just not be replicated

winged badger
#

dynamic actors are destroyed when not relevant and respawned when relevant again

#

which in turn causes BeginPlay to happen "again", but not really as its not the same instance as before

#

@severe nymph you got navmesh generated on client?

#

that is the second thing i can think off can cause this behavior

#

@chrome spear after the first replication of the Actor (which happens before BeginPlay) PostNetInit is called

chrome spear
winged badger
#

we use timestamps, and synced network clocks

#

so we can tell if the change happened recently, or half an hour ago

chrome spear
#

Ah okay, I just actually did that myself recently haha so that’s good to hear

#

I’m not sure if you’ve tested out level streaming or world partition in ue5 p2 but when level streaming is enabled, the client actor begin play happens before its onreps not after

#

So you don’t have any of your replicated variables in begin play

winged badger
#

all replicated variables are set, and all OnReps are called prior to BeginPlay

chrome spear
#

Not with level streaming enabled in p2

#

It’s bugged I think

winged badger
#

doesn't matter

chrome spear
#

Both are called in the same frame so onreps always come late

#

The values are all defaults and null

winged badger
#

PostNetInit is what calls BeginPlay on replicated Actors on clients

chrome spear
#

For static actors it doesn’t get called, it doesn’t seem

winged badger
#

and the initial replicated variables come in same package as instructions to spawn the replicated Actor, so one can't happen without the iother

#

static Actors are not spawned on clients

#

there is a difference

chrome spear
#

I’ve had to put in a time stamp to check if the onrep is directly after intialization

hard hinge
#

got like no idea why this is happening, been looking through the code but not finding anything useful sadly

[2022.04.02-00.33.54:519][136]LogSecurity: Warning: STEAMID:7777: Malformed_Packet: Received packet with 0's in last byte of packet
[2022.04.02-00.33.54:519][136]LogSecurity: Warning: STEAMID:7777: Closed: Connection closed

Anyone seen this before? All I'm doing is open steam.id_of_server and the server has this. My server is on linux.

chrome spear
#

Yes but the functionality changes between level streaming and a normal map. With world partition disabled it works as expected

#

Enable world partition and your onreps happen after begin play

winged badger
#

there is a bug i think

chrome spear
#

Yeah, I think so

winged badger
#

with streaming levels that are set to AlwaysVisible

#

basically, the visibility of the streaming level doesn't replicate correctly

chrome spear
#

So I’ve had to use time stamps just to check whether or not the onreps that occur within x time are first rep or not as it is

#

So I assume that’s fairly similar in concept to what you’re doing normally

severe nymph
#

@winged badger i've tried with it on and off

#

same behavior

#

I've also rebuilt it

#
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Client 1: true
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Server: false
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Server: false
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Client 1: true
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Client 1: false
LogBlueprintUserMessages: [BP_Ai_Male_C_0] Server: false```
winged badger
#

not there

#

project settings navigation

woven basin
#

Is there an generally agreed approach for β€œinstance” style dungeons in multiple open worlds? In single player I’d just load the player to another level/map. But is there a way to do this on a dedicated MP game?

severe nymph
#

@winged badger you talking about client side navigation?

winged badger
#

yes

severe nymph
#

of course you want this

#

its how sim proxies do movement prediction

gleaming kite
severe nymph
#

The thing is that with net load on client nav mesh disabled

#

and only a server copy of the ai

#

the client shouldn't be doing any CMC corrections on Server controlled AI

#

@winged badger

gleaming kite
severe nymph
#

The server reps AI position out to clients

#

not the other way around

woven basin
gleaming kite
#

Np

dark edge
obsidian gyro
#

I have a problem where The client can see the host's full head/gun rotation, but the host can't see the client's head/gun rotation, the clients bullets(which are shot from the rotation of its camera) are never able to shoot upward or downward because the host sees the clients head as not moving up or down, how do I fix this?

dark edge
winged badger
obsidian gyro
winged badger
#

Actor spawns on client on same position as on server (30ish UU above ground), next CMC Tick, the Actor starts falling on clients, as its in the air, as far as its local CMC is concerned

#

next server update correction happens, server update causes it to teleport it back on the navmesh

#

and it start falling again

#

movement updates from server don't arrive every Tick, and in between client CMC does its best guess, in this case best guess is that it should be falling

dark edge
obsidian gyro
spark owl
#

anyone know anything about overlap events on servers? they seem inconsistent

obsidian gyro
spark owl
# dark edge What's the scenario?

basically anytime I have my overlap events use switch has authority to make sure that it's only the server that's firing them, it just seems inconsistent for when it detects the overlaps, it will work sometimes but sometimes it won't, i don't know if this is relevant but the hitboxes are attached to bones of a skeletal mesh so they're constantly moving with the animations of the player model

dark edge
#

Could be tunneling

spark owl
#

at times very fasst

#

it's a soccer game

dark edge
#

Turn on CCD

spark owl
#

CCD?

dark edge
#

continuous collision detection

spark owl
#

i think I did

#

there's also another issue I have

dark edge
#

make sure you turn it on for both bodies you need to collide

spark owl
#

where sometimes the overlaps will trigger when they shouldn't

#

yes that's not the issue

#

it's that it works sometimes but not others

#

this is an example of the issue where it triggers when it shouldn't

#

i've had this problem for a long time, been trying to find a fix

#

i just asked because I've just had a hard time with overlaps running on server

#

for example in this game there is a slide tackle mechanic

#

there are hitboxes attached to the players feet

#

if overlap only runs on server it doesn't fire usually

#

basically when the hitbox overlaps the ball it runs a custom event

dark edge
spark owl
#

that gives it some impulse

spark owl
#

not a solution

#

i can't move it back that much

dark edge
#

It's probably a tick order thing.

#

basically it might be triggering overlaps 1 frame ahead of what's being rendered

#

how fast is the ball moving?

spark owl
#

fuckin fast at times

dark edge
#

Yeah i'd drill down and do some testing to make sure it's never physically ahead of where it's showing

#

is ball moved by Physics?

spark owl
#

yes

#

i was thinking the problem is something along what you said, where it's processing the overlap ahead of physics

dark edge
#

That smells like a tick order thing yeah

#

It's more that the physics is ahead of the rendering

spark owl
#

how can I mess with the tick order

spark owl
dark edge
#

Could be some physics settings you can tune though if this isn't it

dark edge
#

Make a testing setup that's less complex so you can rule things out

spark owl
#

good idea thanks

severe nymph
#

The client cannot have different properties for a server spawned replicated proxy

#

It’s a server authority spawned character class

#

With its walking mode set to Nav mesh walking as β€œdefaults”

#

The Nav mesh is generated on server β€œas the cmc is sending transforms”

#

And the nav mesh is net load on clients by default

#

If the character is placed in the level all is well

#

If it’s spawned by authority the client is falling spams

#

I’ve also debug printed walking mode with navmesh enum output on both the client/server

#

normal walking doesn't result in "isfalling" spams

#

navigation is on both client and server

ashen stone
#

and EndPlay is called only on client with Reason = Destroyed

#

the Channel close reason is 170, strange

ashen stone
#

i fixed, it was relevancy problem ...

obsidian gyro
#

I have a problem where the client is constantly moving slower(and laggier) than the host is, they use the same player character

#

Is there anything that could be causing this?

lavish minnow
#

has anyone done any large scale multiplayer experiences hosted on AWS, of up to 80~100 clients. (previously we have done smaller scale ones hosted on our own servers supporting ~30 people). Is 100+ clients a feasible thing for the default networking system to handle?

near bison
#

What's the correct class to add all my UI to player for multiplayer games?

kindred widget
near bison
#

just a screen UI

#

idk why I'm struggling.
just 1 (same) button on all clients

kindred widget
#

Sounds like some form of state based replication that calls HUD and adds it. Really depends on the button, what it's for and why it needs to be shown.

near bison
#

It's a settings button

#

I jsut want it on my client when the client loads up

#

Why is this so hard? and no, I'm not going to replicate anything for this

#

UI should be local only.

kindred widget
#

Then your issue isn't a multiplayer one. Add a widget to screen from where ever you manage your UI. AHUD is usually a good place for this.

near bison
#

I mean it is a multiplayer one, but that's the next step. I was trying to add my entire UI in my playercontroller so far

#

AHUD? Do I need to create a new HUD class?

lavish minnow
#

Spawn the widget in your pawn or player controller on beganplay?

near bison
#

i tried that @lavish minnow . you can't spawn widget like that in player controller

kindred widget
#

AHUD is a local only class spawned by the player's local controller. It's a good place to keep UI, because it cannot network, but everything still has global access to it through the local controller. One AHUD instance per player, per machine.

lavish minnow
#

you mean you want the server to trigger the appearance of the widget?

near bison
#

I don't, and I never will do that @lavish minnow (at least until the need comes up)

near bison
#

Is this ok or do I need to feed in OwningPlayer in the HUD class? does it implicitly resolve?

kindred widget
#

That's fine. Owning Player only matters with multiple players on same machine.

#

It'll run through the framework to find the local player for you and set it.

silent valley
near bison
#

how to get player state in HUD class

twin juniper
#

so PlayerController, Pawn

#

etc

near bison
#

does player controller implicitly get the local playter controller?

twin juniper
#

you could just get the owner

#

HUD Owner is always the player controller

#

i guess it's referenced in PlayerOwner

near bison
#

ok great.
now, I am trying to print something from local player state in my HUD. however, it does not give me the correct result. Basically, I get only one of my connected clients printing

#

Lol ok...looks like it's because PlayerState is not set on time

kindred widget
#

Playerstate requires time to replicate. If you have C++ access, it can be good to drop some delegates in GameState on the Add/RemovePlayerState functions.

near bison
#

I'm using Blueprints only

#

Can I not have an event on PlayerState?

#

But is the problem that I can't bind to that event because playerstate is not available in the first place?

#

This isn't gonna work is it

kindred widget
#

PlayerState Beginplay could, probably. Make a GameState delegate and have your PlayerState call it with passing Self through it.

#

Beginplay will never run on any system before a GameState is valid. So GameState is a great place to keep your core UI bindings that you have to rely on a replication chain for.

twin juniper
#

or you have OnRep_PlayerState

#

on Pawn/Controller

twin juniper
near bison
#

I don't see an OnReP_PlayerState in my pawn

twin juniper
#

C++ πŸ˜›

kindred widget
#

There is pretty much no BP access to the core framework stuff. Easy to override in C++, but BP only requires a little bit of workaround.

near bison
#

guys

#

please help me find an equivalent solution in BP, I'll be ever so grateful

#

I think this is the only problem I'll encounter in BP, starting state and setting up with UI

#

everything else is predictable/workable

twin juniper
#

Delay(10 minutes)

near bison
kindred widget
#

GameStateDelegates, Make two. PlayerStateAdded, PlayerStateRemoved, Call them in PlayerState's Beginplay and Destroyed events.

near bison
#

but how can I bind to that in my AHUD class? Because I don't know at that point the PlayerState right? The cast will fail

kindred widget
#

Game State. Not Player State

near bison
#

is gamestate available from the get go?

near bison
#

missed that, nice

twin juniper
#

just curious but what are u trying to access on your PS ? πŸ˜„

near bison
#

TurnNumber

#

if it's the current player's turn, then show UI elements

twin juniper
#

why u holding that on PS, it needs to be persistent across levels ?

near bison
#

no, just 1

#

the main level

twin juniper
#

then you can just hold it in your PC

kindred widget
#

No.

near bison
#

but why? i want my turnnumber to be replicated

kindred widget
#

Array of PlayerStates in the GameState.

twin juniper
#

You can replicate things in your PC

#

Pawn

#

etc

#

etc

near bison
#

why not playerstate?

twin juniper
near bison
#

does it matter though?

kindred widget
#

Depends on the game. If it's all players, I'd just drop an array of playerstates in GameState.

near bison
kindred widget
#

PlayerState is also used for player relevent data that all players need to know about that doesn't belong on Pawn.

#

I meant an ordered array in the order of your turns.

twin juniper
twin juniper
#

than Pawn or PS

kindred widget
#

Player Controller really has no business holding anything UI related most of the time.

twin juniper
#

that is holded by the PC ?

#

so ?

kindred widget
#

Well lets just fucking network all UI through the GameMode then. It spawns the GameState.

twin juniper
#

Or just using things as they should be used

#

πŸ‘

near bison
#

ok guys I hav a good solution. works fine for now.
hear me out:

kindred widget
#

PlayerController is a networking and input handling class. It has no business messing with UI.

twin juniper
twin juniper
#

GameState

#

etc

near bison
#

in game state I call an event when all player states are ready.
I bind to this event in my HUD class. BOOM. works like a charm.

kindred widget
#

PlayerState is a class meant to hold data per player. GameState is a class meant to hold data about the game.

twin juniper
#

but yeah ok

#

anyways πŸ‘

#

i don't see at any point why you would need to hold a non-persistent UI data on player state, it does not even need to be relevant but anyway

kindred widget
#

Out of curiosity. Where would you store a player's current level's score that doesn't move to the next level?

kindred widget
#

And how are you planning on letting Player 2 know what Player 3's score is?

near bison
twin juniper
#

UT4 does it

near bison
#

btw. @kindred widget
This is the most useful statement I have ever come across on this channel:
"Beginplay will never run on any system before a GameState is valid. So GameState is a great place to keep your core UI bindings that you have to rely on a replication chain for."
I can literally bind whatever events I want via this

twin juniper
#

that's not because your "Blueprint Tutorial Series" on youtube told u to put everything related to your player on PS that this is a good thing

near bison
near bison
kindred widget
#

You still haven't answered the question. How are you going to tell Player 2 what Player 3's score is?

near bison
# twin juniper was not talking to u tho

yeah i get it i get it, just saying that i dont like what unreal has done with all of these abstractions.
didn't they prune GameMode and GameState to GameModeBase and GameStatebase. We need more like that

chrome spear
# twin juniper ShooterGame does it

ShooterGame stores kills and deaths on the playerstate, the gamemode or gamestate then iterates through all of them on match end to generate a score

#

it's not on the pc, there's some variables on it for internal tracking i think

near bison
#

btw if I ever have bots, will they also be using playerstate?

kindred widget
#

If their set to request them.

pallid mesa
#

you can yes

kindred widget
#

PlayerState has a IsBot function you can call to test if it's a player or AI

near bison
#

ok. Right now I am hardcoding playerstate.length == ExpectedPlayerCount. If I have bots I want that to add to playerstate too

chrome spear
#

and there's a setting, I think in the ai controller to make it have its own player state

pallid mesa
#

specially if you want them to have score/name

#

it's handy

near bison
#

guys, I fixed blueprints for multiplayer with this one sequence. do I call tim

#

I can bind whatever events I want now anywhere because I have my playerstates ready

#

wow

pallid mesa
#

that's indeed Timothy

near bison
#

this should be out of the box in BP. I think it is for C++

#

I. need. more. events. to. bind. to!

pallid mesa
#

theorically using Jambax idea you get rid of this problem

#

specially since it's a subsystem that you'll be able to access everywhere

#

doing it blueprintable won't be much effort

#

it just requires some C++ here and there + the subsystem

near bison
#

it's fine. i don't think i'll have the problem anymore with the above setup ^

#

I'm just gonna safely wait for all clients to connect and their playerstates be ready before I do anything in game

#

just gonna add a "Waiting for all clients to connect..." UI before the event fires

#

ez. why complicate anything

pallid mesa
#

πŸ˜„

near bison
#

anyway blueprints for mp sucks. not gonna reinvent the wheel XD

#

btw just out of curiosity, if a client disconnects and reconnects, his state is taken care of right? (if all the needed vars are replicated?)
How is this handled

pallid mesa
#

when a client disconnect their player state stays around for some time

#

so indeed you can support reonnections i believe implementing OverrideWith

#

but not sure to what extent that exists in BP's πŸ˜…

near bison
#

i'm losing hope

#

can I not build a production ready game iwth BP

#

I'll probably tackle this when we get there

#

hopefully isn't too hard

twin juniper
#

but i would still use cpp if i was u πŸ˜› (when u got time. don't abandon your current project to learn cpp)

#

so you can explore the engine source code and understand how things does this and that out of the box !

hallow summit
#

How do I wait to spawn players till all clients are loaded in to the level?

bleak cargo
#

C++ only multiplayer hud.
Hello, I wonder if it is possible to set multiplayer inventory (I have one variable containing pickuped items) and own HUD for all the clients without adding a lot of extra classes (atm all logic - interwaction, hud is in Character class).
When there is one person on the server its working just fine, but when its 2+ -> everyone share the same hud (i have hud prompt for interaction and when one person wants to open the door everyone have this prompt) and when i try to pickup item item is picked up but nobody have it.
All tutorials that I was able to find use BP for this logic ;-;
I really dont want to change much the logic i already have ;/
I would really appreciate it if somebody could answer me some question on pm

fathom aspen
near bison
#

Is there an event I can listen to on the server after a variable has replicated to all clients successfully?

bitter oriole
near bison
#

Can I do something like this? @bitter oriole

#

So in repvar, once it successfully replicates, (on the local player) call an event

bitter oriole
#

Yes, if you really need that

near bison
#

@bitter oriole may I walk you through my use case, you can suggest your best approach after listening to mine

bitter oriole
#

I guess

hallow summit
#

Is there a way to wait for all clients to load level before beginning play?

bitter oriole
#

No, but you can have each client send a "I am ready" event to the server that calls a "real begin play" event once everyone is there

near bison
#

@bitter oriole

  • in GameState, wait for all clients to load (by checking length of PlayerArray),
  • Function to set turn order of all players (this is a board game),
  • In function, get all PlayerStates, set a RepNotify'd var called TurnNumber,
  • In TurnNumber repNotify (on player state), enable my UI on HUD
bitter oriole
#

Okay, sounds good

near bison
#

That's it..works most of the time, but got this error once
Blueprint Runtime Error: "Accessed None trying to read property GameState". Blueprint: KTHUD Function: Check if My Turn Graph: CheckIfMyTurn Node: Return Node

#

I'm setting the GameState way before calling this function though

bitter oriole
#

You can only call server events on player controller, player state, possessed pawns, and objects they own

near bison
#

But HUD does not exist on Server right? I'm calling this from HUD

bitter oriole
#

Obviously HUD cannot have server events

hallow summit
bitter oriole
#

But neither can game state

bitter oriole
near bison
#

@bitter oriole can I not bind to a GameState event from HUD?

bitter oriole
#

You can only call server events on player controller, player state, possessed pawns, and objects they own

#

Other objects cannot have server events

#

Dunno if that's your issue here

near bison
#

No it isn't, I can still bind to events on Game State in my HUD. GameState is replicated

bitter oriole
#

Okay, but consider this: You cannot have a Server event in GameState

#

Just checking if you tried doing that

near bison
#

What are you talking about though? The event I'm listening to is client sided

#

i.e GameState pushes out an event on multicast for all clients to listen to

bitter oriole
#

Okay then, so it just sounds like your KTHUD is reading game state before it replicates, then

near bison
#

Do I need an event dispatcher for when game state is ready? :/

#

Does HUD load first?

bitter oriole
#

There is never any guarantee on timing

#

You can poll it on Tick, or use another event

near bison
#

Looks like I'll have to use an event, sigh

#

hahahah but the question is, how do I even listen on that event if the GameState doesn't exist yet?

#

lol

#

Where can I reliably acccess GameState without race conditions again?

#

If Pawn exists does that mean for sure that GameState exists?

bitter oriole
#

Tick, get game state, is valid

near bison
bitter oriole
#

Why would it be better?

near bison
#

tick on every frame 😦

bitter oriole
#

Being afraid of Tick is a disease

near bison
#

Yes but I have to bind to a function after. I wouldn't wanna do that in Tick right?

bitter oriole
#

You could do the binding and then disable Tick

near bison
#

I'm calling Delay right now in BeginPlay, so that the handlers don't get registerd again later

#

Why disable tick though? What if I need it for later

bitter oriole
#

Delay is almost never a good solution

near bison
#

why?

#

Disabling tick sounds worse to me

#

What if I want it for something

#

Also how do I disable*** tick?

bitter oriole
# near bison Disabling tick sounds worse to me

i'm assuming you only need to bind your listener once, and that you don't currently use Tick, so in this context I'm suggesting something like "wait on tick for a valid game state, bind your stuff to it and then either check if you're bound alreayd, or disable tick"

#

Delay in multiplayer is terrible because you're assuming a given time is going to be enough

near bison
#

Yes but I'm putting delay on loop

#

πŸ™‚

bitter oriole
#

Just use tick

near bison
#

I am very averse to using Tick, sorry.

#

And this will work fine

#

My problem is not here anyway

bitter oriole
#

Like I said, this stuff is a disease

near bison
#

nah

#

tick leads to more problems the way I see it, I don't wanna accidentally keep registering listeners and then having memory leaks

#

I've had it happen before

#

Having any logic to register an event listener frame per frame is a bad solution

#

Even if there are checks in place

bitter oriole
#

Right now you literally have a tick that ticks only 10% of the time

#

So I'm not sure how you think it's somehow different

near bison
#

because it safeguards me against memory leaks

bitter oriole
#

You literally can't leak memory in Unreal

#

Even in C++ it takes some serious stupidity

#

Anyway, not my code, not my problem

near bison
#

it doesn't matter anyway

#

tick 10% of the time doesn't sound too bad πŸ™‚

#

Do I have access to the variable that just changed in OnRep?

kindred widget
near bison
#

Can you help me solve my problem if I quickly mention my use case?

#
  • in GameState, wait for all clients to load (by checking length of PlayerArray),
  • Function to set turn order of all players (this is a board game),
  • In said function, get all PlayerStates, set a RepNotify'd var called TurnNumber,
  • In TurnNumber repNotify (on player state), enable my UI on HUD
bitter oriole
#

You haven't explained what the problem is in those four statements

near bison
#

I can't do the last step

dusky yoke
#

Do you guys have any tips on what to troubleshoot if I'm trying to host my game with Advanced Sessions Steam API, and my friends can't see the server? When they host on the other hand it's fine. They're both situated in Netherlands, not sure if that has anything to do with it, but yeah

#

I've tried disabling my firewall and exiting my editor while testing

kindred widget
# near bison - in GameState, wait for all clients to load (by checking length of PlayerArray)...

First off. Start by putting the function in GameMode. GameState should never have this logic as it's a server authoritive thing. GameState's functions should be things that even clients can call, maybe filtering functions for game state's data, etc.

Regardless of the upper point. You'd need two OnRep for this to be solid. One OnRep for the Player's Turn, and an OnRep for the GameState's CurrentTurn. Both should call HUD, or have bindings that a widget or HUD can use to show/hide things based on if CurrentTurn from GameState == Turn from the PlayerState

near bison
#

@kindred widget

You mentioned this right? Does this apply for ALL begin plays? Including HUDs, playerstates etc?

kindred widget
#

Every single Beginplay applies to this. GameState sets a value in the current World. The World holds whether it is ready for beginplay. When GameState starts up, it will get all current actors in the world and broadcast Beginplay to them. Or more accurately I think it has World do this, and then World sets it's HasBegunPlay value to true and from then on every time World spawns an actor, it calls BeginPlay on it directly after it's done spawning.

near bison
#

Including HUD right?

kindred widget
#

Every Actor

near bison
#

HUD is not an actor though right?

kindred widget
#

AHUD, it's an Actor spawned by the Player Controller locally for the client.

near bison
#

ok thank god

kindred widget
#

People name some of their widgets Hud. Not to be confused with AHUD which is an actor.

near bison
#

So is this the right one? (The one that waits for GameState)?

kindred widget
#

Yep. Blueprint.. very stupidly removes class prefixes. Mildly annoying.

near bison
#

For example HUD, print "Hello" ONLY on my local client?

kindred widget
#

That is a very easy and a very hard question to answer at the same time.

#

HUD for instance is local only. It has no networking. If you get HUD on a machine, it belongs to that machine and has no version on another machine.

near bison
#

Then why is my "Hello" printing on all clients?
Client 1: hello
Client 2: hello
Client 3: hello

is that an Unreal thing? Showing logs of all clients on 1 client's screen/

kindred widget
#

What event did you print Hello on?

near bison
#

BeginPlay

#

I guess, cause it runs on all clients right

kindred widget
#

It's more of a PIE thing. Prints run on all viewports. What you're seeing is each client printing once.

near bison
#

But how is it printing on all clients if HUD is only on 1 client

kindred widget
#

HUD is on every client. One per client, non replicated

#

One AHUD per player, per machine.

near bison
kindred widget
#

A Dedicated server has no players, and has no HUD. A Coop game with three people has one machine, but still has three HUDs

#

This is what I meant by easy but difficult to explain. πŸ˜„

near bison
#

No I got what you're saying, the other 2 connected players have Actors spawned on my local machine

kindred widget
#

No, not in your case.

#

You're misunderstanding the prints in this case.

#

For example, put a print in your Pawn's beginplay.

#

If you have 3 clients on a Listenserver, you'll see 9 prints.

#

AHUD will have 3 prints, Player Controller will have 6 prints

#

You're seeing a print from every version on every machine when testing in PIE.

near bison
#

using dedicated, not listenserver

#

So why did Pawn print 9 with 3 clients? Shouldn't it print only thrice because pawn is locally owned only?

kindred widget
#

In that case, you'll see 12 prints for Pawn, Still 6 for Player Controller and 3 for HUD

#

Like I said, you're seeing a print for every version of that actor on every machine you're simulating.

#

When you have 3 players, every machine has to have a version of that Pawn. So...
Server, Client1, Client 2, Client3, all have a version of Client 1's Pawn.
Server, Client1, Client 2, Client3, all have a version of Client 2's Pawn.
Server, Client1, Client 2, Client3, all have a version of Client 3's Pawn.
12 prints

near bison
#

But I thought Pawn is something that's only locally owned, Why would BeginPlay print for Client2 and Client 3 on Client1's machine?

kindred widget
#

Beginplay runs on every machine the actor exists on.

near bison
#

Ok so just to be clear, when there are other players in game, their objects are also considered Actors, in essence

#

Do I have that right?

near bison
kindred widget
#

Pawn is a class that can be possessed by a PlayerController for input.

#

Usually a Character in Unreal games.

near bison
#

Ok so, 6 for playerController because:
Server, Client1, all have a version of Client 1's Controller.
Server, Client 2 all have a version of Client 2's Controller.
Server, Client3 all have a version of Client 3's Controller.

kindred widget
#

Correct, cause other clients do not have a version of other client's controllers.

near bison
#

Fantastic

#

Ok so, 3 for HUD because:
Client1, all have a version of Client 1's HUD.
Client 2 all have a version of Client 2's HUD.
Client3 all have a version of Client 3's HUD.

kindred widget
#

Yep.

near bison
#

So now I'm confident that my event handler in HUD is being bound only once, even though it's in BeginPlay. so that's good.

kindred widget
#

If you're ever in doubt, test by disabling the RunUnderOneProcess setting. It'll make clients run in Standalone mode.

near bison
#

Let's tackle the next problem, if you don't mind

kindred widget
#

Prints are process specific and PIE simulates all machines under one process so to speak. So in PIE, client 1 can see Client 2's prints, etc. In Standalone, it separates that out.

near bison
#

If we solve this I'll get a very good grasp of what to do to avoid these nasty race conditions

#

So now, in my GameState, I am looping through all PlayerStates and setting their Turn Number

#

When I know my turn on my local client, that's where I decide whether to enable or disable their own HUD.

#

So naturally for ease of use sake, I want to hook into OnRep of TurnNumber in PlayerState so that I don't have race conditions

kindred widget
#

Personally. Like I said before I would just drop a delegate in the GameState for OnCurrentTurnChanged, and one in the PlayerState for OnPlayerTurnSet.

Make Set functions for your Turn variables in both classes and call these delegates after setting the value.

Have a function in AHUD that GetGameState->GetCurrentTurnNumer == GetLocalPlayerState->GetPlayerTurn. If this is true, show your widgets, if this is false then hide your widgets.

Have HUD's Beginplay GetGameState, and GetLocalPlayerState, and bind those two delegates and then also call the function you made that does the check.

#

Now, regardless of what happens in whatever order, your HUD will set things to display correctly.

near bison
#

So, the OnRep_CurrentTurn works fine, because there are no race conditions well into the game.

#

I'm looking into what you said with OnPlayerTurnSet

#

Already have the function you mentioned in my HUD

#

Now my problem actually lies in this part:
Have HUD's Beginplay GetGameState, and GetLocalPlayerState

What if I don't have the LocalPlayerState in my HUD begin??

kindred widget
#

Same thing. You bind to the GameState's PlayerStateReplicated thing.

near bison
#

Like this?
This is in GameState

#

And then I bind to AllPlayerStatesReady in HUD

kindred widget
#

Maybe. Personally, if this was me, I would make a throw away widget for it. Initialization is fucking annoying. You know that Local PlayerState will arrive at some point. I would just plaster a widget up that says "Waiting for game to start", or whatever. Tick whether the game is ready. Then make a call to whatever to bind your delegates. Once that's done, you can throw this widget away, which will stop it's tick.

near bison
#

Should I use a delay instead of Tick?

kindred widget
#

Same thing in the end.

near bison
#

Ok so now my flow is:
When all player states ready, I get local player state in HUD and set it in a var

kindred widget
#

Blah blah, delay is probably faster cause bp tick, something something performance, cause doing stuff the hard way is better, use timers, cause they're so much neater, etc etc. I'd just tick it. They're very simple fast checks that not even a phone would recognize in BP.

near bison
#

But the problem is: now has my TurnNumber finished replicating or not?

#

Now you want me to have another delegate in PlayerState correct?

kindred widget
#

Doesn't matter if the turn number has replicated or not. That's why you both bind and call the update function.

#

Only thing that matters as far as initialization is that you have a valid GameState, and LocalPlayerState on that client that you can bind things to.

#

After that, replication will take care of the rest just from calling that function post binding and on each binding.

near bison
#

Actually, wait what? I tried playing like 10 times. Like 3 times local player state wasn't there

#

Guess I have to do this then? lol

pallid mesa
#

@near bison initialization code pursues you

#

🀣

near bison
#

hahahah

pallid mesa
#

told you

near bison
#

it's ok, this ^ of mine works all the time

#

Just delay until player state is available locally.

#

Working 100% of the time.

#

Done.

#

Now what's the final step?

#

How do I hook into when TurnNumber is correctly replicated on my client?

pallid mesa
#

onrep

kindred widget
near bison
#

Yep, I've done all of this.

kindred widget
#

This should be all you need in HUD. Replace the prints with calls to show or hide the HUD.

near bison
#

Question is ,when do you Call OnPlayerTurnSet in PlayerState?

#

How do you know when the PlayerTurn has successfully replicated?

kindred widget
#

The OnRep.

#

Default Value for turns should probably be set to something you'll never use for turn number, like -1.

near bison
#

Done done

kindred widget
near bison
#

So I think what's happening now is:

#

(since it isn't working)

#

My OnRep fires the call BEFORE my player state is bound in HUD i presume?

#

Yep I can confirm that's what's happening @kindred widget

kindred widget
#

Which is fine.

#

Sometimes it won't. That's why you call the update function after the binding calls. No matter what happens, at some point in time, something will update this to the correct state.

near bison
#

No but my button isn't appearing. So clearly the order matters doesn't it?

#

Which update function?

kindred widget
#

If you set this up like these images, and cannot see the button, then for some reason your client has been told it has a different turn number than the current game's turn number

near bison
#

Yeah I missed the second part of your sequence

#

Implementing it now

#

lol this...is so weird

#

I am calling SetLocalPlayerState() (to a local variable) and THEN in the second sequence calling UpdatePlayerUI for turn

#

Why is the function saying the localplayerstate is invalid???

#

Does sequence not run...sequentially?

spark owl
#

so I have collision hitboxes attached to different bones of a skeletal mesh, I'm wanting these collision boxes to trigger overlap events, the problem is that it seems like the hitboxes do not move with the skeletal mesh on the server, so when I have the overlap events run only on the server, it doesn't work as it should, it's like the hitboxes don't move with the animations even tho they are attached to the skeletal mesh. Does this make sense to anyone? This is the conclusion I came to but i'm not sure if it's right

#

i wonder if there's a way I can make the server factor in the movement of the animations so the hitbox moves accordingly

pseudo merlin
#

Anyone have thoughts on a good time to write client persistent stats to disc on a multiplayer game? The most obvious route I think is on round end, but if that leads to map change there could be instances where client is still writing on map change. Do servers wait for all clients to confirm they are done writing?

chrome bay
#

Well if you're storing it client side it doesn't matter right?

pseudo merlin
bleak cargo
#

Destructible Object on Multiplayer.
Anyone know how to delete an item after is destroyed? I need solution for LATE JOINING into the game, every new player can see this object and interact with it. I have no issue with other object such as bullets or pickup items when client late join. But i cant hide/destroy permanently Destructible Object ( even GetWorld()-> DestroyActor(this) do not work)

chrome bay
pseudo merlin
#

Ok cool! Thanks

chrome bay
oblique flicker
#

Hi guys! I have a small problem and I'm kinda stuck. I'm trying to automatically change the map when the round is over. Server side running on a dedicated server(so the host,player, can change the map). I've seen some docs about travel and seamless, but I saw that you can change one map, not more. I have multiple maps for 1 gamemode. Right now I'm using reset game. Thank you!

chrome bay
#

Just use the ServerTravel feature to move to the new map

#

And be sure to enable seamless travel

oblique flicker
#

I know that, but after the next map is changed, the round will be over on that map and then I need another map. That's why I'm asking. I have 7 maps for that gamemode

severe nymph
#

@winged badger btw

#

Disabling client navigation fixes the issue

#

But the issue is I need this for ai auth only spawned characters

winged badger
#

that just sounds... wrong

#

we have client side navmeshes and autonomous proxy predicted movement with pathfinding

winged badger
#

we had that jitter issue, but only because CMC on clients started in wrong movement mode

severe nymph
#

Easy mock-up

#

Blank thirdperson template

#

Slap in map

#

Set navmesh walking on the aibase

#

Project settings β€œclient navigation”

#

Toggle it on and clients will print β€œfalling”

#

In animbp

#

Be sure to enable ai controller possession for placed and spawned in world

#

Test β€œas client”

chrome bay
#

Or at least, the MatchState will change. You may need to handle your custom logic in the various overridable functions in the GameMode class, though I'm not sure how many of them are exposed to BP.

severe nymph
#

@winged badger I use client navigation for teleport btw

#

For vr players

mortal kernel
#

How can I make sure things that are being executed in repnotify also work in singleplayer? Should I just set it or is there some cool trick I don't know of?

severe nymph
#

So disabling at project level isn’t an option

#

Need to find out why navmesh walking on server spawned AI is doing this

#

Shouldn’t have to use β€œwalking”

oblique flicker
chrome bay
#

That's fine, I use the same mode for my maps also

winged badger
severe nymph
#

@winged badger I'm printing it out

mortal kernel
winged badger
#

that means no

severe nymph
winged badger
#

BeginPlay -> GetMovementComponent -> SetMovementMode (NavWalking) and reenable client nav

mortal kernel
#

Some people told me it wouldn't because they are brought into the new world as is

severe nymph
#
LogBlueprintUserMessages: [BP_AIBase_C_0] Client 1: Navmesh Walking```
#

@winged badger

winged badger
#

which is not even remotely the same as printing out DefaultLandMovementMode

severe nymph
#

what?

#

the base class CMC component default is nav mesh walking

winged badger
#

DefaultLandMovement mode is not MovementMode

#

so do what i told you, exactly

severe nymph
#

wtf

chrome bay
#

Have to give it a try

severe nymph
#

the "movement mode" is ignored on clients when spawned from the server?

#

really?

winged badger
#

they will always call BeginPlay if class has changed

faint eagle
#

is CMC's saved move expected to be replicated to other clients? for some reason I can see sprinting animation only on owning client and on server but not on other clients

mortal kernel
severe nymph
#

server spawns them as "navmesh walking" for "movement mode" server and client prints navmesh walking as "class defaults"

#

but client still loads as walking

#

thats retarded

winged badger
winged badger
severe nymph
#

thanks bud

#

i really appreciate it

#

beating my head against a wall on this

faint eagle
#

so do I have to replicate the bSprinting variable by myself with UPROPERTY(replicated) then or is there anything else to do with FSavedMove to replicate it to simulated proxies as well?

winged badger
#

they just need the speed, really

#

acceleration if you're using it, but yeah

faint eagle
#

well in my case sprinting variable is used in anim BP so i need that variable

winged badger
#

just don't try to replicate it inside the anim BP πŸ˜„

faint eagle
#

it won't work at all as far as i know

bleak cargo
bleak cargo
#

its on the scene from the beginning of the game, i can destroy it and every client (that is at this moment in the game) can see its destroyed and fading away

#

but when i late join, new client can see and interact with it

winged badger
#

in that case ULevel should handle the destruction

severe nymph
#

damnit

#

ignore that

#

didn't fix

winged badger
#
/**
 * Stored information about replicated static/placed actors that have been destroyed in a level.
 * This information is cached in ULevel so that any net drivers that are created after these actors
 * are destroyed can access this info and correctly replicate the destruction to their clients.
 */
USTRUCT()
struct FReplicatedStaticActorDestructionInfo
{
    GENERATED_BODY()

    FName PathName;
    FString FullName;
    FVector    DestroyedPosition;
    TWeakObjectPtr<UObject> ObjOuter;
    UPROPERTY()
    UClass* ObjClass = nullptr;
};

    UPROPERTY(Transient)
    TArray<FReplicatedStaticActorDestructionInfo> DestroyedReplicatedStaticActors;```
severe nymph
winged badger
#

so im thinking you did something unspeakable there @bleak cargo

bleak cargo
#

maybe, cuz its my first time using UE4, and its hard to find any tutorials in c++ only for multi

#

making single was pretty ok, but with multiplayer, everything gets super messy...

severe nymph
#

@winged badger I even tried setting in constructor

winged badger
#

did you turn client navmesh back on?

severe nymph
#

yes

winged badger
#

@bleak cargo so its part of the level - static Actor, and you're destroying it with destroy, you don't do TearOff, you don't turn its replication off? Is it replicated?

severe nymph
#

they be jumping πŸ˜›

winged badger
#

i can't see any of that, nor do i have any idea what that print is

severe nymph
#

its sooo funny to see them hopping around 🀣

#

the print is "cmc is falling"

#

spamming between true/false

bleak cargo
severe nymph
#
LogBlueprintUserMessages: [BP_AIBase_C_2] Client 1: Navmesh Walking
LogBlueprintUserMessages: [BP_AIBase_C_2] Client 2: Navmesh Walking
LogBlueprintUserMessages: [BP_AIBase_C_2] Client 3: Navmesh Walking```
winged badger
#

are they jumping or jittering?

severe nymph
#

yup

winged badger
#

its an or question πŸ˜›

winged badger
#

their feet should ne on the green plane, not the floor

severe nymph
#

your just telling me something I already know

#

lol

#

they are "falling" or "jumping"

#

and they will never "walk on" the green mesh

#

they approximate the floor

#

it works correctly with client navigation off

#

if the server is the "only thing" nav walking

winged badger
#

youre not giving me much useful information here

severe nymph
#

I've given you a complete mockup

#

prints of all logic

winged badger
#

video

severe nymph
#

1 sec and I'll zip the dang thing up

winged badger
#

i w9ont download or open it

severe nymph
#

you want me to record and upload the video here?

#

or you want me to jump in a chat

winged badger
#

video here

severe nymph
#

@winged badger

winged badger
#

well, one bit of good news is you can't use NavWalking for VR

#

it would look silly

severe nymph
#

what?

winged badger
#

you can pathfind with normal walking

severe nymph
#

you need client side nav mesh to get "navigatable radius"

winged badger
#

NavWalking is more performant, but they walk in the air

severe nymph
#

I'm not going to rpc to the server for that

winged badger
#

30cm off the floot

#

which can pass with isometric or top down camera

severe nymph
#

I draw and trace the arc with client side logic

winged badger
#

but not for FPS, TPS or VR

severe nymph
#

look

#

I've been doing this a very long time

#

I appreciate you trying to help

#

but your wasting my time

#

have a good day

winged badger
#

i don't know how to debug this with blueprints

#

c++ data breakpoint on MovementMode

severe nymph
#

I'm not blueprints only

#

i'm cpp also

winged badger
#

callstack to see what causes the change

severe nymph
#

again I'm a senior unreal dev I have access to source and can look there too

#

I simply posted the video to appease you

#

because i felt you were calling me a liar

winged badger
#

you did give me distinct blueprint only impression

severe nymph
#

again ... have a good day

#

you assume

winged badger
#

c++, data breakpoint the movement mode, examine callstack

severe nymph
#

which is offensive

#

assumptions are for "a-holes"

#

ever hear that?

#

if you check out my git you'll see I'm not simply a blueprint warrior

#

but its cool

#

again... thanks for "trying"

#

my point was "this is whats happening" and instead of looking at what was presented you "made assumptions" you knew better

#

"I have projects .... thats impossible... that seems wrong"

#

etc

#

your ego dude

winged badger
#

your animation blueprint is throwing conclusions off

severe nymph
#

check it

winged badger
#

can't see if they are actually jumping or jittering

#

which is an important distinction here

severe nymph
#

the animbp is default vanilla

#

and in the video anyone with eyes can see them in the jump loop