#multiplayer

1 messages · Page 699 of 1

ashen stone
#

Nice 🙂

#

If you want, you can play my mmo on unity

#

it is online right now

#

anyway, thank you for your response

timber anchor
#

Hey guys, i'm currently testing with steam and andvanced session, but the client has this stuttering movements, anyone knows why? ^^ Ping was 9999 tho, makes a bit of no sense

twin juniper
#

Hi guys, any tips for replicating physical objects that get thrown around? what would be the best approach

dark edge
#

You can just replicate the physics movement, tune it in project settings under "Physic Replication Settings" yes it's a typo but that's what it is.

twin juniper
#

@dark edge I would say something like in the game portal where u pick up an object and launch it

#

Not sure about prediction but I want clients to see the same thing

#

I guess I could replicate the movement but would it be too heavy if there are like 20 physic objects in the map?

twin juniper
#

K what about 60 👀

#

Don't they get track every tick?

dark edge
#

Idk, go test it. You can set the replication rate yourself.

twin juniper
#

Which setting would that be? Sry first day doing multiplayer

dark edge
#

If it's your first day doing multiplayer I 100% cannot recommend trying to do multiplayer with physics.

twin juniper
#

Also the server side sees jitter, I change some setting and make it better but still not smooth as client to client. I suppose this are common problem?

dark edge
#

I'm assuming you are using a character that uses the character movement controller? So you have kinematic movement but also physics involved? That sounds like a nightmare

twin juniper
#

I'm using Advanced locomotion system 3

#

Most of the stuff r replicated already

dark edge
#

That's prolly kinematic. I'd reconsider using physics unless your game is centered on physics and just treat things as projectiles instead.

twin juniper
#

Yup that's what I want, a projectile

#

Prefer if it behaves like a physict object tho

#

The ghost would be throwing things around the map

dark edge
#

This sounds like a absolute pain in the ass to get working smoothly in a multiplayer setting, good luck

twin juniper
#

Kay, thx for the answers

#

Oh btw do u know what I can tap to fix the jitter issue on server side?

#

Client to client sees everything fine

dark edge
twin juniper
#

Not the objects it's the player movement

dark edge
#

Oh no clue, I'd ask in the ALS forums. You're saying everybody sees everybody else butter smooth except for the host?

#

You aren't replicating input, correct? You are just applying it to the movement system locally and letting it handle the replication?

twin juniper
#

The problem isn't limited to ALS, even the default TPS suffer the same issue

dark edge
#

I've never noticed it, does it happen in a bone stock template project?

twin juniper
#

I will check now

#

it has something to do with FPS too

#

Yup it's the same thing

#

U can just start from Third person template. Launch as listen server with 3 players. Then watch movement on every window. Clearly client to client side is smooth while listen server sees jittering

#

this has been a common problem in multiplayer for soo many years without a lot of people addressing it. Kinda what dissuade me to work on MP before, but i just hope dedicated server fix this issue (maybe that way the player 0 doesn;'t have to play as listen server)

dark edge
#

We've never noticed it but we also only ever test by launching. Might be a pie thing

twin juniper
#

👀 so u test the game with package or launch everytime?

#

doesn't that take ages

thin stratus
#

Launching is just right clicking the uproject file and clicking launch. Or even faster making a bat file and using that.

#

Packaging, based on your team and project might be done over night by a build machine (:

#

The ListenServwr jitter issue is annoying. I looked at it in the past but couldn't figure it out either. Only thing I always change is the ticking of the pose through net updates. Idk what solution I did in the end...

pallid mesa
#

I gathered some notes here in the past from an analysis a slackers user did

#

ofc I couldn't verify this myself, but maybe this enlightens the situation

royal vault
#

Hi Adding Statitc Mesh Instances with an rpc seems to be working fine on both client and*server

#

However

#

Removing instances

#

with onrep or multicast

#

isnt being shown on clients

#

only the server can see the changes

#

those onreps and multicasts are all being fired on server btw

#

Any ideas on how I can get the client to see the changes?

#

If i print out the changed values from the client

#

they are all seemingly correct

#

its just the client cant see the physical changes

slate basin
#

Hey, does anyone know what's the best way to have a spectator pawn that you can fly around with?

#

Do I have to use the floating pawn? Since the spectator pawn doesn't seem to only let your focus on other players

low helm
#

You can just make your own

#

Set actor location on tick, location+momentum*worlddelta

#

But floating pawn should be fine too

#

Just remember that all non characters don’t come with proper server correspondence, so the server won’t know where you are by default, which means other actors won’t properly net distance cull

#

Without a solution

low helm
#

There are lots of little problems with your setup, removal of indeces can cause 1000 problems in multiplayer

#

Also, the multicast is sending clients a reference to the ISM that I suspect is not valid because instanced static mesh probably isn’t replicated

#

I have a lot of experience with replicated ISM crap, it requires some unusual approaches

#

Like setting scale to 0 instead of deleting

#

PM me for more follow up

peak star
#

What's in your opinions the best way to manage a project so you can build it for Steam on PC and for non-steam on Android (since having Steam online subsystem makes it unable to build for Android)?

ashen stone
#

Is it possible to make PreLogin async to check for credentials on database first?

ashen stone
#

Is setting the player pawn to spectator until auth accept him the right way on unreal?

sinful tree
peak star
#

Would I need to split it into two different projects? Is there a way to tell the build process to include or exclude Steam OSS when i build? Or do I have to have that in place or not when compiling the project rather than building the app it makes?

ashen stone
#

Search for conditional compilation

blissful totem
#

When doing multiplayer tests in the editor, the state of the game seems to shift when I enter simulation mode. Why is that exactly? Is the simulation acting as a client or something?

neon ether
#

Question: if you call a function from within a server rpc, does the function called also only get ran on the server? If the method is being called by using a passed in actor reference and that reference is being used to call the function does the role of that actor matter, and if so what ways does it matter?

kindred widget
#

The actor pointer you pass gets compressed into a NetID and uncompressed on the other side of the RPC before the function call. This only works for replicated actors. Once you are in the body of the ServerRPC, you're on the server machine.

#

Generally passing a pointer that gets resolved into a NetID and back into a pointer is safe for client to server. You have to be careful with this for server to client though as the RPC can reach the client before the object has a chance to replicate there, leaving your pointer null on the client.

#

As for the role of the actor mattering. Not really. You sent an actor pointer from client to server. It's role on the client is irrelevant as long as it is a replicated actor.

knotty mason
#

hey everybody!

i want to set gravity off (extremely preferably only in c++) for only one client, but PlayerHost->GetMovementComponent()->GravityScale = 0 works only on server (and afaik it turns gravity off not only for PlayerHost, but also for all clients) -- how can i turn gravity off only for 1 client and not for anybody else?

neon ether
gritty pulsar
#

Hey, has anyone used Keycloak or something similar for login? I was planning to use Amazon Cognito but not being able to export users gonna be a problem in the future.

peak sentinel
knotty mason
peak sentinel
#

CMC does not allow that type of movement

kindred widget
#

It does.

knotty mason
kindred widget
#

Movement Mode flying.

peak sentinel
#

I didnt understand if client wants to be somewhere else while server seeing it in somewhere at first reading, sorry

#

I hit the language barrier on the last sentence

knotty mason
peak sentinel
#

Try sending a server RPC

#

if (!HasAuthority())
{
Server_SetFlying());
}

#

and let server_setflying call that setmovementmode

graceful flame
#

If a game running on a dedicated server has to send half the players of a session to a new level and the other half back to the main menu how can the session remain for the half still playing if the main menu calls Destroy session during event beginplay? Is that possible?

#

or will the entire session end for all players?

#

Use case is winning team moves on to a new level and losing team gets booted back out to main menu.

knotty mason
peak sentinel
#

You need to declare that yourself

#

Tbh I didn't dive into movement modes too much, maybe CMC has its own function to call some RPCs for you but if it it doesnt, you just need to create a Server function and call it if you are client

#
UFUNCTION(Server, Reliable)
void Server_SetZeroGravity();
knotty mason
glacial shuttle
ionic coral
#

im trying to do name tags but it is just not working
The host can see the names but every name is the same and the people that join cant see the names

#

(for the ui)

twin juniper
#

Hey, is there a way to make sure SET w/ Notify's callbacks get called like a reliable multicast event?
Or should I just convert it to a reliable multicast event? seems kinda unnecessary because it's doing all the calculations needed for setting that variable, however I need to make sure all the OnSet callbacks get called, (So I won't miss one if it's quickly Set to something else before it replicates...)

kindred widget
ionic coral
#

whaa

#

there is a get player controller

kindred widget
#

In beginplay. Which is ran on both server and client, and setting a replicated property.

#

Same difference. Different actor.

ionic coral
#

i dont understand

kindred widget
#

GetPlayerController returns the local controller on a client. On a server it returns the first player that joined the server.

ionic coral
#

ohh

#

its fine now anyway i just removed it, it got too distracting well playing because the names are pretty big

#

so i just added a death thingy in the corner that show when a person is killed

kindred widget
#

Also, how come you're not using Playerstate's name?

ionic coral
#

who killed them and what gun

ionic coral
kindred widget
#

That's all the player state's is. Pawns and controllers have access to their relative playerstate as well.

ionic coral
#

ahh

#

eh if it works there aint no need fixing

kindred widget
#

Fair enough. 😄

mortal kernel
#

What role have AI controlled entities? I'm unsure rn... is it authority? or...

kindred widget
#

AI controllers don't exist on clients.

#

Oh, controlled. As in the pawn itself?

#

For the pawn, same as any other actor. Server has authority, as that's the machine that "spawned" it. Clients version would be a simulated proxy.

#

Unless you're spawning it on the client specifically for some reason, then it'd have authority on the client and no other role anywhere else.

mortal kernel
#

o-o Alrighty

#

So I'm currently trying to replicate pawn movement it's working in bp but not in cpp

#
// Called every frame
void AAmbienceCorePawn::Tick(float DeltaTime)
{
    ActorDeltaTime = DeltaTime;
    Super::Tick(DeltaTime);
    
    if(!HasAuthority())
    {
        Server_SetLocation(GetActorLocation());
    }
}

void AAmbienceCorePawn::Server_SetLocation_Implementation(FVector NewServerLocation)
{
    if(UKismetMathLibrary::Vector_Distance(NewServerLocation, GetActorLocation()) > 15)
    {
        Client_SetLocation(GetActorLocation());
    }
    else
    {
        Location = NewServerLocation;
    }
    
}

void AAmbienceCorePawn::OnRep_Location()
{
    SetActorLocation(UKismetMathLibrary::VInterpTo(GetActorLocation(), Location, ActorDeltaTime, 15));
}

void AAmbienceCorePawn::Client_SetLocation_Implementation(FVector NewClientLocation)
{
    SetActorLocation(NewClientLocation);
}
#

Any guesses?

kindred widget
#

Not sure. Don't see anything actually moving it on the server. If it is moving on the server from something else, then I'd assume that it's not replicated somehow. Also worth noting that your current setup can be achieved with just checking the replicates movement checkbox.

mortal kernel
#

it even says here :o

#

But you're right I got confused a little I'm only setting the location OnRep which would mean on clients

half umbra
#

can i use stream level bounds volume only for map visibility?
I'm creating a multiplayer game
I would prefer the map to be always loaded
and only visible when a player enters a field
won't such a practice hurt in multiplayer?
?

#

and can anyone tell me what to look for when using streaming level in a multiplayer game?

rocky night
#

🍑 Got a Problem. In Multiplayer i have items liek a Teddy- if in a 2 Playermatch a Player takes it sometimes it goes to another player and not to the Player who picked it up. Is there a way to get just the Plaayer who is picking it up and avoid teleoprting items to other players simple?

#

i check the Parentplayer from the 4 players who are childs if he owns alreaddy the item or is holding one too

fathom aspen
#

I don't get why you're using two events to implement this functionality. Event Interact should be enough with the Instigator as the player who did pickup the thing.

rocky night
#

Yes i hooked after the delay it also i. The cast to assault… but happens too

#

The overlap is for open the Gate to pick it up

#

This cracks my game totally

#

I call this code in the item… btw

#

And it’s replicated

sinful tree
#

You really shouldn't need an overlap check.
You're probably doing a line trace as it is to determine the actor to perform the interact on - you should be able to calculate the distance of that line trace, and if the player is close enough, then you should allow the interact interface to proceed.

rocky night
#

I have the collision also for a fresnel so it glows when the player is closer

#

But also when i hooke the fresnel and gate logic out it happens

sinful tree
#

Well, as it stands, you can't do this. Any time another person overlaps, it breaks who the interact is really from so your cast is only ever fed the last person that overlaps.

rocky night
#

Oh?

sinful tree
#

Also, you need to separate logic from clients and server on overlap events. When a player overlaps, that event is triggered on the clients and the server. You can use a "Has authority" switch to determine if you're running on the server or on a client machine.

rocky night
#

Does has authority work to with 4 players?

#

So 1 Server 3 clients

#

The event interact repliates aswell unfortunately

sinful tree
#

Sure but you need to understand that "has authority -> server" means it'll trigger on the host of the game. "has authority -> remote" will trigger on the clients that also detect the overlap.

fathom aspen
rocky night
#

Listen Server

fathom aspen
#

Yeah you need to make sure you run a has authority check as Datura told you.

#

And use the Remote pin

rocky night
# fathom aspen And use the `Remote` pin

the remote pin?so if i trz it it doen picks up on server or client... and i need to sedn to the player who picks it up sever things, like show the item in hand, set bollean to true if he owns now the item ect

rocky night
fathom aspen
#

Switch has authority has to be on the overlap event

rocky night
#

@fathom aspen

#

@sinful tree i also changed the pin from cast to to the INSTIGATOR of the Event Ineract

#

it goes now trough also as server maybe thats the sulotion? cant always replicate the teleporting error but this time it dint happen

sinful tree
#

Interaction should follow along something like:
Player presses "Interact" button > sphere or line trace from player's location to (camera's forward vector * interact max distance) > If there is a hit actor call a "Run On Server" interact event that passes the actor from the hit event of the line trace > Server verifies passed in actor is within interact range > Calls Interact Interface on the Actor
Actor with Interface > Does whatever it needs to do as it's running on the server.

