#multiplayer

1 messages · Page 210 of 1

dark edge
#

ok back up, what is the base class of Prayers?

#

Do you have prayer classes or anything like that or just images?

glacial moat
#

Only images, I havent got to the point where I want to store anything in playerstate yet

#

It should be just updating an image at this point

dark edge
#

ok lets assume your goal is to sync an image

#

do you have a replicated onrep variable of type image in your character?

glacial moat
#

I can make one

dark edge
#

what class is this code in?

#

Why is the variable called Prayer 22

glacial moat
#

Made a 2d Texture Variable

#

Assigned it what image i want

#

to see if it will work

#

set the variable to replicates

dark edge
#

Here's the general form

#

Input -> ??? -> run on server event //happens clientside
Run on server even -> ??? -> set replicated variable //happens serverside
OnRep_Variable -> change stuff in response to that variable changing //happens everywhere

glacial moat
#

alright I set it to rep notify,

#

What am I doing wrong now?

dark edge
#

what do you want to do when Prayer 23 changes?

#

wait do you have a variable per prayer? Do you have Prayer 1 through 23?

#

just have CurrentActivePrayer

glacial moat
#

currently this

dark edge
#

ok no there's a much better way to do this

#

why not make a class of some sort called BasePrayer, probably an actor

#

give it a variable PrayerIcon

#

maybe text PrayerName

#

then what you can send around is WHICH PRAYER YOU SELECTED

#

by class ref

#

right now your enum is sorta acting as that

glacial moat
#

So Make a new actor, give it a 2d texture component, refrence that actor, then set image?

glacial moat
#

then make variable public?

dark edge
#

you don't need to instantiate prayers yet, you just need something to pass around to talk about what prayer you're concerned with

glacial moat
#

Alright, sec

dark edge
#

Then the variable you''ll be repnotifying is of type BasePrayerClass MyCurrentActivePrayer

glacial moat
#

Like this?

#

That variable is from the new actor

#

inside BP_ThirdPersonCharacter

zealous wigeon
#

Hi how strong the replication system is against cheating?

I would expect a multiplayer game to send movements inputs as "w_pressed", "space_pressed" etc, but it looks like it's convention to send directlty the position of the player, however we know we can't trust the client

#

how does this work?

#

thanks

lament flax
#

you as the dev have to handle how you send data to the server and other users

zealous wigeon
#

Could you rephrase that, I have zero experience in networking through Game Engines, I only know how it works in multiplayer games made with frameworks (for example raylib)

#

from scratch

#

I watched some explanation of replication system

#

but still not really into that

dark parcel
zealous wigeon
#

yes exactly

dark parcel
#

E.g. in shooting game, client may send data on which actor it hits.

The server will then check if the shoot is possible at all

zealous wigeon
#

however if I structure the game to send my position to the server, it's easy to understand that anyone can easily cheat the game and send fake positions to the server

#

so anyone can teleport themselves

dark parcel
#

Yes and that's been done

#

But you can always do some counter measure

zealous wigeon
#

so I would expect the client to send input events instead

dark parcel
#

Again by validating on server side

#

If the move is invalid, roll back

#

Or kick the player for cheating

zealous wigeon
#

isn't it harder to check if the movement is invalid? compared to record on server side the movement since "w_pressed" til "w_released"?

dark parcel
#

If you look into character movement component. It already have networked movement.

It have client prediction movement but server authorities. Players can move ahead, wrap the movement data and send to server.

Server validate the move, if they don't sync, correction will be made

#

Why do you need to check if a client press w or released?

dark parcel
zealous wigeon
languid finch
zealous wigeon
#

however, the question is, how does the server work in ue

#

?*

dark parcel
#

Don't understand the question but you can read the pinned materials in this channel

#

They hold the best source to learn basic replication

#

A server is just the host computer/machine not sure what the question is about

#

And speaking for my self, since I never publish a mp game and it's my first project.

#

I'm not gonna reach too hard, let cheaters cheat.

#

It's harder to cheat if you have dedicated server

#

Then just validate important bits on server side

#

Don't overthink cheating, if you are not making competitive games

zealous wigeon
#

in a game made without an engine I would just make an external program listening to a specific port, parsing data received from clients and perform the critical game logic,

but in ue there's just blueprint components with replication checkbox, will I have to write an external program as well? or does packaging the game provide the server as well? etc etc

#

sorry for the nooby questions but I can't wrap my head around ready-to-use stuff

quasi tide
#

You're making this way more difficult than what it needs to be

sinful hawk
#

You have to build the server separately

#

its a build target you setup. last i checked you had to do it from c++ in the ide but maybe theres a way now in editor

#

Well not specifically in c++, but from engine built in source

dark parcel
#

Dedicated sever need source build

zealous wigeon
#

in case I would build the server in my own, but what should I expect to receive from ue clients? xml? I mean I can't really underatand how all this premade stuff is not confusing to anyons

dark parcel
#

You are making it sound harder than it should

#

Just look at pinned material and get comfortable first imo

sinful hawk
#

For the most part you don't have to think about it just click the replication box and make sure its setup to broadcast to the correct people with 1 of 2 (or both i think) options

quasi tide
#

You're just making it way more difficult

dark parcel
#

Written tutorial for multiplayers are tend to be helpful

sinful hawk
#

For the built-in stuff like movement, I'm assuming the built-in character movement is built to industry standards, so you probably don't have to think about all that. But I do get your question.

#

Videos like this made it click for me pretty easy: https://www.youtube.com/watch?v=OVeo3cVTIcU

👨‍🏫 My Patreon link:
https://www.patreon.com/kekdot
Download Project Files | Premium Tutorials | Courses

🕹️ Get our Game on Steam | The Anomaly Project:
https://store.steampowered.com/app/2960770/The_Anomaly_Project/


🧑🏻‍🚀Get the project files here on Patreon: https://www.patreon.com/posts/66842088

In this video we take a look at the basi...

▶ Play video
dark parcel
#

Like many is just straight up wrong

#

I would only recommend the pinned material and a written tutorials

sinful hawk
#

Thats true, you just have to go into it understanding that, watch for something that doesn't seem right and find another source to double or triple check, like anything in life

dark parcel
#

Yeah but people can't tell if someone doing the wrong thing when they just start

#

Legit saw a video spawning with multicast

#

And thousands of viewers thank him

#

Lots of victims

sinful hawk
#

ChatGPT is a godsend for me learning things even though it can be wrong half the time it usually says some keywords I can research more. But I already know how to code so its easier for me to notice things that are obviously wrong

dark parcel
#

It's just written tutorial are made by thoughtful people with the goal to educate

#

Youtubers are there for view imo

#

So they don't give a flying f if they say a total bs

#

Not saying all anyway, I found some video very helpful. Would be lost in cmc without delgoodie videos

thin stratus
#

I don't think that YouTube videos in the form of tutorials are usually meant to just generate clicks. If they are bad or teach wrong stuff then usually because the person simply learned it wrong and doesn't know better. Maybe they already learned it wrong from a different tutorial.

#

Most of those are probably actually convinced that their way is correct due to working and not having caused any issues, yet.

dark parcel
#

I do have bias or straight vendetta, seeing too many avoid casting and bad mp info on youtube

zealous wigeon
#

So the base idea was to use ALS for the main character

#

and a simple blendspace for the enemies

#

(that would actually see ALS in their screen)

#

this shouldn't be a problem if the hitbox of the chars is big enough to cover both the ALS version and the blendspace animations

#

what do you think

#

first of all ALS is only for singleplayer, and second it would be still too heavy to replicate over the net

#

also I can't use community replicated ALS

#

I switched to my old laptop lately and can't get C++ build tools to work the right way

hoary sandal
#

I´m spawning these items only on the server, but there are disparaties between the clients, how can I solve this ?

#

The spawner is already placed on the level so unsure who does it belong to and if there are different isntances per server client

lament flax
hoary sandal
keen adder
#

