#multiplayer

1 messages ยท Page 224 of 1

chrome bay
#

Usually SceneCapture is what you'd use there

#

Spit it out into a render target, get the raw bytes, compress, then send

lusty yarrow
#

Its what Im doing but I need the building to be in complete isolation

#

For lighting and post processing purposes

#

Hence the separate world

chrome bay
#

I will be very surprised if that actually works outside the editor then

lusty yarrow
#

But just not sure what the correct way of sending the texture is

chrome bay
#

Because AFAIK, the only environment where you can have multiple active UWorld's at a time is inside the editor, given all the special case handling that exists for that case.

kindred widget
#

Does 5.4 have some sort of forced emulation for networking or something? I'm testing stuff in PIE, Listenserver. Good framerate. no emulation turned on, but it's acting like I have about 150 latency.

chrome bay
#

What happens if you clamp FPS to 60 or so?

#

If you're using CMC and run at a high enough framerate, you can cause throttling

kindred widget
#

My FPS already is clamped there. ๐Ÿ˜„ In this case it's a simple boolean replication. Sets from a button checkbox press. Updated from tick atm.

chrome bay
#

nothing springs to mind, other than possibly a low net update frequency on the object?

kindred widget
#

Maybe. Does that effect even with no other networking going on?

#

I dunno why I always thought of that as a priority system instead of a timing thing.

#

Oh, right no that was net priority. Getting my wires crossed.

#

But yes. ๐Ÿคฆโ€โ™‚๏ธ That was it. I keep forgetting that Playerstate has such a low frequency by default.

chrome bay
#

You could keep it low and call ForceNetUpdate when you change something too, just resets the timer

kindred widget
#

True. But we do a lot of stuff out of the playerstate atm, or out of it's components more so. So I just upped it for now. But I'll keep that in mind for sure if it becomes an issue.

tardy fossil
#

hmmm is ~30kb/s the fastest i can squeeze out of a UChannel?

tardy fossil
#

i send the snapshots as a custom struct at a fixed rate using an unreliable RPC

#

i havent had to increase any bandwidth limits.. actually my system uses way less bandwidth than CMC and mover

#

the client buffers the snapshot and then lerps through them, client doesn't start processing the buffer until theres atleast 1 extra snapshot in the buffer. It gets a little jumpy at high pings but i can just increase the amount of extrasnapshots the client waits for before it starts processing them

cold cipher
#

I am doing a replicated projectile with client prediction of the projectile
does anyone know how to replicate the projectile and sound?
in a way that the client firing it will see the projectile and sound first, but not hear the sound from multicast nor seeing the projectile spawn on server

quasi tide
#

At the start of the multicast, check if the local role is an autonomous proxy. If it is, return.

#

Otherwise, do the stuff

glad escarp
#

Hey all, I'm encountering issues with an OnRepNotify function and I wonder if it's because I'm doing something that isn't allowed or something. It's a simple function but if anyone can tell me if this should work, I'll start looking elsewhere for why it's not workign as intended:

quasi tide
#

As for the projectile - you can link them up by name. I forget how though.

#

Some other people also use an "initiator" param.

#

(For the exclusion on local client)

#

Might be overall easier to do to be honest.

#

Just annoying

cold cipher
#

thanks!

quasi tide
#

Would be nice if Epic would look at the PR earlier this year that implements this functionality though

#

There are also people who have gotten an "Is Local Controller" check to work as well

steel gust
#

If a replicated variable is changed on the dedicated server is the OnRep called on server and the clients? or do you need to invoke it on the server after the variable change

lost inlet
#

are we talking BP or C++ here

#

BP yes, C++ no

quasi tide
steel gust
#

c++

lost inlet
#

you have to manually call it on the server

quasi tide
#

This is where setter functions come in handy

steel gust
#

Thank you!

lost inlet
#

it'll obviously be called on clients when it replicates and the value differs (unless set to always notify)

steel gust
#

Just wanted to clarify, having to deal witrh some replication and its been awhile

glad escarp
# quasi tide There is next to no information you're giving. Best to provide as much info as p...

My mistake. Well this OnRepNotify is for keypad the player presses. It's recording the number of keypresses so that when the max character limit is reached (6) it should call this event dispatcher so that the keycode gets sent to the corrisponding actor it's intended to activate. Right now, it doesn't seem like the even dispatcher is firing on the target actor and I just wondered if that is because I put the variable conditions in the OnRepNotify I posted above.

quasi tide
#

Having a condition in the onrep doesn't affect if it fires or not, no. Something else is afoot.

glad escarp
#

Roger that. I thought as much but I wanted a sanity check from you guys.

quasi tide
#

Slap a debugger on the actual broadcast. If it never hits, at least you now know that the true condition is never firing.

honest bloom
#

I'm looking up the different Mover BaseMovement modes
and I struggle to understand .. when does it make sense to use things like TrySafeMoveUpdatedComponent and when should we just use MoverCompenent->MoveComponent()

#

My guess is that, when there is no collision to watchout for .. MoveComponent does the job .. but I wanna make sure I'm right about it.

steel gust
#

When using a dedicated server in PIE is there away to route the server logs to the output log?

lament flax
#

It should already be the case

#

You see logs from all instances in the output log

fossil veldt
lost inlet
#

well that's easy enough to remember

fossil veldt
#

I am just used to it being automatically called on the server too from using BP for like 8 years before I touched C++ itโ€™s burned into my brain

glad escarp
#

So, solved the last issue but I'm noticing something weird on my player character. I have a flashlight which toggles on and off using an OnRepNotify bool value. That all works great. The thing I noticed is that the flashlight angle doesn't change pitch as the player looks up or down. It is a component of player character and parented to the camera and it yaws correctly but when the payer looks up or down, even though the AimOffset is replicating correctly, the flashlight doesn't tilt up or down with the player's head/camera. Also, this is only true of the client player. I can see the client player's flashlight behaving as intended, from the server character, but not the other way around. The component is set to replicate as well as the spring arm component that the "flashlight" is attached to.

quasi tide
lost inlet
#

if we were so fortunate to have something like C# properties

fossil veldt
quasi tide
#

uuuggghhh - why'd you remind me

fossil veldt
quasi tide
#

Or well...rotators existing at all

quasi tide
lost inlet
#

BM pre-emptively hates this

glad escarp
woeful ferry
little pumice
quasi tide
#

Pitch (w/e one is up and down dang it) is replicated due to GetBaseAimRotation

#

Was a common issue/complaint way back in the day. So Epic replicates it now.

glad escarp
glad escarp
little pumice
#

I mean spring is local thing isn't it? try to read Pitch on server in a different way than from character

glad escarp
little pumice
#

first of all verify that server receives Pitch from clients in some way. I guess that's what Duroxxigar meant by suggesting GetBaseAimRotation, log/print it on server/client

exotic wasp
#

i remember only yaw getting replicated

quasi tide
#

I can never remember what actually gets replicated. But it is what is generally used for up & down replication of the camera stuff.

glad escarp
quasi tide
#

Locally - you want to use your own stuff, but the remote clients should be using what gets returned from the GetBaseAimRotation.

glad escarp
#

That seemed to do the trick

#

If that's not the right way, please let me know. But thanks guys!

little pumice
#

reduce update frequency of the actor/component to 5-10 times per sec and check how it looks when you move lights(pitch). I'm not sure AimRotation supports interpolation(smooth anim) like movement component.

#

though high frequency may be a way to go for "indie/Single A" project Jokerge

little pumice
gloomy ibex
#

I had sprint but i disabled it to try and diagnose the problem, im pretty certain its just the base movement im having issues with. The issues are only happening in a built project, standalone works fine

exotic wasp
gloomy ibex
#

you're a life saver thank you

glad escarp
glad escarp
little pumice
#

which might be not optimal depending on frequency of Look InputAction node

glad escarp
#

I'll read through that doc you sent and figure out if I need to adjust this.

#

I do have another question though, a rather noobish one. If I want to set a variable on an actor that the player interacts with so it is persistent, shouldn't calling a server RPC from the player to the actor, via an interface, allow that replicated variable on the other actor to be switched on the server? I haven't provided BP's or details because, depending on the answer to the above general question, I want to do some reworking before I bother anyone again.

quasi tide
#
  1. Client sends a server RPC saying it wants to interact with X
  2. Do the logic on the server (flip the variable or w/e)
  3. OnRep gets triggered and everyone is happy
  4. Cry because lag
little pumice
#

yeah I would inform server about "Player's actions" i.e. interacted with object, instead of "instruct server what props to modify directly".

glad escarp
little pumice
#

@quasi tide 's approach

glad escarp
# little pumice <@297744474703134722> 's approach

@quasi tide so rather than having a function in the interaction actor that changes the variables, I should reference that actor when I interact and then set those vars directly in the player character actor, with a server RPC?

quasi tide
#

No

#

Refrain from having one object directly alter the state of another object. Interact with them through functions.

#

Makes it much easier to manage the state of an object.

#

So let objects manage their own state

#

It depends on how you do interaction - but, you would just ask the server to interact with X object. The server would then do validation checks (if you care) and then call the interact function ON THE SERVER

#

Then the server version of the object mutates its own state and replicates it back down to clients

glad escarp
#

But it's such a crazy way to do things, my brain hurts. lol.

I'm a visual/hands on learner so reading documentation isn't super effective for me. Practical examples are what lock things in for me. Problem is, all these youtube tutorials on "replicated doors" aren't doing it correctly because they just call a multicast rpc which works while players are connected but any reconnecting players see the door in their default state. So I'm trying to wrap my brain around it.

quasi tide
#

Networking sucks. But you want to play with your friends. So deal with the suck.

glad escarp
#

Yup. I'm trying to gut through it. It's just such a huge shift in methodology that it's fuckin me up.

verbal ice
#

Basic door is just an open/closed state, literally a boolean

#

A little more advanced would be open w/direction or closed

#

More advanced or overkill would be replicating the timestamp at which the movement started so you can keep the door's position in sync with other clients

quasi tide
glad escarp
verbal ice
#

Rep notify -> start moving door

glad escarp
#

I keep forgetting that the clients will get the updated repnotify values when they connect so that makes sense.

glad escarp
verbal ice
#

You can play the sound in the rep notify

quasi tide
#

You do your logic in the onrep function

glad escarp
quasi tide
#

You can have timelines

#

In your onrep function, you just call an event

glad escarp
#

ok that's what I was doing. Sorry. When you say do your logic in the onrep function I thought you meant it had to be self contained.

quasi tide
#

Nope

#

All it is, is a function that gets ran on the machine when the variable changes.

glad escarp
#

Thanks for your patience today.

sinful tree
#

This seems to work pretty well for a door. Audio can be played using event tracks on the timeline itself. Since the Timeline is replicated, anyone within relevancy range should hear & see the door. The OnRep is used only to ensure that clients can see the state of the door when late joining or if the door was out of relevancy range when it completed the move. Any clients who have the door relevant or the door enters relevancy while it is playing will see the door in the appropriate position. Only thing that may need some tweaking is audio playing while the door is moving, which could probably be handled in the Update event.

glad escarp
raven plaza
#

Hi! I need some help understanding how Unreal networking does events. Basically, let's say a client player presses the jump button and it needs to communicate that with the server. I understand that I need to send an RPC from the event trigger in the client to the server (and then to multiplex as well to spread to all other clients). But lets say there are a bunch of specific variables with conditions set inside of the jump function which needs to be true for the jump to pass through- should I have my RPC call from the client route to the start of this chain of checks, or does it need to be at the end of it where only the actual jumping node is for it to work?

sinful tree
# raven plaza Hi! I need some help understanding how Unreal networking does events. Basically,...