Overlap Event (if it's something visual for the player overlapping) should not have anything to do with the interact interface. Doing something visual with the overlap is getting a bit more complicated as you would also want your host (the authority) to see the visuals as well I imagine, but you only want the visuals to appear on the machine that is currently overlapping. To do this, I think you could cast the "Other Actor" to Pawn (or whatever character if you intend on doing something with it) and do "is locally controlled" and if true, change the visuals. Same with the OnOverlapEnd event - you'd want to check only if it's the local player that's ended the overlap.

rocky night
#

ok i seperated nw the interatlogic with the Sphere collision seems to work?

slow wing
#

What is the console command for adding latency? Google lead me to "net PktLag" but this option doesn't come up in my list of console commands (nvm found it, it's NetEmulation.PktLag)

graceful flame
#

I have two parent characters in my multiplayer game. Is it normal for the character blueprints to have hard references to the PlayerController, the PlayerState, and GameState? Am I doing this right or am I creating too many references? I can't seem to figure out how else to get all that data to reach them. I'm mostly calling the state I need and then firing off a custom event, I'm using some event dispatchers as well.

Should I be refactoring into using more interfaces?

#

I'm using each reference more than once to get and/or set data according to some condition.

#

Is it best practice when developing a multiplayer game to NEVER use casting to make references between the GameMode, GameState, PlayerState, PlayerController and Characters?

fathom aspen
#

There is nothing like that to "NEVER" use casting to get all these game framework classes.
If you feel like you're having too many casts going around then you should consider using interfaces instead.

graceful flame
#

Well I'm always storing whatever I casted to as a variable and use it more than once.

fathom aspen
#

That's ok. You're using the same variable.

graceful flame
#

Like does it make sense to make an interface between the playerstate and gamestate that only gets called twice per session?

fathom aspen
#

It's more like a preference question. But my answer would be no.

graceful flame
#

ahh okay

#

It's been working alright so far, but I think it would be better for performance to refactor away all these references into interfaces whenever possible.

#

But that would mean creating lots of interfaces, which I guess is okay...?

fathom aspen
#

You don't gain any performance doing this refactoring or at least it's not a significant factor as you think it is

#

It's more of a design issue

graceful flame
#

I think I understand it a bit better now, its only "bad" if a reference is made but never called. Then I'm wasting memory, is that correct?

fathom aspen
#

ye

graceful flame
#

For example, something is casting to something else then sorted as a object reference variable but never gets used once during the session because of the current GameMode.

fathom aspen
#

Yes sure

graceful flame
#

Thanks for verifying this for me

ashen stone
#

How do i replicate an array (List of Items) only when player open stash or talk to vendor?

#

Do i need replication graph for it?

hollow eagle
#

No. You can either use custom conditional replication, or the simpler solution - just use an RPC to send the data over when it's needed if it isn't being constantly updated.

ashen stone
#

i`m doing this

#

i have an ItemContainerComponent, it is on character (inventory) and on stash (StashItems)

#

But on vendor it is possible for many players open the same vendor at same time (and they need to see the items sold in realtime)

#

Is it a good idea to have a list of interest actors inside the component?

meager spade
#

i would use a FastArraySerializer

hollow eagle
#

(if the whole component is only relevant at specific times to specific people)

meager spade
#

much simpler than handling this stuff all through rpc's (and RPC's won't work on NPC's).

ashen stone
meager spade
#
{
    return WorldInventory.ReplicatedEntries.ContainsByPredicate([Guid](const FKaosItemEntry& Other) { return Other.ItemGuid == Guid; });
}```
#

you don't need maps

ashen stone
#

If you remove the first item of array it will change the index of all

meager spade
#

right but item should not care where it is

#

item location is only determined locally

#

even if the item does know where it is, having a int32 on the item for its location works.

#

I personally would not use map cause map's can't replicate.

#

in my game, item's have no idea where they are in the inventory, that is maintained by the say the QuickBar component (game specific).

