#multiplayer

1 messages · Page 23 of 1

twin juniper
#

Nobody said the opposite 😛 We talked about how great it was to boost development productivity and speed.

#

Development speed of course

#

And no Fortnite really has almost all of their things in cpp, they only expose designers stuff to BP

short arrow
#

If I had for example a replicated health value, and I knew it would only go from 0 - 100, and there'd be no decimals. Is there any reason I shouldn't leave it as a byte?

twin juniper
#

Like managing FX in weapons

#

Abilities so they can customize this or this for this weapon

#

But that is designer stuff

#

They still have a bit of things like giving weapon at startup in BP like Lyra does

#

But nothing to do with the core logic I said they have almost all of their actors in cpp

#

Even if they have a few actors like jump pad in BP it’s all subclassed from a GameplayActor class in cpp.

#

Which makes sense again to have more freedom on replication stuff, lazy loading stuff etc etc etc

twin juniper
#

Like falling damage

#

Poison

#

Etc

#

I don’t know if your game does that but you get it

short arrow
#

couldn't I just clamp it to int and then convert int to byte?

#

maybe I should just not replicate the health, and only send updates as byte

twin juniper
short arrow
#

and then unpack the byte back to the health value 🤔

low helm
#

byte is fine if that's what you want

twin juniper
#

If you know nothing will do decimal damage then yes go for it

fathom aspen
short arrow
fathom aspen
#

Ok it doesn't seem like ints are net serialized, while bools for example are

#

That is doable though if you slap your int into a struct

short arrow
#

Honestly I'm thinking I don't even need a struct

#

nevermind I do

#

alright cool thanks

fathom aspen
#

So you don't have to do anything @short arrow

#

You can use something like bitflags if you feel you are replicating too much variables that relate to each other

#

But the act of packing/unpacking is done for you

short arrow
#

is it's just super simple like that?

fathom aspen
#

No. All you have to do is have it as UPROPERTY(Replicated)

short arrow
#

wait what @fathom aspen

#

no way it's that simple

#

it just works right out of the box like that?

#

I don't have to do

    enum
    {
        WithNetSerializer = true
    };

?

fathom aspen
#

That is for custom structs you want to custom net serialize

#

Even structs has their own default net serialization iirc

#

But if you want your own, for let's say, make structs replicate atomically then you do implement your custom net serialize

wheat magnet
#

Is building server with linux or windows platform better in unreal engine?

#

Which is recommended for professional use and have fully support?

short arrow
#

@fathom aspen damn what don't you know? Lmao seriously. There's like you and 5 others who just blow my mind

twilit radish
#

He's a wizard for a reason 👀

dusty mural
#

Hi All, I have a reasonable background in C/C++, C#, and Golang (as well as others) but am interested in seeing what may, or may not, be possible in developing a UE5 headless server for a type of P2P mesh cluster design in Golang so that the nodes effectively balance out the connections and spread the "world" in addition to removing single-point failures that may result from the current head server crashing. I have been reading the UE5 documentation but am still a bit new to UE5 although I really love what I have seen. Thanks

short arrow
#

Is there any particular reason whenever I call a multicast event my dormant actor wake's up for a frame and then goes back to dormant... ?

#

I'm not calling force net update or flush

fathom aspen
#

Check UNetDriver::ProcessRemoteFunction, there's prolly a flush net dormancy call there...
(on phone rn so can't check)

#

If I get it right, the actor is placed in the level?

dark edge
fathom aspen
#

The thing is that the client is trying to ack the net guid client side but the actor hasn't spawned yet, so an actor channel will fail to open and iirc it will remain closed. BeginPlay on static actors is fired from GameState, so you can delay it for them, and it seeme legit (I bet most games do it). The other funky approach would be to fire a server RPC when BeginPlay fires client-side but don't do it 😄

#

Delays are usually avoided in MP, but sometimes they are crucial, i.e., early game.

ember dagger
#

Is there really no way in BP to set network smoothing mode in real time? It messes up my mantle and makes it jittery, but i dont want it entirely disabled.

fathom aspen
#

No. That sounds really weird, cause you want a stateful behavior. So no RPCs involved.

#

There is a good chance that might be a case.

#

The thing here you are only delaying BeginPlays for preplaced actors, nothing else.

#

Can't think of any other approach at the top off my head.

#

This is the function that dispatches BeginPlay on actors: AWorldSettings::NotifyBeginPlay()

#

Slap a delay in there

#

How much is a question of investigation and it depends

#

You mean a split screen game?

#

Hmm.

#

Double checking, you have bNetLoadOnClient set to true

#

Right?

fathom aspen
#

No, it also doesn't make sense if you think about it. You need a reference to an actor to be able to fire a BeginPlay on it 😄
BeginPlay is fired client-side on static/preplaced actors when GS replicates, and at that time all static actors should have been loaded from package I believe

#

Maybe that's a bold guarantee that UE does, so you can take advantage of it actually

#

Best you know if you test

#

Always remember that UE is full of landmines, so you never know about them till you face them

kindred widget
#

Is it not replicating at all, or just not running the OnRep?

fathom aspen
#

They are also talking about sublevels that are always loaded, but the persistent level is always loaded afaik so that is no exception

#

But again fixed

short arrow
#

is it still relevant?

fathom aspen
#

Of course you don't, the engine does it for you.

#

The NetDriver is the one that gathers properties for replication and routes RPCs

#

Is the multicast reliable or unreliable?

short arrow
#

unreliable. it's super weird though

#

the server never leaves dormant all, but the clients do?

fathom aspen
#

Okay here's the thing. Looks like the actor is awaken from dormancy, but I can't seem to find where the channel is closed and it goes dormant again

#

The NetDriver code is a nightmare

#

But it's 100% in between the lines, so that's normal.

#

I don't think that is the case for property replication or reliable multicasts

#

Can you make the multicast reliable and let me know what happens

#

Though it sound more natural for the net dormancy to be flushed even in this case

short arrow
#

it was like this regardless of whether or not the health was replicated, I set the health variable to not be replicated and made a reliable netmulticast event to see if that did anything, same result. I tried unreliable and still same thing. It updates to clients no matter what

#

I wonder if I'm the problem

#

but there is absolutely no flush or force net updates in the project currently on my side

fathom aspen
#

You are doing all this in cpp right?

#

Regardless of the issue, you don't set a replicated health property with a multicast

short arrow
fathom aspen
#

Double checking cuz dormancy is bugged in BP

#

And again what you're trying to do is done with property replication

#

You set health on the actor

#

And flush net dormancy

fathom aspen
#

Relevant connections will get the update at the time

#

Others will get it once they become relevant

short arrow
#

I hope that image is a little helpful

fathom aspen
#

Multicasts will break

#

Connections that aren't relevant won't get the updated value once they become relevant

#

Which is 100% the behavior you want to avoid

short arrow
#

I agree, I was trying to see what worked though and it seemed like none of it did, property replication is what I started with :/

#

I'll revert it back and see if it magically works. fingers crossed

fathom aspen
#

And you should stick to

twilit radish
#

@royal sinew this has nothing to do with multiplayer, and crossposting is against the rules I'm pretty sure :p

fathom aspen
#

Is this the new Iris system?

twilit radish
#

This sounds for something like #graphics yeah. Also I would suggest removing the other posts if you post there as you may get some angry moderators over posting in like 5 channels 🙂

fathom aspen
barren nest
#

hey everyone, whats th most optimal way to add client side prediction to a physics based pawn? seems like i dont have control over chaos execution

dark edge
#

I have a multiplayer physics based game but don't do prediction as my pawns are super chaotic and unpredictable

#

They are player-built vehicles so yeah, no thanks on predicting that with any amount of consistency

#

It helps that they're slow and tank-like, not zooming around like F1 cars

barren nest
#

not zooming around like F1 cars
and im working on wipeout clone

#

i guess ill look into chaos vehicles sources

twilit radish
#

Anyone ever have that feeling that you want to do a million things but are too lazy to start or know you'll never finish it? xD

fathom aspen
#

Classic daily vibes

twilit radish
#

I want to make a proof of concept of some weird kind of "host migration" system for co-op games that I thought of. But I know I'll just likely abandon my very cool spaceship game thingy in doing so :c

fathom aspen
#

RIP for the spaceship

#

btw there was a cool host migration discussion here a while ago

#

I missed it as I was at vacation but I skimmed through the most of it

twilit radish
#

Well maybe host migration is not the right term, rather a save system for when a host crashes/disconnects so you could continue in your own version of the world.

fathom aspen
#

Ah that I see

#

Yeah oddly it's called host migration too

#

But I was referring to seamless traveling to a new server

twilit radish
#

In some way it is, but it just feels weird to call it host migration 😆

fathom aspen
#

Anyways that was also talked about a few times here

twilit radish
#

I saw the seamless travel discussion from server to server a bit ago yeah.

fathom aspen
#

The key is to make sure clients are recording the server state overtime which also sound like an overkill

#

There's a plugin on the MP that does it, no idea how good is it though

twilit radish
#

Why is that a plugin? That should very much be a thing of just not replicating specific things only to specific clients.

fathom aspen
twilit radish
#

What I was also considering is making snapshots of the server's state and sending those over every so often. But not sure if that's any better honestly than just sending all state at all times.

fathom aspen
#

The latter seems like too much. Doing it periodically sounds more natural.

twilit radish
#

No more need for Dedicated Servers! If the host leaves, the game can continue
Ah yes because everyone uses dedicated servers.

short arrow
#

I'm starting to think it wasn't just a blueprint thing

twilit radish
#

If we're referring to the dormancy thing, I would be very surprised to see that broken as Fortnite I believe heavily relies on it.

fathom aspen
short arrow
#

It's like it sometimes works and sometimes it doesn't, twice now it's worked and twice now it hasn't. All in different projects lol

#

I do the same thing everytime xd

short arrow
twilit radish
#

I get people buy that plugin but it feels like something you can do your self within a few days max with C++, all it seems to do is just use Unreal's built in serialization system to save and load actors etc. and do the actual reconnect part.

#

But I guess that's plugins in a nutshell, saving you those couple of days 🤷‍♀️

short arrow
#

are you talking about net dormancy? That's a plugin?

twilit radish
#

No the host migration plugin Wizard linked earlier.

twin juniper
twin juniper
fathom aspen
twilit radish
#

Btw did we already hear more about that new replication system?

fathom aspen
#

Sadly nothing. Not that I've seen/know it made it to the 5.1 preview

twilit radish
#

😦

short arrow
# twin juniper I don’t know if you showed code but in the case you hadn’t do it

Header:

public:

    UPROPERTY(BlueprintReadOnly, ReplicatedUsing=OnRep_CurrentHealth)
        int CurrentHealth;

    UFUNCTION(BlueprintCallable, Category = "Health")
        void UpdateHealth(int Health);

    UFUNCTION()
        void OnRep_CurrentHealth();

    UFUNCTION(BlueprintImplementableEvent)
        void MCHealthEvent();

};