If you're using the Character Movement Component, the Jump functionality is already built in with client predicted movement & replication. All you need to do is press an input and call the Jump function and it'll end up replicating to others. If you're wanting to change the logic of when that Jump is allowed to execute, to do it properly, you'd have to modify the CMC within C++ to ensure that the server knows when a client should be allowed to jump or not correctly with client prediction otherwise you run into a situation where a client could potentially cheat and jump whenever they want and the server won't really be able to compensate for it, or if you enforce a server authority on the jump function being triggered, the client prediction of movement will fail and cause corrections on the client's end making the movement look jittery.

If you're making your own movement component then you can basically do whatever you like. Technically you should have the client perform the checks themselves too just so you're not sending an RPC if it's not necessary, and then having the server validate it as well before calling the jump function, however, this again will have poor response time on the client as it requires the server to perform the move and replicate the result before the client receives any feedback that they pressed the button.

clear valve
#

I got tired of debugging multiplayer so I added this little tool for myself ๐Ÿค” together with a macro UE_MULTIPLAYER_DEBUG_BREAK(ContextObject) I can break on either client, or, server, or none, without recompiling. I found debugging across multiple clients pretty annoying, are there any secret tools that people know of?
It would be neat if you could easily filter logs by server/clientX also ๐Ÿค”

fossil spoke
#

The Immediate Window tips in here are handy to know.

clear valve
#

I remember seeing this years ago, you are right, this is pretty useful. Sadly doesn't seem to work for rider

#

I'll ask internally if this is something we can do

fossil spoke
clear valve
#

a doc for Unreal + Rider would certainly be useful, I'll ask one of our technical writers if that's in the cards. But no promises

fossil spoke
cold cipher
nova wasp
cold cipher
nova wasp
#

It does, I'm just wondering why everyone is spawing a replicated bullet here in a multicast

#

simuled proxies spawning a replicated actor seems uninteded

sinful tree
#

Multicast = "Everyone do this"

#

If the actor that the multicast is called on exists on a client, the client will execute whatever is contained in the multicast execution path. In your case, when clients receive that multicast, they'll spawn a local copy of that actor while also receiving a replicated version that the server spawns.

#

What's also probably happening here is that because you're spawning the replicated actor on the server call, and then also calling the multicast afterwards, the server can end up spawning 2 copies of the projectile since the server also executes the multicast, so then they could end up colliding and destroying one another before the clients can actually see anything.

cold cipher
#

huh I'll check that

glad escarp
#

Alright. I'm heading to bed but I wanted to post this in case someone might be able to spot my mistake while I'm away.

I'm working on a keypad system that lets the player enter a code, this code is sent out along with an int ID to find a matching receiver actor. If the ID matches, it checks the code that was sent to see if it was correct then does stuff. This works on the server but not on the client and I'm hoping someone can look at this very crazy code flow and tell me what dumb mistake(s) I'm making:

dark parcel
#

Also what is up with the use of interface here?

meager heart
#

At what point during initial PIE / game spawn should a client's Player state be valid? I've been trying to run some logic on the playe controller BeginPlay/RestartPlayer but the playerstate doesn't seem to be valid on the spawned clients if there's no delay

Is there a certain function I can override where when it gets called I know the player state should be valid? Right now I'm trying to use ACharacter::SetupPlayerInputComponent() but that doesn't seem to work

sinful tree
meager heart
#

My worry with onRep_PlayerState was that it wouldn't fire for the client hosting/running on the server, would that be true?

nova wasp
#

yes, you can just call it manually though

sinful tree
#

Try it and see, but you're probably right.... In that case, you should just be able to check on Begin Play of the PlayerController for the server.

nova wasp
#

C++ onreps are only called by unreal when replication happens. The simple thing is to just call the onrep when the value is changed on authority as well

sinful tree
#

Yea but that's not something typically modified by someone trying to augment the class... It's internally assigned.

#

They'd have to override any place where the PlayerState gets assigned in order to then call the function.

#

Even better...

#

Nevermind... What I was thinking only exists in APawn.

nova wasp
#

don't use a delay set to some arbitrary time...
I would try to make a timer for next tick that does some checks to consider if

  • the game objects you need replicated are set
  • the game objects have each other set (the player state->controller actually point to one another)

If they aren't there yet, set the delay for the next tick again to check until it shows up

#

replication is fuzzy... even more so with multiple objects

#

Pawns know when their playerstate is set at least

meager heart
#

I've been trying to copy Lyra's implementation for the most part, but this is the first main part where I haven't been able to replicate their logic

They do delay a tick on ALyraGameMode::InitGame() before restarting all players, but then they delay for all assets to be loaded which I think covers up the liminal time I'm hitting where the client spawns but their player state isn't valid

#

Lyra also uses the IGameFrameworkInitStateInterface for their necessary components which probably helps out with this a lot as well, but it was a lot of overhead for something that was more supposed to be a proof of concept for me so I haven't implemented that

nova wasp
#

IGameFrameworkInitStateInterface is literally just some if statements that check for if some objects are present in current contexts

#

what exactly is the overhead caused by this?

meager heart
#

Sorry overhead as in the implementation overhead lol, they also use the pawn extension component to facilitate the init checks and it just seemed like a lot

nova wasp
#

what does implementation overhead mean?

meager heart
#

It may be the functional answer though so I may consider it, I just have only ever seen it used there and figured it was overkill

nova wasp
#

I guess it does appear complicated but the main gist of it is that it's just multiple places calling CheckDefaultInitialization

#

each one of them can advance how ready the object thinks it is by... some if statements

#

It's maybe pointless to be an entire new type of thing if you only need it for this one thing, but the exact way it works is pretty simple besides the gameplay tag array

#

the idea there was probably to split up the idea of "okay, the playerstate is here but their assets aren't loaded yet" or something

#

But yeah... definitely be keenly aware of calling stuff from onreps that could be expecting things that happen RIGHT AFTER the onrep in the same frame

#

especially if you are changing the netcode to iris etc, it might surprise you

meager heart
#

Yeah I took some time to try to figure it out to assess if it was necessary or not and you're right it's not that complicated, I just figured it was an overly robust solution to something which could reasonably be done another way (also considering I'd never seen any tutorial/example use it either)

Maybe I was just hoping that the replication part would work relatively painlessly, which seems like isn't usually how it works out lol

nova wasp
#

There is basically nothing that gaurantees replication of separate properties will show up together

meager heart
#

Lol

nova wasp
#

so... yeah you get to make spaghetti like this

meager heart
#

Okay that makes me feel a bit better, I felt like doing some repeated tick-delay like you mentioned was more non-deterministic than it needed to be, but it sounds like that is kind of just the accepted reality of initializing things with replication

nova wasp
#

The playercontroller is sort of the head-honcho of the connection so that one you can safely assume will always be around in a multiplayer context on the local client (just for you)

#

also the default send rate of the playercontroller is pretty damn low, you might not want that

meager heart
#

Makes sense, that's helpful thank you!

#

Maybe I will set up the game framework init state interface

nova wasp
#

you can just have your own simple function, you don't really need their interface etc

cold cipher
nova wasp
#

the simple thing here is to determine if the actors ever beginplay on the other clients

#

and also make sure you make these always spawn if you want to

vapid gazelle
#

Say I want to have a Trigger Volume only operate on the server. Sure I can add authority checks on things like the overlap event, but could I also just not have the Trigger Volume be replicated in the first place to the clients' instances, having it only exist on the server, so that I don't even have to bother with that? Or is that not the UE way of thinking of this kind of gating?

vapid gazelle
nova wasp
#

I think it just kind of depends

#

It might arguably be kind of wasteful to load the actors and then instantly nuke them...

#

If you want you can go nuts with data layers/sublevels that have different sets of actors but that can be a headache

#

You might find that the actor doesn't have anything interesting to do on the client but it might be useful to have as a marker for visual things, etc

cold cipher
# nova wasp the simple thing here is to determine if the actors ever beginplay on the other ...

I think I found the problem
the actor did run beginplay on client
so I checked the on hit event, in case the actor hit the shooter and disappeared
and found out client run hit event right when the actor spawned, when server's run normally

it seems that the actor pointer is different for different machines
currently I used an actor param and != to prevent bullet from hitting yourself

iron forge
#

Hello everyone, I'm considering developing my first game using Photon so I that I can concentrate on game development rather than the client/server rabbit hole for a small multiplayer game - has anyone got experience in it here?

thin stratus
#

So I doubt there are many or any users here who touched that

#

Pretty sure it also costs?

iron forge
#

Well I noticed they have the Unreal offering in there circle at the moment with public realease upcoming.

thin stratus
#

I mean you can use it if you want. I personally would not and just use the existing logic in UE. Makes a lot more sense to me. Small multiplayer games can be done with ease and I doubt photon will take away the pain

verbal ice
#

I'm surprised it's even a thing

thin stratus
#

Even with photon you'll still need to setup property replication, handle smoothing, prediction, etc

iron forge
#

Yeah it's odd one I'm looking to develop a Empire of Ants style game but very much humanoid PvP with tanks and bases etc - I'd come across photon have noticed some games with rather a lot of players (Albion online for example) that use Photon and wanted to figure out if it was worth it.

verbal ice
#

Why waste your time trying to beat the native networking model lol

thin stratus
#

With UE you can at least use the character and get that for free

#

Well a lot of players is not a small game

iron forge
#

Because it's serverless and if by some weird chance I end up creating game that gets loads of players(it'll be hyrid PC/Mobile) then I don't want a billing surprise trying to upscale servers on AWS.

thin stratus
#

It's totally the opposite

verbal ice
#

The only reason I'd ever consider Photon is if I'm making a memey "cross-engine" multiplayer game

iron forge
#

Clash of clans is a small game, but has millions of players.

thin stratus
#

With EOS you can also just have the clients be hosts Crossplatform

verbal ice
#

If you reach clash of clans levels of players I don't think money is going to be an issue

thin stratus
#

The server hosting is what will be your problem, not the UE part

#

And server less or listen server is gonna be the wrong approach if you want to have pvp

iron forge
#

Hmm OK - you see I'm work in AWS/Devops so server orchestration/scaling is the easy bit for me - but I was wondering about Photon, however it seems the consensus is don't bother ๐Ÿ™‚

thin stratus
#

You always need to host the dedicated servers away from the players otherwise the cheat both the gameplay and the progress of their accounts

#

Don't bother isn't true

iron forge
thin stratus
#

If you need more than 100 players in one session, UEs default system will fight you

#

Otherwise if it's just, idk a max of 100 or way less, using UEs system that powers games like fortnite sounds a lot better

iron forge
#

Yeah gotcha, so this would be mostly matchmaking based so yeah it wouldn't go over 100 in a session.

thin stratus
#

Yeah then UE would probably make more sense

#

Pretty sure you'd need to write movement prediction etc from scratch for photon

#

Here you could use the character class fwiw

#

A lot of the UE systems also have built in multiplayer solutions which I would assume would all become useless. You might even add work by using photon

#

And you can probably forget asking for help here cause almost no one uses this

#

You are the first to ask in months or years

#

My opinion though. Take multiple and form your own I guess

iron forge
thin stratus
#

If so that's also a pretty shitty requirement in the long run

#

If they fail or shut down you'll have a very shitty time ahead of you

iron forge
nova wasp
#

A bit of a chicken-egg problem but it's surprising how few projects use photon seeing as how they have a lockstep determinism setup that handles animation/navmesh as well

thin stratus
#

Idk I just don't see the gain if UE already offers everything you need

#

"you" specifically

chrome bay
#

Multiplayer is a first-party feature of the engine, literally no benefit to using anything else IMO

#

Just making life harder

thin stratus
#

Pretty sure a bunch of projects use it

#

Most of them probably never made it to the public

chrome bay
#

I wouldn't be shocked if many of them use it out of ignorance of UE's native networking

nova wasp
#

UE does not do what quantum does (no, network prediction does not count...) but the fusion thing seems completely pointless to use with ue

chrome bay
#

Especially if they came from Unity in the past

thin stratus
#

Unity also has its own system by now iirc

nova wasp
#

they seem to have a matchmaking service as well which I have no clue about... I don't know anything about that stuff

thin stratus
#