ashen stone
#

Do you have item drag & drop from different containers?

#

how do u know what u are dragging on

meager spade
#

yes

#

cause the widget holds the info about the item

#
struct FKaosSlotEntry
{
    GENERATED_BODY()

public:
    UPROPERTY(BlueprintReadOnly)
    FGuid Item;
    
    UPROPERTY()
    bool bEnabled = true;
};```
ashen stone
#

and i need to maintain itemId on the EquipmentsContainer

0 = weapon
1 = shield
2 = pants
etc

#

cant have holes

meager spade
#

what i am saying is

#

split the sutff

ashen stone
#

cant move pants to 1 if i remove shield

meager spade
#

stufF*

#

ffs, keyboard lol

ashen stone
#

I see

peak sentinel
#

Hey Kaos, is there any possibility you know about this? If yes, can you share your thoughts after your conversation ends?
<#multiplayer message>

meager spade
#

oh i dont fire bullets on the authority, so never encountered that

peak sentinel
#

Did you go full client authoritative? 🤔

meager spade
#

yes

#

with server side checks on the shot data

#

one thing is, you need to keep the timers in sync with framerates

#

i assume you set a new timer for each shot?

peak sentinel
#

Yes

#

But ShooterGame had some logic to keep it synced, they are just not getting executed (breakpoint never hits those lines)

meager spade
#

i use interval adjustments

#

i assume your doing the same?

peak sentinel
#

yes

  const float SlackTimeThisFrame = FMath::Max(0.0f, (World->TimeSeconds - LastFireTime) - WeaponData.TimeBetweenShots);
    if (bAllowAutomaticWeaponCatchup)
    {
        TimerIntervalAdjustment -= SlackTimeThisFrame;
    }
#

Yeah pretty much same, but this does not prevent it either. So probably I should seek solution in another logic. Thanks for the inputs ❤️

meager spade
#

like i said, mine is all client side

#

not tested with server running the same code

#

what is liekly happening

#

is client has finished firing, but the RPC to server has not arrived yet

peak sentinel
#

Yeah, exactly

meager spade
#

so server fires an extra shot, cause its not been told to stop

#

as the rpc takes a while to arrive

peak sentinel
#

I thought ShooterGame was preventing this somehow (as I wrote above) but I realized even ShooterGame's implementation is not able to prevent this

#

So maybe this can be even unavoidable

meager spade
#

ShooterGame is client side only?

#

it doesnt run fire timing on the server

peak sentinel
#

Ah, you're right. I confused with my altered implementation. I also fire from server. So probably I shouldn't then

#

I wrote that logic in my very early days

meager spade
#

yeah, if you do server doing the stuff

#

you kinda don't want to run it on client

#

though for responsiveness, just let the client handle timings

#

server can still do the traces (if you want)

#

just the client signals to do that

peak sentinel
#

Server fires literal actor projectiles so my past self though I need to avoid RPCs because it can cause serious delays and desyncs. Now I'm realizing I need to rethink about the whole system

meager spade
#

i have anti-cheat measures, like i check the firerate between shots to make sure its consistent on the server, angle to the shot, simple line trace to ensure the shot could hit not what was hit, etc

#

and a few more secret ones 😛

peak sentinel
#

Secret Kaos tech ™️

#

Alright, thanks a lot Kaos

stray badger
#

Is there a way to get all current actors in the owing frustrum?

fathom aspen
#

You mean actors in the camera view?

stray badger
#

Yes. I know of one way by converting the actor’s location to screen space but it’s expensive. I was wondering if there was a lower level abstraction already built in.

meager spade
#

not really no

stray badger
#

What about this?

meager spade
#

that's still doing calcs under the hood

stray badger
#

Idk why I’m in multiplayer btw

#

But alright

fathom aspen
#

There this answer by Rama but it iterates over all actors. Don't think that's ideal

#

Hyperlink intensifies

#
stray badger
#

Yeah I saw this post

#

Thank you

meager spade
#

becareful with that though

#

i had bad results (might be ok in FPS games, but breaks in top down games, etc)

#

also it works from bounds, so if an actors bounds is huge, it could be rendered, but not actually in the viewport

somber glade
#

Widgets in multiplayer are only locally relevant right? I'm working on setting up video chat on a quest and running into a small issue. The user is joining the channel (audio works both directions so we know it's connected) but the video image isn't being delivered to the widget. In agora this is done by binding an image to a delegate and then setting the image brush with the delivered texture each time it's updated. This works in single player, so I know the setup itself functions. There must be something off in the way I have the function filtered.

We have an actor in the level that functions as a 'video booth'. When the user steps into that booth, the user is connected to the video chat channel and a widget is display that has the remote (desktop user) video displayed. Logic works like this:

When the player character (default motioncontrollerpawn from the epic template) overlaps the video booth we check for the following:

  1. it's a motioncontrollerpawn
  2. and the pawn is locally controlled

This should (unless I'm mistaken) mean that any code that executes after this is being run on the client who stepped into the video booth.

At this point we tell the pawn to request an open video channel name from the server, set the widget visible, and then we tell the widget to activate. Activate means going to the local users game instance, getting the reference to the local agora object, and binding that texture. We know agora is working because the audio works, and I know this works in theory because this works in a non-multiplayer environment.

All I'm seeing though is a white box where the video image should be when connected to our dedicated server. The widget, nor the video booth actor are replicated. it's not necessary here. So I'm not sure why I'm getting a white box.

crude quail
#

I'm using GAS abilities to play an animation montage, it seems to only be replicated from Client->Server. The default mannequin movement animations seem to replicate fine. Here's a vid example

#

Any ideas what I might of missed?

#

for a bit more context, everything else about the ability is replicated fine

nova wasp
#

that's the main way to replicate montages with GAS abilities

#

you can extend it if you want

meager spade
green garden
#

hi
so i made multiplayer, but when i shoot only i can see the projectile and the other cant see it

twin juniper
#

@green garden gotta replicate it to clients I guess

#

I'm trying to setup steam multiplayer connection, but my steam overlay doesn't switch on when running the game? How do I fix this. I already changed the defaultengine

twin juniper
#

omg.... turns out I disabled steam overlay to reduce lag in Elden ring

nova wasp
thorny saddle
#

how can figure out the server func done it's job ?
i write Server func on cpp and on bp call it. in bp flow don't wait for server func to finish his job and go to next step.
i want to wait for server to finish his job
how can i do it?

bitter oriole
#

And then (which may be one second later) resume your logic

thorny saddle
#

it is reliable

#

i sync my player info like lvl on server

#

in replicate var

#

then

#

i wanna show it

#

but in client

#

don't wait for server done its job

#

and show older info

thorny saddle
bitter oriole
#

i want to wait for server to finish his job
You need the server to send a replicated event to the client to tell it that the server is done.

#

Simple stuff

thorny saddle
#

i see steam do a nice job

bitter oriole
#

There is no other way, no

thorny saddle
#

how they do that?

bitter oriole
#

Look at the source code for it

bitter oriole
#

I've given you a simple solution, this might be the basis for another

#

Same thing essentially anyway

cosmic badge
#

So.. I discovered over the weekend that netpriority does more then just effect bandwidth of actors, it also seems to change the initialization order of actors that are sent in one go.. It seems very consistent even over the internet, and simulations to drop packets but I cant find anywhere this is documented, only things I've found about netpriority just talk about 'bandwidth' and nothing about the order. Anyone know of any reference about this? otherwise I'm going to have to dig over the source code to just be 100% sure this is safe.

chrome bay
#

Any code that depends on actors being initialized in a certain order will inherently be prone to error. All I would say is don't rely on NetPriority to enforce that.

#

I imagine that Epic would consider this something of an implementation detail and nothing you should rely on, same thing with property replication order.

#

E.g, properties will replicate in the order you define them in GetLifetimeReplicatedProps - but you shouldn't actually write code dependant on that.

peak sentinel
#

Is there any difference between replicating a tsubclassof and default object?

brave wagon
#

Hi, when I "play in viewport" with 2 players, everything works fine but when I play with 3 players, my UE 4.26 crashes and shows this error :

Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/Templates/Casts.cpp] [Line: 10] Cast of IpConnection /Engine/Transient.IpConnection_6 to LocalPlayer failed

Do you know why this is doing that ? thanks

hallow acorn
#

hey guys, hope everyone's day is going great 💙 I wanted to ask if there is a way to prevent the Controller's Pawn from being destroyed on Logout? Thanks!

kindred widget
hallow acorn
fluid summit
#

Hi! does anyone know if there's a way to know when an actor has finished spawning?
I have one method where i spawn a few actors and i don't want it to continue until those are fully spawned

kindred widget
#

What does fully spawning entail?

dark edge
#

When a mommy actor and daddy actor love each other VERY much....

fluid summit
#

I'm getting some times the following error "actor xxx is not fully spawned" so i guess that there's some notion of fully spawned for UE4

chrome bay
#

It probably means you used deferred spawning and didn't call "FinishSpawning"

sinful tree
blazing spruce
#

Hi all, sooo multiplayer's a cunt lol ive been learning more about replication and the server-client relationship and all that good stuff and from what I can gather I've pretty much wrote everything in the 'wrong' way, although I'm still getting the desired behaviour I think I'm over complicating things for no reason, in the below example ive got code for a door, old way on the left, new way on the right, (ignoring the has authority check for now but I do wanna touch on that) am I now writing this in the best way or can i even improve it further? Would really appreciate the feedback so i can start getting this right lol

dark edge
#

@blazing sprucev3 will be using OnRep

#

If someone's out of replication range or late joins, they might see the door closed when it should be open as they missed the event

#

use state whenever possible instead of events

#

your v2 is close, you don't need the open and close events to be replicated

#

also you can use 1 timeline and just play it forward or backwards

#

CLIENTSIDE
Interact -> Run on Server Event Interact

SERVERSIDE
RoS Interact -> Set w/ notify DoorBoolean

EVERYWHERE
DoorBoolean Onrep -> call UpdateDoor
UpdateDoor -> branch on DoorBoolean -> Play or Reverse the timeline -> Set Door Angle.

blazing spruce
#

Thats how ive got it set up atm

dark edge
#

all in the pawn. So the client -> server communication happens between input and the interaction interface call

thorny saddle
#

can call game state server func from widget?

dark edge
thorny saddle
#

am i do it right?

fathom aspen
#

Simple function called GetGameState

#

In BP

dark edge
spark owl
#

Are map variable used in blueprints replicated? If I had 1 on the game state class would clients be able to find values? I ask because there is no option for setting a map variable to replicate

fathom aspen
#

Maps can't replicate out of the box

#

There is a workaround though and it's to use structs

spark owl
#

hmm ok ty for the info

latent sky
#

Hello, anyone know how to get a response from two clients separately via UMG ?

fathom aspen
#

UMG is local to each client. It can respond to the client and stuff

latent sky
#

@fathom aspen It's like this, I play a cutscene and it stops mid way and asks for each clients input. After getting the inputs of each client I resumes the cutscene. But the cutscene should resume at the same time for each client. Until that the cutscene is being paused

dark edge
#

Widget talks to PlayerController or Pawn or PlayerState which talks to server

hard hinge
#

I was reading through a lot of the source code for the online subsystem steam module and noticed there seems to be no way of using SteamAuth with dedicated servers. What happens is if you have steam auth enabled, you have to also use SteamNetworking() (p2p). The problem with this is that I am unable to connect to my dedicated server when using p2p connectivity. It just connects, and keeps trying and then fails. If I disable SteamAuth then I'm able to connect to the server. However, this obviously has it's own problems. It looks like Epic only implemented steam auth with listen servers lol...

fathom aspen
hard hinge
#

Epic's implementation of Steam is wrong.

fathom aspen
#

That could be a thing too

thorny saddle
#

hey folks

#

i wanna call server func

#

in game state

#

from widget

#
UFUNCTION(BlueprintCallable)
void TestClient();

void UPCSClanWidget::TestClient()
{
    Cast<APCSGameState>(GetWorld()->GetGameState())->TestServer();
}
#

this is in my widget header and cpp

#
UFUNCTION(Server, Reliable)
void TestServer();

void APCSGameState::TestServer_Implementation()
{
    UE_LOG(LogTemp, Warning, TEXT("test server"));
}
#

and this is in my gamestate

#

this don't print anything on server

#

what is wrong?

lyric skiff
#

My projectile spell doesn't perform any of its logic when fired from the client side. Its supposed to explode on impact which works when used from server, but from the client's pawn it just hits someone and stops moving. The server doesn't even see the projectile. The event to fire it is a multicast function from the pawn. The pawn is "owned" by the clients player controller

#

its logic includes playing an explosion particle effect and calling functions on nearby pawns to deal damage

#

this is all done inside the projectile blueprint

#

the event for that is "run on server" which is triggered by onComponentHit

marble gazelle
# thorny saddle what is wrong?

You can't send Server RPCs to an actor you don't "own", this only works for example on actors like the player controller or player character

lyric skiff
#

so should i set the owner of the projectile?

marble gazelle
#

Wasn't an answer to your question. I have no idea what you are doing wrong as I don't know your code^^

lyric skiff
#

lol

#

my bad

marble gazelle
#

But I think I get your issue. You can send multicast events only from the authoritive actor(I think, but possible you only can send multicast from the server), which usually is on the Server, so what you need to to is: Request to shoot on the server (you may do local prediction) and then the server needs to send the multicast.

lyric skiff
#

yeah i have the "shoot" event as a multicast

marble gazelle
#

So the client sends a request to the server and the server then sends the multicast?

lyric skiff
#

first picture is the character pawn, second is in the controller

#

so i guess yes, its an input action that calls the "run on server" event in the controller which then calls a multicast event on the pawn

marble gazelle
#

What does "IsProcessing" do, who sets this and where

#

and if you "guess" why not log it?

lyric skiff
#

isPossessing is set by the controller, it probably doesn't need to be replicated

#

log it how?

#

well apparently if i don't have it replicated the client can no longer even cast spells

marble gazelle
#

Why do you need isPossessing? what does it do?

Log: PrintString

lyric skiff
#

my game is similar to chess (eg you have a certain amount of units) and you can possess your units and move them. IsPossessing makes sure you don't use the spell controls and stuff while on the rts style camera

marble gazelle
#

so you have multiple actors?

lyric skiff
#

yeah

marble gazelle
#

and you are sure these are setup correctly?

#

I have the feeling they are not ^^'

lyric skiff
#

i am not sure

marble gazelle
#

could you try using the PlayerState to send the Multicast with the actor you want to call it on as reference?

lyric skiff
#

i haven't been using playerstate.... lemme see

marble gazelle
#

I basically just want to figure out if the issue is on your actor or a different one^^'

lyric skiff
#

i'll have to set up playerstate

#

i've basically just been using my controller to do anything I thought a playerstate would do

#

so make an event on the playerstate that the controller calls which then calls the multicast on the pawn right?

marble gazelle
#

no^^

So the PlayerController is only on the server and the client it belongs to. the player state is on each client. So I'd first of all just test if you receive a multicast event on the player state on each client.

Afterwards you can either check whats wrong with your actors or use the player state to distribute the multicast and then on client side just start the logic on the actor

lyric skiff
#

so make a multicast event on the player state and call it from the controller just to see if it works/

marble gazelle
#

yep

lyric skiff
#

what is supposed to happen? i have just a print string there and on the listenserver it says "server: example string" "client1: example string" and on the client it just does "client1: example string"

#

i just have it hooked up to a keyboard input on the controller

marble gazelle
#

guess that's fine, seems unreal replicated the print also to the server

lyric skiff
#

yeah i'm not sure

thick scroll
#

I am currently implementing a stance system(standing, crouching, prone), using the CharacterMovementComponent. Currently I am implementing my prone the same way crouch is implemented, meaning I extend SavedMove to accept a flag called bWantsToProne. However, considering the stances really are a state machine of sorts, having both bWantsToProne as well as bWantsToCrouch, feels like a bit of an anti pattern since conceivably we could be in a state that would not be handled by the movement component. I would much rather be able to pass in an Enum, lets say DesiredStance into my SavedMove, read that on the server and then update the new stance on the proxies.

Is there any detriment to passing something into the SavedMove which is not handled by the compressed flags (Like my Enum in this case)? I would much rather use the compressed flags for other things, like Sprinting, Sneaking etc. than wasting 3 of the bits on the stance.

Also, which is the best method to override in the CharacterMovementComponent to intercept the new move on the server?

Grateful for any answers!

sweet pilot
#

Hi guys! Is it possible to convert a FVector to FVector_NetQuantizeNormal, I want to know the compressed value before send it through RPCs!

blazing spruce
# dark edge The fact that you're trying to interact needs to make it to the server somehow. ...

Thanks, thats how ive got it set up but do you use the HasAuthority node anywhere? when ive been looking at the network features content example project, as well as the project for one of the inside unreal livestreams they did a while back they are using them almost everywhere but im still not entirely sure what exactly they're doing since most of the code works without them being there and it works for both client and server regardless

stiff fractal
#

Hey guys. I think this is the right channel. I've got some local non-replicated widgets that the players drag onto the screen which then activates some replicated visuals to all players. It used to work fine but then at some point it broke for clients. Every time I try to interact with the drag widgets in a client I get this warning and nothing happens. It's not even an error. It still works fine on the server. My very limited research findings says it's something about network serialization, which makes no sense because the widgets are not replicated. It's driving me crazy. Has anyone had a similar issue?

chrome bay
#

Presumably you're trying to reference them within a network function or replicated property

stiff fractal
#

Is there any way to tell where? This warning is next to useless. I've followed the trail everywhere and it all looks correct.

sinful tree
#

Somewhere in your game instance, or at least, it's referencing variables from your game instance.

inland pond
#

Hi, I would like to show the name and a healthbar above other players in my game. I came up with this solution you can see in the screenshots. I curious if I can simplify this to a somewhat cleaner approach. The main problem is that the player state is not immediately available because of replication. For that I have created the OnRep_PlayerState dispatcher. But this only works for the client (remote authorities) because the playerstate is only available in the server after the character is possessed on the server.
Inside the BPW_PlayerInfo I am listening to the OnRep_PlayerState event but it can also happen that the event is called before the the listener is setuped so this is why I also needed the extra check for isValid on playerState.
This feels like lots of checks in different places just for that "simple" thing. The healthbar with replicated health was much simpler to setup. Is there a more intelligent way of handling this kind of waiting for the playerState?

bitter oriole
dark edge
#

The capsule pretty much has to be vertically aligned. Anything beyond that will involve a lot of modifying the CMC

inland pond
bitter oriole
#

If this is purely Blueprint, being afraid of Tick is somewhat legitimate

#

There's indeed a cost attached

kindred widget
#

If you have C++ access, you can easily override Playerstate's SetName and add a delegate. Otherwise your only choice is tick.

bitter oriole
#

There's indeed no real alternative here

#

As I usually say - if you need Tick you should not be afraid of it

kindred widget
#

Also random fun note. Even that function breaks on a Listenserver. Requires a next frame delay to set correctly after the delegate broadcast in some cases, but only on the listenserver itself.

inland pond
#

Alright thank you both for your answers! Yes it is Blueprint but I have exposed OnRep_PlayerState from c++ so I might also try your advice @kindred widget. Does this also solves the replication issue so does SetName gets called even if I don't call it by my self and instead constructed from replication?

kindred widget
#

When I was making my player name widget, I had a delegate in PlayerState. Ran from SetPlayerName and OnRep_PlayerName. For some reason specifically on Listenserver Machines at the time despite the broadcast being at the end of those functions, the widget didn't update name correctly on the listenserver. Not really sure why considering that PlayerNamePrivate should have been set at that point. Ended up with blank names on the server and correct names on clients. Was easily fixed with a 0.0f next frame delay, but weird.

inland pond
#

Oh okay thanks for that hint. Maybe I will also come across this weird behavior now I am warned

inland pond
#

@kindred widget Sorry one more question regarding the delegate in your playerstate. How have you assigned a listener to that delegate dispatcher when the playerstate is not yet ready?

kindred widget
#

GameState delegate. Uh..

#

AddPlayerState runs when a playerstate replicates and adds itself to the GameState's PlayerArray

inland pond
#

Alright thank you!

kindred widget
#

If you initialize your UI with AHUD's Beginplay, you can always count on GameState being ready at that point since it is what causes that to run.

#

Good place for root delegates for that sort of thing.

inland pond
#

Okay nice thanks, I will try that

thorny saddle
#

hey guys

#

i wanna run server with cmd

#

and join it by cmd

#

anybody know what should i do ?

plush wave
#

Do player states stick around even when a player is disconnected?

#

I see there is InactivePlayerStateLifeSpan and I can set that to 0 to have it stick around, but isn't it still a "copy?"

winged badger
#

it sticks around for 5 minutes

#

it takes a little work to get working, depending on the game

#

and there is one Duplicate() call involved

edgy flower
#

i dont even know what im looking for to hopefully find the fix for this

#

im not even sure what term i should be googling :<

fathom aspen
plush wave
winged badger
#

not sure without checking the engine code, but pretty sure Duplicate happens if the player reconnects

plush wave
#

Right so pointers would not work

#

Thanks

lyric skiff
#

I need some help with projectiles that do stuff upon impact. Essentially I have it so that the player controller owns a bunch of pawns, these pawns can shoot projectiles which are then owned by that pawn (and therefore owned ultimately by the controller).
The projectile is fired via a multicast from the pawn, but since the owner is the client player controller, i guess this does not work? what is the proper way to deal with this, just have a multicast AFTER a run on server with an authority check to make sure the server does not run twice?

#

and then how should the logic within the projectile be run, same? on server with a multicast after and authority check to make sure server does not run twice?

#

any help would be appreciated 😅

dark edge
edgy flower
#

oki

dark edge
#

Your handle starting new player is doing nothing

#

not sure if that'll break it, but seems like it

#

@lyric skiffDo you need prediction?

#

what's the game style

#

cuz if it's at all close to RTS, this sounds like you should just be doing everything on the server and replicating it

lyric skiff
dark edge
#

Do your units fire predicted or serverside?

#

the non-possessed ones

oblique inlet
#

I'm trying to make the first person template multiplayer. Usually I just call the fire function on the server but since the weapon is a separate actor in UE5 that no longer works. What can I do now?

lyric skiff
fathom aspen
dark edge
#

Yeah that is the easiest, and can work for some games

#

hell even New World doesn't predict projectiles

lyric skiff
#

I don't think prediction matters as it is a turn based game

dark edge
#

oh lmao

lyric skiff
#

maybe i'm wrong about this

dark edge
#

if it's turn based then yes server does everything

#

what the client passes to the server is "Hey I wanna shoot my gun now"

edgy flower
#

thx

dark edge
edgy flower
#

thats the goal xD

lyric skiff
#

i get confused cause my brain is pretty smooth so lemme try to understand though. It should all be done on the server but then what is the multicast vs run on server? do i just have to chain those together to make sure everyone sees it?

fathom aspen
fathom aspen
dark edge
#

no multicast

#

multicast means "everyone do this"

#

only server can call it

fathom aspen
dark edge
#

What does a "turn" look like in your design, sorta like Divinity Original Sin?

lyric skiff
dark edge
#

yeah, that's super simple to make multiplayer. Much simpler then live action real time stuff

#

So what you want to be passing to the server is your moves. Move here, use this ability here, etc

fathom aspen
#

Multicast I would probably use it for non gameplay events. For example spawning an effect or something

dark edge
#

Yeah maybe but I like to keep stuff state as much as possible.

lyric skiff
#

when I change the event that actually spawns the projectile/ability to "run on server" it doesn't let the client call it at all

dark edge
#

Client probably doesn't own what's trying to do the calling

lyric skiff
#

it does own the pawn i think... hold on

#

imma check

dark edge
#

You can set up this whole system in your playercontroller, no need for pawn stuff really. Don't use possession for turn based stuff

#

The playercontroller just has to have run on server events like MoveCharacter or MoveCurrentCharacter or CurrentCharacterPerformAbility etc

#

you don't need to do any RPCs inside of characters.

lyric skiff
#

uh huh that kinda makes sense

dark edge
#

I wish I had a good turn based idea, it's actually really feasible as a small indie vs trying to make a twitch shooter.

#

Basically think about how you'd play the game by mail. That's what you should be sending to server.

lyric skiff
#

you can work with me 🙂

dark edge
#

like corrospondance chess

lyric skiff
#

lol

quasi tide
#

Can make a TBS game online with friggin standard HTTP requests, lol

quasi tide
dark edge
#

@lyric skiffI would start with a PerformAction struct. The struct would contain a character ref or ID, a ref or ID of the move to perform, and the target tile or cell or location.

#

Just pass that in a TryPerformMove run on server event

#

("Bigass McGee", ChargeAttack, (12,3))

#

That'd be your big boi charging at tile 12,3

lyric skiff
#

I ideally wanted movement in 3D as the character.... i'm really not sure yet if that adds anything to the experience but that was my ideal

#

full 3D movement like as in the thirdpersoncharacter example project

dark edge
#

ok
("Bigass McGee", ChargeAttack, (1231.231, 3021.55, -200.37))

lyric skiff
#

i see

quasi tide
#

And please, make sure their name is in fact, "Bigass McGee". Or at the very least, be a hidden character.

lyric skiff
#

lemme think about what you've said for a bit

dark edge
#

That's what all my muscley guys are in games lol. Shirtless and with a big bonk stick.

lyric skiff
#

i mean i think i can still refactor my stuff to be what you're saying

dark edge
lyric skiff
#

i just have to move the spellcasting logic from the pawn to the controller

dark edge
#

no spellcasting is on pawn still

#

controller is just passing over orders

lyric skiff
#

yeah that is currently how i have it

#

let me screenshot some stuff real quick

dark edge
#

You're talking like XCOM right?

lyric skiff
#

top image is from the pawn while bottom is from controller

pseudo merlin
#

is there anything that would make an actor not set to replicate replicate? like being attached to a repped actor or something?

#

trying to track down an actor appearing on client that shouldnt

dark edge
pseudo merlin
#

nothing fancy MySquad = GetWorld()->SpawnActor<ASquad>(UGLGameInstance::GetGLGI(this)->SquadClass);

#

behind a check

#
    if (GetLocalRole() == ENetRole::ROLE_Authority)
    { ```