Heya dudes, how can we get the client's Number/Index/ID?

#

PlayerState.PlayerID gives me the total number of players created. So after a while in the editor it's 460. Just looking for player index 0, 1, 2, etc.

kindred widget
latent heart
#

Though I don't think that's guaranteed to be the same everywhere or even in join order.

kindred widget
#

Referencing players by index never ends well.

latent heart
#

Indeed

keen adder
daring gorge
#

UPROPERTY(ReplicatedUsing=OnRep_Driver, EditAnywhere, Category = "Seating")
ACharacter* Driver;
UFUNCTION()
void OnRep_Driver();
my onrep function doesnt call? am i missing something? im setting the driver variable through a server RPC and did replicate the variable in getlifetimereplicatedprops

#

the variable does set too

quiet yarrow
#

I must be missing something obvious. Client to server and server to client is working. But client to client my physics constraints isnt replicating

ripe lotus
#

does unreal sends a network packet as soon as i trigger replicated code (e.g. moved something replicated). or does it waits till end of frame ?

kindred widget
daring gorge
#

so the repnotify only triggers on clients when i change value through blueprints?

ripe lotus
ripe lotus
daring gorge
#

yeah i tried but it doesnt seem to work, the onrep doesnt seem to trigger through cpp until i actually call the onrep function when i change value and even if i do unless im setting the value from bps the func is not getting called on clients

ripe lotus
#

have you also set the variable as replicated by oerriding virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

daring gorge
#

yea

ripe lotus
#

also i vaguely remember reading some doc that says that either on rep or a server/multicast behaves differently on cpp than bps. on one of those it doesnt trigger on the server. sorry i cant remember.

daring gorge
#

its all good, it does seem to be behaving weirdly, im doing the same attachment code i did in bps yet it doesnt seem to work as it did in bps

kindred widget
kindred widget
ripe lotus
kindred widget
#

For server though, in BP it will run the OnRep when setting it. In C++, you have to call the OnRep yourself manually when setting something.

daring gorge
daring gorge
kindred widget
#

You are saying that if you set the value in C++, you do not get an onrep on the client. But if you do it in BP, you get an onrep on the client?

daring gorge
#

yeah

kindred widget
#

You're 100% sure you're setting the value only on the server instance of the object?

daring gorge
#

yes

#

i know has authority can return client but im using an actor which isnt owned by a client and am setting the variable only after checking if local role is authority

#

also i dont think the function is running as it should or it did in bps

kindred widget
#

Is this the same value or two different ones? Like you're setting the C++ defined property in BP?

daring gorge
#

same value

#

yeah

kindred widget
#

That's a new one. O.o

daring gorge
#

and the function was just attach actor to actor at some socket, it doesnt seem to actually fire up on client

#

it worked in bps

#

the same exact code

kindred widget
#

Worth noting that actor attachment is replicated. You don't actually have to set it on clients usually. This is why Unreal Tournament uses a FPS and TPS mesh in it's weapons. Cause it can't easily override the attachment behavior.

daring gorge
#

but when i attach only using a server RPC my character isnt attaching like properly. it jitters and lags behind the actual attachment pivot. when i attach using on OnRep for clients, atleast when i did in bps it would work properly and smooth and actually attach

#

what im more confused about is why isnt this attachment firing up on client side as it should/did in bps

daring gorge
#

is there a way to check if this attachment is actually being fired on the clients? or force it to fire up on clients because im sure it isnt

daring gorge
#

nvm i figured it out, cpp is indeed a bitsy weird though

reef flume
#

Hey all, new to the multiplayer scene and having a troubling time with a networking/audio problem.

I have an audio manager on clients only (no server as audio only can be spawned on clients)