constructor:

ACPPMasterBuildpart::ACPPMasterBuildpart()
{
    PrimaryActorTick.bStartWithTickEnabled = false;
    bReplicates = true;
    bNetLoadOnClient = true;
    bAlwaysRelevant = false;
    NetDormancy = DORM_Initial;
    CurrentHealth = 100;
}

step 1(blueprint): https://gyazo.com/602d18f84ff6ebc9b68836c54a9747bb

step 2:

void ACPPMasterBuildpart::UpdateHealth(int health)
{
    if (GetLocalRole() == ROLE_Authority)
    {
        CurrentHealth = health;

    }
}

Sorry it's so huge

#

nowhere in this setup is flush net dormancy called

twilit radish
#

Is this placed in the world from within the editor or dynamically spawned?

short arrow
#

It's spawned by players, but even if I don't use Initial and use Dormant All instead I get the same result

fathom aspen
#

Nice. I've been trying to reproduce for the past 10 minutes wondering why clients weren't getting the new value repped down, to discover I forgot to replicate the property kek

#

The consequences of not touching any code in a while

#

So it works fine for me if the actor was preplaced

#

Let me check what happens if it was dynamically spawned

twilit radish
#

But even then DORM_All should not allow any updates.

fathom aspen
#

Yeah not even Initial. Unless you FND

#

Even Initial becomes DORM_All after the first FND

#

At this point I'm not sure why would one use Initial over DORM_All or the other way around

short arrow
fathom aspen
#

I'm just saying I can't see how they are different

#

Now my client freezed FSR

#

Ah lol mixed GameModeBase and GameState classes

#

So it works for dynamic actors too

#

Now time to check if it's fucked up if was done in pure BP

twilit radish
#

I feel like initial is more of a safe bet to make sure that if people place replicated actors in a map it doesn't consume your entire network xD

pallid mesa
#

sup guys, whats the menu today?

twilit radish
#

Pizza 😄

short arrow
#

net dormancy doesn't want to work pizza

twilit radish
#

Always +1 for pizza 😛

pallid mesa
#

whats ur netupdate rate?

fathom aspen
#

I mean Dave Ratti said that they have all these preplaced props in Fortnite as Initial, but I wish I could ask him why they weren't Dorm_All

twilit radish
#

I'm just waiting on Wizard to confirm if it works for him lol.

fathom aspen
#

I just wasn't there sad_cat

short arrow
#

I've actually been trying to get it to work for 13 hours now, I think wizardcell went to sleep and woke up already

#

I haven't slept yet..

pallid mesa
fathom aspen
twilit radish
#

Because if they were dormant all Wizard they constantly need to open and close actor channels for props. That's just bad.

short arrow
#

my net update frequency is 2

pallid mesa
#

0? that will never work

fathom aspen
twilit radish
#

Unless I misunderstood the entirety of dormancy lol.

fathom aspen
#

But I don't think that is the case, as if they were open then that means they can replicate fine

pallid mesa
fathom aspen
#

It just says if they were in the map, without stating whyyy

twilit radish
#

Man I wish Unreal's documentation didn't suck so much. I can't even find an explanation about dormancy xD

fathom aspen
#

You have to crack the source to understand why oof

short arrow
#

without calling force net update or flush

pallid mesa
#

wut

#

i tested this on 5.0

#

and it wasnt the case

fathom aspen
short arrow
#

I'm on 4.26.2 source

pallid mesa
#

yeah 4.26.2 dormancy worked, definitely.

#

mphf... how did u

short arrow
#

I posted the code a bit earlier

fathom aspen
short arrow
pallid mesa
#

I dont have ue4 by hand... but ive used and abused dormancy in such version and i dont recall such issue

#

shits hitting the fan for whatev reason... huh

fathom aspen
#

I have feelings you hot realoaded

#

Considering you're on 4

#

And you're new to cpp

clear island
#

anyone ever had an issue where where PlayerState returned a negative ping value?

fathom aspen
#

If that's the case, I'm sending you to #cpp so they can get their revenge

clear island
#

how is this possible 🤔

fathom aspen
#

Class Default Object

#

Class Defaults tab

clear island
#

thats a log on a dedicated server

twilit radish
#

Anyone knows what file implements ReplicationDriver.h?

fathom aspen
#

Ah it's ReplicationGraph.cpp

pallid mesa
twilit radish
#

wait nvm I'm dumb.

clear island
#

had the server running on a vps of mine

#

connected from my pc

pallid mesa
#

right, good so not connecting to 127.0.0.1

fathom aspen
clear island
short arrow
#

ue just hates me I guess

clear island
#

connecting to a vps in germany

fathom aspen
fathom aspen
short arrow
#

because not every actor needs to know about it from far away

fathom aspen
pallid mesa
#

ugh i need the engine to double-check the code of how the ping gets calculated and to see what would be the cause for such case @clear island do you have the engine at hand and able to explore how the ps calculates that? remember that we are on a server context

short arrow
fathom aspen
#

Pardon me I'm blind

#

🦯

clear island
#

most of the times the ping returns just fine

short arrow
#

I'm going to try with 0 net update frequency

pallid mesa
#

yes thats just a getter, but u have to check how that value is calculated

pallid mesa
#

and break everything

short arrow
#

I literally just want it to not update until I tell it to

fathom aspen
clear island
short arrow
#

from what I can tell it already doesn't work, and is broken

clear island
#

no idea where its being calculated

short arrow
#

I'm so frustrated it's been almost 14 hours lol

fathom aspen
pallid mesa
short arrow
#

Is it possible that it just updates when there's free space available?

clear island
#

I think I found it tho

clear island
short arrow
#

It is literally setting itself to awake when I change the property, and then back to dormant... Something has to be flushing it

pallid mesa
#

so now... lets try to understand when this can happen @clear island 😁

pallid mesa
#

and then puts it back to normal

short arrow
#

the thing is I'm not calling it anywhere

pallid mesa
#

i guess u know that already

clear island
#

I'll be honest I dont really understand much of what that "RecalculateAvgPing()" function is doing 😄

pallid mesa
#

hahaha aighty i think this requires a bigger picture

clear island
#

looking at PingAvgData I could understand it stores the last 4 seconds of ping data

#

but I cant see a case where the final result of the average would be a negative value 🤔

pallid mesa
#

correct but remember that execution context matters

#

so u are printing this value in the server

clear island
#

yep

#

thats a server log

pallid mesa
#

so we know that for some reason the value of such variable in the server

#

reaches said value

clear island
#

yep

pallid mesa
#

so we gotta check how that value gets written on the server

clear island
#

but still how could it ever return a negative value