dark edge
#

@lyric skiffYou should be able to do the Server -> client stuff just by replication

#

Repnotify is your friend

lyric skiff
#

are you saying something specific in the example should be set to repnotify?

dark edge
#

Casting a spell should look like replicating some data and spawning some replicated actors

lyric skiff
#

health on all pawns is replicated and the projectile actor is replicated\

#

i'll just be more specific here

#

the issue right now is that clients cannot use that spellcast event when its run on server

#

and i'm not sure why

#

or rather not sure how to fix it

dark edge
#

Unless your abilities get too fancy, you can probably just have a multicast PlayAnimation node and do the rest with regular replication

#

but I like just haveing a replicated variable AnimationToPlay and using RepNotify on it to drive it

lyric skiff
#

i need further info on how exactly repnotify would drive it

dark edge
#

So for example, casting a fireball would look like
AnimationToPlay = SingleCastRighthand
Spawn Actor Fireball

#

You'd probably want to roll all this up into a PerformAction struct tho I'd guess

#

Depends on how you define your abilities

lyric skiff
#

i have an ability struct

#

but lets forget animations and stuff for right now

#

i just want the logic to work correctly

#

I don't understand why a "run on server" event on a pawn, called from the owning player controller would not work

#

it spawns a replicated actor so all seems to me like it should be fine, and it does actually work when used on the listen server