I would like to send a message from my audio manager(B_AudioManager) to a different server bp (let's call it B_Score).

Basically saying:

When all clients send you a message saying their audio timer is done, do a thing.

But I can not figure out how to send said message. If, on my B_AudioManager I

  • get the client version B_Score
  • Then try to call the event, CS_DoThing,
    • which then calls SC_DoThing(replication RunOnServer)

the server version of that event never calls.

Hopefully that makes sense. I've tried watching a few different YT's on multiplayer replication, but I still can't seem to get my head around sending info from a client to a server. I do know that in general the server calls the shots. So it is a bit backwards to have the client tell the server what's up. Bare with me, and maybe I am just approaching this from the wrong angle

Thanks for the help!

reef flume
dark parcel
#

That's not what I asked

#

The image you posted, what bp it's in

reef flume
#

Ahh, that makes more sense. It's in B_Score

dark parcel
#

Especially include the top right corner that shows what class it's derived from

reef flume
#

I do have component Replicates enabled

dark parcel
#

For a start client don't have ownership of game state

#

Calling server rpc there will just get dropped

reef flume
#

ok I think that make sense. Gamestate only ever lives on the server right? Then info is replicated to clients. So a client can have a non-owned GameState? not sure the lingo here

dark parcel
#

Not true, everyone have a copy of the game state but only the server owns it.

reef flume
#

Ok, that's what I was trying to make sense of thank you.

dark parcel
#

When calling RPC you need to be aware of ownership

#

In general only the controller and character are owned by client by default.

#

So you will probably have to route the rpc there

reef flume
#

Ok that's good to know. Is there a way to tell who owns what? Or is it a bit more of an abstract concept that you can' t really check? Follow up Q, how do you apply ownership, if I want my client to own the AudioManager?

dark parcel
#

You use set owner node (have to be done by server) but it's not recommended to do that.

#

Normally always limit what client can have ownership on

#

Soo far, I just use my character and controller or component that lived in either of the two

reef flume
dark parcel
#

Security is one of the reason

#

Also only 1 owner can be set to an actor

#

So who's gonna own the Audio comp? The server? Player 1? Player 3?

When you think about it, not very useful

reef flume
#

try and spawn audio on server and instant error

dark parcel
#

Not aware of that, I will look at it later maybe

#

Like what audio comp? The kind you attach to actors?

#

Like why not?

#

I would be surprised if I crash but I will take your word until I try it

reef flume
#

Both. So either a SpawnAtLocation or SpawnSound2D or SpawnSoundAttached.

Crash is a stretch. more like you will get an error saying invalid and no sound plays

dark parcel
#

Nah, why wouldn't they work

#

Server is just another computer, that is happend to be the host

#

And I used those nodes too, don't see any problem

reef flume
#

Idk what to say, just tried spawning a sound 2d via a server specific event and it never played, putting an isValid on it says not valid

dark parcel
#

The error you are talking about is it accesses none error?

#

Server rpc = hey run this on server version of the actor

dark parcel
reef flume
#

Let me set something up quick to show here. I'll recreate in a fresh project

reef flume
dark parcel
#

@reef flume just tested on my end, works and no issue

#

what is your Net Mode?

reef flume
dark parcel
reef flume
#

yeah standalone and listen will work as they create the client version locally

#

should of specified that to start, my bad

dark parcel
#

wait what

#

Play as Client will work too

reef flume
#

?

#

wait I think I see what you are saying. Yes it will still play a sound on the client since the actor component is on both

dark parcel
#

Game State exist in every machines

reef flume
#

but we were talking about having a spawned audio component on the server

dark parcel
#

hmmm

#

I didn't use component

#

just do something on the begin play of the game state

dark parcel
#

Yea still work

#

no problem what so ever here

reef flume
#

got ya. So in this instance. the server owning version can not spawn audio. Which is fine. I only ever want it on the client. but it means in order to avoid errors I would have to always put in HasAuthority checks

#

So the owning server can't have a cashed version of the audio component.

#

So if I played a sound from the server, and wanted to AssignOnAudioFinished. The server owning version would never occur. The client would, but the server no

dark parcel
#

in the case of audio comp you seems right actually

#

gonna do some test

reef flume
#

For example, this does not work on the server

dark parcel
#

actually nvm it work for me

#

but I found something interesting

#

the game is mute for the first few seconds when running multiple window

#

when the client joins

reef flume
#

what does your bp look like?

dark parcel
#

it's a comp that lives inside the game state too if that helps

reef flume
#

I get this. This is straight on the GS

reef flume
dark parcel
#

I moved it straight on the GS, no issue either

reef flume
#

You are in client net mode as well with 1 player right? I must be missing a bool somewhere

dark parcel
#

im on listen server mode

reef flume
#

ah that's why. try client mode

#

because the server in listen server is also the local client it will play it

dark parcel
#

I see

#

@reef flume well if you are playing as client net mode, you are aiming for dedicated server?

dark parcel
#

because there would be no point in playing a sound in a headless machine

reef flume
dark parcel
#

it's all just processing and output text, no render

#

yea no audio either

#

I just crashed after changing it to client mode

reef flume
#

gotta love those

dark parcel
#

but prob make sense, why play sound on headless machine 🤷‍♂️ , maybe someone that actually knows can clarify tho

reef flume
#

so then allll the way back, and sorry I should of said dedicated server, if I want to have my audio on a client, tell a score counter on the dedicated server, how do I do that?

void juniper
#

This Looks Cool

dark parcel
#

what's the relationship between audio and the score counter?

reef flume
#

now that I think about it, it doesn't have to be audio. could be any event.

I have a audio count down that is driving a score counter via Quartz. so really it's just an event

dark parcel
#

Server RPC is the only way for Client to communicate with server

glacial moat
#

Is this the proper way to do rep notify?

dark parcel
#

Rep Notify gets called when the variable value gets updated (On Server and Client in BP), (Only on client on cpp)
"proper" is very subjective, that image really tells nothing

#

though I don't know why you are over complicating it.
On_Rep Emoji -> Update widget

#

why do you need event dispatcher there

reef flume
dark parcel
#

controller or character

reef flume
dark parcel
#

AudioManager->PlayerController->Server rpc there

glacial moat
dark parcel
#

anyway the idea is widget just read the replicated variable

#

OnWidgetInit-> Read the variable -> Display

#

OnVariableReplicated (OnRep) -> Get Widget -> update widget -> Display

glacial moat
#

I guess I don't know how to update it without an interface or event dispatcher, casting?

dark parcel
#

No, just grab the reference to the widget

dark parcel
#

if each players have individual scores

reef flume
dark parcel
#

@reef flume It can be as simple as this

#

if you need to access all the player states, lets say to display the score of all players

#

you can go.
Game State -> Get Player Array

#

those are your player states

#

gtg, gl

reef flume
glacial moat
#

So this works now (except that it doesn't replicate) and I get these errors along with it

dark parcel
#

You are trying to access a widget that don't exist

#

Need to point the reference to an actual instance in the world

#

You are leaping top far diving to multiplayer if you don't know how to use reference. The difficulty is way harder because you will need to handle not one but multiple machines

glacial moat
#

It gets made at run time (the widget)

dark parcel
#

At the time when on rep called the widget ref points at nothing

#

Hence the error accessed none

#

Also need to be aware of race condition here

glacial moat
#

How is it able to update then?

dark parcel
#

If the variable replicate before the widget is created then you will get the error

#

So have is valid check

#

Simply don't update widget when the widget is not created and it is not yet set

#

OnRep-> widget valid? Update widget

Else do nothing

glacial moat
#

is valid removed errors, still works

dark parcel
#

Race condition it is then

#

There is latency in multiplayer, you mpst likely haven't even test in a battle tested environment

#

0 ms is fake multiplayer, you will need to add some latency and address race condition when working in mp

glacial moat
#

I'm still stuck for days trying to get am image to replicate. I figured out how to replicate some static meshes with tutorials and documentation you recommended before. And I understand the basic concept ( I think). I just want to learn how to do this one thing so I can apply it to everything else

dark parcel
#

Simply marking the variable e.g. texture 2d as replicated will make the variable replicate from server to client.

If client need to change the value, do server rpc
If server need to change the value, just set it right away

#

If client need to react to the update , use on rep

#

Just try to replicate a texture 2d, forget about your widgets and these event dispatcher and enum

#

Some common advice is to read the pinned material 8 times , practice, fail, repeat

#

But once you understand replication, it's actually very easy when it click.

#

Unfortunately replication is probably the easiest concept to understand in MP. There are many other challenges ahead

glacial moat
#

Don't feel like I'm going to get that far if I can't figure this part out

dark parcel
#

Practice with changing a color of a ball or something

#

That's how I start

glacial moat
dark parcel
#

Do not use multicast

#

If you are stuck with that share your code here

glacial moat
#

hmmmm, working with multicast, need to do more research, might take me longer than I thought, thank you

rough dock
#

does anyone know how to add an impulse to a client? whenever i add an impulse on a client it just corrects no matter what even when doing a multicast.

glacial moat
dark parcel
#

Don't need event dispatcher

#

Also you can just use input

#

Like pressing the V key

glacial moat
#

The event dispatcher is bound to the E key

#

Only works on the server/clinet combo

dark parcel
#

V key pressed -> if server-> Set the material variable

If client -> server rpc that set the material variable

On rep update material

glacial moat
#

switch has authority?

dark parcel
#

You can use that to filter host vs client in most cases

#

Client can have authority if the actor it's in, are spawned by them self.

glacial moat
#

😮

dark parcel
#

If it's replicated actor and spawned by the server then it's fine to use switch has authority

glacial moat
#

Okay, all of that makes sense to me, mostly (I think)
Trying to think how that applies to my 2D texture dilemma

#

What node(s) can I use besides has authority to tell if its a server or client calling

#

or is it just this?

fossil spoke
#

An RPC marked as Run On Server, will only ever run on the Server...

#

You dont need a HasAuthority to check if a Run On Server RPC is being called on the Server...

glacial moat
#

Yep, just read that on the forums. I'm going to pull up something that I got to replicate properly. Then ask why it doesn't work on anything else.

#

Maybe what I labeled each of these things is not what it actually does and I don't understand it properly

fossil spoke
#

SetIsReplicated just marks an Actor/Component to be considered for replication. Calling that function doesnt actually replicate anything.

glacial moat
fossil spoke
#

Sure, im just speaking more to how you have the comments

#

Update Clients of Server change

glacial moat
#

🤔

fossil spoke
#

Technically speaking, thats just a byproduct of calling SetIsReplicated

#

You should be able to just set bIsReplicated to true on the Add Static Mesh Component node.

#

In the details panel

glacial moat
#

So things can replicate on the server without seeing the results of it being replicated?

fossil spoke
#

No, again, you are confusing terminology.

glacial moat
#

Having issues with details panel, going to keep reading what you posted and read more on the forums

dark parcel
#

@glacial moat

glacial moat
#

ohhhhhhhh so you do use cast XD

dark parcel
dark parcel
dark parcel
# glacial moat here

yea I never said anything about casting, what I said was why do you need event dispatcher

glacial moat
#

maybe you were replying to something before that post

dark parcel
#

you asked for an overhead icon

#

I did above with a few lines

#

don't make it overtly complicated than it should be

#

though I think the problem boils down to not knowing how replication works

#

you should attack the pinned material again

glacial moat
#

I will check it again, but the things you posted are golden, I thought you were saying to set it without casting, interface, or event dispatcher, which is why i posted the only other thing I could think of

dark parcel
#

you are still using dispatcher in your post tho

#

im only casting because im using widget component

#

because the getter node return generic type

glacial moat
#

this one

#

but I guess it still uses an event dispatcher to get to that point

dark parcel
#

last time you tried that you have accessed none error

glacial moat
#

yeah, but i made it like that because I was trying not to use cast or event or interface

dark parcel
#

using cast or not is not the issue

#

you can certainly do what you have above

#

but your issue was you didn';t set active player widget ref

#

or there might be race condition happend

#

e.g. widget created after on rep is called

#

casting is just a type check

glacial moat
#

is valid fixed that one

#

but still didnt replicate properly,

dark parcel
#

no error doesn't mean it's fixed

#

it can even be a silent bug

#

the point is since order is not guaranteed in multiplayer

#

you need to know how to address incoming data

glacial moat
# dark parcel <@300810204138962944>

I guess I only know some of what I don't know at this point. And trying to learn a bit at a time. This is defiantly going to help me understand /know more of what to do/when to do it (I'm hoping). So thank you again, a ton. 😊

charred lark
#

Hey Guys! I have a problem with the replication? I Guess?^^
Ich have a multiplayer game. and i want to set the selected player meshes on start.
Only the player itself sets the mesh so every player on his own machine...

#

I mean the meshes only get refreshed locally… client 1 can’t see the new mesh of client 2 ^^

#

My BP_Player is replicated. All needed variables too…

dark parcel
#

Don't use Multicast

#

Set the Struct

OnRep(Struct)-> Set Mesh

#

or if you don't need those info and just need to set the mesh in the client, make the mesh replicated variable
Server : Set Mesh,
Client: OnRep(Mesh)-> Set Mesh, that's it

charred lark
#

Oke ill try it this way - thanks 🙂

#

So the server sets the struct variables...and onRepNotify it should set the mesh

#

so server calls this:

#

thats the method that gets called on the player:

#

Thats the RepNotify:

#

same result ^^

dark parcel
#

If you used multicast everywhere, you might want to start refactoring

#

don't use multicast for any stateful behavior

#

this may account up to 95% of the casses

#

or more

charred lark
#

No i do not but i tried so much stuff 😄

dark parcel
#

Break your S Curr Character

#

Get the mesh

#

Set the skeletal mesh from the mesh inside the S curr character

charred lark
#

WOW!

#

it works 😄

#

But can u explain why its working that way?

#

even if i set the custom event rpc to not replicated it did not

pseudo wagon
#

So you are not understand RPC and replicated at all.

dark parcel
charred lark
#

I already refactored so many things with this authority calls and stuff...im getting better...but still a noob I guess 😄

#

But thanks...I already did some tutorials and explanations about rpc calls and thats everything is better than multicasts ^^

dark parcel
#

its not about the question of better but the context it is used

#

If you need to do something stateful, don't use multicast

#

if you want to do something fire and forget where it wont matter if some players don't replicate the behavior then you can use multicast

#

Like a chat message, where you just want to broadcast your msg to the players currently in the game

charred lark
#

Yah cosmetics etc. that isn relevant for the game

#

for example

#

But Thank you!

#

For the quick help! 🙂

#

im gonna refactor everything now where I use an RPC call..if its necessary 😄

tacit pine
#

Hi. I have a question. Is it possible to force the server side to render a specific shader or Actor? I am working on water in Unreal and as you know, the standard Unreal Engine plugin does not support multiplayer and synchronization due to the lack of water rendering on the server. Therefore, I am considering options such as using server rendering, so that some information can then be transferred, for example, Fluid textures - simualtion textures, to the client side, and then use this data to calculate physics.

pseudo wagon
tacit pine
charred lark
#

I have another question. When I call a function from the server that calls a method on every player … the player should call a dispatcher that is executing for a example a hud update… but I don’t want to replicate my local widgets and I only render my widgets on client side. (Which is the common way I hope?) What’s the way to let the players call their dispatchers and refresh the hud when the server did the main call?

#

Because the server has nothing to do with it - it’s only client sided … is it like calls from server -> rpc owning client -> refresh hud?

tacit pine
pseudo wagon
charred lark
#

Like so?

GameMode -> Call „dispatch yourself“ on every player controller

PC -> Receives call from server -> Calls Dispatch yourself (owning client rpc) ?

#

does the pc has all of its local components when it’s „wrapped“ in an owning client call?

dark parcel
#

widget don't replicate, so you can't even if you want to

#

also widget just strickly READ

#

dont even put any shared information in it, widget just read the variables from else where

#

Why does the server need to tell the player to refresh their hud?

#

sounds like design problem

charred lark
#

hmm

dark parcel
#

HUD update when HUD update,
e.g. when client array of item structs get updated for example (the variable lives in player character/ player state for example),
on repnotify -> Update widget

charred lark
#

Ah ok 🤣 I think there was a complete misunderstanding on my side 🤣

coral badger
#

I've not seen anyone mention Online Beacons in a while. Anyone here using those or are they perhaps deprecated or something?

thin stratus
#

Not a lot of people get into the situation of needed them

#

They were originally a concept to allow Players to register to DedicatedServers before actually joining them.
Something something Unreal Tournament.

chrome bay
#

ye used them in HLL for that + server queues

thin stratus
#

Then people started to use them for MainMenu Friend Invites.

#

I assume Fortnite also does that or at least something along those lines.

chrome bay
#

only matters if it takes an eternity to load your map

thin stratus
#

For the Server queue?

#

The Friend Invite stuff is more of a feature than a solution.

chrome bay
#

For reserving space in a server I mean

thin stratus
#

Yeah okay

chrome bay
#

server queue was just a feature we added

thin stratus
#

Yeah I only ever had to use them for that Friend Groups that queue up for Games, like Fortnite, CS, Overwatch and what not

coral badger
#

Yehh I've used them for a pre-server game Lobby system as well. Was just wondering if there are other use cases.

chrome bay
#

anything where you need a light connection to a server I guess, and want to transfer data via replication. That's it really

dark parcel
#

Anyone can throw some wisdom on fast array?

Regular struct does delta replication right? While fast array would replicate the whole object.

If that assumption is correct, why do I want atomic replication for large data like items?

Wouldn't that be more performance heavy to replicate the whole thing instead just replicating the difference?

chrome bay
#

Structs, TArray and Fast Array all do delta replication

#

Fast Array also does delta replication of the internal structs by default (you can turn it off)

#

The main advantage of fast array is per-item callbacks, and that you can change the order without causing a massive delta, which is what you'd get with TArray

#

TArray can still be faster and cheaper. Plus custom delta serialization prevents you using any shared serialization, so FastArray can be slower with POD types and lots of connections

#

Calling it "fast array" was a mistake

lament flax
#

i thought Fast Array would always be faster that TArray, since i learned that an array will replicate all entries after the modified index

hoary spear
lament flax
#

how worse is fast array replication performance ?

chrome bay
#

TArray calculates delta by comparing elements. The problem is that when you move/delete an element, usually every element after that will then be "deltad"

lament flax
#

my whole inventory and other systems use those

chrome bay
#

Depends(TM)

#

Faster in some cases, not as good in others

lament flax
#

but it wont be "way worse" right ?

#

or should

chrome bay
#

If you're using POD types and your array doesn't change size/order, TArray will be massively faster and cheaper

lament flax
#

fk me

#

my inv array doesnt (for now) change size

chrome bay
#

If it doesn't have UObject/FNames in it, you could benefit from shared serialization with lots of connections.

#

could being the operative word

lament flax
#

but yeah, on a OnRep of an array, how do i know what changed ?

chrome bay
#

There are no hard rules here

#

Compare it with the previous state

lament flax
#

i have to iterate the whole array to compare ?

#

yeah

chrome bay
#

no shared serialize 4 u then

lament flax
#

im doomed then, i dont want to remake all of it yet

chrome bay
#

Profile it, find out if you are doomed or not

lament flax
#

yup

chrome bay
#

Problem is people assume fast array is better, but it's not always the case and unless you look at how it actually works under the hood and understand it, you can't make the best decision.

lament flax
#

but how can i know if it can be improved ? for know i can only guess its bad if i get lag spike

chrome bay
#

fast array for inventory is probably fine

hollow brook
#

Quick question about replicating movement using standard MovementComponent inside PlayerCharacter. I am teleporting players on the server only, but this does nothing with the Client, ie. Client is not teleported AND on the server, the client's position goes back where it was before the teleport (client overrides the movement). I am using just the standard setup, anything obvious here, what am I missing? Does teleport need to be handled on clients, as they are the authority of the character? I am so used to that Server has to do everything.

lament flax
#

are you 100% sure you use TP on server ?

hollow brook
#

From the Server POV, it looks like the Client teleports for a frame and then goes back to where he was (like the Client overrides the position)

#

SetActorLocation should replicate by default right? I mean if I set a player position like that on the Server, it should update on the client? Works like a charm for non-player actors 🤔

dark parcel
#

Instead set actor location, isn't there teleport node?

hollow brook
hexed pewter
#

How are pointers to actors, objects ect sent through in context of multiplayer / replication / rpc. Are these sent in some form of ID?

chrome bay
#

ye

#

Servers/Clients create mappings between those IDs to the local pointers so they can identify objects

lament flax
#

when are those created ?

#

my guess is:

  • server knows the UObject exists
  • created netid
  • sends netid to client (with class instance data ?)
  • client recreate its local version of the uobject with the class instance data
  • assigns it to a map with the given netid
chrome bay
#

for a replicated actor the server sends the ID with the actor spawn packet.

#

For objects which can be addressed by their path name, you just use the path

lament flax
#

so ican check what is inside

lament flax
chrome bay
#

or the path of the asset, or the object in the level, whatever it might be

lament flax
#

okay

#

thats kinda smart

#

idk what other possibilites there was to rep UObjects

hexed pewter
#

What about SoftObjectPtrs / SoftClassPtrs. These are just paths to assets as FStrings so there is nothing unsual about sending them through net, right?

hollow brook
lavish wigeon
#

im making a multiplayer racing game and have the player select their vehicle in the main menu then it loads them into it when they create the session, but when i have the second player join the session it doesnt seem to spawn the vehicle pawn, does anyone know what i can do to fix this

lavish wigeon
glass crescent
#

hello,
one window is both client and server and another is client only. On Spawning the objects (using game mode), i m giving possession to the player controllers iteratively. But for the (server and client ) person , how can check out of the two spawned object which one is possessed by it?

lavish wigeon
#

so i need to tell the gamemode to spawn a seperate pawn for the other clients?

glass crescent
#

no game mode is spawning all the players together one by one

#

when the host clicks the start button

lavish wigeon
#

so what is the solution?

glass crescent
#

its my question , i m not answering your's problem😅

lavish wigeon
#

oh, you should use a question mark lol, its also very similar to my issue i just posted

glass crescent
#

oh yeah just changed it

#

are you spawning the vehicle on server?

#

@lavish wigeon

lavish wigeon
#

i was doing it in the gamemdoe

#

mode*

glass crescent
#

send ss

#

bleuprint of game mode

lavish wigeon
glass crescent
#

what is happening , if you start game after joining the session

lavish wigeon
#

what do you mean start after joining?

glass crescent
#

on clicking play button only you are spawning ?

#

i think you are spawning only on clicking the play button , and when user clicks on join its just switching your level without spawning the player

#

you need spawn player on joining

lavish wigeon
#

yeah i think you are right

lavish wigeon
#

what is the alternative? sorry im an artist.. lol

#

im surprised iv got this far

glass crescent
#

ohkay

#

well i m also new to unreal , but i understand some logics

lavish wigeon
#

you think i should look into how to spawn multiple players?

glass crescent
#

the alternative is , you need to send an RPC event to server on joining succesful

glass crescent
#

when server get the rpc event , it will spawn player for you and gives you the possession as you already did

lavish wigeon
#

ok thanks

ruby lodge
#

Why is the niagara effect not visible on the server? This is the multicast event called by an run on server event.

I, again, feel like this is a fairly stupid mistake I am just overlooking.

dark parcel
dark parcel
#

and don't forget the receiving end

#

well I don't know, you gotta show proof that it's called by the server

#

show the code maybe

ruby lodge
#

it's called by a run on server event. It's working for the client, the server also runs through this and prints correct values inside the macro at the end

#

it's just not visible for him

lament flax
#

what costs more between an RPC each tick or a onrep var change each tick

ruby lodge
#

inside the macro the server is printing correct values here as well

glass crescent
#

I m stuck at this problem , please help , if you know😅

one window is both client and server and another is client only. On Spawning the objects (using game mode), i m giving possession to the player controllers iteratively. But for the (server and client ) person , how can check out of the two spawned object which one is possessed by it ?

dark parcel
#

I think there is a misconception

#

the 1st window is the server

#

not both client and server

#

it's simply the server

lavish wigeon
#

isnt there a "get possessed" node

glass crescent
#

okay , but isLocallyControlled must give true for that

dark parcel
#

isLocallyControlled will check if the actor is locally controlled or not in respective on whos calling it

lament flax
glass crescent
#

i mean for host , which is also a part of game

dark parcel
#

Don;'t see how that connects between client / server tho

#

isLocallyControlled just check if the actor is locally controlled by the machine that's calling it

ruby lodge
dark parcel
#

Players normally have a pawn they posses, for the pawn they posses, isLocallyControlled will return true on the machine that owns the pawn/actor

ruby lodge
#

The material change and timeline are working for the server. Just the niagara effect is not visible, although it's valid

glass crescent
#

here i m assigning playercontrollers, but it is giving true for client , which is correct, but for host it is throughing false for both object

#

this is the loop

ruby lodge
#

Oh now I see. I set the particle size to 1000 and apparently the server is spawning the particles in the center of the map although it's set to snap to target :/

#

so nvm, It's not a multiplayer issue then

keen adder
lament flax
#

top left: client
bottom right: server

any ideas why the camera rotation is replicated from client to server (screen 2), but not from server to client (screen 1) ?

#

none of the camera spring arm and camera is set to replicate

#

well anyways i think i can use RemoteViewPitch from GetBaseAimRotation since its reped

lavish wigeon
#

is game instance client side?

lost inlet
#

there is no networking element to game instance at all

lament flax
#

so its server only ?

#

or local

lavish wigeon
#

im trying to set a vehicle of the players choice in the menu, that theyll spawn with in game, but currently both players spawn with the hosts choice of behicle

#

the variable was stored in the game instance and cast to by the game mode

#

id like this to be per player

lost inlet
#

a game state is networked

lament flax
#

so its some kind of pure local

lost inlet
#

?

lament flax
#

its local and isnt networked

#

i personally call something local when its running locally on a machine (so client + server)

vivid seal
#

Is it possible to get PreDestroyFromReplication for an object you hadn't received from the server before? Like the initial bunch for that object was just its destruction? I had a crash as client joining a game in progress, and the crash was inside PreDestroyFromReplication, and the initialization for that object hadn't run at all yet (its triggered by an OnRep)

glacial moat
#

It's finally working! thank you everyone that helped!

P.S. the texture that I was testing everything with was corrupted so I wouldn't have gotten it without your code ColdSummer

half umbra
#

I have Pawn, and a camera in it, when the player rotates the camera, it changes the Mesh rotation in this Pawn, and I would like the Mesh rotation to be the same on the Server and clients

#

someone can help?

upbeat basin
half umbra
#

with this option the entire actor is rotated

upbeat basin
#

Pawn's Use Controller Rotation X options directly apply the selected rotation axis to the Pawn actor itself yes. But the result should be the same on all players. What is your issue here, not wanting a component in your pawn to rotate with the pawn?

magic vessel
#

Could use GetControlRotation and retrieve the X component?

upbeat basin
# half umbra some ideas?

Then you wouldn't want your pawn to use any part of the controller rotation. I haven't mingled with vehicles before so there is probably a better way to do this but you need to rotate your barrel and turret part according to base aim rotation's pitch and yaw respectively

#

While your rotation inputs still adds rotation to controller and movement inputs using add movement input with your world direction being the forward of your actor

#

That way everyone can update your tank's instance themselves according to base aim rotation

quiet yarrow
#

Anyone know why chaos wheeled vehicle component causes a crash when running server but not standalone?

meager spade
#

Never crashed for me

#

So nope

zealous wigeon
#

Hi, I'm trying to open a map from client1 on button click

#

however the map doesn't load

#

this is what clicking on the button prints on the server side

#

tag me for answer please

#

thanks

brittle ledge
#

Happs u forgot adding player start?

zealous wigeon
#

I have two player starts there

#

mh but wait

#

I think I understood

#

basically I'm launching the server saying that L_Lobby (that doesn't have player start) should be the default one