Even Godot has its own haha

chrome bay
#

Press X to Doubt

#

"as easy as developing a local multiplayer title" Hmm

iron forge
#

This is what I came across that made me think about it: https://www.youtube.com/watch?v=6DdR9U0czBk

Live-coding with Quantum for Unreal Engine 5:

  • Deterministic game state properties added to Actors and ActorComponents
  • Predict-rollback logic using DeterministicTick()
  • Quantum Unreal native physics engine built-in components
  • Input, events, settings, late-joins and other topics.

Besides the above, general questions related to Quantum or ...

โ–ถ Play video
sinful tree
#

โŒ

nova wasp
#

I would say lol to that... unless they provide a lot of tooling for rolling back sounds/vfx

#

also I will say with this you would basically need to turn unreal into a rendering api

#

I am doing something similar to this (their SEO must be pretty awful for me to miss it for this long lol)

iron forge
#

Thanks everyone, so I guess it's Ue5 native and Kubernetes then, I guess that'll be quicker anyway, I just wanted to see what other people thought of Photon ๐Ÿ™‚

woeful ferry
#

And they provide 0 reflection support out of the box. So scripting integrations such as BP/Angelscript/U# won't work with it unless a programmer exposes it.

nova wasp
#

I think photon has like 6 distinct products here... The only one that appears directly unique over unreal's offerings is quantum and the matchmaking/chatting stuff I don't know

#

god save us they add another reflection macro on top just for their stuff

#

which frankly is probably needed to segregate the deterministic sim from unreal doing random shit

woeful ferry
# nova wasp god save us they add another reflection macro on top just for their stuff

โ€œWe did not do any direct integration... ( for BP) But it is easy for any C++ programmer to expose functions to BP to handle either view polling (we use this all the time for animation, etc), or for gameplay.
But I would NOT recommend using BPโ€

This is a direct quote from one of the devs, it was brought up in a discussion over on unrealsharp's discord

#

So I don't think those properties are viewable from the editor

nova wasp
#

not sure if based or insane

#

I would say it's probably not reasonable to just hand over a bp api for this that isn't SUPER locked down and basically crashes when you call RandRange without a seed

#

They would need to do a lot of extra work to make a "designer friendly" + foolproof api

woeful ferry
#

they miss out on a lot of customers to not integrate it with unreal's reflection

nova wasp
#

They kind of just... can't let that happen though

#

like I don't think you understand that deterministic means they must control the state COMPLETELY

#

it appears that you can do that yourself if you need to, they have serialization etc already done for you

woeful ferry
#

Sure, but if it comes to the cost of cutting out a big part of the engine's feature set

#

is it really worth it

nova wasp
#

yes, which is just the way it is

#

they made their own physics/AI etc to be deterministic I guess

#

you can't just randomly add a dash of non-deterministic state... this must basically be anything that effecst the game must be made and tested by them for state hashing etc

#

visual things that just represent or interpolate between frames can do whatever

#

Imagine if they sold this to people and someone made a ticket like "uhm, I tried to turn on chaos physics and the state hashing broke?"

#

they more or less need to make it insanely hard to leave their walled garden here

woeful ferry
#

I don't disagree. Just they make it out to be so integrated, when a whole lot the engine won't work with this out-of-the-box

nova wasp
#

of course I'm sure in the C++ api you could explode it in one call to rand() but it's more about the principle of the thing and having a sort of "other context" of code

nova wasp
#

I think to make this reasonable for them to make and reasonable to use they probably would need to have users get a separate "scene viewer" application thing

#

as I doubt they are putting in the effort to make their collision meshes visible in the editor (I still debug draw lines for my meshes from Jolt like a dingus but I spent a bit making a custom/unique wireframe draw at least)

#

Take what I say here with a grain of salt because I haven't used their product... this is more speaking as someone who does waste their time basically hollowing out the engine for no reason to make it all stuff I like (fixed ticking with Jolt physics, everything done in an ECS because I like it)

iron forge
# woeful ferry Sure, but if it comes to the cost of cutting out a big part of the engine's feat...

Yeah fair point, at the moment I'm putting together a demo and am currently thinking about platforms, if I decide it's playable on mobile I might even just remove physics completely, at which point Photon did seem like an easy(ish) drop in.

There have a been a few indie launches recently which have tanked in their steam reviews because they didn't properly plan for scaling they servers, so one publication posted a review, a few thousand extra people logged in and their game was unplayable.

That being said I can just use AWS/Lambda/Kubernetes to manage this kinda thing quite easily, knowing nothing about photon really though I thought it was worth checking.

#

Plus I do have some cool destructable stuff in mind that would need physics so classic networking is probably going to be better.

#

Thanks everyone!

nova wasp
#
Deterministic math library: FP (Fixed Point) type (Q48.16) to replace floats/doubles, FPVector2, FPVector3, FPMatrix, FPQuaternion, RNGSession, FPBounds2, and all extra math utils including safe casts, and parsers from native types.

Interesting... I haven't seen fixed point used in the wild before

#