#

however the clients are unable to run this event

dark edge
lyric skiff
#

yes

dark edge
#

Show the entire execution path

#

from input

lyric skiff
#

i think i already did lol with those screenshots

#

inputaction --> spellcast (player controller run on server) --> spellcast (pawn run on server)

dark edge
# lyric skiff

First of all you don't need all that get controlled pawn stuff

#

you're in the controlled pawn

#

but anyway, you don't need to do it like this

#

do all run on server events in playercontroller or some floaty vision pawn

lyric skiff
#

ok i'll try moving the actual spellcast logic to the controller

dark edge
#

Don't move the spell logic to the controller

#

just move the Client -> Server RPC there

pseudo merlin
dark edge
#

in a generic way. That's how you're passing orders from your computer to the server

#

Input/UMG -> Run On Server Event -> Pass order to character

lyric skiff
#

okay i'll give it a try

#

i mean is what you're defining not exactly what i have here?

#

input action -> spellcast (run on server) -> pawn

dark edge
lyric skiff
#

yes

dark edge
#

That's close, just include more info in the RPC and change it to PerformAction or whatever and instead of calling it on controlled pawn, pass over the pawn you wish to command or a reference to CurrentPawnWhosTurnItIs or whatever

#

I would pass over in the RPC

#
  1. Who you want to do the thing
  2. What thing you want them to do
  3. Other info (Target location, options, etc)