#

how do I prompt the client to start from a specific level?

brittle ledge
#

The default level is the one client will launch

#

Make sure it has a player start

zealous wigeon
#

no it doesn't

#

and doesn't need to

#

it's a lobby

#

with join button

#

i need to launch the client to a specific level instead

brittle ledge
#

There is server default level and the client default level. When u launch the game it will launch that level.
U can then open a different level though.

#

When u connect to a server u open that servers level

zealous wigeon
#

no no okay I managed to do it, just passing the level name as argument
but now when the map loads, the input doesn't work on the client, so the player is not moving, and the server prints this

#
[2024.09.12-19.55.01:530][565]LogNet: Client netspeed is 100000
[2024.09.12-19.55.05:679][654]LogNet: Join request: /Game/Levels/L_Grid?Name=DESKTOP-4K9SVM7-65C0AA104C4C4ACBDB68B88512B914FA?SplitscreenCount=1
[2024.09.12-19.55.05:690][654]LogNet: Join succeeded: DESKTOP-4K9SVM7-65C0
[2024.09.12-19.55.06:105][663]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:107][663]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:150][664]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:198][665]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:249][666]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:251][666]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:254][666]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:291][667]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
#
[2024.09.12-19.55.06:292][667]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:338][668]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:340][668]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:385][669]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:388][669]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:432][670]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:480][671]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:481][671]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:526][672]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
[2024.09.12-19.55.06:527][672]LogPhysics: Warning: COLLISION PROFILE [ALS_Character] is not found
grand mica
#