that completely removes the need to reckon with floating point indeterminism (platforms don't all agree on how floating points work)

iron forge
#

Yeah I think a few of the comments here around Photon might not be quite doing it justice, when you watch them go through the live programming on youtube it looks like a pretty solid, well thought out product.

nova wasp
#

I am more concerned with how it actually works I guess... I think this looks awesome but the Unreal parts look pretty early on

#

Also very scary to have so few real-life examples of this being used besides some unity projects

iron forge
#

That lead programmer guy on there is very approachable by the way, you can just contact them - Albion online supported 350,000 concurrent players earlier this year on the previous version of Photon(unity) - thats the only one I found at any scale.

chrome bay
#

tbf, there aren't that many use cases for full determinism really

nova wasp
#

If you can pull it off and make up for some of the strange drawbacks

#

it can remove some complexity from having one holy code path

#

but MAN it is difficult and basically forces clients to be able to simulate an entire frame 10 times as fast as normal (and they can't skip simulating much either)

#

regular client server desyncs basically every frame... but if you fuck up and desync in a lockstep deterministic game you have no choice but to either drop the connection or basically send the entire game state with little compression

#

I think it's an awesome choice for games without floating point state that are willing to make the tooling required... it has a lot of fun properties

#

for example: replays are cheap as shit

#

The downsides are massive though:

  • you must make a balancing act choice between delaying input locally vs forcing more rollbacks/popping each frame the less delay you add
  • anything that pushes frametime for the game beyond msPerFrame/8 (the number of frames behind by ping etc) will basically hardlock the simulation and force a variety of bad situations to happen depending on what you promised to the other simulating clients
  • rollbacking things like sounds/visuals is... yeah.... Imagine accidentally playing a loud gunshot and rolling back, then playing it again
chrome bay
#

tbh, just for the kind of stuff I work on and being so long in the tooth with UE multiplayer, I've just grown used to it

nova wasp
#

yeah frankly I think it's a testament to simplicity in some ways with how many games kind of Just Work with the chaos that is unreal property replication multiplayer

#

There are a LOT of scuffed things that can be fought off but my general impression is moving towards something in the middle for most games

#

Basically life is easier if you can kind of make tiny atomic expressions of game state over the network

for example: If the height of something is controlled by a separate property, and you also send the state

#

you are basically risking those being sent on different frames, resulting in some funny situations

chrome bay
#

Yeah, but that's kind of what I mean - I've grown used to dealing with/working around that sort of thing. Though it is still a tripping point even for experienced UE devs

nova wasp
#

I find shit just works having a dumb "rep struct" that basically expresses the state of the object on its own... Anything that involves timing frame-by-frame is not reasonable to do over property replication without some fairly decent efforts into timestamping things

chrome bay
#

It also partly comes down to finding different ways to represent that state with as few variables as possible, not just for bandwidth reasons but also to avoid conflicts

nova wasp
#

For example... something like an animation that plays that needs to do something for a quick moment... you do not send that "moment" as a replicated property

you are basically praying it will show up with the same timing as the animation... Always just send the "start doing this at this point" and follow through on the sim proxy if it must be timed well...

nova wasp
#

It's honestly strange we can't make it easier to bundle properties to be replicated as tuples

#

that would save a LOT of fucked up situations where things show up in odd orders

cold cipher
#

how to store an actor pointer from client that point to the server machine self?
or as an alternative get their replicated actor on server machine and store it as pointer

nova wasp
#

replcated actors already do this for you assuming you spawned them on the authority with replication enabled

glad escarp
dark parcel
#

I see no reason to use int to tag things that needs to be activated

#

oh well, I don't really know your use case

#

if it work for you then good

glad escarp
#

Well it's not working for the client so if that's the reason, I'm open to any suggestions. I'm not sure how I'd go about getting a reference to them though, other than giving the keypad actor an array of actors and exposing that var so I can "eyedropper" select them in the editor

dark parcel
#

activation should be done on server

#

the server can then send signal to client that things has been activated.

#

can be done by listening to variable change (rep notify)

glad escarp
dark parcel
#

activation on client doesn't necessarily have to mean anything. Your job is to just sync the world, you don't need to any unnecessary data.

#

For example when opening a door, for client. The door being "activated" or not is irrelevant, only the the state in the server matters.

#

Server can handle opening or closing

#

while client only receive information in a form of the door's position

glad escarp
dark parcel
#

@glad escarp I think in a nutshell you have to think what information the client need to give illusion that the world are in sync between different machine.

little pumice
#

Illusion driven development Ratge

glad escarp
dark parcel
#

if you get what I mean

glad escarp
upbeat basin
#

I think I have the perfect example for this for the door mechanics. We're just replicating the door's open/close state and the server time of the last state change. Client's are moving/rotating the door locally according to that data. So if a door that opened ages ago gets relevant freshly on a client, it's being shown directly as open instead of playing the opening animation

#

Weird to say this but I love using timestamps for this kind of stuff

dark parcel
#

As Client : Server RPC -> Enter Code
On Server-> Checks code, if true, set lock color variable to green

Client On Rep -> Set Color

upbeat basin
#

Or like using the server end time of the skills cooldown as the replicated variable instead of a bool

glad escarp
# dark parcel As Client : Server RPC -> Enter Code On Server-> Checks code, if true, set lock ...

Probably hard to tell from the spaghetti code image I posted above but that's essentially what I'm doing. I send the code to the various receiver actors, using a server RPC but I'm relaying on the ID var being set to fire a server RPC. I'm gonna try getting a ref to the actors like you suggested so I can bypass the ID thing and just change the door open bool which has an OnRepNotify to open the door (which is used flawlessly with the regular interact interface)

glad escarp
#

I think my brain is finaly adapting to this whole OnRepNotify methodology

glad escarp
dark parcel
#

should make sense in paper first before implementing

glad escarp
#

Now I get the super fun task of revamping all the systems I've incorrectly created to this point. ๐Ÿ˜‰

#

But it's nice to know that something is working as it should rather than just that I happened to hack a solution that may or may not work depending on circumstances.

dark parcel
#

it's like eye opener when the basic stuff clicked

glad escarp
# dark parcel takes a while for things to click for me too

Yeah and my problem is that I'm a very hands-on/visual learner. So reading documentation doesn't work for me as a learning tool. Documentation reinforces practical stuff I've learned and explains to me why it works but it just goes over my head until I've seen an implementation.

Which unfortunately annoys alot of coders when I ask questions because I think they think I'm just bing lazy and want the work done for me.

thin stratus
glad escarp
thin stratus
#

I only witnessed this in cases where the user refused to follow the provided information and repeatedly asked for having their actual problem being solved for them.

glad escarp
#

Haha well that's just obvious laziness

thin stratus
#

As in actually code the solution. But not when asking for generic examples, fwiw in pseudo code

#

Unless you go around on StackOverflow

#

There you probably need to know the solution to your question

glad escarp
rustic peak
#

How to setup Multiplayer for VR
Hey devs
I am new to Unreal and multiplayer in Unreal, but am experienced in Unity, C#, and C++. I am creating a multiplayer game for VR, and I am confused about whether to use a dedicated server or a third-party app like the Photon server.

I want to make a drag and drop app for users where one user creates the room and other join with the name and password, I have experience using photon with Unity and wanted to use that but after finding that it only has realtime SDK for Unreal, which is responsible for Session creation, joining and not much replication, where we need to do replication on our own, I step back, and when was researching I found approx everyone are using Unreal's default multiplayer mechanism, but to setup that with C++ so I can implement custom logic, it is giving me hard time bcz I am using null subsystem right now for local testing, but could not make it work as there is no player id there and my command returns when it could not find that.

So I am again back to wandering which sdk or server to use, that are easy to setup, scalable and less pricy. and has documentation to follow through. Can you please suggest me some good methods that I can do and docs to learn
Thanks

cold cipher
#

and the multicast event seemed to can't read the parameter replicated

raven plaza
#

Hey does anyone know how to not have Replicate Movement force the client position?

cold cipher
#

turn it off
I think client movement is already replicated anyways?

raven plaza
silent valley
#

In a multiplayer game, if a player is killed due to Kill Z when falling out the world, how do I respawn them?

raven plaza
#

Does anyone know why my Add Movement Input doesn't move the player on the server but does client side?

#

(I have verified that the Move Right Axis Value gets sent correctly and that the direction is correct as well)

umbral tangle
#

Only servers can call multicast RPCs

#

The client needs to tell the server to tell everyone to move

raven plaza
sinful tree
# raven plaza so like this?

Add Movement Input is normally called on the client side. If your class is based off of Character, all you should need to do is call Add Movement Input from the input you're using, pass in the vector calculation you have, and feed in the scale value from the input event.

raven plaza
#

The reason I'm trying to do it like this is because I'm having horrible rubberbanding on my clients, as the server tries to force them into their "correct" position whenever they try to move

sinful tree
#

That's probably because you're fighting against the Character Movement Component with other movements you may be doing. The CMC has built in client-prediction and server correction, so your client gets quick responses when they move, but if they move in a way that the server isn't expecting, you get a correction that adjusts the position of the character -- the rubberbanding you are seeing. So any movements outside of what the CMC is doing can cause a correction, whether on the client or on the server.

If you're using the CMC and only performing moves on the server, then you can't really use the "Add Movement Input" node. You'd have to RPC the values from the client to the server (like the world direction & scale), and then the server would need to calculate and set the desired new location of the actor based on those values. The problem with this is that players would have to wait the round trip time of their ping in order to get any response from their controls... So even someone with 100 ping to the server will feel more like 200ms before they get any response, and it only gets worse with higher ping.

raven plaza
#

Ah that makes sense! Thanks so much for your explanation!

#

Since my game is a 2D platformer, its very important that ping is very low for the clients. Although, in my game clients wont really interact with each other at all, so is it possible to perhaps skip this correction from the CMC completely and give the clients full authorization over their movement? (Basically making the clients free from the servers control in regards to movement)

sinful tree
#

You can, there is a setting on the CMC for ignoring corrections and another for client authoritative movement. The risk with this is that someone with a little bit of know-how could then potentially make their character teleport anywhere in the map. If it's not a competitive game, then it may not be that big of a deal.

That said, what's the point in having your game multiplayer if the players can't interact? Is there a specific type of game that you're trying to mimic for a multiplayer system? There may be a better solution than Unreal's built-in networking for such a game.

raven plaza
# sinful tree You can, there is a setting on the CMC for ignoring corrections and another for ...

My game is primarily a single player game but there's an option to invite friends to play through the story cooperatively. The player uses a gun to shoot things (so bullets will need to be synced between clients) but players wont be able to shoot each other, since its not a competitive game at all. The method for playing together I'm going for is similar to dark souls where you can summon a player which joins "your world", i.e. you only make progress on the host's session and not on the client players'.

sinful tree
#

Ah ok, so that kind of game would probably be good with Unreal's networking. So then it's just a matter if you're willing to allow client authoritative movement or not. Technically speaking, the host would always be able to teleport around as they are the host, so having a client have authority over their movement would be no different than what the host can do.

#

These are the settings you can find when you have the CMC selected.

raven plaza
raven plaza
raven plaza
feral narwhal
#

Quick question, if I have an array of vectors will changing a value in it trigger a repnotify event?

dark parcel
hoary spear
#

(Clients, and server if you call it as a normal function )

#

I thought bp had that weird thing where you need to use SetArray to trigger it

feral narwhal
exotic wasp
#

unless you use fast array replication, I believe the entire array gets replicated every time there's a change

dark parcel
#

I'm not using fast array, have an array of structs.

Everyone always get the same value eventually.

#

@feral narwhal maybe show what you have so others can take a look

feral narwhal
#

I am calling this from the gamemode every time I add a new spline point.

#

I am trying to create a spline that is replicated during runtime

exotic wasp
#

what do you mean by "one change only"?

feral narwhal
#

As in the repnotify string gets displayed once only for the client

exotic wasp
#

i believe that is intended

feral narwhal
#

I call this at least 3 times

exotic wasp
#

all of the changes are going to get packaged into one replication iirc

feral narwhal
#

oh

#

that would make sense

#

I thought each change was seperate

exotic wasp
#

are the values getting printed what you expect?

feral narwhal
#

let me test

dark parcel
feral narwhal
#

yeah okay I just tested and they're all received in one repnotify

exotic wasp
#

property replication gets checked each tick

grizzled garnet
#

I stumbled upon this by chance while searching for research on network prediction

lost inlet
#

kinda, but not really, Mover does use it though

#

not sure what the "or is it just required for replication" bit is getting at though

grizzled garnet
#

Can't find the documentation now but I saw on the official docs a page explaining how relevancy works, I believe theres some way to set the radius which an actor is considered relevant or you could turn on always relevant

sinful tree
#

Net Cull Distance needs to be the squared distance you want to use.... So if you want the object to be relevant within 10000 units, you'd need to have the NetCullDistance set to 100000000

#

Are you perhaps moving a component of the actor rather than moving the actor?

glad escarp
#

Hey guys, any idea why this clamp would give me different results on the client vs. the server player? This server RPC is being called on my look input btw. It's setting the rotation for my character's helmet light.

#

If the clamp is taken out and I just use the GetBaseAimRotation Pitch, it works fine.

#

It's like the transform of the flashlight on the client player character is somehow different than that of the server player character....

dark edge
#

assuming Base Aim Rotation is in a good state on server then just do that work on tick

#

you're basically spamming at the server "UPDATE THE FLASHLIGHT ROTATION" and it's like "geeze i know calm down, I could just be doing this on tick."

glad escarp
dark edge
#

What's your goal, just to have a flashlight pointing the same direction on all machines, and clamped to those pitches?

glad escarp
#

Sorry, it pitches up or down too far is what I meant.

dark edge
glad escarp
#

Yeah that's working great. I guess the server RPC was messing it up. Thanks for the fix. Does this work because the Get Base Aim Rotation AND the Flashlight are replicated?

dark edge
#

setting ControlRotation clientside affects that replicated pitch

#

so the local client is using their ControlRotation, and everyone else is using that replicated compressed pitch. It's a holdover from the old Unreal days probably

#

Note it's just pitch I think, you won't get yaw or roll as they are assumed to be from your capsule for Character

glad escarp
#

Which makes sense since it would be rare to pitch your player capsule but you might want to pitch individual components.

glad escarp
gritty warren
#

Is there any way to force an OnRep to fire when a variable is set, even if it is set to the same thing?

gritty warren
#

C++

#

Do I just mark dirty?

sinful tree
#

Beat me to it ๐Ÿ˜›

gritty warren
#

thanks!

#

where do I place this?

#

perfect, you read my mind

burnt coral
#
bool AGameCharacter::ServerEquipWeapon_Validate()
{
    
    return true;
}```

What does this function do specifically? Is it to check if the player isn't cheating? Or is it a verification that the server has done something correctly, before replicating it down to the client?
sinful tree
#

_Validate() calls are automatically executed when the server receives the associated RPC from a client. If you make the function return false the server will automatically kick the client.

burnt coral
sinful tree
#

You'd use it to validate whether or not it was a valid RPC for a client to be calling and validate any values that are incoming and automatically kick players if something isn't as expected by returning false. The logic for how you validate is up to you.

#

It's not something mandatory to use, but it is used as an anti-cheat measure by some.

#

An example.... Maybe you want to allow a client to send an RPC only once when they are joining the match during a Begin Play, but never again during regular gameplay, and you don't have any code yourself that under normal circumstances would allow a client to manually call that RPC. You can then have some kind of bool that gets set true when it's called the first time, and if the RPC is called a second time, you know that something is afoot as you don't have any code in place that would normally allow that RPC to be sent again from a client. So then you'd check in the Validate() if that bool was set true, and if so, then you can make this Validate function return false so that it boots them out of the game. You may want to do other things like logging or whatever disciplinary actions (like maybe a 1 time warning? notifying some external system of a player potentially cheating? whatever you like) before returning false

burnt coral
#

Thanks for the information! I appreciate the help.

queen escarp
#

or on all ofc, but i cant get it to work

#

what am i missing

#

solved it * lel

honest bloom
#

Does someone understand what makes the MoverComponent move the UpdatedComponent ?
I've been trying to make my own MovementMode mode that makes my spawned Projectile via RPC move constantly forward .. but for some reason .. when its the server who spawn the bullet .. the thing moves .. but when its the client who spawns the bullet via ServerRPC .. it stucks at its spawn position in BOTH server and client ..

thin stratus
honest bloom
thin stratus
# honest bloom yes

The MoverComponent moves the UpdatedComponent via TrySafeMoveUpdatedComponent inside a given SimulationTick function.
can't remember the exact naming. SimulatedTick could also be the function name.

#

In the traditional "Client controls the Actor" scenario, the Client would provide all Client-only information to the Server by implementing the ProduceInput function.
Both would then run GenerateMove on the current MoverMode and use the generated move (or ProposedMove) in SimulatedTick to move the UpdatedComponent.

#

FinalizeFrame would then be used on SimulatedProxies to update the UpdatedComponent to match the SyncState.

#

If it's a Server-owned Actor, like a Projectile, then the ProduceInput part would be skipped and GenerateMove would figure out the Velocity based on other things.

#

Only on the Server then of course. All Client would then only updated to the Interpolated version of the SyncState in FinalizeFrame.

cold cipher
#

how to make an actor that's spawned on server invisible to only the actor that spawned it's controller?

honest bloom
#

Yup, that's how I'm doing it .. but still things doesn't work well when its the client who sends spawn the bullet via server RPC
I guess, according to what you said .. my problem is with the FinalizeFrame part of the code

thin stratus
#

Could be yeah.

#

The code is a bit funky in the native version and has a comment on it from Epic

#

But it basically checks if the UpdatedComponent and teh SyncState are different and if so sync them

#

Which Server and AuthProxy would never need to

honest bloom
#

Alright, I guess I have now a clue where to dig.
Thx !

thin stratus
cold cipher
#

didn't but I can
and then how?

twin vessel
#

I have a 'weapon slot system', which keeps track of different properties for each slot that can hold and use a weapon (right hand, left hand, ...)

Right now i'm using multiple replicated arrays on a component, and i just know that at the same index of each array there is the property of the same slot.

I was wondering whether would be better to use a single replicated array of replicated UObjects which would hold all the properties for each slot.

For sure readability wise it would help, but i'm concerned about the bandwidth cost. What would you suggest?

cold cipher
thin stratus
#

PlayerController of Client-1 is null on Client-2, Client-3, etc. ,but valid on the Server.

#

Server basically has all PCs

#

Clients only their own.

cold cipher
#

actor, run on server
I somehow succeeded in making it go invisible, along with the client prediction projectile by running a run on owning client function on the bullet

#

but then client can't see the server bullet as well

cold cipher
# thin stratus Where is the RPC being called in?

the client first spawns a client predict projectile that does nothing
the client call a custom event that's run on server
the server spawns the projectile
now I want the only the client to not see the projecitle

and the projectile I wanted to hide is simulated proxy on yourself if shot from a client (replicated from the server projectile) so can't differentiate it this way

thin stratus
cold cipher
#

character

thin stratus
#

Right, so then you don't need to pass the Controller via the RPC.

#

Because the Server version of the Character also has that Controller.

#

You can pass the Controller as the Owner.
And the Character (self/this) as the Instigator.

#

Both on the SpawnActor node.

#

In BeginPlay of the Projectile you can then check either of them for being Valid and for either "IsLocalPlayerController" or "IsLocallyControlled".

cold cipher
#

character on client or server as the instigator?

thin stratus
#

You spawn on the Server inside the Character or not?

#

So just "self"

#

In theory Owner and Instigator should be valid on BeginPlay, unless Epic sets them after actually spawneing. If that's the case and you aren't using C++, you'd probably be better of making your own "ProjectileInstigator" variable on the Projectile, marking it as "RepNotify" and "Exposed on Spawn" and supplying the Pawn/Character (self) to that.

#

Then use the "OnRep" function in the Projectile, and fwiw BeginPlay too in case of Race Conditions, to check if the ProjectileInstigator is Valid and IsLocallyControlled.

#

If both are true, you are on the local player and can hide it.

cold cipher
#

okay, will try it

honest bloom
#

ok so here is the culprit .. I forgot to check the log
Interpolation out of sync. We don't have valid frames for this time for this sim. Frame 0. TimeMS: 38233. @ 52855

#

not sure what that actually means .. but I'll keep trying things till I understand

twin vessel
#

Someone familiar with unreal tournament's code can tell me how firing is notified to other clients?

visual urchin
#

I'm having a problem where if I test the game using Standalone, the game will freeze or it won't be able to change the level. I haven't seen any information about this anywhere.

normal fulcrum
visual urchin
#

At the very beginning. It will open up this window and will remain black. I can't even move the window or close it by pressing the [X] in the top right corner. The only way to close it is by clicking in the editor, press on the three dots and change the mode to Play in viewport. That will close the window and proceed to play in the editor fine.

#

@normal fulcrum
Edit: Decided to let it play and it looks like it's just taking a bunch of time loading. Right now it says that it's preparing shaders (over 13k).
I hope this won't affect properly when playing multiplayer, which I just realized I posted in the wrong channel. Sorry!

normal fulcrum
honest bloom
# thin stratus Only on the Server then of course. All Client would then only updated to the Int...

Ok so, I confirm what you said .. but this is the case when using "Fixed" ticking policy
Basically my code was working perfectly when I switched the policy to "Fixed" without changes
However, things doesn't work .. only when the client sends a server RPC if I change the policy to Independent.
Since Independent seems to work much smoother for my game .. I think I'm gonna try to read about it more and understand how it works in order to use it instead.

thin stratus
#

You can start there to figure out what calls

#

And then you have the Service_xyz.inl files for the different services that have Fixed and Independent versions

honest bloom
#

Alright, I'll start there.
Thx again !

chrome bay
#

You will never escape it Cedric

lean tide
#

when sending unreliable RPC's, is it common practice to include some sort of timestamp in the data struct so that whoever receives it (usually server) can put the data in order if some network abnormality causes the data to be received out of order?

specific use case: replicating transforms as often as is practical. more specifically, replicating SKM pose in VR body tracking melee/projectile combat. only specific transforms will be replicated, the rest will be done by local IK. I will use simple lerp, and eventually use snapshot lerp to validate hits.

#

in the end, I probably need to experiment with various simulated network conditions to answer this. if packets are arriving out of order, that might indicate bandwidth saturation, which I'm guessing should be addressed first, and adding a timestamp won't help that lol.

on the flip side, timestamps are useful for performing snapshot interp for hit validation... ๐Ÿค” I will not be implementing nor using simulated proxy prediction, so no velocity data needs to be transferred.

regardless, I still think unreliable RPC's may be better for this. if I'm not mistaken, reliable RPC's use TCP instead of UDP?

summer tide
#

Can you replicate activation and deactivation of brain component in controller or character class?

chrome bay
#

@lean tide all RPC's besides unreliable multicasts are ordered, so long as they are channeled via the same actor

#

And all communication is UDP

glad escarp
#

Hey all. Another quick noob question for y'all: Which class should I do my SetBaseSoundMix on and is that the same class I should be doing most of my player persistant variables as well?

glacial bay
#

Hello Hello! I am looking to see if there is an individual who will spend a few minutes with me, as I need to ask a series of architectural questions around dedicated server design within Unreal Engine 5.

Architecture, Solution/Project structure and some general design concerns.

Does anyone have extensive knowledge in that space?

thin stratus
#

Luckily you know as much about it as I do, in theory. I'll just redirect them to you.

#

Maybe I can get Lewis to make an account here and waste his free time.

#

Hm hm hm.

thin stratus
#

Dedicated Servers aren't anything super special. You usually get the Source Engine so you can build them and that's kinda it. Code wise you just make sure nothing plays on the server visual etc that doesn't need to.
Solution and Project remain the same.

glacial bay
#

My core issues is understanding how to architecture systems that are server-side only. I understand the preprocessor definitions but UE Macros can not live within the body of a preprocessor block which fine, I get it. However, it seems the only way to have isolated implementations is to build a server-only modules, there is no way to do that natively

normal fulcrum
lost inlet
#

WITH_SERVER_CODE is 1 for game target

#

And how isn't a server only module a native way of doing something?

normal fulcrum
quasi tide
glacial bay
#

There are various classes, objects, structs, etc that I want are dedicated server specific. If with preprocessor definitions UE_SERVER / etc, there is still some sort of footprint client side.

Is there no way to have custom objects / classes that are server specific without wrapping the guts with a preprocessor?

There is no way to have clear abstraction between server and client?

lament flax
#

i thought networking was hard, but damn EOS is another level

#

its high modularity and seperation of systems makes it difficult to naviguate

sinful tree
glacial bay
lost inlet
glacial bay
#

Yes, I was hoping that maybe there was an approach I was missing, trying to avoid the module approach

lost inlet
#

Why?

glacial bay
#

My question(s) were more about understanding what the best approach is. If going the server only module route being the only or correct way, that is what matters to me.

cerulean tangle
#

Can anyone share a more or less extensive list of best practices on lightweighting and optimizing the CMC for the most basic XY movement? The setup: isometric high speed hack'n'slash gameplay with RootMotionSource-based evade/dash moves, no physics (or as less as possible), capsules are used only as a retainers for obstacles, not pushing or similar actrions

#

The target experience - Windblown style gameplay with zero resyncs

pastel escarp
#

Getting lots of correction majority of time when I use Lyra (dash, jump, normal moving with rotation) basically I get this in a fresh lyra project, any idea why ?

misty rose
#

Iโ€™m replicating an actor with a spline mesh component. Thereโ€™s a listen server and remote clients. Spline points are added dynamically. Any connected clients and the server will see the dynamically added spline points as intended. However, late joiners will not receive the previous spline points. (All other actor properties replicate as intended for late joiners.)

Iโ€™m implementing a workaround since further reading seems to indicate spline components are not meant to replicate? It is strange that it works fine with currently connected clients, however.

If anyone has further insight, it would be greatly appreciated! Cheers

nova wasp
dark edge
#

Could be that the points are not replicated but the act of adding them is

#

you probably want some sort of onrep here if spline points themselves cannot do that, IDK if they do or not.

misty rose
# dark edge how are they added?

With AddPoint at runtime. The base function, not any RPC I made.

I think youโ€™re right though. โ€œAddingโ€ is likely replicated. I plan to add my own functionality to duplicate the points locally for late joiners.

dark edge
#

you just need some code to add/remove/modify points in the spline to match the replicated data and you're all good

nova wasp
#

What about the spline mesh exactly needs to replicate?

#

Does it move the points? or just add points at x times along a stationary spline?

#

But yeah... Just use a fast array or regular array if it's small enough

dark edge
#

On that topic, is subclassing to add replication a possibility?

#

I've never done it, but say there was some engine class with some property, can a subclass "enable" replication + repnotify on that property?

nova wasp
#

you can use macros to change the replication settings of parent rep properties

#

like DISABLE_REPLICATED_PRIVATE_PROPERTY

#

I don't know if DOREPLIFETIME_CONDITION_NOTIFY will add a repnotify for a member that didn't have one before

#

It's almost certainly easier to disable the parent and then make your own

#

If you want to change what it replicates

#

then just hook up what the parent does into your new one

#

But not everything is so simple... this is doable for some things but not others

dark edge
nova wasp
#

I would say the amount of data here is quite small so it would be less hard to just add a replicated array of points

nova wasp
#

why the spline points are there is nobody's business

dark edge
#

Are you talking about subclassing or making a parallel class that does the same thing

nova wasp
#

I mean subclassing here

dark edge
#

ah yeah and just duplicating the data and using the onrep to shovel it in the original data

#

that'd work in a pinch

nova wasp
#

It would be arguably possible to just make a separate component that expects a passed in spline component for it to manage the points of

misty rose
nova wasp
#

But it's all arbitrary... the real thing here is to have a replicated actor (or comp) property that has the points on it and onreps changing something

#

It doesn't really matter what it's on.... It just has to make sure it applies it to a specific spline component

dark edge
#

Yeah I'd do that first

misty rose
#

I have a lot of other functionality in the same actor, so a quick onrep_notify seems the best path. Another project, perhaps, Iโ€™d try subclassing. However, feels like a spline compโ€™s point data should just replicate like other properties marked for replication. The checkbox for โ€œComponent Replicatesโ€ (I forget the exact wording) seems useless.

pastel escarp
#

and this dsnt happen in a fresh ue project at all

#

only happens in my current lyra and a fresh lyra

#

i used both lyras, marketplace and latest source

#

I wonder i to package the game and test in shipping, if this would happen or not

dark edge
hoary spear
#

It means the compoments properties should be considered for replication, right ?

#

You can have hundrer rep variables in a comp, but if its not marked 'Component replicates' they will never replicate

dark edge
#

Yeah, and if the component is marked as replicating but the inner properties aren't then it doesn't help much

hoary spear
#

Indeed indeed

#

It is weird to me that the essentials of a spline isnt replicated tho ๐Ÿ˜…

#

Would be like the actual mesh in a StaticMeshComponent wasnt replicated

#

SplineCurves are replicated ๐Ÿค”

thin stratus
latent heart
#

You could always #if WITH_SERVER_CODE && !WITH_CLIENT_CODE etc. (or whatever the defs are) and define everything 3 times ๐Ÿ˜„

lost inlet
#

well the && !UE_CLIENT part is pretty redundant

latent heart
#

I'm assuming different code for dedicated servers, listen servers and clients.

dark edge
#

it can only have 2 points, not much of a spline there. The spline data itself should be replicated, not the spline mesh component(s)

lost inlet
#

UE_SERVER is only 1 for dedicated servers
WITH_SERVER_CODE is 1 for game and server targets, 0 for dedicated client

latent heart
#

Ah okay!

#

Fixed. Thanks!

lost inlet
#

the only thing I've put in a server module is stuff that is dedicated server only, which isn't really gameplay

#

it'll be things like backend

steel gust
#

Are gamemode subsystems owned by the client or server?
I am starting to think that its owned by the server,
which means if a client calls a UFUNCTION(Server, Reliable) its going to get dropped because you dont own the subsystem as a client?

lost inlet
#

gamemode subsystems?

steel gust
#

Sorry I mean UGameInstanceSubsystem

#

Also is there away to check in visual studio during debugging if your inside the server or a client?

hoary spear
#

GameInstance is per instance... client has one, server has one

lost inlet
#

in addition, they're not replicated

steel gust
#

Oh fricc so you cant rep from a client UGameInstanceSubsystem to a Server one

#

That would make a lot of sense

#

I need to find a better subsystem type then

lost inlet
#

well none of them are replicated

steel gust
#

oh hmm

lost inlet
#

but at least with a world one you could spawn a proxy actor or something

steel gust
#

That is annoying

#

So theres no way to call a function from a client subsystem to a server subsystem, correct?

lost inlet
#

no? because who would own it?

steel gust
#

I assumed it would work in relation to what owns it

lost inlet
#

in relation to what? not sure I understand

#

for a Server RPC to work, it needs to be owned by the player that's calling it

steel gust
#

I thought things like controller owned the local player controller subsystem

#

gameinstance owned UGameInstanceSubsystem etc

dark edge
#

subsystems don't replicate so the concept of ownership doesn't make much sense in this context

summer tide
#

How do you replicate toggling on/off of brain comp blackboard comp, behave tree comp?

steel gust
#

Gotcha

lost inlet
#

well there aren't "local player controller subsystems", there's local player subsystems

dark edge
steel gust
#

Ah thought you needed a controller to access them?

lost inlet
#

no, they're owned by the ULocalPlayer

#

you get a notification when the player controller changes

lost inlet
steel gust
#

Ah okay gotcha

#

Guess il make a proxy network actor

lost inlet
#

well even a proxy actor isn't going to do much in your case if you want Server RPCs

steel gust
#

I cant go client subsystem -> proxy actor -> RPC to server -> Server subsystem?

quasi tide
#

The answer is going to be the same

dark edge
lost inlet
steel gust
#

Well it would be spawned by the server

lost inlet
#

probably would just create an actor component to put on the PC tbh

steel gust
#

That might be a good idea

dark edge
#

So at this juncture, what's the advantage a worldsubsystem has over a component on gamestate?

lost inlet
#

the auto-initialisation is pretty much the only thing

#

but hey, GFPs can also inject components if you do the setup

quasi tide
#

More easy global access as well

dark edge
#

I do like the access and auto initialisation

#

I haven't attempted to do any networking with the subsystem version of my plugin but I'll have to soon

quasi tide
#

But, it would be a very tiny benefit imo (the easier global access that is)

dark edge
steel gust
lost inlet
#

well if you use seamless travel, anything that's in the seamless travel list, anything else, not really other than things that have a longer lifecycle than the world

#

but everything in unreal replicates within the context of an actor

dark edge
#

When I want to make a new one I literally just copy paste the closest similar file, rename, replace the guts, and done.

#

If I were to use UObjects instead is there a way to query at runtime for classes to instantiate?

#

Like instead of a manager subsystem + tons of other subsystems that automagically get instantiated, a manager subsystem/component + tons of uobjects that get instantiated.

#

not really tons but probably about 50

meager heart
#

General question for replication:

  • So if I'm understanding things right, typically the same logic will fire on both the server AND the client most of the time, but just in specific circumstances we differentiate between the two, is that correct?
  • So lets say for initialization logic on an autonomous proxy player character, typically the logic will fire on both the client and the server independently, except for specific times when initializing UI and stuff right?
feral narwhal
#

Is there a way to get all the currently connected player controllers / player states? I cant use the traditional add to array method when a player joins / leaves because I am using seamless travel.

lost inlet
#

well that sounds like reinventing the PlayerArray

feral narwhal
lost inlet
#

yes, on the GS

feral narwhal
#

does it not exist on the GM

lost inlet
#

not sure how that would be a problem since you can trivially get the GS from the GM

feral narwhal
#

I am just trying to understand how it works because lets say I have some data like NumberOfPlayersAlive that I need to determine how the game mode logic will work. Will the player array update everytime a player loads or will it already have all the players from the previous map?

#

Usually it wouldnt matter but I am trying to carry over the number of players alive from map to map

queen escarp
#

hi, having an issue, this is fore a "buff" so when the client use ability apply buff on players in range

#

it works for server(listen) with self+ clients

#

but on clients it only works on self

dark edge
#

what's missing

queen escarp
#

well the starting part works* so just to short it down really

dark edge
#

Need to see the whole path from input to there

#

probably missing the run on server event though

sinful tree
#

Looks like the trace would only be happening on the client. You can't call RPCs on actors (or components) that aren't owned by the client.

queen escarp
sinful tree
#

Yea on the client only.

queen escarp
#

but you men its opnly hitting on clientside

dark edge
queen escarp
#

hmm

sinful tree
#

But then you're trying to call RPCs on their components.

queen escarp
#

ah gotcha, and tracing serverside is dumb ?

dark edge
sinful tree
#

Tracing serverside would make the most sense.... Otherwise you could have a client tell the server anyone in the game got the buff.

dark edge
#

the message your client should tell the server is "I pressed this button"

queen escarp
#

Montage server is only Rpcing the montage

#

yeah lol just by playing the tracing from server everything works

#

noice ๐Ÿ˜‰

#

makes sense tho

#

ty

twin vessel
#

In short:
when i create a default sub object in constructor, is the object created the same in client and server?

My problem:
i have a class inheriting from UObject (setup to be used as replicated object), and have a component with a non replicated pointer to an object of that class.
If i then assign that pointer in the constructor by creating a default sub object, and add that object to the replicated sub object list, would the sub object replicate properties fine?

I'm asking cause i did not have time to investigate, but it seems that the properties on the sub object are not replicating, and i was wandering if it was because the clients were actually pointing to their own instance of the sub object instead of the one the server is using

sinful tree
#

Yea that sounds like you're probably creating separate instances. The variable would only contain a reference to the locally created object.

twin vessel
#

But then why are components shared? (Are they not?)
I probably am misunderstanding the whole default sub object thing

sinful tree
#

If you spawn a component on the server at runtime and want to access it on a client you can mark it as replicated in which case it can replicate to the client, but the client still needs some way of referencing that object once spawned. Just because you may spawn that same component on the client side doesn't mean that it is the same object across the network.

https://ikrima.dev/ue4guide/networking/network-replication/general-replication/

#

Based on this, you need to make sure the object is named the same on both the server and client (so you have to have some deterministic way of naming the object) and override IsNameStableForNetworking() to return true, then you can set a non-replicated reference on either side and it should refer to the correct object across the network.

summer tide
#

How do you replicate toggling on/off a character movement component?

red musk
#

Anyone have a recommendation for how to know when game state has replicated down to a client?

dark edge
red musk
#

I guess game state in general?

red musk
#

I understand all the networking stuff in that capacity

#

But game state itself isn't on something as a rep notified element is it?

#

I am not talking about a variable on game state

#

I am talking about the game state itself

dark edge
#

begin play

red musk
#

I need other things to be aware of it being valid on the client - best way I could think of was basically having game state on its begin play manually raise an event on something guaranteed to be valid on the client, like game instance

#

But that felt sorta derpy

#

So was curious if there was something already provided in some capacity that could be use to key into when the game state replicates

dark edge
#

there might be a replicated ref to gamestate with an onrep somewhere

red musk
#

Yeah thats what I was curious about

dark parcel
#

Lyra would make some sort of macro that just keep looping with wait till next tick until the object is valid

warm sparrow
#

in the network latency settings, is the units in ms? i wanna make sure its not unrealistically high when testing

#

even with the longest distances the latency wouldnt be higher than around 250ms in real world right?

sinful tree
#

300+ is still possible even over high speed links.

warm sparrow
#

i always enable reliable on events that have vital information so i assume with packet loss the network protocol will have those packets sent repeatedly until its received

short arrow
#

I wouldn't even bother making sure a multiplayer game worked okay with anything past 250ms

#

you'll be fine

bright summit
#

what about units? because this wasn't answered and I am curious too

#

I have settings like this for emulation, and GetPingInMilliseconds() shows me about 200-230ms ping

#

those are captioned as "average" conditions but I think +200ms ping is BAD network conditions, isn't it?

#

are those good for testing or should I set something other? At the moment my movement is corrected sparsely by server but it still happens

short arrow
#

packet loss is also important though

#

gotta make sure those packets are getting through

#

I honestly would not bother trying to make your game playable past 250ms, It's gonna end up being a horrible experience for both players who are and aren't lagging, or players who are lagging somehow gain an advantage

bright summit
short arrow
#

if it's a friendly co-op listen server game, I honestly would let movement be client authoritive

#

I'd make as much as I possibly could be client authoritive

#

someone with 300 ping would be able to play just fine at that point

bright summit
#

I know what you mean but I don't know if I would do something competitive in the future in this game. But if I remember correctly for make client-auth movement it is one checkbox?

short arrow
#

sort of

#

cmc is weird I doubt it's just one single checkbox

#

but it's important to remember that if it's a listen server game, all bets are pretty much out the window anyway for any serious competitive game

#

the host would have the ultimate advantage of 0 ping, and cheats if they wanted to

#

it's up to you as the developer to find the appropriate balance of non hackable (server authoritive), and client authoritive events which rely on anticheat

#

people often forget that anticheat serves a large purpose in the battle of lag compensation. A good anti cheat would mean people can't abuse client authoritive functions, ofcourse that's way easier to say then to actually apply it

bright summit
#

you have given me food for thought

sinful tree
# warm sparrow so if the game still works with 500 delay and 40% packet loss is it safe to say ...

Even 1% continuous packet loss is really bad and is not the norm for the majority of connections and is something effectively completely out of your control and is a problem on their end, not yours. All you can do on your end is try to make your systems so that packet loss doesn't completely break things and can potentially recover from it as gracefully as possible. As far as ping goes, there's only so much you can do about it as well, and usually it's more about the player experience than it is about the actual ping being a problem. There's no way you're going to support someone with continuous 500+ ping without the game feeling like crap for them in some way. I agree with Moxie, and realistically 250ms is probably the highest I'd test against as 250ms ping is like what a 56k modem would play with back in 1997, but I imagine there are still some people using dialup.

thin stratus
#

40% Packet Loss. Might as well kick that Player.

dark parcel
#

someone didn't play dota 2. 1% packet lost is unplayable

thin stratus
#

I always treat package loss as something that will happen and if it does happen it shouldn't lock up the game. Despite that, any visual problems it causes are unfixable in most cases.
When testing we always have it at 0% and 250ms ping is also quite high. Ping is just a delay after all so it doesn't really matter for games where players don't interact with each other. It won't ever break anything. Just doesn't feel nice.

#

In theory, a predicted client that doesn't interact with other clients can play on any ping.

#

Very naive theory of course

sinful tree
#

I had some sporadic 1-4% packet loss on my old cable internet connection trying to play some Black Desert Online.... Take 5 steps, game would force a reposition which in that game would give a mini-loading screen. Super frustrating.

thin stratus
#

That all said there are ways and systems to help with occasional package loss

#

NPP for example sends the last x InputCmds to the Server and the Server actually buffers a few InputCmds before starting to process them.

#

That way, if one is dropped, it will be part of the next batch

kind star
#

What is a 'good' approach to sending gameplay notifications between level-based actors in a multiplayer environment?

E.g.

  • A switch for a door on the other side of the map?
  • A 'boss' ability that can trigger a pillar to crumble or start shooting lazers at players

My initial idea was to use a 'get all actors of type' with some additional tags, but that seems very performance intensive and not ideal.

Ideally looking for something that doesn't rely on the specific level (no level BP usage)

hoary spear
#

GameplayMessageRouter

kind star
# hoary spear GameplayMessageRouter

Ooo wow! Didn't know this existed! Looks perfect! Basically a sub-pub system?

This feels similar to event dispatchers basically? What's the key use-case differentiation between them?

hoary spear
#

I believe its just using dispatchers internally, with some tiny routing logic and subscription list

#

Its just way more generic than how one would usually use a dispatcher

#

Allows for easy data transactions between totally independent actors without the need to link them in any way beside subscribing to the right Channel and agreeing on the datattype

#

A tad hungover today so excuse my extra weird attempt of explaining it๐Ÿ˜…

kind star
#

Ahh good homie, yeah I think I get it, sounds like a good unreal-native solution with low overhead.

Reading the docs is says it doesn't replicate, so for most of my multiplayer use-cases, I would need to

  • Implement a RPC broadcast function on the player (to use their RPC connection) and then
  • broadcast the message on the server
  • relevant (authority version of) actor picks it up
  • authority actor actions it and replicates the action?
#

I also can't seem to find it in the plugins view; so I guess I have to go and rip it out of Lyra?

bright summit
#

I am using multicasts, don't know if there is any other option for that

#

For button on other side of map - just increase relevancy range

dark parcel
#

Not giving any context

hoary spear
#

In my eyes it doesnt actually meed to replicate at all (the GMR, that is)

kind star
#

For example, a switch for a multiplayer door;

  • Client 2 pulls switch
  • Client 2 needs to send a RPC to Server that switch was pulled
  • Switch broadcasts gameplay message tag 'Open'
  • Door (authority) is listening for 'open'
    • door receives 'open' and updates its position
dark parcel
#

I would get the client to request the server if it can pull the switch

#

what if the interacting player have delay and other player actually pull the switch first

#

it would be akward to do some rewinding there

#

Client Tell Server, Hey I am pulling this switch.
Server checks if the switch is pullable. First come first serve.
If pullable, then set the variable that opens the door

Client-> OnRep-> Open door

tardy fossil
#

another way to do it is to have the client only send a generic "Use" rpc and have the server determine what it's looking at and do whatever context sensitive action it needs to (like opening the door)

#

also i can't read "context sensitive" without thinking of conkers bad fur day lmao

bitter violet
#

I've never touched multiplayer in Unreal before, so I was wondering if y'all know of any good resources to check out?

quasi tide
#

Read the pinned messages

bitter violet
#

Would've thought I would be intelligent enough to work that out myself, guess not

raven plaza
#

Hey so I'm not sure I understand replication correctly. Is it true that all variables with "replication" enabled will only affect the host player and not the clients, but the clients can still see the changes applied on the host player? Is it smarter to just send all the variables through RPC regularly instead of enabling "replication" on the variables?

queen mortar
#

Hello I'm having problem replicating flashlight rotation in blueprints. The problem is that replicating just camera rotation won't work because of my hierarchy, where camera and flashlight mesh are attached to different bone sockets on arms mesh. I'm thinking about replicating spring arm rotation.

sturdy sand
#

I've been struggling to destroy an actor and replicate it. How do I do it? I tried using multicast but it didn't do anything. Tried using server rpc but I can't since the actor doesn't have an owner and shouldn't.

quasi tide
#

It should be destroyed on the server

#

The logic to destroy it should happen on the server

#

Show your code, because destroying on the server and it replicating down works.

#

Make sure the actor is set to replicate as well

sturdy sand
#
UFUNCTION(NetMulticast, Reliable)
void Multicast_DestroyInteractable();

void HandleDestroyInteractable();

void RequestDestroyInteractable();

void AInteractable::HandleDestroyInteractable()
{
    Destroy();
}

void AInteractable::RequestDestroyInteractable()
{
    if (HasAuthority()) Multicast_DestroyInteractable();
}

void AInteractable::Multicast_DestroyInteractable_Implementation()
{
    HandleDestroyInteractable();
}```

I call RequestDestroyInteractable() on key press which calls without a problem.
#

Need more?

#

I set replicates to true

#

in the constructor

#

using binary code engine

quasi tide
#

You don't need the multicast.

#

Show the calling code

sturdy sand
#
{
    if (IsValid(this))
    {
        if (bIsContainer)
        {
            if (ContainerReference)
            {
                HUD->TabMenuWidget->GroundContainer->ContainerInit(ContainerReference);
                HUD->OpenGroundContainer();
            }
        }
        else if (bIsCollectable)
        {
            if (InventoryComponent->HandleAddCollectable(CollectableReference))
            {
                RequestDestroyInteractable();
            }
        }
    }
}```
quasi tide
#

And how do you call that?

sturdy sand
#

The interact() function calls inside the player character class after pressing the key E

quasi tide
#

Show that function

sturdy sand
#

void APlayerCharacter::Interact()
{
    if (IsValid(CurrentInteractable))
    {
        if (TObjectPtr<APlayerController> PC = Cast<APlayerController>(Controller))
        {
            if (TObjectPtr<AGameHUD> HUD = Cast<AGameHUD>(PC->GetHUD()))
            {
                if (!HUD->bIsTabMenuVisible)
                {
                    CurrentInteractable->Interact(HUD, InventoryComponent);
                }
            }
        }
    }
}```
quasi tide
#

Is Interact a server function?

sturdy sand
#

the function doesn't have UFUNCTION or anything

#

I need to?

quasi tide
#

Yes. CurrentInteractable->Interact is calling it on your local machine. Because you don't own it locally, it won't call any server rpcs

#

The interaction needs to happen on the server

#

So the player calls Server_Interact and that is where you do the rest of the logic

lost inlet
#

Quite the dependency chain

sturdy sand
#

wait which interact. The APlayerCharacter::Interact or Ainteractable::Interact. The Ainteractable::Interact handles some checks before destroying the actor

quasi tide
#

You cannot call a server RPC from something you do not have network ownership of

sturdy sand
#

Well then APlayerCharacter

quasi tide
#

Your local client does not have network ownership of the interactable

sturdy sand
#

Well it should be fine then if I simply make it a server rpc no?

quasi tide
#

But inside of your Interact method on the interactable object, you are trying to do a server RPC

lost inlet
#

Please use delegates for things changing rather than gameplay interactions directly interfacing with the HUD

But yeah, it'll have to be on the character

quasi tide
#

It is getting dropped

lost inlet
#

Or anything else the player owns

sturdy sand
#

Since the server is going to call the Ainteractable::Interact function it's going to handle all those checks and destroy it

lost inlet
#

Could be a component

quasi tide
#

The server is never calling it

#

Because the RPC is being dropped

#

Because your local client does not have network ownership of the interactable object

sturdy sand
#

Well if I did this:
void APlayerCharacter::Server_Interact_Implementation()
{
if (IsValid(CurrentInteractable))
{
if (TObjectPtr<APlayerController> PC = Cast<APlayerController>(Controller))
{
if (TObjectPtr<AGameHUD> HUD = Cast<AGameHUD>(PC->GetHUD()))
{
if (!HUD->bIsTabMenuVisible)
{
CurrentInteractable->Interact(HUD, InventoryComponent);
}
}
}
}
}

this line: CurrentInteractable->Interact(HUD, InventoryComponent);
Would be called by the server no? So the server will handle the destruction:
void AInteractable::Interact(TObjectPtr<AGameHUD> HUD, TObjectPtr<UInventoryComponent> InventoryComponent)
{
if (IsValid(this))
{
if (InventoryComponent->HandleAddCollectable(CollectableReference))
{
RequestDestroyInteractable();
}
}
}

#

void AInteractable::HandleDestroyInteractable()
{
Destroy();
}

void AInteractable::RequestDestroyInteractable()
{
if (HasAuthority()) Multicast_DestroyInteractable();
}

void AInteractable::Multicast_DestroyInteractable_Implementation()
{
HandleDestroyInteractable();
}

quasi tide
#
  1. Player presses a key
  2. Does some checks and then calls server_interact
  3. We are now on the server, so we'll do our logic here - such as telling the interactable object that we interacted with it
  4. Server version is doing w/e it needs to - such as destroying itself
#

This is the flow

#

server_interact is on the player character

#

Because you need to have network ownship on something to call a server rpc

sturdy sand
#

yeah I understand that

quasi tide
#

Otherwise, what sswires said. Don't gloss over that. Design wise, it is not good for your gameplay code to be interacting directly with the hud.

sturdy sand
#

wait what. Why? I'm only checking if a widget is visible or not. That's all

lost inlet
#

Even then it's not a good idea to have it directly dependent like that, the character shouldn't even know what a HUD is

#

Can get some nasty circular dependencies very easily

sturdy sand
#

hmm ok.

bitter warren
#

hey ...i never changed GameState (was always default ) .,...but now i tryed a custom GameState because i had to put a timer for deathmatch inside .Problem is that when i change to custom GameState only server can move others imposible to move ,,,anyone have an ideea why ?

sinful tree
bitter warren
sinful tree
#

Correct

bitter warren
#

oh shit ๐Ÿ˜„ now i get it :)) thanks man ๐Ÿ˜„