inland pond
#

@kindred widget I am lost. I have created a dynamic multicast delegate and broadcast it on AddPlayerState this adds lots of more questions. The code for the PlayerInfoWidget creation is inside my player character. I wanted to call it inside the AHUD (BP_InGameHUD) but via the log I can see that the delegation registration is too slow. BeginPlay on AHUD is to slow. In the LOG.png the Begin Play on AHUD misses the first added player state. This was not the hint you gave me right?
And I also can not get the pawn from the player state. So I can not call the function for creating the PlayerInfoWidget there. The OnPlayerNameChanged delegate how I implemented it is also not working. I don't know what I am doing wrong.
Maybe you or somebody else can see where the problem is :S
Otherwise I will use the bind function method for now.

dark edge
lyric skiff
#

both of those seem like the same thing to me pretty much

#

what does "passing" mean in terms of the unreal editor?

#

I don't think it really affects the issue at hand but I also do have logic set up in the pawn for showing the projectiles path and picking the spell to be cast so all that is already chosen within the pawn

sinful tree
# lyric skiff I'm so confused what the difference between "calling it on the controlled pawn" ...

A controlled pawn would be one that is possessed, so a pawn that you would end up directly controlling so any inputs that you define within the pawn can be used to control it. However, you can still get reference to another pawn that isn't possessed and send commands to it - like if you had a "Selected Pawn" variable in your controller that gets set when you click on one of your pieces, and then you can call functions on the "Selected Pawn" by using the "Selected Pawn" variable as the target to receive the commands.

hard hinge
#

Can RPC's be called in PostLogin()? Seems like I can't?

sinful tree
hard hinge
#

I guess I can't call RPC's on the PlayerController as well then?

sinful tree
#

You can.

hard hinge
#

I'm calling my RPC from the game mode, but on the PC

sinful tree
#

But it can't communicate back to the Game Mode.

hard hinge
#
void AShooterGameMode::PostLogin(APlayerController* NewPlayer)
{
    Super::PostLogin(NewPlayer);

    // Do Steam Auth
    AShooterPlayerController* PC = Cast<AShooterPlayerController>(NewPlayer);
    PC->ClientRequestSteamAuth();
}
#

this client rpc isnt being called

#

I checked all of the log files

sinful tree
#

I've been able to call RPCs on the controller as soon as HandleStartingNewPlayer, in blueprint at least. Mebbe there's something up with how you defined the RPC on ClientRequestSteamAuth()?

dark edge
#

What if you had a bug where ControlledPawn was lagging or whatever. It's better to be more specific.

hard hinge
#

But the UE_LOG is not in the log file

#

I have a few other logs as well which are just scattered around that aren't in any if/else blocks

#

Did you ever figure out the cause of this issue?

lyric skiff
#

so i've narrowed it down to this branch that doesn't return true even though i've checked in the editor and that value is set to true for that pawn during gameplay. More issues though because even after that it doesn't actually spawn the projectile actor anyway when I bypass the branch completely

olive marsh
#

Hi!
The question is about replicating classes.
I have my UTeam class