Hi!
I am trying to get OnRep_ReplicatedMovement() this called for my custom pawn.
I am trying to do this on the server side code but still this doesn't get triggered

FRepMovement& repMovement = PawnOwner->GetReplicatedMovement_Mutable();
repMovement.Location = m_position;
PawnOwner->SetReplicatedMovement(repMovement);
PawnOwner->ForceNetUpdate();

here, for ref

    /** Used for replication of our RootComponent's position and velocity */
    UPROPERTY(EditDefaultsOnly, ReplicatedUsing=OnRep_ReplicatedMovement, Category=Replication, AdvancedDisplay)
    struct FRepMovement ReplicatedMovement;```

according to what I have learnt - when ever the replicated object gets manipulated then the OnRep_ method gets called. This is not happening in this case and I am debugging this on the client's exe.
grand mica
#

or basically I am trying to get OnRep_ReplicatedMovement on the simulated client by changing its value in the server

brittle ledge
#

Cuz it could be many things like server not knowing about your input, or there being a non-multiplayer related issue

#

So like first know if the server knows of the input, then add like breaking points like that to know where the issue happens

zealous wigeon
#

i fixed that

#

but the client now does not handle input

brittle ledge
zealous wigeon
#

yes but anyways I think i will drop ue for this project

#

ue with dedicated server for my project feels like a spaceX rocket to travel 5km

#

makes no sense

#

ain't no way im downloading +200gb engine source code and compiling it from scratch just for this

brittle ledge
zealous wigeon
#

there is a grid 16x16, two players search for a match putting each 100 coins, fight with Pump, AR and fortnite builds and who wins takes all the coins

#

you can then cash out the coins into real money

#

for example 1€=100coins

#

this may not be compliant to UE rules so I will adapt it with some workaround like gift cards and tickets instead of a virtual currency

#

what you think?

brittle ledge
#

U can do it with ue though u could also do it with other engines. I was wondering if it was a game or just an app. I guesh do what u think is best.

#

Though if u intend to make more games, id recommend regardless of decision start installing the source build

#

Worst case scenario u'll have it ready for a future need

#

Even if u end up using a diff engine for this one

zealous wigeon
#

but it's too much stuff forna relatively small project

lament flax
#

But do as you want

zealous wigeon
#

trust me you don't know my internet provider

#

anyways thats not the only thing

ripe lotus
#

good day, quick question. if i have an actor that's owned by the server, then the server reparents (attachtoactor) to the pawn. would that object become an autonomous proxy on the client for that pawn?

lament flax
ripe lotus
lament flax
#

But its only the case for components attached at compile time (95% sur)

twin juniper
#

owner = ownership
parent = attachment
(95% sure)

quiet yarrow
#

any common reason why client to server replication is fine, but client to client replication is not working?

dark edge
#

Variable replication is Server -> Clients only

quiet yarrow
#

I mean the server and a client both see it, but the other client doesn't get notified

dark edge
#

show code

quiet yarrow
#

replication was the wrong word there

dark edge
#

The general form is that a client informs the server of something through a run on server event, and the server sets a replicated variable, which eventually makes it to everybody

quiet yarrow
#

maybe im lacking that variable

dark edge
#

show code

quiet yarrow
#

sorry its sorta a mess atm

dark edge
#

that is very cursed

quiet yarrow
#

lol i've been trying everything I can think of

dark edge
#

so I'm guessing you want to hitch something to something else right?

#

Press key -> if close enough, hitch

quiet yarrow
#

yeah pretty much

#

using a physics constraint

dark edge
#

Networked physics is cursed enough on its own but it's doable

#

First off, don't try predict the hitch. The client side should just be input -> tell the server something

#

Input -> I wanna hitch (run on server)
I wanna hitch -> is there something close enough to hitch to? (get overlapping actors) -> yes -> hitch to it

#

Now whether or not setting constrained components on the server is enough is neither here nor there

quiet yarrow
dark edge
#

How are your vehicles moving to begin with?

quiet yarrow
#

vehicle movement component

dark edge
#

is the constraint component replicated?

quiet yarrow
#

it is

dark edge
#

Check that everyone agrees what the 2 constrained bodies are

#

tick -> get constrained components -> print them

quiet yarrow
#

idk why I havnt thought of printing that out of all things lmao

quiet yarrow
dark edge
#

It's been a while since I've done this but it is doable

dark edge
#

the fact that it gives you anything useful at all is a stroke of luck

#

you don't care about the last thing you began overlapping, you care that you're overlapping something hitchable at the time you press the button

quiet yarrow
#

right right

#

yeah that was giving me issues in the past

#

so how should I check if something is overlapping without that?

dark edge
#

for each -> is it a wagon? -> proceed

quiet yarrow
#

I honestly forgot that was a method of getting overlapping actors

dark edge
#

there's basically an array of overlapping stuff hanging around and the events fire when it changes

quiet yarrow
#

I was scratching my head thinking I dont remember overlap being this weird lol

#

doubt this will fix my issue, but it needed fixing nontheless so ill give it a try

dark edge
#

If I were doing this I would at start with making sure everyone agrees on what's constrained (and the ref frame for it)

#

then I'd look at the physics replication settings of the wagon and possibly the car. Make sure everyone agrees on everything. Do you know for sure that your car is replicated correctly?

quiet yarrow
#

for sure, no. but from all my testing it they have been extremely stable with no issues

daring gorge
#

if i have very simple use case of max 6 elements to be put in an array, i do want this to fire up OnRep func whenever the item is added, does it makes sense to use fastarray or should i just stick to normal TArray replication

quiet yarrow
short arrow
#

a normal Array is just fine

#

as always, if you want to be sure everythings okay it only takes about 2 minutes to pop open the network profiler and see

opal shore
#

where can i host a free unreal server build? its for learning, it will have aproximately half CAU

opal shore
#

mmm, could be, but im looking for cloud mainly

twin juniper
#

then you need to pay or use some free tier

opal shore
#

i think i will self host, otherwise aws. thanks erererererer

#

or unity multiplay i have to look at that

daring gorge
short arrow
daring gorge
rough dock
#

does anyone know how to add an impulse to a client? whenever i add an impulse on a client it just corrects no matter what even when doing a multicast. please help

verbal vapor
#

Looking for locomotion guide

lament flax
#

Whats your issues with MP & locomotion ?

verbal vapor
#

I am just trying to get the idea how can I build my own locomotion from scratch and handle replication

#

I know that Epic released their locomotion system but it's quite advanced

#

XD

#

by the way, how can I export their animations from the locomotion project - exported i mean it use the manny skeleton and mesh instead of the UEFN one

hoary spear
#

Is there any considerations to replicating a UDataAsset reference? My understanding was that they would 'instantly' replicate fully, as they exist locally already ?

lament flax
#

I dont fully remember, i remember having issues with that.
Anyways my recommendation would be to not store a DA at runtime (for example as a Inventory Item), but instead use them as static data that is used as a initer

hoary spear
#

So create some method to grab this data on init , instead of storing a reference to it?

#

My current setup just pointed to these like this;

    UPROPERTY(BlueprintReadOnly, Replicated)
    USqsQuestLine* QuestLineDefinition;
#

While it seem to 'work' I'm seeing some weirdness but it could ofcourse be elsewhere

lament flax
#

I mostly do that because i want to store more data at runtime then in the DA

#

So instead of editing the DA i edit my runtime object

hoary spear
#

i do the same, but separate them in the instance so to speak

lament flax
#

It also depends how heavy is you DA compared to its potential runtime version

hoary spear
#

SqsQuestLine is DA (static for all intents and purposes)
SqsQuestLineInstance holds a ref to the DA, + whatever runtime data i have

lament flax
#

IMO if i had a quest system i would only replicated specific data like the quest title and description

#

And a soft ref pointing to a location ping actor for eg

lament flax
#

There is a lot of differente ways of doing

lament flax
hoary spear
#

The only issue atm is that some stuff dont update in the UI, while if i inspect the reference at the time, it got the correct data

lament flax
#

Can you show how you rep that to UI ?

#

And the supposed good value at runtime

hoary spear
#

during inspection

#

(currently mid refactor, so this is just all testing)

#

when hovering the variable it's "out of scope",

#

if i print its value, it's correct

lament flax
#

You are forced to hover the original struct/object var

hoary spear
#

hoooold on

#

im a dumbass

lament flax
hoary spear
#

the TB_Description was collapsed -.-

lament flax
#

I had this issue when i first tried a inventory composed of DAs

hoary spear
#

the sub textblock was visible.. making me think it was the TB_Description

#

yey, it works!

lament flax
#

Didnt understand

#

Oh you are talking about the text blocks

hoary spear
#

yeah

#

the "bug" was only wrong visibility

#

sorry about that

lament flax
#

So is the DA ref replicated ? Or do you only need the texts here

hoary spear
#

yes, everything replicates as it should

#

the DA contains all the static info about everything related to that quest line

lament flax
#

On your screenshot i dont see any usage of the DA

hoary spear
#

QuestLineDefinition is the DA
Quests also holds a QuestDefinition to a Object inside same DA .. (one could say its redundant, but its for ease of access in widgets)

and Objectives/Failconditions yet again holds a definition. plus the runtime data

lament flax
hoary spear
#

which part?

lament flax
#

oh im dumb

#

i was looking the quest reward

hoary spear
#

ah haha yeah that's invalid at this point

#

the quest got no reward 😛

grand mica
lament flax
nova wasp
#

you already changed it

grand mica
grand mica
nova wasp
#

is this actually being called on the authorative client?

lament flax
#

maybe its just not changing ?

#

did you add it in GetLifetime... ?

#

or is it already

nova wasp
#

is bReplicateMovement true?

grand mica
grand mica
nova wasp
#

{,,UnrealEditor-Engine.dll}GPlayInEditorContextString

#

is this a replicating actor at all? is it even created on the client?

grand mica
#
APawnAgent::APawnAgent()
{
    // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    SetReplicateMovement(true);
    SetReplicates(true);
    bAlwaysRelevant = true;
    

    defaultSceneRootComp = CreateDefaultSubobject <USceneComponent>(TEXT("SceneRootComp"));

    RootComponent = defaultSceneRootComp;

    // Create and initialize the skeletal mesh component
    SkeletalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("SkeletalMeshComponent"));

    SkeletalMeshComponent->SetupAttachment(RootComponent);

    PawnAgentMovementComponent = CreateDefaultSubobject<UPawnAgentMovementComponent>(TEXT("PawnAgentMovementComponent"));
    //MaxJumpHeight = 5.0f; // Desired maximum jump height
    //Gravity = -300.0f; // Gravity
     // Calculate initial jump velocity based on maximum height
}``` 
I have set the things in the ctor
#