#

seems like my gamemode is from gamemode and i need a game state base

bitter warren
sinful tree
#

If you want to use GameStateBase, then you must make your GameMode based off of GameModeBase.

bitter warren
#

yes ..both must be of base type

#

im trying it now ๐Ÿ˜„ thnx

bright summit
sturdy sand
#

Don't know

burnt coral
#

So - this works fine in blueprint but I want to learn replication in cpp.. Can anyone provide any guidance or help on what's wrong with this?

I am a bit of a slow learner so if you help and I don't understand please be paitent with me. ๐Ÿ™‚

โค๏ธ

void AMyProjectCharacter::StartSprintingOn()
{
    GetCharacterMovement()->MaxWalkSpeed = 500;
}

void AMyProjectCharacter::StartSprintingOff()
{
    GetCharacterMovement()->MaxWalkSpeed = 240;
}

void AMyProjectCharacter::OnRep_bWantsToSprint()
{
    if (bWantsToSprint)
    {
        StartSprintingOn();
    }
    else
    {
        StartSprintingOff();
    }
}

void AMyProjectCharacter::Server_UpdateCharacterSpeed_Implementation()
{
    bWantsToSprint = !bWantsToSprint;
}

void AMyProjectCharacter::StartSprinting(const FInputActionValue& Value)
{
    if (HasAuthority())
    {
        Server_UpdateCharacterSpeed_Implementation();
    }
    else
    {
        Server_UpdateCharacterSpeed();
    }
}```
dark parcel
#

you probably don't test your game with delay

#

Movement should be predicted otherwise people will just uninstall the game

#

imagine if it will take 1 second to sprint after pressing shift, wouldn't you stop playing the game?

burnt coral
burnt coral
dark parcel
#

@burnt coral https://www.youtube.com/watch?v=urkLwpnAjO0&list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk&ab_channel=delgoodie
This break down the monstorious cmc and also comes with code to sprint in multiplayer and beyond.

https://discord.gg/uQjhcJSsRG
In this video I am introducing a series I will be making which explores the character movement component and how you can extend it in depth.

0:00 Intro
1:00 What is the CMC?
2:00 Do you need a custom CMC?
5:35 What does the CMC provide?
7:10 Outro

โ–ถ Play video
#

but looking at delgoodie's video will give a very good insight

burnt coral
sinful tree
# burnt coral So - this works fine in blueprint but I want to learn replication in cpp.. Can a...

Here's a brief on the problem:

The Character Movement Component has client prediction built in. This allows a client to move locally before the server knows about the movement, and then when the server receives the movement, plays it out on its side and replicates it out to everyone else if the server determines that the movement the client made is ok to perform, otherwise it will correct the client's position to what it thinks is appropriate.

The way this works is that the client's movement component sends timestamped movements to the server and the server then plays them back as it saw the world at those times. By changing the movement speed on either side first, it doesn't integrate with the Character Movement Component's own movement system and will cause corrections on the client as either the client isn't moving as fast as the server is expecting them to or the server sees the client moving too fast.

The solution to the problem is to integrate flags that are then inserted into the move list in the CMC so the server knows when the client requested to start sprinting and increase the movement speed at that time.

burnt coral
dark parcel
burnt coral
sinful tree
#

Game feel and player agency is where client prediction is important. Like... It doesn't really matter if an inventory system is client predicted (like moving things around in an inventory) but shooting a weapon or dodging are likely things you'd want predicted.

burnt coral
#

I will watch the video that ColdSummer suggested then I will come back and ask questions. Because the video might explain the questions I have now.

#

And there's no point in redundancy, at least not in my eyes.

left wedge
#

doesanybody know how to use replays generated from dedicated servers?

#

i started the demo servers with -execcmds=demorec testfile

summer tide
#

Why this doesn't work? Trying to replicate setting of movement component tick

{
    return true;
}
void AN_Character::ServerSetTickInterval_Implementation(float interval)
{
    if (GetCharacterMovement()->GetComponentTickInterval() != interval)
    {
        CompTickIntervals = interval;
        OnRep_SetTickInterval();
    }
}

void AN_Character::OnRep_SetTickInterval()
{
    if (GetCharacterMovement())
    {
        GetCharacterMovement()->SetComponentTickInterval(CompTickIntervals);
    }
}```
fair halo
#