class UTeam : public UObject```
which contains
```UPROPERTY(Replicated)
int players_count;```
In my GameState I have
```UPROPERTY(Replicated)
UTeam* blue_team;```
GameState and UTeam have `GetLifetimeReplicatedProps()` overridden

Then I have a widget, that tries to access `GameState->blue_team->players_count`
```MyGameState* GameState = GetWorld()->GetGameState<MyGameState>();
int count = GameState->blue_team->players_count;```
It works perfectly fine for server, but when the client is using the widget, a crash occurs with this message:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000038

What am I doing wrong?
winged badger
#

your UObject is not replicated

#

you are just replicating a reference to it, which client can't resolve

#

takes extra bit of work to replicate a UObject that is not an ActorComponent

#

also, you're not nullchecking your pointers

olive marsh
#

makes sense, what should I do to replicate a UObject?

winged badger
#

override ReplicateSubobjects() in the Actor that owns it, and IsSupportedForNetworking on the UObject itself

lost inlet
#

or just use an actor component where that's mostly handled

winged badger
#

better learning experience if he doesn't 😄

olive marsh
#

thank you a lot!

lyric skiff
#

If you set a replicated variable in a "run on owning client" event does it still update the server?

dark edge
#

No

lyric skiff
#

i see

dark edge
#

It'll update the value locally on the client and then it'll be set back to the replicated value next time the value is replicated out.

#

Why would you do that anyway?

lyric skiff
#

it wasn't intentional

#

just issue of not knowing what i'm doing well enough

dark edge
#

For your design you shouldn't need much for replicated events. I'd start by just haveing your Client -> Server RPCs and that's it. Rely on replicated state for the rest

spark owl
#

i have a custom struct variable in my gamestate class. Inside this struct are 3 map variables. I'm trying to get it so on a widget it gets the struct variable that's replicated from the game state class, and then do something with the variables, the problem is whenever I change the struct on the game state, it doesn't seem to replicate the map variables. It just has the default map values. Any clues on how to get the maps replicated?

lyric skiff
#

controller just for inputs

dark edge
#

Spell out a situation and I'll suggest how to implement it

lyric skiff
#

currently I have a "ghost" projectile that does a linetrace and shows where the projectile will hit

dark edge
#

Local only, nothing to do with the network.

lyric skiff
#

i had it running on client only casue no need for the other person to be able to see that

#

yeah i just happened to be setting a variable "is aiming" in that though

#

so i'll just have to change where that variable is set

dark edge
#

is aiming a state? Like does aiming happen during a turn or is it like a stance?

lyric skiff
#

"aiming" happens when you press an ability button while possessing a pawn

dark edge
#

I thought you were doing turn based

lyric skiff
#

its during your turn

dark edge
#

ah ok so it's aim -> fire

lyric skiff
#

yeah

dark edge
#

that'd be local unless other people have to see it

#

don't possess tho, that's a trap

lyric skiff
#

they don't

#

yeah possessing seems annoying but making the whole movement scheme without it seems really complicated

#

replicated movement without possessing

dark edge
#

No different from AI

lyric skiff
#

you have a good resource for this?

dark edge
#

You'll have AI controllers running on all these dudes anyway probably

lyric skiff
#

i'm unfamiliar with ai controllers

dark edge
#

I'd do this with the players pawn being an invisible floating camera

#

Do you intend for movement to be manually driven or click and pathfind?

lyric skiff
#

manual

dark edge
#

If it's manual then possessing might be fine, that's a weird hybrid but could work.

lyric skiff
#

yeah its a pretty unique idea and i'm not sure it will even pay off

#

like be fun

#

but its my first project so just trying to have fun myself

#

I have all the possession stuff working already anyway

#

at least the basics

#

if you'd like to see it i'd like to show you to see if you have tips haha

#

but no pressure

spark owl
#

does anyone know about having maps inside of structs being replicated? it seems like in a custom struct I made that's replicated on the gamestate class isn't replicating map variables, it's just returning the default map values

sinful tree
spark owl
dark edge
#

@lyric skiffSo how do turns work, just time?

lyric skiff
#

action points for movement, spells, etc

#

each turn get a set amount plus whatever you had left over last time up to a max

#

like divinity

dark edge
#

So if it's my turn and i strafe left and right real fast I'll just drain it all and stand there?

lyric skiff
#

yep

#

i've got that worked out too already although it needs work

#

like action point movement is working

dark edge
#

You could add in a little bit of slop, like the character is dragging a thing 50cm behind them and that's the thing who's movement burns AP

lyric skiff
#

that would be smart

#

not my top priority but definitely something to add later

dark edge
#

Yeah if you need to manually drive the dudes around then possession makes sense. I thought you were talking about something like Divinity or XCOM

#

We're making something like a live-action XCOM roguelike

lyric skiff
#

when you say "we" you mean me here? or you're also doing something similar?

dark edge
#

nah me and my buddy

lyric skiff
#

oh dank

dark edge
#

Sorta like a coop XCOM roguelike with the combat and pacing of the old school Rainbow Six games

#

slow and methodical

lyric skiff
#

click to move?

#

or wasd

dark edge
#

nah twin stick / top down wasd

lyric skiff
#

nice nice

#

i'm trying to do super methodical too. projectiles in my game will be turn based in movement as well

#

its actually already implemented as well

dark edge
#

So when do they move? Or is it like a SuperHot type thing

lyric skiff
#

move a certain amount on player who fired its turn

dark edge
#

I'd consider maybe making it a time system

lyric skiff
#

based on real time?

dark edge
#

Sorta like how Pillars of Eternity does things

lyric skiff
#

or you mean super hot

#

like if the enemy is moving my projectile will slowly move

#

i haven't played pillars

dark edge
#

Yeah basically a real time game but any time nobody is doing an input the time stops

#

doing input or doing a thing that takes time.

lyric skiff
#

that would be pretty cool

#

this is how its implemented rn

#

pretty rudimentary

dark edge
#

Would make for some cool interactions too like trying to intercept a projectile about to kill your homie etc

lyric skiff
#

yeah there are definitely lots of things that would be cool to try

#

i'll consider that for sure

#

so it seems like another issue is that the client pawn "spawn actor" for firing the projectile doesn't work

#

even though its being run on server

wary sigil
#

When using SessionInterface->FindSessions( with the Steam subsystem and the test SteamApp ID of 480 - why doesn't it return the sessions of ever other Dev using the same app ID? What/how is it filtering sessions so it only returns my own?

lyric skiff
edgy flower
#

@dark edge so you were right

#

deleting that fixed my non existing meshes

#

but the movement isnt replicated however

#

on the second screen

foggy idol
#

is set movement mode replicated by default ?

#

and do saved moves essentially take client data and use that to update the cmc on the server ?

eternal canyon
kind ember
#

Alright, how can I delete asset in PIE?
FAssetRegistryModule::AssetDeleted( AssetData.GetAsset() ) ; This doesn't seems to work.
Or
ObjectTools::DeleteAssets(AssetsToDelete); This compile error

dark edge
kind ember
#

Ok

#

Thought this was cpp section lol

lyric skiff
#

adriel i'm already having problems with some sort of lag maybe you could help sort it out

#

in order to rectify the last issue (variables were not being set replicated because they were in an event that only had to run on client) at the end of it I made a new event to set all those variables which are used when actually casting the spell (selected spell, isAiming). Now I have significant lag from when I press the select spell button (ie Q or E) and when I can click to cast that spell

#

I think it's lag only cause the client has the issue and not the server

#

but i'm kinda unsure what to do about it lol

#

possibly will have to somehow pass that info into the "cast" event as input instead of just retrieving the replicated variables

#

but the chain of events that leads to the "cast" event starts at player controller so its kinda sketchy

eternal canyon
#
//    Network Prediction Plugin
// --------------------------------------------------------------------------------------------------------------------
After a long road and many attempts, we are dropping support for the async version of Network Prediction. We felt the 
complications it introduced into the physics system were too much to maintain and performance was still too poor in
the worst/degenerate cases that it wasn't going to be a viable system for enough games to warrant the complexities.
The original single threaded version of Network Prediction is preserved and unchanged. We still hope to use it to 
build a new character moverment system with it. Physics support could come back into this version but it would be
strictly opt in and only applicable to games with small number of objects and players.```
#

rip

dark edge
#

You gotta choose whether the players interface with the game is by issuing commands or driving the characters around. If it's driving the characters around then just do it the way all the other 3rd person action games do it

#

That's a much harder approach though as you'll probably want some sort of prediction, but maybe you can just do clientside stuff with no worries as only one player is moving at a time.

lyric skiff
#

so just have the pawn take input?

dark edge
#

If that's the way you wanna do it. Whether the pawn or the playercontroller handles the input doesn't matter really. Depends on what works best for your design

lyric skiff
#

yeah i'll have to play with it

#

thanks

#

would checking replicated variables cause it to slow down though? basically what i'm looking at is pressing Q sets these variables (spell to cast) and click to cast it but they're replicated so idk

dark edge
#

Going fully turn based Divinity style will be 10x easier tho. Lag doesn't matter in a design like that where it definitly does for live action

lyric skiff
#

yeah i'm just gonna keep going this way cause i might wanna adapt it to a less turn based style game mode at some point

dark edge
dark edge
#

Then later you just stop them when they run out of SP

lyric skiff
#

the turn based stuff is already implemented

#

i'm just talking about lag while using the interface is happening right now

eternal canyon
#

but they may add it back later

dark edge
eternal canyon
#

just performance wont be very good

#

physics stuff

#

im pretty sure

dark edge
#

@eternal canyonWhere'd you see that?

eternal canyon
#

Actually might only be async stuff

#

I wonder if that means ur gonna have to have the frame cap now for physics stuff like usual

#

But the last part made me think it’s physics stuff

dark edge
#

Where did you see that? Can't find it anywhere

eternal canyon
#

If u go on the ue5 main GitHub

#

Go to the network prediction plugin

#

Should be there

hollow eagle
#

that comment has been there for a month or two now. And yeah, it's specifically talking about async mode.

#

Unfortunately NPP is still up in the air since the primary author left Epic and we don't know if anyone/who is taking it over.

dark edge
#

I still can't find that comment but anyway

#

Prediction has always been a rat's nest, too many linked systems. You'd think it'd be ripe for some sort of generalized Value / Boundary Condition / Dependency type treatment, maybe that's what NPP is trying to be.

hollow eagle
#

I honestly don't remember

round kernel
#

Multiplayer Movement Jitter

Hey all. I am having an issue with client movement jitter when using P2P. Using a standard set of movement inputs and the character, and components, are replicating; Replicate Movement, Replicates, Component Replicates. and Net Load on Client is ticked.

Is there something I am possibly missing with what I have mentioned? Or could the issue be else where?

dark edge
#

Yeah Dave Ratti i think

hollow eagle
#

ah yeah, his name is on the commits

round kernel
kind ember
#

Oh shit, my bad, spelled his name wrong lol,
Wow, he left, that sucks.

dark edge
#

@round kernelDoes it happen everywhere or just on the host?

round kernel
#

The host doesn't see or feel any jitter.

#

sorry I shouldn't say that. Most times it doesnt see it. But any "client" that joins will feel jitter on input movement. Something like gravity doesn't look like it's jittering from the servers perspective.

dark edge
#

@round kernelThat setup looks fine, compare your CharacterMovementComponent settings with a default character's and see what differs

round kernel
nova wasp
#

bummer though...

eternal canyon
nova wasp
#

yeah, it was Dave Ratti

#

he made some videos about it over the last 2 years

eternal canyon
#

Yea

kind ember
#

Well where is Dave Ratti working now?

round kernel
lyric skiff
#

If i do this is the set bool at the end going to run on server?

fathom aspen
#

No

lyric skiff
#

thanks

digital wigeon
#

When testing PIE as clients, is there a way to leave/rejoin or add a new client?

fathom aspen
#

Yes

#

There's a setting for that in the editor preferences

#

I guess it's called AddClient

digital wigeon
#

Thanks!

dark edge
lyric skiff
#

Anyone have any ideas why an input action wouldn't work on the pawn when it works on my controller?

lyric skiff
#

yeah

#

and other inputs work

#

including other customer input actions

lyric skiff
#

only thing is that it is left click so maybe its overridden somewhere

fathom aspen
#

Your input is being uhhh

#

Forgot the word

#

There is a bool you need to turn off on your player controller

lyric skiff
#

hmm a bool?

fathom aspen
#

Yes

#

Press on the input event

lyric skiff
#

like a default bool?

fathom aspen
#

It's like a check box

#

And look on the details panel

lyric skiff
#

is this for all input or just specific ones cause other input actions are working

#

but i'll check

fathom aspen
fathom aspen
fathom aspen
lyric skiff
#

F is working properly

fathom aspen
#

So the input you're talking about

lyric skiff
#

my input action "cast" which is above that

#

is a custom input action bound to left mouse click

#

i put F there to test

#

my bad that was a terrible screenshot lol

fathom aspen
#

Yeah it's an input action

#

Press on that action event node

#

And you'll see what I mean in details panel

lyric skiff
#

ahhhh