pallid mesa
#

do we know the execution context of recalculatething

clear island
#

hmm could it happen maybe if the server was lagging?

pallid mesa
#

?

clear island
#

that I dont know

pallid mesa
#

right so this is where the big picture comes

#

is this like a super issue that u need to solve now?

clear island
#

its inside the PlayerState so I guess it could be either client or server

clear island
#

I was just checking todays server logs and I saw that value

pallid mesa
#

okaay then we can probably tackle it tomorrow when i get some more time, gotta go to sleep now and pc is off haha

clear island
#

and it surprised me

pallid mesa
#

but its a curious one for sure

#

😄

clear island
#

yea indeed

#

that was my reaction too 😄

fathom aspen
clear island
#

now that I look at that function again I'm noticing this

#

so its clear now the excution context is the server

#

well actually no, nvm

#

thats an "or"

#

could still be either client or server

fathom aspen
clear island
#

but oh well not important for now

short arrow
#

that's what I mean because I have this exact setup in a different empty project and it works fine

fathom aspen
short arrow
#

I mean it's similar right down to the bone

fathom aspen
#

That will be my last try

short arrow
#

still replicated to clients

fathom aspen
#

Again are you sure you are not hot reloading?

short arrow
#

I hot reloaded a few times, but it usually just crashes the editor anyway and then I have tolaunch it lol

#

Good ol development editor

fathom aspen
#

At this point I would just leave this buggy project and jump to other working one and not HR anymore

pallid mesa
#

lmao wizard

#

x'D

fathom aspen
#

🧠

pallid mesa
#

basically he means delete binaries (intermediate, yada yada...) and don't hot reload anymore 👍

short arrow
#

is hot reload gone in 5.0 ? lol

twilit radish
#

unfortunately not

fathom aspen
#

I thought it was. Or you mean the LC producing similar but still non-destructive issues?

#

Because that is my take of 5

twilit radish
#

Not referring to LC.

scenic dome
#

Hey guys, maybe an easy question for some, but I'm trying to follow a tutorial about UE multiplayer with EOS Online Subsystem. (https://www.youtube.com/watch?v=UlX3umztFDk) I followed it (I believe) perfectly but I'm getting an error when I try making functions. I make public functions but they can't be used in other scripts. I also try to include different plugins, but I can't use the code from those plugins...

fathom aspen
scenic dome
pallid mesa
scenic dome
pallid mesa
#

also probably missing a couple of includes

#

whats the error?

#

mind sharing the error?

scenic dome
#

370

fathom aspen
#

Ready for the winter I see

pallid mesa
#

hahahahah

twilit radish
#

But does it not compile or does it just show "errors" in the IDE.

pallid mesa
#

correct

#

compile it

#

and take a look at the output

scenic dome
fathom aspen
#

This is the error list

#

Ditch it

#

Output log is what you want to look at

scenic dome
#

hmm

#

I don't know... what you mean by output log, but I'll search it on google I guess

fathom aspen
scenic dome
#

I already did that to normally :(§

fathom aspen
#

It's the last part

fathom aspen
#

I left VS a while ago so I could be wrong

#

And honestly at this point it's #cpp

scenic dome
#

Well I got rid of the error list, but don't have an output log no where

#

And I still have the errors xD

#

I think my code is just not including the libraries

clear coral
#

Hi all, does anyone have a link to a tutorial on making clothing that will scale with different characters is size? I have a good set of clothes that I want all characters to be able to use but they are all slightly different in size (Multiplayer)

fathom aspen
#

Deal.

#

Now I get where my MP questions at though sadeg

#

Probably the same one that came over here

fathom aspen
#

Where's my #clothing at?

clear coral
past totem
#

he,llo

#

does it make sense that my struct array variable became too big (too many array items) so it stopped replicating to clients? lol

sinful tree
past totem
#

but the array size is only like

#

30 items

sinful tree
#

How big is each item?

past totem
#

Good question

#

but I feel like

#

the whole actor stopped replicating

#

but maybe not.

#

Idk.

#

man , games are complicated

#

I'm scared

#

what if someone finds another major bug like this on release

#

okay, I think I get what happened

#

I think a different array reached the max array memory

#

and that made the whole actor replication break kinda

#

cleaning that array fixed the issue

#

so what should I do

#

I have like a big array

#

that I want to sync to the client every few minutes or so

#

should I just make it into a multicast event that updates the var on the client? instead of a replicated variable?

past totem
#

how can I know why my server is crashing

stuck gorge
#

Hi, Is it normal that variables are replicated without sync with main flow? When I try change a replicated variable and after send multicast event this event works faster on clients then replication data. Is it right? Or do I something wrong and wrong interpretate my log?

vivid seal
#

replication is not guaranteed to happen instantly or even in the order you set variables (i think order is determined by where you list them in GetLifetimeReplicatedProps?) The client is also not guaranteed to get every update to a variable, it will just eventually sync

#

the only time you can know for sure that one thing will arrive before another is if you send reliable RPCs, in which case those always go in order

iron crest
#

Hello I have a question/problem, I have an ability where when you active it, it will show a particle affect on the ability's instigator/user, and everyone else, but only the ability user can see the affect, the problem is, the particle just wont spawn on the other players, I know this is a replication problem, but idk where I went wrong, here is my bp, thanks in advance

thin stratus
#

What's the GetAllActorsOfClass for?

#

Despite printing the DisplayName of what your other Variable should already be, you aren't even using it

#

And what is "Chakra" that you are passing along the RPC?

#

Also that is Overlap driven, does this Actor you are in exist on everyone?

#

If so then the Overlap already happens on everyone.
If not, then you need to ensure that the Chakra thingy is also replicated, otherwise you can't pass it along with an RPC

clear island
#

how do I get the error message of a network error?

#

that is on the GameInstance

#

when I do that "ToText" I get "Pending Connection Failure"

#

But I want that error string, in this case "Incompatible Version"

#

that message is set on the GameMode during PreLogin

#

ok I just realized this is not possible in blueprint, I'll do it through cpp

noble junco
#

horribly noob question: If characters have the ability to have multiple layers of clothing. its it better to make skeletal meshes to merge for each variation or is there a better way to layer the meshes on the fly and avoid collision problems?

twilit radish
#

@scenic dome I would suggest asking in #epic-online-services , there's also Epic staff in there. Probably a better place to get an answer 🙂

twilit radish
noble junco
regal geyser
#

Is there a way how I can remove the "character sliding" effect when the joined client has low fps/slow internet connection? It's impossible for him to move because the server will just start moving him in a different way based on his previous inputs and he will start sliding to the sides.

scenic dome
iron crest
#

Hello, I have a problem; im trying to make an ability where you can see an emitter on the ability user and actors around him, I also want it to function as, if your not using the ability, you cant see your emitter, im doing this by spawning an emitter on other actor in a collision, problem is, everything is going haywire, its spawning the other actor on top of mine, and the person not using the ability can see rtheir emitter, here is my bp, does anyone know whats going on?

young spoke
#

hello, anyone working on linux use a network profiler?

#

however, i am able to generate profile files with netprofile command

solar swallow
#

hi, I'm new to multiplayer. I've got an actor that randomly spawns in a couple actors at runtime. The issue is the spawned actors are in different locations for each player. How would I spawn in the actors on the server itself so they appear in the same spot for every player?

fervent yacht
#

Check if it's the server before spawning?

solar swallow
fervent yacht
#

HasAuthority iirc, let me look to be sure

#

Role_Authority may beproper

twin juniper
# iron crest Hello, I have a problem; im trying to make an ability where you can see an emitt...

This is happening because the collision block your player is colliding with exists on every client and the server, so when a player interacts with it, the collision also hits everywhere that pawn is (all clients and the server have a "copy" of the pawn) thus spawning a ton of particle systems.

I might be misunderstanding what you want, but if you only want the emitter to be visible to the players that have the ability, you should execute the spawning on each client and check if the client has that ability set. Begin overlap() -> !has_authority -> get player controller 0 -> bUsingAbility() or however you want to check for it -> spawn emitter.

https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
Is a really good source to understand how unreal does their multi-player stuff

fervent yacht
#

100%^

solar swallow
twin juniper
# solar swallow 5

There's an enum you have to check I believe. Let me find it. They changed it lol

#

Role == ROLE_Authority

hollow eagle
#

just call HasAuthority()

#

you can't access Role anyway, it's private. You'd need GetLocalRole().

solar swallow
#

I've used HasAuthority and now the spawned actors only appear on the server, not client. I have enabled replication on the spawned actors. They only have a static mesh component. Do I need to do anything else to make them visible to the client?

hollow eagle
#

yes, the actor needs to be marked as replicated

solar swallow
hollow eagle
#

sorry, missed that

#

for basic replication that's really all you need - SpawnActor needs to happen on the server, and the actors need to be marked as replicated. I'd suggest posting some relevant code (potentially both the bit spawning the new actor and the actor itself)

past halo
#

I fixed it for him 👍

twin juniper
#

What was the problem?

#

Just curious

solar swallow
# hollow eagle for basic replication that's really all you need - SpawnActor needs to happen on...

This is the spawning function, this gets looped x times

FOreValue OreValue = *OresToSpawnArray[OreNum].GetRow<FOreValue>(OresToSpawnArray[OreNum].RowName.ToString());
        
AOre* Ore = Cast<AOre>(GetWorld()->SpawnActor<AActor>(AOre::StaticClass(), SpawnLoc, Rotation,SpawnParameters));
Ore->OreValue = OreValue;
Ore->SetMesh();
Ore->MeshComp->SetRelativeScale3D(FVector(UKismetMathLibrary::RandomFloatInRange(.75, 1.25)));

This is the setMesh function in the spawned actor. It reads in a static mesh from a datatable and sets the mesh of the static mesh component equal to it

void AOre::SetMesh()
{
    if(GetWorld())
        {
        MaxOreContained = OreValue.MaxOreContained;
        
            if(IsValid(MeshComp))
            {
                MeshComp->SetStaticMesh(OreValue.Mesh);
            }else
            {
                MeshComp = NewObject<UStaticMeshComponent>(this);
                if(MeshComp)
                {
                    MeshComp->RegisterComponent();
                    MeshComp->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::SnapToTargetIncludingScale); 
                    MeshComp->SetStaticMesh(OreValue.Mesh);
                    MeshComp->SetWorldLocation(GetActorLocation());
                    MeshComp->SetGenerateOverlapEvents(true);
                    MeshComp->SetNotifyRigidBodyCollision(true);
                    MeshComp->SetCollisionProfileName("BlockAll");               
                }
            }
        }
}
past halo
#