Does anyone have any advice on how to handle Soft Object References? I've set up data assets for my weapons that load in SOR, but we're seeing in Standalone only that after a short amount of time, our Soft References to our sound cues and VFX become unloaded again.

Currently we're loading the SOR only when a weapon is equipped, but weren't anticipating that the VFX/SFX for an actively used weapon would get garbage collected.

exotic wasp
#

is your weapon a class?

static owl
#

I want to replicate a text render component. (This is inside of a blueprint named world select text).

Whats the easiest way to do this, and where should it be replicated?

sinful tree
static owl
#

I feel like im overcomplicating this alot.

So basically I have a Widget that when you change the combo box selection it sets the URL (for map server travel). And then sets the WORLD TEXT variable (the world text varaible is inside of the WORLD_SELECT_TEXT blueprint.)

This isnt super important right now because this all goes through the Steam advanced sessions plugin.

For testing and trying to get the replication correct, I have placed a flip flop node in the player controller that takes input from N. This sets the URL variable, which is OnRep, and in the URL OnRep the World Text variable is set.

In the OnRep World Text, I call a multicast even called "MULTI TEXT"

MULTI TEXT gets the URL Variable from the Lobby Game mode, then sets the World Text variable.

This works great for the server! But the clients dont see the change. The visibility of the spotlight is also not being replicated.