but I am trying to change the value from the movement component but on the server

nova wasp
#

what's the point of defaultSceneRootComp here if it's the same type as teh root component already...

#

besides the point I suppose

nova wasp
#

is this code actually running on the server?

grand mica
#

the code that changes the FRepMovement& repMovement?

nova wasp
#
    UE_LOGFMT(LogTemp, Log, "{WorldString} Set repmove here", GetDebugStringForWorld(GetWorld()));
#

yes

grand mica
#

yes that's running on the server I am 100 percent sure

nova wasp
#

this dumb logging thing should help show which context it is being ran in

#

okay, I'm not 100% sure lol

grand mica
#

it done in server rpc

nova wasp
#

Is the object also replicated to the other client as well?

grand mica
#

that object is in Actor.h
it's replicated yes

nova wasp
#

Is it actually being created on that client?

#

I'm not asking what checkboxes you pressed, I'm asking what is ACTUALLY HAPPENING

#

could be as simple as a missing Super:: call somewhere

grand mica
#

basically I want void APawnAgent::PostNetReceiveLocationAndRotation() this to get called whenever the position of the actor changes and I can update the position for the simulating client

nova wasp
#

you can actually override OnRep_ReplicatedMovement interestingly enough if you want to

grand mica
nova wasp
#

what is getting triggered on the client? I'm confused