He was trying to make a mesh become visible on client side without the whole server seeing so i showed him he needed to just not replicate it at all and make the visibility check client side (Replicate the code for the spell and make separate code for the single player visibility)

hollow eagle
#

two notes - one, you can do SpawnActor<AOre> and get rid of the Cast

#

two - is the mesh component set to replicate?

hollow eagle
#

it won't pickup changes to it from the server then

#

so either set it to replicate or make SetMesh into an RPC

solar swallow
#

k, I didn't know it could be replicated, the docs say it cant

hollow eagle
#

docs are wrong about that, you can tell by looking at the source for UStaticMeshComponent - multiple properties (most notably the mesh itself) are setup for replication

#

not everything in it is replicated but the important part - the chosen mesh to render - is.

solar swallow
#

ok, thank you for your help

twin juniper
fathom aspen
#

So they are just part of the CDO (Pulled from the CDO client-side). Replicating the SkeletalMeshComponent for example would break the CMC.

dim trail
#

do functions that cast not replicate? I have a HP and SP UPROPERTY that is set to replicate and I have a function that increases hp/decreases mana, but for some reason when my healthregen function gets called by timer the hp/sp will reset to the previous value

int32 AStatus::StatusHeal(ACharacter* PC, ACharacter* Enemy, int32 HP, int32 SP)
{
    if (PC)
    {
        APlayerCharacterGASWithAbilities* Player = Cast<APlayerCharacterGASWithAbilities>(PC);
        if (HP && Player)
        {
            if ((Player->Health < (Player->MaxHealth)) && (!Player->Death) && (Player->Health > 0) && (Player->Mana >= 3))
            {
                if (Player->Health > Player->MaxHealth - 6)
                {
                    Player->Health += Player->MaxHealth - Player->Health;
                    Player->Mana -= 3;
                }
                Player->Health += HP;
                Player->Mana -= 3;
            }
        }
        if (SP && Player)
        {
            if ((!Player->Death) && (Player->Health > 0))
            {
                Player->Mana += SP;
            }
            
        }
    }
    if (Enemy)
    {
        AEnemyCharacter* EnemyCast = Cast<AEnemyCharacter>(Enemy);
        if (EnemyCast->Race.Equals("Undead"))
        {
            if (HP)
            {
                EnemyCast->Health -= HP;
            }
        }
    }
    return 0;
}
#

i call this on beginplay

#

when the mana decreases im casting the ability to increase hp

pale obsidian
dim trail
#

yeah, i just realized this. has to happen on the server

manic trellis
#

hello there,
I am working on a nameplate functionality using the tutorial link given.
he is doing a RPC on server. and then server is doing a RPC multicast.
but I want to avoid multicast RPC.
is there anyway to do.
I am pretty much new to multilayer implementation.
thanks in advance.

plucky prawn
#

Really though multicast seems like the wrong thing to use anyway. You would be better off just using the player state since it's replicated for you and contains the player name

manic trellis
#

thanks for this information.
hope it will helpful.

fathom aspen
#

The name would be a TextRenderComponent attached to the player pawn

manic trellis
fathom aspen
#