I feel like i made a stupid mistake somewhere, or just overcomplicated the code. So I may end up redoing it and trying to simplify it.

(on a random note, I need to research casting more, because I always struggle with what to put as the object).

static owl
dark parcel
#

@static owl for a start game mode only exist on server

dark parcel
#

Second, why are you using get all actor of class? You most likely diving to mp too early.
Third, don't use multicast, it has no place in this stateful behavior

#

you will need to store the variable in a place where client can reach if the client needs to receive that replicated variable.

static owl
static owl
dark parcel
#

also replication works from server to client, not vice versa. Calling multicast on onRep as client will just call it as regular func at best.

dark parcel
#

though you can just do this in the LobbyController imo

static owl
dark parcel
# static owl If i dont use the Get all actors of class, what would be the best way to refere...

Casting is just a type check. You need to know how to get and set references.
Not knowing how to do that and jumping to multiplayer is shooting your own foot. I am not gate keeping you, but I would give this advice to even my best friend.

The problem with multiplayer is that you need to know the state of multiple machines. Reference may be set in a machine may not be set in another machine, or you may get different
results. Learning Object Oriented Programming in multiplayer settings will just serve to confuse you more and you better off getting comfortable with OOP with just one instance before attacking multiplayer.

Just my 2 cent.

sinful tree
#