grand mica
grand mica
nova wasp
#

also LocalRepMovement.bRepPhysics being true precludes a call to PostNetReceiveVelocity

#

can you just breakpoint AActor::OnRep_ReplicatedMovement ? think

#

Or override it just for debugging purposes

grand mica
#

i have the source code. I can put a breakpoint there

nova wasp
#

unsure if it will work without debug symbols

grand mica
#

i am running it on Debug Editor build

nova wasp
#

that's not what I mean, I mean debug symbols for the engine

#

a rather large optional download you need if you are doing any non-trivial C++ stuff

grand mica
nova wasp
#

or you can just do the simple thing and override it to see if it's called

nova wasp
grand mica
nova wasp
#

sorry, I assumed you were on the binary launcher build

grand mica
#

no issues 🙂

nova wasp
#

having the source code does not preclude it being a binary build

#

both of them have the source code...

grand mica
nova wasp
#

okay, just breakpoint it then?

#

you don't need my permission to try to solve the problem lol

grand mica
#

one moment. So to get the breakpoint triggered i think i have to run it under one process.

#

also, i am getting this warning when I run it
ensureMsgf(!NeedsInitialization(), TEXT("SetIsReplicatedByDefault is preferred during Component Construction."));

#

would it matter for now?

nova wasp
#

unless you want to get that ensure literally every time you run the game then leave it?

#

SetIsReplicatedByDefault appears to skip the extra call to UpdateReplicatedComponent

grand mica
nova wasp
#

then... why didn't you just do what it says?

#

Just use SetIsReplicatedByDefault ...

#

I'm not certain if it matters for this but it's definitely skipping a lot of extra work

grand mica
#

SetIsReplicatedByDefault where do i need to call this?

nova wasp
#

This is just a change to the source file? this is a file you are changing anyways 😛