Ah it's doesn't matter if it's a WidgetComponent or a TextRenderComponent honestly. It's just that a TextRenderComponent seems more natural and gets the job done faster (though you don't need localization).

#

Yeah multicasts are of course not intended for this

#

Another sad day for YT tuts

manic trellis
#

lol
thanks for the information.

chrome bay
#

FFS

fathom aspen
#

Wondering what bKeepNonOwnedActor means? All they saying down there is "we don't own this actor"? Who are we?

TArray<AActor*> ActuallyKeptActors;
ActuallyKeptActors.Reserve(KeepAnnotation.Num());

// Rename dynamic actors in the old world's PersistentLevel that we want to keep into the new world
auto ProcessActor = [this, &KeepAnnotation, &ActuallyKeptActors, NetDriver](AActor* TheActor) -> bool
{
    const FNetworkObjectInfo* NetworkObjectInfo = NetDriver ? NetDriver->FindNetworkObjectInfo(TheActor) : nullptr;

    const bool bIsInCurrentLevel    = TheActor->GetLevel() == CurrentWorld->PersistentLevel;
    const bool bManuallyMarkedKeep    = KeepAnnotation.Get(TheActor);
    const bool bDormant            = NetworkObjectInfo && NetDriver && NetDriver->ServerConnection && NetworkObjectInfo->DormantConnections.Contains(NetDriver->ServerConnection);
    const bool bKeepNonOwnedActor    = TheActor->GetLocalRole() < ROLE_Authority && !bDormant && !TheActor->IsNetStartupActor();
    const bool bForceExcludeActor    = TheActor->IsA(ALevelScriptActor::StaticClass());

        // Keep if it's in the current level AND it isn't specifically excluded AND it was either marked as should keep OR we don't own this actor
        if (bIsInCurrentLevel && !bForceExcludeActor && (bManuallyMarkedKeep || bKeepNonOwnedActor))
        {
            ActuallyKeptActors.Add(TheActor);
            return true;
        }
#

That is part of the code of persisting actors on seamless travel

#

The better question is: When will an actor have Role < Role_Authortiy? (away from the player related ones: Pawn/Controller/PlayerState)

#

I managed to make an actor to has bKeepNonOwnedActor == true by making it:

  1. Preplaced.
  2. NetLoadOnClient = false.
#

But that's dumb. Not sure when I will have such an actor. Seems to me they are referring to a specific type of actors

chrome bay
#

I have actually used that setup, but pretty damn rare tbh

#

IIRC what it does is cause the actor to not be loaded by the client as part of level startup, but will sort of "spawn" the actor for the client and replicate it down

#

So it's almost like you had a spawner there or something

#

Can't imagine why I'd want to keep it for seamless travel though :/

#

Unless you were going back to the same level or something.. IDK

fathom aspen
#

Ah I didn't make it Replicated. If I did it would have persisted right?

chrome bay
#

Ah yeah, I would think so

fathom aspen
#

Cause with NetLoadOnClient set to false the client has no idea it's there

chrome bay
#

reallly odd case though to bring that accross

#

Oh maybe there's more to what we did then

fathom aspen
#

Yeah I see

chrome bay
#

Oh yeah sorry, this was a replicated actor that was pre-placed in the level. But them being pre-placed caused some issues for clients, so we marked them as bNetLoadOnClient to false, which would cause the server/client to treat it like a "spawned" actor rather than a preplaced one essentially

fathom aspen
#

Correct, it would have a dynamic net guid I guess?

chrome bay
#

Yeah I would assume so

#

no idea why you'd want that to persist on seamless travel though

fathom aspen
#

Another totally different question, does the Outer affect if an Object gets to persist to the destination level?
To put you more into context: I'm trying to understand why UUserWidgets are persisting a seamless travel. So it turns out that happens because their outer is GameInstance. If I Rename them so their outer changes to be something else, say Character, then they don't persist.

chrome bay
#

yeah that makes sense to me

#

we only use GI for stuff that should survive level/actor lifetimes like dialog boxes etc - but gameplay widgets are always assigned to the controller that's looking at them in our case

fathom aspen
#

By assigned you mean owned or outered?

chrome bay
#

Yeah, although we do explicitly kill them off in our AHUD when it's destroyed as otherwise they would also persist with the controller

#

I'm sure widgets never used to survive level transitions in ye olden days

#

Lyra uses LocalPlayer as the owner so I assume it has the same problem and they have to manually clear somewhere

fathom aspen
chrome bay
#

yah

#

Plus they're referencing a bunch of level actors and stuff usually, so we always just kill them

fathom aspen
#

Also if I look at this:

/** 
     * called on server during seamless level transitions to get the list of Actors that should be moved into the new level
     * PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list
     * (i.e. Object.Outer == Actor in the list)
     * are all automatically moved regardless of whether they're included here
     * only dynamic actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay)
     * this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game)
     * @see also PlayerController::GetSeamlessTravelActorList() (the function that's called on clients)
     * @param bToTransition true if we are going from old level to transition map, false if we are going from transition map to new level
     * @param ActorList (out) list of actors to maintain
     */
    virtual void GetSeamlessTravelActorList(bool bToTransition, TArray<AActor*>& ActorList);
#

You can see this part: (i.e. Object.Outer == Actor in the list)

#

So their has to be something with the Outer

chrome bay
#

oh yeah, figures - would be components and stuff I guess

fathom aspen
#

But what is puzzling is that it's the Object referencing the GameInstance/PC, not the other way around? Why they aren't getting GCed?
So I used this obj refs command and it turns out they are being referenced by the slate widget which isn't GCed.

#

But that still doesn't explain the behavior I'm getting

chrome bay
#

I just don't think there's a mechanism for automatically killing widgets when the level changes, since they aren't bound to the level in anyway

#

Unless they are "outered" by an actor or something that lives in it

fathom aspen
#

Hard traveling does it by binding to a delegate that calls a function that does it

chrome bay
#

oh interesting

#

hell if I know then 😄

fathom aspen
#

Yeah that's why they only persist in seamless

chrome bay
#

Oh HARD travelling, gotcha

fathom aspen
#

And only under the condition of Outer being persistent

#

At this point I'm pretty sure that any UObject that is outered to a UObject that is persistent will also be persistent

chrome bay
#

yeah

#

We manually clear them up, I expect we'd have the same issue if we didn't probably

#

Quite literally:
void AShooterHUD::Destroyed() { CleanupWidgets(); // blah }

fathom aspen
#

But keep in mind the HUD is persistent up to the point the newer HUD is created

#

So Destroyed fires but a bit late

#

I would probably do it on FWorldDelegates::OnSeamlessTravelStart delegate

fathom aspen
warped hawk
#

Hi <@&608320500170620938> , I am trying to spawn a character on my map. The "possess" functionality doesn't seem to work on the client side but. I tried adding delay but still it was of no use. Please help if possible.

#

This is the event graph

fathom aspen
#

I've been here for a few years and never seen that ping thonk

#

Whatever the thing is you are using GetPlayerController(0)

#

That is only making the first player possess

#

We know that is event graph but we don't know what class it is

warped hawk
#

This is the level blueprint

fathom aspen
#

Oh no.

warped hawk
#

I tried the same in the game mode

fathom aspen
#

You don't use the level BP for such a thing

#

Not that you use it for many things

#

Reason being the level BP isn't replicated so you can't fire RPCs there anyway

#

And you have timing issues

fathom aspen
#

But the good news is you don't need RPCs at all

#

And you do need GameMode as that is where the engine spawns pawns

#

So more or less you are going to go the engine route

#

My suggestion would be to read Cedric's Compendium found in this channel pins and you should be able to solve the problem by yourself

fathom aspen
# warped hawk

Another two notes:

  1. You should avoid using delays when doing multiplayers.
  2. You should know that BeginPlay usually fires on server and client so splitting the two execution paths is generally done using a SwitchHasAuthority
warped hawk
#

Ok.... Thank you so much...!

devout dagger
#

how can this "authority only" option be enabled in a function created from a blueprint?

fathom aspen
#

You can't

#

The best you can do is check NetMode < NM_Client

devout dagger
#

you meant netmode == server ? that's right ?

fathom aspen
#

Silly NetMode isn't exposed to BP, so you will have to do your own function that you just attach it to your custom BP functions

fathom aspen
#

All types of servers

#

Listen, dedicated and SinglePlayer

devout dagger
#

Well, thank you.

fathom aspen
#

Or you can just use IsServer

#

It's exposed to BP and does somehow what I typed

#

It does the not equal operator though

timid tendon
#

HI guys, I have the following BP to toggle between character movement modes. It works perfectly fine except for the use controller roatation yaw bit, which does not seem to replicate client -> server. It worked perfectly fine when I initially set it up, I don't remember having to do anything special to get it to work. Any advice as to where I should start looking for the solution?

fathom aspen
#

Not that I do any CMC, but my initial guess would be that you might want to set that variable on server (too)

timid tendon
faint parcel
#

I'm looking at disabling movement when GamePlay effects apply an Immobilized tag.

Will this code behave nicely if implemented in a GetMaxSpeed override of CharacterMovementComponent sub class or is there a better/simpler way? I was also looking at just setting the MovementMode to None as a possibility.

float USSPCharacterMovementComponent::GetMaxSpeed() const
{
    ACharacterBase* Owner = Cast<ACharacterBase>(GetOwner());

    if (!Owner->IsAlive())
    {
        return 0.0f;
    }

    const int32 ImmobilizedTagCount = Owner->GetAbilitySystemComponent()->GetTagCount(ImmobilizedTag);
    const int32 ImmobilizedRemovalTagCount = Owner->GetAbilitySystemComponent()->GetTagCount(ImmobilizedRemovalTag);

    if (bImmobilized || Owner->GetAbilitySystemComponent() && ImmobilizedTagCount > ImmobilizedRemovalTagCount)
    {
        return 0.0f;
    }
    const float MoveSpeed = Owner->GetMoveSpeed();
    return MoveSpeed;
}
fathom aspen
#

I set MovementMode to none when I want to disable movement, but there might be better practices for GAS. I would also consider asking in #gameplay-ability-system

faint parcel
#

Should I link to my post if I want to cross-post or just copy it whoesale, hope it doesn't feel like spam if I post the question multiple places.

#

Good to know that it isn't an unheard of way of doing it though.

fathom aspen
#

Both options are good. The latter would just force peeps to see it so it's better.

#

And no you are not cross posting at this point

latent heart
#

Why not just return Owner->GetMoveSpeed(); ?

faint parcel
#

You mean condense the two last lines? I'm not sure why I wrote it like that, maybe leftovers from lines gone.

latent heart
#

Also, why do you check Owner->GetAbilitySystemComponent() in the if expression, but not when getting the tag counts?

#

You should rewrite this function almost entirely!

faint parcel
#

No idea, good call. I think I can just assume it to have an AbilitySystemComponent.

#

check() it to be sure.

latent heart
#

For instance, you can check bImobilized and return early.

#

Then check the Owner. Then check the Owner->GAS.

faint parcel
#

I should post more code, get it reviewed 😄

#

Good points, rewriting.

latent heart
#

I have to do it a lot. 😦

faint parcel
#

Review or rewrite? 😄

latent heart
#

Many many philosophical coding standards arguments!

#

Both.

faint parcel
latent heart
#

Absolutely!

fathom aspen
#

I vote for #coding-standards 👀

latent heart
#

This one coding standard said to use virtual or override. I cried inside. Luckily it wasn't ours.

faint parcel
#

A bare-knuckle fighting pit where the winner decides! This week: capitalization rules are on the line!

latent heart
#

I usually rally the support of my fellow coders!

faint parcel
#

Why discuss when you can just refactor the entire code base whenever anyone steps out of line, then revert their revert of your intrusive refactor?

faint parcel
dim trail
#

why cant RPCs have a return type? is there a way around this?

latent heart
#

Because they are asynchronous.

#

Having an immediate return type doesn't make sense.

#

The way around it is to make a second RPC which sends data back (or use onreps if it's server->client)

#

It's like sending a letter and expecting a response the second you put it in the letterbox.

dim trail
#

so if i wanted an rpc to return a bool i would have a second rpc that send data back in what way?

latent heart
#

Correct.

dim trail
#

but you said RPCs cant have a return type?

#

i'd need an example to understand what youre getting at

chrome bay
#
{
    Client_DoSomethingResult(true);
}

void Client_DoSomethingResult(bool bResult)
{
    // Voila
}```
dim trail
#

i see

chrome bay
#

You can't perform a network request synchronously, you're sending data from one PC to another which takes time

#

(an arbitrary amount of time also)

twilit radish
#

Hey, question. What do you guys think is a good project/feature to make to in general gain more knowledge about multiplayer? I feel like the silly spaceship game I'm working on just isn't really learning me anything new or pushes me in any way. Except me just getting triggered by Unreal's UI system lol. I'm trying to improve my knowledge of this all but I'm just not really sure what to learn that would actually be good to know 🙂

fathom aspen
#

Write blog posts. 👀

twilit radish
#

😂

#

But about what D:

fathom aspen
#

Blog posts are underrated I knew it PES_Cry

#

Anything that comes to your mind honestly

#

You will feel the pressure that this will be seen by many people and you will spend much time just cracking every bit of the thing you're exploring

#

Even basic systems that you think you understand, will amaze you by the pitfalls and secrets they have

twilit radish
#

How to make my own fully predicted server authoritative spaceship vehicle

fathom aspen
#

That is nice but tough as it touches on prediction. You'll get reach though I assure you

eternal canyon
twilit radish
#

No such thing as packet loss with TCP am I right 😛

quasi tide
quasi tide
fathom aspen
twilit radish
whole zealot
#

Make it a network or split screen game

#

There's lots of value in taking even a simple game all the way through to a releasable package though (even if it's free). Soooo much to learn from the final 10% of a project. It's where you really see the impacts of decisions made early in development that back you into a corner. All the ins and outs of adding the tiny bits of polish that take a game from just playable to a smooth fun experience

#

But yeah, if you find the project isn't pushing you in ways you want, I'd look at spicing it up, not scrapping it

quasi tide
bitter oriole
#

Put it on Steam, build a store page, get bug reports, fix issues, etc.

#

Not for everyone, but a great learning experience!

fathom aspen
twilit radish
#

I think those are pretty good ideas. Both making something that's more challenging instead of my lazy implementations I've done so far honestly and trying to actually make it a full working thing 🙂

#

Not sure if I will actually publish it on Steam but the idea of having a version that in theory could go on it sounds like a first step 😄

#

Thanks for the input all!

twin juniper
#

Does anyone know if an actor can have issues with RepGraph if it's not ticking ?

chrome bay
#

Doesn't matter

twin juniper
#

i'm facing a weird issue then

#

I guess i'm giving weapons too early that pawn had not time to be added to rep graph

chrome bay
#

possibly. if you're using the dependency system, it will silently fail if you add it to the graph before the parent actor

twin juniper
#

So yeah it might be that

#

I well implemented my weapon actor to it, exactly like ShooterGame so idk where is the issue

chrome bay
#

That looks like Lyra not ShooterGame?

#

unless you're doing massive online game rep graph is pretty pointless anyway tbh

#

In my own version of repgraph I keep anything that is dependant on it's owner/parent in a pending list, and check that list whenever a new actor is added

twin juniper
#

My project was based on ShooterGame, then implemented GAS etc....

#

So yeah it's lyra but not lyra 😄

#

the whole weapon logic etc are not the one from lyra

#

it's more like the one from UT4/ShooterGame with GAS implemented in it

twin juniper
#

i better learn those systems now than having one day the task to implement it in a professional situation and having no clue how it works nor how to implement it

chrome bay
#

Yeah fair enough, that's probably the issue anyway

#

Pretty common problem when you're spawning actors that also spawn other actors as part of their startup/init process

twin juniper
#

yeah i'll try to give the weapon 5sec later to see if that's it

#

but that's very weird cause i'm spawning the weapons in Pawn's Possessed function

#

it should be initialized etc since that

chrome bay
#

Hard to say really

twin juniper
#

Okay i know where is the problem 😛

#

It's when the simulated has to call Equip function on other clients

#

That's what i'm doing for late joiner or rare case where player does not see other player weapons

#

So i guess i should call the Equip function directly (since it handles the RepGraph delegate)

twilit radish
#

Has anyone ever used the built-in spectating system? It feels like a mess and I'm not sure if it's just me not understanding it correctly or it actually being a mess. PlayerController has a state for being a spectator (or playing or being inactive) while PlayerState also has 2 states for spectators ('is a spectator' and 'can only ever be a spectator') but they don't nicely seem to get updated. Then for some reason GameModeBase has a bStartPlayersAsSpectators that only ever prevents someone from spawning the default pawn and doesn't actually change any of the state. Very confusing lol.

chrome bay
#

It's garbage legacy stuff from UT/Gears

#

But probably never going to be culled because no doubt many licensees sorta depend on it

twilit radish
#

Got it. Then I'll just write something my self 🙂

quasi tide
#

Maybe one day we'll get UE to remove a bunch of cruft.

chrome bay
#

It's usable but only when jumping through hoops tbh

#

No doubt people can do something more specific for them

twin juniper
chrome bay
#

It is but you have to handle it gracefully in replication graph

oak prawn
#

Isn't there a way to copy the movements of the car without using repetitive motion? The 2nd user agent hangs a lot when using the replicate move.

woeful mirage
#

Good day guys! can you tell me text chat services like vivox or photon that work well with Unreal engine ? I am testing streamchat but so far not so good results , photon and vivox only have voice chat as far I can test. Thank you so much in advace to all of you!

#

btw I cant use Eos chat because the game wont be in the Epic store by the time.

gleaming kite
#

You dont need a game in the epic store to use EOS afaik

woeful mirage
#

ohh really?!

gleaming kite
#

99% sure, but double check

woeful mirage
#

I was given that for granted ! I will double check that! thanks!! if that so it will be awesome!

gleaming kite
#

good luck :)

woeful mirage
#

"Epic Online Services will work across any engine, any store, and are designed to be integrated with any major platform. With a single SDK, you can easily access any of the services offered by Epic." Ohh boy! thanks @gleaming kite !!!

gleaming kite
#

glad I could help

gleaming kite
#

Quick question, why do Anim notifies not fire on the server when triggered by a client? The client is playing the anim infornt of the listen server so it’s not like it’s being culled or anything. Strangely though, anim notifies that are triggered by the server fire on all clients and the server

#

Also all clients fire the notify so it’s not a replication issue, it’s just that the server doesn’t fire clients rep-notifies

dark edge
#

just the animation is playing on both sides so the notify happens on both sides

gleaming kite
dark edge
#

From the host POV, does the clients mesh play the anim?

gleaming kite
#

It’s just driven by the cmc in an anim graph. But yes, the clients are playing the animation from the host pov

gleaming kite
#

If anyone has any tips on this it would be much appreciated as I’m struggling to find a working solution. I suppose I could rpc to the server but these notifies are firing multiple times a second at times (footsteps)

#

Ok, I found a fix by setting bOnlyAllowAutonomousTickPose = false; on the Mesh and commenting out TickCharacterPose(DeltaTime); in MoveAutonomous() on the CMC.
It seems like the listen server doesnt really play client animations but a weird netsynced version of keyframes. I'm sure its not synced anymore but for my use case its good enough.

gilded vapor
steady musk
#

Sup guys
Do you know, is there a way how I can hide smth for a player that is hosting listen server?
I want to hide things ONLY for host and not for other players of course

gleaming kite
solar swallow
#

Hi, I'm spawning an actor during runtime, adding a static mesh component to it, setting the mesh, and then enabling replication on the component. Both client and server can see it when I do it in blueprint, but not when I do it in c++, I can only see the actors on server

#

Creating and setting the mesh^

#

The blueprint and c++ versions both create the same actor class, which has replication enabled in the constructor

#

The actor gets spawned at a random location so I can't just have each client call the spawn function individually

dark edge
chrome bay
#

Also, most of those component properties are not replicated

#

So server and client will have different collision settings, different physics settings etc.

#

About the only property that is replicated is the mesh to use

solar swallow
solar swallow
#

I've got it to work properly now in c++, turns out the spawn parameters were messing it up

#

Still interested in what the best practice is for replicating components

fiery jewel
#

I'm having issues with my dedicated server build. I created a Docker image that builds my server based on the one at unrealcontainers.com. The build and everything works fine, but when I run the docker container the server seems like it doesn't quite finish starting. Here are the logs - https://gist.github.com/Coop56/f3233f7b73fbe3ffd09e28e5e2c46c22 - notice how they seem to just stop and never create a socket bind. Normally I'd expect to see something in there like Created socket for bind address 0.0.0.0 on port 7777 but I don't have that in my logs. Can't connect to the server either. Here's the Dockerfile if that might be helpful. https://gist.github.com/Coop56/0257e926747ad046865f3302d5ec8f28 I'm running the docker container with docker run -d -p 7777:7777 image-name. It's hosted on an Ubuntu 22 droplet on Digital Ocean. I opened up port 7777 with ufw allow 7777. Anyone have any ideas?

vivid seal
#

Working on predicting root motion (not using GAS) with my own ability system and having jitter every time I do so. Currently my custom ability system applies the root motion on the client, and I am then integrating with the CMC to have the network move data also call that root motion on the server. For simulated proxies I am replicating an object that just applies the root motion on PostNetReceive, and I'm using the bNetOwner flag in ReplicateSubobjects to avoid replicating this object to the owning client. I have checked with logging and the root motion is successfully running on the owning client, server, and simulated client once each, it looks smooth on the server and simulating client, but the owner has some snapping around that occurs pretty consistently.

I am really struggling to understand the cause, as I have implemented things pretty similarly to use Launch Character and to be able to teleport within the CMC's prediction system and those work without a hitch or any net corrections... It's just root motion stuff that causes jitter.

#

I can post code if that helps but there is a LOT of different stuff involved and I'm not sure exactly where things are going wrong

chrome bay
# solar swallow whats the best approach then?

Best approach is make it a default component with the appropriate settings as an asset. If you can't do that, you'll need to manually replicate any additional properties that you want to sync down to clients.

bold perch
#

Hi
I created a widget in the form of world. but somehow it doesn't show up
does anyone have a solution? (in stand alone, BP can work)

twilit radish
bold perch
#

widget not visible even after i trigger it

what is RPC from Client -> Server?

i still beginning in multiplayer so I don't know the meaning of RPC

twilit radish
#

The "SR_OpenWidget" event is what I was referring to.

bold perch
#

net mode play as client

twilit radish
#

As in what is actually calling / triggering that event 🙂

bold perch
#

if I approach the box then click the E button it will activate BPI_interact

bold perch
twilit radish
#

So what my guess would be is that you're calling the RPC/Event on the actor directly, which likely isn't owned by that player. A client needs to own the actor to be able to call a RPC/Server side event on it. I quickly looked at your tutorial and the person in that video uses the third person character (which is owned by the client) to send that RPC/event to the server. What I would recommend you do is either use the PlayerController or also a Pawn/Character and put the interaction event from Client -> Server in there and then from there do the multicast/event to all players on your UI actor 🙂

fathom aspen
#

I would prolly Reset them before doing the travel. See AGameModeBase::ResetLevel for reference

#

BeginPlay won't get called for sure. And I don't see the part where same class is mentioned there. But if you want BeginPlay to get called, call it yourself in APlayerController::Reset.

#

That will call it server-side

#

Call it in ClientReset to call it client-side

#

You have to reset them yourself

#

Reset doesn't do anything really

#

It's a convenience function for you to implement

#

I don't think you need to destroy and respawn your controller really

#

If all you're doing is reloading your level

#

Even seamless travel doesn't reloading them by default if they were the same class

#

That is left for you to do

#

And oh yeah that same class part is if you are seamless traveling correct

#

Right, but if you are traveling to the same map then they are same class, and I don't see a value in reinstantiating them

#

That if they were the same class

#

Then you will have to make new classes

#

Or edit engine code

#

It's a good practice to make different classes fwiw

#

For different levels that is

#

Yes

#

You will prolly at some point have different logic

#

So you are ready for that moment from now

#

The same level will be handled differently. You will have the same PCs and reset them

#

Or you reinstantiate

#

Just how you see best

#

You can recreate the engine functionality. Though you have to be careful. I would prolly just Reset them

#

It will stay in GameMode. Some other GameMode function will call it prolly

#

I can't know who that will be

#

Will have to look at code

#

No worries. As long as you know what you're doing and you are not reinventing wheels, then you're good to go!

twilit radish
#

Wizard I hate Unreal

#

It's biased towards GameModeBase 😂

#

I'm trying to spawn and possess my own pawn instead of using the default system, but for some reason BeginPlay gets called directly when spawning the pawn while when the default system does this it only does it after things like ownership have been initialised. Which in my case makes IsLocallyControlled fail for just the listen server host.

fathom aspen
#

Yeah that's right.

#

BeginPlay gets called usually before the pawn is Possessed

#

Ah you're referring to the vanilla behavior

twilit radish
#

The new system is me just doing this:

APlayerShip* Ship = GetWorld()->SpawnActor<APlayerShip>(PlayerShipToSpawn, FoundSpawn->GetActorLocation(), FoundSpawn->GetActorRotation());
Controller->Possess(Ship);
```But for some reason whenever the default GameModeBase does this it works just fine with BeginPlay and IsLocallyControlled.
#

But when I do it with the above code it has different behaviour for the listen server.

fathom aspen
#

I mean I'm pretty sure even in vanilla you can't guarantee that is the case either

#

In vanilla they do it kinda like this

twilit radish
#

And that's why it confuses me

#

Why does it work really consistently when using the default behaviour but when I do the exact same thing it's different xD

#

Unreal just hates me 😔

fathom aspen
#

I assure you the default behavior doesn't work for me lol. Unreal is just playing games with you 😛

#

There is a race actually here

#

Possess and BeginPlay

twilit radish
#

I'm just going to change it to what I did with my other project, OnRep overrides everywhere 😄

fathom aspen
#

I mean the best I found is to call a client RPC when Possess fires and then check IsLocalllyControlled, etc.

twilit radish
#

But why would I call an RPC for that when I can override a method?

#

There's a replicated property for the owner.

fathom aspen
#

Ah I'm not aware of your setup xD

#

Yeah do it where it fits you

twilit radish
#

It's default Unreal behaviour.

fathom aspen
#

I don't think I'm following. You are doing things in BeginPlay but IsLocallyControlled is failing because the pawn hasn't been possessed yet

twilit radish
#

Correct.

#

So what my solution in a different project was is doing this:

// Client side detection of when the controller gets set...
virtual void OnRep_Controller() override;

// Overriden so the server...
virtual void PossessedBy(AController* NewController) override;
#

PossessedBy gets called on the server, and OnRep_Controller on the client.

fathom aspen
#

Right.

#

I was going to say my other method

#

Which I haven't got to try yet

#

AcknowledgePossession

#

for client

#

GAS compendium mentioned it, as you have to initialize things for server and client and I still recall that

#

For server they use PossessedBy which is 💯

#

Anyway either this or yours sound better to me than calling an RPC. But you know for BP peeps it's inevitable 😔

twilit radish
#

So Wizard. Your AcknowledgePossession gets called based on the same OnRep that I override xD

#

Also I hate the code for PlayerController. It basically copies the code of AController and then proceeds to not call the Super in this specific method :/

#

PlayerController overrides that method from Controller and then just yoinks most of the code instead of just calling the super or similar x)

#

But yeah either Acknowledge or OnRep works for this purpose.

fathom aspen
twilit radish
#

Probably lol.

#

I still want to see if there's something that triggers on both client and server though. Instead of needing 2 methods.

fathom aspen
#

Gotchu.

#

You was there and didn't notice it 😔

twilit radish
#

xD

fathom aspen
#

Called in APlayerController::OnPossess

#

And in APawn::PawnClientRestart

twilit radish
#

:o

#

It seems to get called both server and client yeah.

#

Time to test it out

#

It's not virtual :c

fathom aspen
#

It is

twilit radish
#

Oh wait nevermind.

#

I was looking at void DispatchRestart(bool bCallClientRestart);

fathom aspen
#

Will I get credit when you release?

twilit radish
#

😂

#

Absolutely 🤣

thin stratus
#

Some person from Discord.

twilit radish
#

Special thanks to:
"The wizard person from Discord"

thin stratus
#

No worries, glad helping you.

twilit radish
#

I mean.. The compendium definitely has helped a lot too 😄

fathom aspen
#

Though:
APawn::Restart > Compendium

twilit radish
#

Haha

fathom aspen
#

Lol

#

We have all been raised by Cedric

thin stratus
#

Okay enough offtopic :D

fathom aspen
#

Let's be honest here

twilit radish
#

Ok so real talk. Anyone knows a good article or similar about proper ways of doing interpolation? My current system is definitely not as smooth as I would like to.

fathom aspen
bitter oriole
fathom aspen
#

But that YT tutorial said Tick is bad

twilit radish
stoic ore
#

currently working on that. Really nice page, thanks a lot

fathom aspen
#

No worries, here for questions!

bitter oriole
#

And you kinda need velocities to have realistic smoothing

twilit radish
bitter oriole
#

With the often true assumption that movement will keep going on for at least half a second

#

By that time if you don't have updates, you are getting weird results no matter what

#

The point of averaging the replication rate and using the velocity is that you're going to recreate a smooth trajectory from a slower, unpredictable source

thin stratus
#

I can't say I ever saw a proper page about Interpolation and Extrapolation for Movement. Something that explains this maybe in 2D with all values involved.

#

There is a nice page about the concept of this, but not walking one through the ideas behind an implementation

chrome bay
#

just use physics, interp + extrap for free 😄

thin stratus
#

James, leave

chrome bay
#

run away

bitter oriole
#

The Krazy Karts parts of the udemy multiplayer mastery tutorials explains quite well

thin stratus
#

That sounds very much hidden in some random course though

bitter oriole
#

It doesn't handle listen server smoothly but other than that it teaches how to implement rollback/replay/interp for a new movement component

thin stratus
#

By now I have the feeling that either no one wants to explain this or it's seen as so simple that everyone who can't come up with te code themselves is deemed an idiot

#

;_;

bitter oriole
#

The opposite really, nothing about it is simple

#

And few people actually implement their own network movement

twilit radish
#

If it was this simple no game would have jitter issues lol.

thin stratus
#

Yeah I know, but if it would be broken down to 2D movement on 1 Axis, it could at least be made somewhat approachable

#

Well, I'm not saying it's "simple"

#

But the idea about interpolation and extrapolation is probably the same in most games

#

Including how it's done

#

This doesn't strike me like something that can be reinvented 50 times

twilit radish
#

According to the Rocket League video in the pins they supposedly dynamically change the rate at which they interpolate based on how many packets they have left in a buffer. Not sure if they still use this though.

bitter oriole
#

Not reinvented no, but... I used to have a clean, simple multiplayer floating pawn movement with proper rollback replay, but it ended being 90% implementing specific features from the game that you have to handle speciifcally

#

I think most people end up with the same conclusion

chrome bay
#

pretty much tbh

bitter oriole
#

Like I had a pick up animation that inevitably ended up being a "turn off simulation, do your thing locally and then we'll talk about resuming MP movement"

#

You can't exactly make that generically

chrome bay
#

Also I'm not joking when I said use physics btw 😄

thin stratus
#

But the example doesn't need dynamical rate changes

#

I don't teach multiplayer by letting someone look at UT

chrome bay
#

my floaty boys have been physics for a long time now

#

and the free interp/extrap does a lot of heavy lifting

bitter oriole
#

I'd rather die than use physics tbh

chrome bay
#

honestly don't blame you

#

I didn't want to make that transition

#

Had to eat it up

thin stratus
#

Doesn't physics totally remove the ability to play back moves?

chrome bay
#

yep

#

client auth baby

#

come @ me cheats

twilit radish
#

Do we refer to velocity with physics or what do we consider 'physics based'?

thin stratus
#

Welp, I went through the trouble of making your floaty boys with vector math

bitter oriole
#

physics here means engine physics

chrome bay
thin stratus
#

And I can say I hated every minute of it, but it made me a better person, in regards to knowing that I will never do that again

chrome bay
thin stratus
#

Physics here means he freaking sold his soul

bitter oriole
#

Vehicles as in wheeled

thin stratus
#

It depends again

chrome bay
#

Yeah wheeled vehicles is literally what made me make the transition

twilit radish
#

Just implement your own deterministic fixed timestamp physics engine 😄

thin stratus
#

Formula One? Physics + Client Auth

#

James buggy Hell Let Loose vehicles? Server Auth with Corrections PE_PandaDab

chrome bay
#

floating bricks were quite easy to solve collision for in a reasonable way, since 99% of the time they aren't touching anything. Wheeled vehicles with moving parts and constant contact just became a minefield

bitter oriole
#

Shots fired

thin stratus
#

(just pulling his leg)

bitter oriole
#

But also didn't Fortnite do that? (client auth part)

chrome bay
#

You're not wrong though 😄

#

HLL Is server auth but we get away with it because the vehicles feel crap almost by design

#

And they're slow/sluggish

#

FN is client-auth physics yah

#

At least, it was when Epic guy told me a couple of years ago - they just went really hard on anti-cheat but didn't detail how

twilit radish
#

The moment even Fortnite gives up is a danger sign lol.

thin stratus
#

Honestly. there was a time where I really loved Multiplayer. So much that I wanted more people to make it, thus the Compendium.
And I still love multiplayer, but I have long noticed the huge difference in FUN multiplayer and COMPETITIVE multiplayer.
And the competitive games are just not fun to make.

chrome bay
#

I felt bad about not being able to find a solution for years until I realised people dedicate their entire careers to it and still haven't found a solution

thin stratus
#

I'm currently fighting cooldowns for GAS in a fast paced moba brawler

#

I just hate it

bitter oriole
#

Competitive MP I would only touch if it was turn-based

twilit radish
#

The company I work for has a MP turn based game 😄
Although I don't actually work on the game it self as in programming or whatever.

chrome bay
#

MP games are pretty "heuristic" in nature in turns out - and that's a trigger word for me

thin stratus
#

Gimme whacky multiplayer like Plate Up or Overcooked

chrome bay
#

Give me nice closed-form solutions anyday

thin stratus
#

Or something fun like Unrailed

#

It's also that UE opens a new door of "How is that not a thing and why is it so much extra work?" every few days/weeks.
I never realized that stuns + CMC don't actually work out of the box, cause the SavedMoves have no idea about the stun.

#

How can anyone make BP MP Games ;_;

twilit radish
#

By having no authority and just praying some delays work lol.

#

That's kind of the average technique if you look in here 😅

thin stratus
#

It is, and I would probably go for that all day

#

I mean, not the delays

#

But the praying

twilit radish
#

It just depends on the game I guess.. Like you said competitive games suck and co-op and all that stuff no one cares about cheats as long as it works.

bitter oriole
#

Hear me out: turn-based games! No cheating, no delays, nothing complicated

#

Want it competitive? No problem

thin stratus
#

I'm sure it comes with its own problems

#

But yeah, real time sucks

#

Somewhere on the todo list is predictively spawning projectiles

#

Shoot me please

#

Like, I don't care about the damn spawn delay ;_;

bitter oriole
#

lmao

#

Man

#

I'm so sorry

#

"oh no the player did not in fact fire, you didn't see nothing"

thin stratus
#

And then you look at games like Overwatch and even they just didn't freaking care

#

Don't get me started on Dead by Daylights delays

thin stratus
#

Their programmers must have some unique skill of convincing designers that it's not worth the time

thin stratus
twilit radish
#

😅

#

So Cedric, when are you making a real time MMORPG?

thin stratus
#

Next life

#

Games like WoW are probably even more chill

#

They just show you all the effects

#

Doesn't matter the ability never fired

#

Health just not going to move

#

f u

bitter oriole
#

MMOs usually have zero chill about net quality

#

Here's the new update

#

Yes you teleported

#

So what

#

Explosions go brrrt

chrome bay
#

absorb my c o n t e n t

twilit radish
#

The Division sounds like a fun one to work on according to their developers.. Several hundreds of players per server with in parallel processed worlds and on top of that PvP 😄

chrome bay
#

Division was famously prone to hacks too when it launched

#

Due to too much client auth

#

I remember them weapon hax

bitter oriole
#

Can't beat the Splatoon hacks

thin stratus
#

Remember peeps, they made a second one of that

#

I still like the simplicity of lag switching

#

In Dead by Daylight

twilit radish
bitter oriole
#

Right now, no idea

#

It used to be "players can change weapon names for other players" bad

#

IIRC

twilit radish
#

That sounds horrible.

#

GTA 5 flashbacks

bitter oriole
#

I mean.

thin stratus
#

I never understood GTA 5 cheating tbh

#

From the outside it seemed like everything was client auth

#

I can't imaging a scenario in which they would allow clients to spawn money

chrome bay
#

hahaha

#

That's great

twilit radish
#

GTA 5 is supposedly true p2p from what I can find online quickly.

#

So I guess all clients just accept the nonsense of other clients.

signal lance
thin stratus
#

Unbelievable :D

twin juniper
#

While using the Steam Subsystem what should the other client expect after calling SendSessionInviteToFriend ?

#

Do I need to handle that myself or will there be a steam popup message saying xyz invited you to a session?

#

Currently I don't see anything like that

chrome bay
#

IIRC you need to handle it yourself

#

ShooterGame has some code that binds to callbacks in UShooterOnlineSessionClient

#

Hmm although that seems as though it's only for accepting an invite, where the callback is for receiving one I can't find atm

warped hawk
#

Hi, I am unable to use player state while on multiplayer server, the cast fails to my custom player state, how can I solve this

bitter oriole
#

Probably it did not replicate yet

kindred widget
#

Why not just pull the value from the same PlayerState in the GameMode's SpawnDefaultPawn stuff?

#

Semi sure that PlayerStates exist by then.

thin stratus
#

Are we not going to talk about the RPC on BeginPlay?

twilit radish
#

I think that's what Stranger was referring to.

thin stratus
#

Also I have a setup like this and I simply save that value in the PlayerController too and override "SpawnDefaultPawnFor" or so in the GameMode

#

No, Stranger means the PlayerState Object hasn't replicated yet

#

Which is fair, that's what OnRep_PlayerState is for in C++.
But the RPC in general is redundant.