The question is, what is a "WORLD SELECT", why do you have multiple in the game, and why would you need to replicate the URL in a separate actor, and set them all to the same text?

keen adder
#

Thatโ€™s the main reason for casting, letting the engine know which class you are actually using specifically, like a Honda Accord, when the game just thinks its a generic Car.

static owl
#

So the world select is literally just the map change.

I made a blueprint which is a spotlight with default visibility to false, and has a text component.

All I am trying to do is that when i press the comboboxstring button in my widget, it changes the URL, then I wanted it to chnage the text in the blueprint I made containing the text.

This way all of the clients can see the map choice

static owl
keen adder
static owl
sinful tree
#

Ok, so your WORLD SELECT should probably be reading from the state of the game rather than having something update it.
Create an Event DIspatcher in your GameState.

Widget Input > RPC To server on PlayerController > Get GameState (Cast) > Sets OnRep Variable.
OnRep of Variable > Call Event Dispatcher that Variable changed.
Begin Play of WORLD SELECT > Get GameState (and cast) > Read current value of variable and set text of text component > Bind Event to Event Dispatcher on the GameState > Event sets text of text component

#

Now nothing really needs to know about the world select, but the world select needs to know about the gamestate.

keen adder
#

If you dont cast it, unreal still thinks its an just actor and you do not have access to your custom variables

#

So you are just telling unreal what class an actor actually is. Its not magically transforming something into something else

keen adder
static owl
#

@sinful tree @keen adder thank you both! I went off of what you said and ended up getting it to work! Going to look into the Event Binding more. Iโ€™ve used it a little with my health bar before and thatโ€™s all.

fiery wadi
#

Can someone tell me what you plug into the Enhanced Input when using Multiplayer please in the Player Controller (Im assuming its Get Controller but im not sure)

#

nvm this seems to work. ๐Ÿ™‚

sturdy sand
#

I've marked an object pointer to be replicated in the UPROPERTY but when I create a new object and set it to that object pointer on begin play it doesn't set it at all. I'm assuming I missed a step.

agile loom
fiery wadi
agile loom
agile loom
#

And you should set it on the server

sturdy sand
#

Thanks

#

Wait nevermind. I forgot that server rpc can't be used if there's no owner. I'm creating the new object inside an actor which isn't owner by any client. What do I do in that case?

#

Multicast is the solution I'm assuming?

dark edge
sturdy sand
#

I'm trying to create an object inside an actor that doesn't have an owner and set the new object to a TObjectPtr replicated variable

dark edge
#

"hey server, do the thing"

#

If you're wanting to do that at the request or initiated by a client

sturdy sand
#

Nah it's on the begin play. The object should be created right when the game starts. There's no owner

sturdy sand
#

Never mind it seems that if you call server rpc on an actor it seem to not have any problems

#

tho it still doesn't work

dark edge
#

what gameplay mechanic are you trying to do

little pumice
lament flax
#

will GetWorld()->GetFirstPlayerController() always return the local player controller ?

  • if run on listen server, will return the LS PC
  • if run on any other client locally, will return its local PC
ivory halo
#

Hi, I've got a problem and I can't seem to figure it out :
Before, when I was coding my game in 5.4, I added screen space widgets as player name tags (in my lobby, and in game),
Everything worked correctly, until I upgraded to 5.5 : the server doesn't see the clients' nametags anymore (knowing i didn't change the code at all, just upgraded the version)

undone granite
#

Hello

undone granite
#

i hope i dont interrupt, maybe just read over me ๐Ÿ™‚
"Trace Under Mouse" doesnt work with Multiplayer.
I think its because i have many controllers.
I have added: Branch is locally controlled, but that did not fix it.

#

do you know what i can do?

ivory halo
sinful tree
# undone granite

Inputs are one of the things that normally only exists on the local computer, and that includes where the mouse currenly is located on the local machine. You'd have to RPC the mouse location to the server if you want the server to do something with it or replicate it out to everyone else. Rather than RPCing on tick, I'd recommend using the triggered output from your input event (Which is normally present on Enhanced Input event nodes). This way you can at least only be sending RPCs when there is movement of the mouse.

#

If you don't need the server to know the position, then you can just send the server the results of the trace and do so only when necessary, not on tick.

little pumice
# undone granite

is it intended that you check Pawn for local control instead of RTS controller?

undone granite
#

hmm i thought that locally controlled = my owned controller for my client

#

i guess i was wrong.

#

anyways, in fact i am trying to get info only for my local client here.

#

playing standalone, i still got that error warning that the RTS controller was empty now since i added some MP things.

#

i have to run over it again and think about what i did to introduce this error, even if i play single person standalone

#

thank you very much for the hints

feral narwhal
#

anyone know what is the best way to prevent any movement before a round starts via game mode? Not really sure where the logic for this should be.

#

I tried messing around by preventing controller input which worked until I created a build then it didn't

thin stratus
#

For the Movement itself, so WASD, you usually set the Movement Mode of the Character to None, both on Server and Client.
In C++ you could override some stuff in your own CMC to check if the round has begun.
I would move that information to the GameState though, so it can replicate properly.
For the View, so Mouse input, you kinda have to disable it via the PlayerController. There isn't really a server auth way to do that as this kind of data is client authoritative

thin stratus
#

You'll need to debug it properly and explain what is not working. Put breakpoints up etc to see what is being called and what not.

feral narwhal
#

Or I think I would have to do it in the game state since it wouldn't be called for clients

little pumice
#

GameMode is server-only Ratge

dark edge
thin stratus
gentle pagoda
#

Hello guys, I have a issue related to skeletal mesh replication when it is placed in level. I have placed an actor with a skeletal and a static mesh in the level, I have also attached the code but the static mesh is very fine it's replicating to all when changing the mesh but the change in skeletal mesh is only reflecting on listen server. Can someone explain is this there for a reason or I am doing something wrong.

Here is the video: https://youtu.be/Q_-fkJviS_0

boreal wadi
gentle pagoda
#

I have tried to update it on multicast but that didn't worked, can you explain at bit more or share an example? It would be very helpful.

boreal wadi
gentle pagoda
#

Ok I will try that.

ruby pendant
#

Hi, I have a question, but since it is long, I want to link to the topic I opened in the forum. I would be very grateful if you could help me ๐Ÿ˜Š

#
#

You may not want to try too hard, I understand ๐Ÿ˜

cunning bronze
#

for some reason when I call Set Focus To Game Viewport trying to move on the listen server actually moves the client, wtf? ๐Ÿ˜„

#

it's weird, since mouse input still works in the listen server's game window, but apparently keyboard is being captured in the client's window, trippy

vestal pagoda
#

Hey all, I've got a question about the way unreal engine replicates structs

if I add a TArray inside of a struct with a UPROPERTY() above it, will it properly replicate?

lament flax
#

will GetWorld()->GetFirstPlayerController() always return the local player controller ?

  • if run on listen server, will return the LS PC
  • if run on any other client locally, will return its local PC
agile leaf
#

How can I view network sync discrepancies? I have an object that I need to be accurately synced between client and server, so i would like to be able to see the client and server perspectives at the same time - is that possible?(outside of duplicating the play window)

latent heart
#

Not accurately.

#

And perfect network sync is very hard.

#

Well, unless you use a single process. But that's not a true reflection of the environment your game willl actually run in.

shrewd ginkgo
#

When this linetrace event in the thirdperson character is triggered, I want to check the number of players with the event in the gamestate and if there is only one person left, I want to trigger the function in the gamestate again.

#

I want to write traitor win to all of players

#

but I can replicate it correctly

sinful tree
summer tide
#

I'm trying to replicate chaning the value of char movement component tick interval? I tried server and multicast. I tried OnRep.

lost inlet
#

Why would you even want to change this

summer tide
#

I have a game viewport so that I can optimize my NPC Ai when they are far a way.

#

Also having trouble replicating toggling of the char move comp? I probably making silly mistakes

left mural
#

Hey guys,
Did something change in 5.5 regarding replication and widgets?

Tried to port a multiplayer project from 5.4 to 5.5 and everything works fine except name tags

lost inlet
#

Well seeing as widgets never were or ever will be replicated, I'm inclined to say no

summer tide
lost inlet
#

Still trying to figure out why you want to specifically change this

#

How does it make sense from a LOD perspective when you have multiple players

summer tide
#

Maybe not tick interval. But could be done to SK mesh. I can show/hide it per player

#

Maybe not either. Never mind.

sinful tree
#

You can optimize things like this client side, you don't need to replicate it down.

#

If you're trying to optimize things like this on the server, then perhaps use spawners that can spawn and destroy actors for you when players get near to them instead of using placed actors, but the server will likely need to always be running at appropriate speeds and have things visible in order to perform its own correct calculations for state.

summer tide