nova wasp
grand mica
nova wasp
#

yes, that YOU WROTE

#

look at the callstack of the ensure

grand mica
#

it must be coming from where i wrote

nova wasp
#

I think it would be really beneficial for you to figure out what a callstack is and what it means because otherwise C++ debugging will be quite difficult

#

next time you see the ensure, look at WHERE it is coming from and what could change

grand mica
#

anyways, I am not sure what do we need to fix first. Keep a breakpoint in OnRep_ReplicatedMovement here or fix the warning?

#

xD

nova wasp
#

both

grand mica
#

yeah i know lol.

#

xD

nova wasp
#

also you never proved it's being created on client and server with anything

#

if you are compiling with the editor open or something do not do that (Unless you know what you are doing, live coding can as a rule of thumb can change cpp stuff)

grand mica
#

this gets triggered but only on the first few frames and I highly doubt its getting triggered because of my code

grand mica
#

one moment

nova wasp
#

ensures are designed to only cause a breakpoint the first time they are triggered each run

#

this is to avoid being stuck pressing f5 forever on "bad but not a crash" kinds of errors

#

yeah, this is a received bunch

#

It would be easier to override this to see if it's being called

#

as this could be any replicating actor

#

you also hid which actor it's for... I don't understand how I can do this seeing only small pieces of isolated things at a time

grand mica
#

ok i am overriding it and dioing super::call in it

nova wasp
#

also please just fix the bad SetReplicates call now rather than ignoring it

nova wasp
#

Also make sure you didn't miss any Super:: calls in your overrides, like beginplay etc

grand mica
#

yes sure!

grand mica
nova wasp
#

with packet loss you just... spam moar packets lol

grand mica
#

I don't want the server to acccept whatever the client has done in those packets which were lost

grand mica
#

so there must be a solution?

nova wasp
#

a server correction?

#

I think the reality is eventually you just have to correct the client to be where the server expects them to be... if the server missed some old unreliable move RPCs then oh well

grand mica
# nova wasp a server correction?

yeah but that would make the client to keep on sending the new moves and the server is still processing the old moves. With more packet loss - older moves and so on 😦

#

btw overriding didn't help either

nova wasp
#

I didn't say it would help, I said it would let you see if anything was calling it

grand mica
#

no, didn't get called. Let me show things are happening on the server

nova wasp
#

I still haven't seen a simple output log showing the object existing on both other client and server

grand mica
#

these are my logs in the server code and server logs

nova wasp
#

none of this shows the client's log

#

just... run in editor to avoid the headache here

grand mica
nova wasp
#

UE_LOGFMT(LogTemp, Log, "{WorldString} Set repmove here", GetDebugStringForWorld(GetWorld())); I gave you this exact line here to pasta in (If this doesn't compile my b, I think it's accurate though)

#

add this log to the pawn's BeginPlay as well

grand mica
#

okay one min

#

UE_LOGFMT it says its undefined?

#

cant i do it with normal UE_LOG?

nova wasp
#

sure, you can

#

UE_LOGFMT is just fancier

nova wasp
grand mica
#

uhm. Doing it with normal log. Running it

nova wasp
#

Is there a reason you need to run it outside of the editor here? I personally prefer just doing stuff like this in PIE

#

it's not a perfect test but it should be more than good enough for stuff like "does this replicate at all"

unkempt tiger
#

Can I switch a player's APlayerController instance mid match? To perhaps a difference type?

dark parcel
#

What would be a good use case to do something like that?

#

Sounds like a pain to me

nova wasp
#

the player controller is more than just "what buttons you push", it's kind of the object that owns the connection to the server

unkempt tiger
#

I want to let players spectate the match if they're dead
I figured maybe changing the controllers to a spectating controller would work

nova wasp
#

it's not simple to swap out from what I can tell and I have never seen a project that needed to

unkempt tiger
#

Makes sense, I figured it wouldn't be trivial

grand mica
nova wasp
unkempt tiger
#

Oh right, doing it via a pawn makes so much more sense

#

how do you mean partially possesses it?

nova wasp
#

the server doesn't know or care about it

dark parcel
#

Makes me wonder how fog of war works in multiplayer

unkempt tiger
#

Ah, gotcha

dark parcel
#

I guess what can be seen must be defined by server

nova wasp
#

If you want to do things the ~unreal way~ you can do this to start spectating (dot his on the server to the player that starts spectating)

// start state "spectating"
            MyPlayerController->ChangeState(NAME_Spectating);
// make sure to yell at the client too
            MyPlayerController->ClientGotoState(NAME_Spectating);
unkempt tiger
#

woah

#

that is bizzare to me

nova wasp
#

there is nothing stopping you from just making a new flying pawn and possessing that to make spectating a thing, spectating (the unreal player controller NAME_Spectating state) is entirely optional

#

it is techinically used when joining before you get given your pawn etc in the default case I think?

#

but in most cases this will be like a brief stutter before you start walking around

unkempt tiger
#

I would guess that at the initial couple of seconds before the pawn is spawned for the client the controller is in a pawnless limbo

#

gotcha

nova wasp
#

the unreal setup is fine except for a few omissions in spectators not being respected as the current pawn ( PlayerController->GetPawn() does not return it, but GetPawnOrSpectator does)

unkempt tiger
#

That works, thanks a lot for directing me to pawns

nova wasp
#

I feel like I need to take a step back here, lol...

#

learn what a pawn is first... please read the getting started docs

unkempt tiger
#

I was about to actually use this system I wrote some time ago that I called 'player experiences' which was just an input controlled camera that became the player's view target, potentially letting the original pawn still get inputs

#

i don't like this multitude of options

nova wasp
#

the alternative is to ignore those options

#

your setup is actually probably a pretty good idea, the view target + input is all you need in reality

#

but it might omit some key things like the server knowing where your viewpoint is from the possessed pawn (distance based relevancy?)

unkempt tiger
#

exactly my thoughts

nova wasp
#

I would highly recommend at least possessing a real pawn while playing

unkempt tiger
#

yes ofc

unkempt tiger
nova wasp
#

also if you want... you CAN add actor components complete with server RPCs + replicated properties to a player controller

#

if your concern is "why do I have to stuff all of this darn stuff in the player controller" or something

#

but the pawns are there for a reason I guess

grand mica
#

showing where things are called.
The call on the clients come from begin play and On_RepReplicatedMovement which I think is being called only when I play the game. Not when the values are changed

nova wasp
#

How on earth are you getting a -1 client ID?

#

are you passing in a nullptr?

#

ah, no read the ternary wrong

#

I guess -1 is the pie instance of standalone processes

grand mica
nova wasp
#

I suspect something else is overriding the repmove here (the value I mean, not the function)

#

I would just launch it all under one process for stuff like this (just to make it faster to test, no it is not an accurate test that way)

#

try setting the position of the root component rather than manually changing the rep move

#

I think it's gathering movement and seeing the position hasn't changed

nova wasp
#

See AActor::GatherCurrentMovement

#

which is what fills out ReplicatedMovement

#

you can actually make a seperate property for your own replicated movement if you like and disable the old one if need be

grand mica
# nova wasp you can actually make a seperate property for your own replicated movement if yo...

right. I noticed in high ping

These are the values of the local client over 10 frames

local client - 1,2,3,4,5,6,7,8,9,10
server - 0,0,1,2,3,4,5,6,7,8,9,10
remote - 0,0,0,0,1,1,1,4,4,4,8 etc
so the remote client is getting the update in a bunch rather than receiving every single update. This seemed weird and I tested the Third person template in Unreal and they were updating the values regularly even on high ping using PostNetReceiveLocationAndRotation

I am not sure what was happening here

#

thats why i was looking into it

nova wasp
#

is it changing anything in the onrep? Is it set to Onrep_always?

grand mica
#

anyways its weird. I'll try this stuff on a different project now

#

At this moment I think i need to focus on how to deal with packet loss