#

i see

fathom aspen
#

Cool

lyric skiff
#

uncheck "consume input"

#

?

fathom aspen
fathom aspen
lyric skiff
#

still not working but i'll look at that article

fathom aspen
#

Where did you turn it off?

#

Pawn or PC?

lyric skiff
#

i see

#

lol

#

i did pawn

#

that was dumb

fathom aspen
#

That's how you learn

lyric skiff
#

lol after unchecking in controller it still doesn't work

fathom aspen
#

Make sure it's checked in Pawn

lyric skiff
#

still not working

#

i think it might be getting consumed elsewhere in pawn

fathom aspen
#

In PC

#

Not pawn

#

PC consumes input and it doesn't get to pawn

#

So you have to make sure all the action events that sit in both have ConsumeInput off in PC

lyric skiff
#

ah

#

ok i see

#

got it

#

thank you wizard

fathom aspen
lyric skiff
#

lmk if you want another spaghetti code challenge i'm facing right now

fathom aspen
#

Well I hate spaghetti, but yeah send away

lyric skiff
#

this is for when I level up a unit, the end part highlights a box on a widget

#

like so

#

for some reason the client skips highlighting lvl 2 when it should

#

server works fine

#

and heres the spaghetti

#

so on lvl 2 for any client unit, it doesn't highlight 2, but then on lvl 3 it highlights lvl 2 and so on

#

on the server it works perfectly

fathom aspen
lyric skiff
#

lol

fathom aspen
lyric skiff
#

only 2

#

its one behind each time

#

only on the client

fathom aspen
#

Yeah seems like an increment issue

lyric skiff
#

everything else works like the skills you can pick are correct

#

and the number of skills you can pick are correct

#

but just the highlighting is off by one ONLY on the client though

#

idk where it could be going wrong since the level that I am passing is correct on their overhead status bar

#

and correct when i click on them in the editor

#

i guess i'll see what number its passing

fathom aspen
#

Yeah debugging can help you a lot in these cases

lyric skiff
#

so it actually is a multiplayer issue though but Idk where it is incrementing differently on the server vs client

crude quail
#

Anyone able to shed some light on this, been debugging this for a comically long time and I just can't figure out what's wrong. Super simple, I have a box with a static mesh set to replicate here, and this code here

#

But for some reason... only the server ever succeeds in replicating changes

#

I'm super stumped.

hollow eagle
#

you want multicast, not client

#

client RPCs only execute on the owning client. I'm guessing you don't have an owning client for that box.

crude quail
#

You talkin on the Client change Material call?

hollow eagle
#

yes

crude quail
#

It's set to multicast yeah

#

i can see how that name could be confusing 🤣

hollow eagle
#

ah I missed the executes on all

#

generally you name those multicast, not client. Because client has a specific meaning.

crude quail
#

yeah lol, that does make sense

hollow eagle
#

the issue is still similar though

#

server RPCs can only be executed from the owning client

fathom aspen
hollow eagle
#

Oh I already had those

#

I'm just tired and forgot to distrust things 😦

#

Anyway, in this case you'd generally want your interact interface to execute on the server.

#

I'm assuming this is triggered via some sort of input on your player, so you'd have the input call a server rpc on the player pawn or player controller and the server would decide what to interact with

lyric skiff
#

Nvm I got it Wizard, just passed the level into that event

#

I guess it hadn't updated on the client yet when the client drew that widget

quasi tide
#

I always pass the object that I'm trying to interact with to the server rpc personally. Then call the interact stuff from there.

hollow eagle
#

Certainly an option, but I'd do extra validation on the server in that case.

#

You don't want a client cheating and passing an object 10 miles away from them.

quasi tide
#

Yeah, you do, but I omitted that part for brevity

fathom aspen
crude quail
#

Trying to get this straight mentally, so you're saying a network agent can only fire a server RPC if it has authority over the given object

hollow eagle
#

correct

#

(server excepted - it can do what it wants)

quasi tide
#

Because server is the one true version of the game.

#

Generally, you'll find that you'll be doing all kinds of server RPCs through your PC or Character.

hollow eagle
#

The general pattern for something like this is you RPC what you want to do via the player pawn or controller (or whatever other client-owned object makes sense) and let the server do the same thing you were going to do with the client.

crude quail
#

Gotcha, I think this straightened everything out. I'll have to rethink how I'm doing interaction then, glad I prototyped it early 🤣. Cheers ❤️

kindred widget
jagged aurora
#

Hello, I am calling a function on my pawn that calls a function on server, however when I try calling the function from an actor component attached to the pawn the replicated function does not reach the server, however when the function call originates from the pawn itself (on remote client) it reaches the server, but not when it originates from the actor component attached to the pawn.

#

Is there something I am missing here ? (component replicates is set to true)

#

Nevermind, figured it out. Network replication priority was too low

solar stirrup
#

Hey! Quick question, do blueprint replicated variables use the push model?

#

Would kinda make sense since the engine would be able to know when you call Set on them, but we wanna make sure before we think about porting them to C++

bitter oriole
#

Pretty sure they do not

solar stirrup
#

Porting time it is then, wew

peak sentinel
#

I remember there was a console command to enable them though

jade fractal
#

what am I doing wrong? why is current weapon stay empty on the client?

Client:
Server: Weapon

solar stirrup
#

I guess that works for props defined in C++

peak sentinel
#

Should not matter since all UPROPERTY but I never used yet

#

So if its not working its because of something else

jade fractal
#

but the variable still stays empty on the client

twin juniper
#

I am having some problems with replicating sound effects for every client. Does some1 know how that works and might give me a solution for it?

#

This sfx works fine for every client. Its called in Character BP

#

Every sound that comes from this bp can only be heard by server

#

This events are in the gamemode bp

quasi tide
#

Gamemode only exists on the server.

twin juniper
#

So how does the multicast events work in gamemode then?

#

It doesnt calls on every client in gamemode?

quasi tide
#

They don't. Because the object literally doesn't exist on clients.

twin juniper
#

Oh

#

Does that count for the other bps also, i mean every bp exept of character

quasi tide
#

No. I'd recommend reading the Networking Bible that is pinned in the channel.

#

Reading through it a couple times even.

twin juniper
#

Okay ill spend some time with it, thanks XD

#

When i find it.

quasi tide
#

It's the 3rd one from the top...

twin juniper
#

compendium?

quasi tide
#

yeah

twin juniper
#

Ok! Ty

graceful flame
#

I'm just starting out using Bitwise operations to help reduce network traffic size but I'm not 100% sure on how to refactor existing code. For example I have a bunch of replicated booleans, floats, and ints that should be optimized into a better structure.

Is it just a matter of creating various ENUM structs with strings in CPP and then set their values using a bitwise operator during a multicast? Then on the client side I can just use something like tick to constantly listen for a change in the ENUM to then trigger my bools, floats, and ints to change as normal? Is that correct?

#

This second screenshot is at the end of the multicast and the first screenshot is an event that fires during tick. Is that right?

winged badger
#

generally

#

you'd have a replication callback when your bitpacked integer changes

#

then you can compare the per/post replication bits and trigger per state callbacks from there

#

there is no point in plugging it on Tick, and some of those callbacks can grow not to be cheap

#
void ADoorBase::OnRep_DoorState(uint8 OldState)
{
    const uint8 ChangedStates = DoorState ^ OldState;
    for (uint8 i = 0; i <= 5; i++)
    {
        const uint8 TestedBit = 1 << i;
        if ((TestedBit & ChangedStates) != 0)
        {
            if ((TestedBit & DoorState) != 0)
            {
                AddDoorFlag(TestedBit);
            }
            else
            {
                RemoveDoorFlag(TestedBit);
            }
        }
    }
}``` example of testing difference for 6 different states packed into one byte
graceful flame
#

Ahh so I should be using repnotify on the "test network enum" to compare before and after bits (using bitwise operations) then trigger the stuff I've already setup from there. @winged badger Is that correct?

winged badger
#

pretty much, and also do your networking in c++

#

BP is pretty horrid

#

it has 10% of the tools, and half of those are hacks

graceful flame
#

I've setup the enum in c++ by following a guide, so its already using power of 2. Just the testing and setting in BP. Is that still not recommended?

winged badger
#

i generally find it awkward, if you have a mind to use c++

#

you should do your networking there

graceful flame
#

I'm a total c++ newbie... LOL

winged badger
#

so was every one here at one time

graceful flame
#

I'm using the network profiler a lot and I'm trying my best to reduce waste.

winged badger
#

bandwidth is generally not a problem

#

unreal is designed to work with ADSL connection, or worse

#

the chokepoint is usually the time it takes the CPU on server to evaluate actors for replication

graceful flame
#

I'm more concerned about the AWS outbound traffic bill

#

ahhh okay that makes sense

#

And for measuring that I should be using the Unreal Insights tool, correct?

winged badger
#

that is pretty decent, yes

#

but also, and i can't stress that enough

#

optimizing before you have a game that is somewhat working is usually a suicidal move

graceful flame
#

I'm at a point where my game is working and I'm teaching myself about optimization techniques and taking lots of notes along the way.

winged badger
#

nods