#multiplayer

1 messages Β· Page 31 of 1

worn wagon
#

It was an issue with how the editor does things

#

(hopefully)

quartz iris
#

erm

#

doesnt work

worn wagon
quartz iris
#

but the error is gone! πŸ˜„ kill me

worn wagon
#

Another thing to try, I had issues even with standalone through the editor. Create a .bat file with this code
"<PathToUnrealEngine>\Engine\Binaries\Win64\UnrealEditor.exe" "<PathToProjectFile>\MyProject.uproject" -game -ResX=800 -ResY=800 -log

#

Run the file twice and you get 2 windows with separate consoles

#

This is how I always test things

quartz iris
#

wtf

#

so i tried it again with this code

#

and i get the pie error?

worn wagon
#

ServerTravel

#

capitalised, try it

quartz iris
#

with a space right?

worn wagon
#

Yeah I'm not sure honestly, like I said try the bat file approach

#

yeah with the space after then the map path

pallid mesa
#

viewport 0 is still a PIE instance in run on one process false

quartz iris
#

What

#

not recognized

pallid mesa
#

the bat one is a good one, you can further automatise it it for initial join.

Client: "<PathToUnrealEngine>\Engine\Binaries\Win64\UnrealEditor.exe" "<PathToProjectFile>\MyProject.uproject" 127.0.0.1 -game -ResX=800 -ResY=600 -log -WINDOWED```
quartz iris
#

😭 i just wanna change the map please unreal

worn wagon
#

Command not recognised might be the client attempting to run the command

#

Did you add your hasauthority check?

quartz iris
#

can do

#

this one?

worn wagon
#

Add that in and make a bat file with the code vori posted

#

yeah

#

You're in gamestate so it's running on client and server

quartz iris
#

do i need to run the custom event as server

#

ok

worn wagon
#

yes

quartz iris
#

i do?

worn wagon
#

Yeah the ServerTravel command must be run on the server

quartz iris
#

well

#

i think the cmd now works

#

its just

#

the pie thing

#

maybe i should disable it again?

worn wagon
#

.bat file πŸ™ƒ

quartz iris
#

we can get this to work

worn wagon
#

Trust me, do the .bat file thing

#

This is how I test all my multiplayer stuff, I get issues in editor

quartz iris
#

man i hate bats

#

fr

worn wagon
#

πŸ¦‡

quartz iris
#

ya know what fuck this

fathom aspen
quartz iris
#

im going to create a new server for the map and boot the players in the lobby server to the new one

worn wagon
#

Damn you were so close, you just need to make the .bat file πŸ˜‚

quartz iris
#

nobody can fucking stop me not even the unreal devs 🐲

sinful tree
#

I don't know a lot about prediction for multiplayer myself, but it sounds like you're approaching it the correct way and are just seeing a side effect of using client prediction. You may need to use a second replicated variable that you can set client side for their selection and visual display and the server only updates that variable if it absolutely must have the client swap to that other weapon (eg. client misprediction), otherwise the server can replicate your existing "Active Weapon" variable for everyone else to get the visual information.

fathom aspen
#

Because each has its own use case. ForceNetUpdate is called when you want to force an actor to be considered for replication on the next frame. Internally it calls FlushNetDormancy because what if the actor in question is dormant? They do that for you and just flush net dormancy, meaning they wake that actor up for you.

short arrow
worn wagon
quartz iris
#

what if I just dont use seamless travel

pallid mesa
#

Iirc forcenetupdate lasts one second by default

fathom aspen
worn wagon
#

Seamless is for persisting data of certain actors

#

I'm telling you the issue is most likely running in editor, make the bat file and your mission will be over

short arrow
quartz iris
#

WHAT THE FUCK

#

GUYS

sinful tree
#

Hah, the warning he was receiving was regarding seamless though XD

short arrow
#

but the naming is weird

quartz iris
#

CAPS

sinful tree
#

Seamless is very easy to get confused with server travel.

quartz iris
#

I just turned off seamless travel in the gamemode

#

IT WORKS

worn wagon
#

Oh right xD

quartz iris
#

Fuck the bats

#

That's your solution

worn wagon
#

Still you should do it, having 2 log windows is nice

fathom aspen
quartz iris
#

No, no bats

fathom aspen
#

Amazed to see this channel active like this

quartz iris
#

Run under one process check
Seamless travel in the gamemode unchecked

That's for anyone else who's struggling

worn wagon
#

YO since people are here right now, if any of you are bored I'd love some input on this issue

#

I won't bring it up again I promise xD

#

My solution atm is going to have a second ActiveWeapon variable just for the owning client

pallid mesa
#

have you read UT4's method?

worn wagon
#

that isn't replicated

worn wagon
pallid mesa
#

πŸ‘ it's a good place where to start

fathom aspen
#

If you are referring to NextUpdateTime, then yeah. Actors are checked for replication on a tick basis, but you can act like a big boss and intrude with FNU

dapper obsidian
#

If a player crashes during an online multiplayer game, does the Destroy() method get called on the server's version of the player controller?

fathom aspen
#

It should be, yes

dapper obsidian
#

Thank you. πŸ™‚

fathom aspen
#

I doubt

#

Have you looked in the marketplace?

ember vine
#

i have now, doesnt seem to be anything of particular interest

fathom aspen
#

But wondering why you're asking for anything newer?

#

What's so flawed about that system

#

It was used in Paragon for the record

#

Also in UT

ember vine
#

i mean theyre just kind of ugly really, also UT is really expensive to run since it runs another uworld alongside

fathom aspen
#

So I would bet it was used (being used) in Fortnite

ember vine
#

because looking at what's there currently now, its looks like that would work

fathom aspen
#

I haven't got to look at all the hidden gems that ue5 has, but it never hurts to try πŸ™‚ (not that I looked much in the replay system tbh)

ember vine
#

yeah i'm gonna give it a go i just was curious if anyone in here has already, i'll report back what i find

fathom aspen
#

Amazing, would love to hear what you found!

pallid mesa
#

same here

quartz iris
#

Hey so I need a system where when the player wins, their level is increased which is kept in their game instance. There are two players in the server

#

I don't want it to increase all players levels only the winner

#

The level variable is saved in the gameinstance and is saved

fathom aspen
#

GameInstance isn't replicable so RPCs there are meaningless

#

Just access the GameInstance locally and save your thing

quartz iris
fathom aspen
#

You don't reference anything but the GameInstance. The winning player references it locally

quartz iris
#

So could i do something like assign host to player 1 variable and assign client to player 2 variable

#

if player 2 has 3 match wins the game is won for player 2

fathom aspen
#

GameMode announces Player A won -> Client RPC to inform that player they won (through PlayerController for example) -> inside the RPC save their level locally in GameInstance

#

Ideally the server should keep track of the client level so they don't cheat

quartz iris
#

So

#

I should be setting the players to their own variables to keep track of them?

fathom aspen
#

You should save stuff locally because that makes sense when you travel to a new server and you want persistence and also because that's natural

quartz iris
#

Yeah

#

Ok one more thing aha

#

I'm updating the play rate of a timeline

#

Why does it only work on the server and not the client?

#

The saber is thrown and so the timeline works

#

Just modifying the speed doesnt for the client

lean surge
#

does making an RPC reliable remove any need to worry about packet order? (i.e.: does it execute the RPCs in the order that you sent them)

fathom aspen
#

Yes

kindred widget
#

But only for that actor channel I believe.

fathom aspen
#

Of course

lean surge
#

ok, thanks

young spoke
#

noob question... is the following workflow normal for multicast rpc

#

client calls ServerJump() (server rpc) --> ServerJump() forwards to MulticastJump() (multinet rpc) to run locally and on all clients

#

(replace jump with any action)

quartz iris
#

So @fathom aspen I should be making a win event on the player bp which increases level etc

#

But how should i be keeping the round stats?

#

Because at some point i need to tell the player it's won from the gamestatebase

fathom aspen
#

That's exactly how you don't want your Jump to look. While that in theory could be working, it's easily breakable and you don't want to perform movement on multicast especially when you want it to be reliable @young spoke
For example CMC replicates movement for simulated proxies and interps location and other stuff on tick
Jump is already implemented for you if you use the CMC
Multicasts are meant more towards playing unreliable events such as all kinds of effects

sinful tree
#

Scoring of an individual player should be stored on the player state. When you increase the score, you can check if the player has enough score to win, and then signal to the player that they've won.

fathom aspen
quartz iris
sinful tree
quartz iris
#

The level transition is finished

fathom aspen
#

If the answer is yes, then put it in PlayerState

sinful tree
#

So the same thing then - reset the player's scores at the start of each round, store the rounds won as a separate variable still on the player state. When you're increasing the rounds won, you again check if they've won 3 rounds.

quartz iris
#

Stupid question but is the player state accessible or is it just the player bp?

sinful tree
#

Every player controller has a player state instance created for them.

#

Player state can contain data that can be replicated to all clients and is always relevant, so scores fit really nicely there as you can access them from any clients at any time.

#

You can access the playerstate of a player by getting player state from controller or from character/pawn.

prisma snow
#

Also iirc GameState has an array of PlayerStates or smth like that

quartz iris
#

Could i just make a wins/losses variable in the player bp?

sinful tree
#

Not the best idea. Characters lose relevancy, and if you have any type of respawning, then those variables won't persist.

quartz iris
#

Ok got it

sinful tree
#

If you do it on the controller, then its not accessible to any other clients.

quartz iris
#

But I could have the wins loses for each player in the gamestate too?

prisma snow
quartz iris
#

Then check whos player 1 and if they've won

prisma snow
fathom aspen
prisma snow
fathom aspen
#

Nothing towards you, but I was trying to get their attention that it might be worth it to roll the dice this time

quartz iris
young spoke
quartz iris
#

I should just being doing a tick checking for both the (0) and (1) player's score to see if it's above 3 on the playerstate

fathom aspen
#

My answer would stay the same. As long as you can use the CMC use it, it already has that hard part done for you (look into this channel pins for adding custom movements to the CMC). Even basic AActors has still got their movements replicated, but you would still have to do the interps, reconciliation, prediction yourself. @young spoke

#

If replicating movement was that easy, then CMC file would have been < 1000 lines of code.

fathom aspen
young spoke
#

while it's not useful to always recreate the wheel, this kind of seems like a vital thing to know how to do

fathom aspen
#

I wish if it was just not to recreate the wheel, but in fact it is how you do things efficiently/correctly. CMC is crazy big, but it's fun to read tbh

dim trail
#

are multicasts in bp in the server or client?

uncut schooner
#

I have a bit of a problem, I have a First person shooter setup, and I have a third person character for the remote views, when the character walks forward and steps it triggers a notify.
It does call print string locally to the remote players, but it doesn't play the sounds
I put a is not locally controlled check to make sure it doesn't trigger on local TP characters and only on Remote players

fathom aspen
dim trail
#

By when I call a multicast event in bp it is in the client?

#

It looks like it’s being executed on the client

sinful tree
dim trail
#

so it basically should never be called on the client

dim trail
#

so multicasts still play on the relevant client like if it was playing only on the client?

#

if its a multicast executed from the server

low helm
#

Yes

#

It is fairly common for Clients receiving a Multicast from the server which they themselves initiated, to ignore it

#

Because the coder already had the client implement that effect

#

on the client side

dim trail
#

another question while youre here; if i call switch has authority on a server RPC will it ever execute to the client?

#

what if i want to send information to the client from a server rpc

low helm
#

Generally it's more efficient for your netcode to send messages to clients through replicated variables

#

though not always

plucky phoenix
#

Connected 2 players on the same laptop , the 3rd is the phone , phone is not connecting on my maps. Err it’s not loading the maps. Packaged *

#

( looking for potential help , trying to connect with mobile to desktop for this )

low helm
#

try connecting on a very small map with no assets connected to it

#

(you probably want a whole new game mode to achieve this minimal memory)

plucky phoenix
#

It connected in a lobby with basic assets

#

But when transitioning it got stuck in loading

low helm
#

Yeah I dunno but it sounds like a memory problem

#

try loading that level on your phone without being connected?

plucky phoenix
#

It worked without being connected

#

Just not connected

low helm
#

So the phone can load the level on its own, and the phone can connect to a simple lobby with the other devices, but the phone can't connect and load the level

#

Anybody know if Unreal's replication system uses an octree for large maps?

An example. I have 1000 gems on the ground over a large area. All set to Replicate. Will the replication assess all 1000 individually, or batch them into groups and assess them that way first to filter out far ones in batches.

silent valley
low helm
#

Ok. I'm a BP Goblin

#

I was thinking of just making a BP based system

#

where every actor reports itself (on constructor beginplay) to it's corresponding grid actor, and the grid actors turn replicates off for everyone under their purview if no player is within range

#

the player count and existing server CPU strain on the game are actually quite small

#

thanks I found some good vids from that

winged badger
low helm
#

Yes, but they server can spawn more

#

the*

winged badger
#

they don't need to send any updates after they are spawned?

low helm
#

right

winged badger
#

then turn them dormant

#

and your problem is solved

winged badger
#

dormancy will cause the actors to just send an initial spawn/update package as they become relevant

#

and not send any updates afterwards

low helm
#

but the server would still need....

#

to do checks for all the gems it has spawned, that you're not around for?

winged badger
#

the server will not waste time evaluating if those actors should replicate, or bandwidth sending updates

low helm
#

Ok but riddle me this

#

I am on one side of the map

#

A gem is spawned dormant on the other side

#

Doesn't the server still need to run lots of checks until I get close to it?

winged badger
#

at this point you don't know that it exists (as client)

thin stratus
#

The Server mainly runs IsNetRelevantFor on that I guess

#

So if it's out of range it will just not be relevant

winged badger
#

only if you were to walk into the net relevancy range (with default behavior)

low helm
#

Well isn't that what we're concerned about altogether? too many IsNetRelevant checks?

thin stratus
#

No

winged badger
#

would the server send 1 package which would cause you to spawn the gems

thin stratus
#

That function is tiny. The annoying thing is if the Server compares the whole state of the Actor to check if it should repliate

#

Which it will not if it's dormant

winged badger
#

(spawn from relplication, client side)

thin stratus
#

Which is why PushModel is becoming a thing more and more

#

But C++ :D

winged badger
#

just finding the FObjectRelicator for that Actor takes as much time as doing 50 relevancy checks

thin stratus
#

But if you have a lot of actors that are relevant AND not dormant ,you can still cheat a bit

#

If you don't need constant updates, you can reduce the priority and update rate

#

And whenver you set a replicated varaible

#

You can force push the net update

low helm
#

Yeah I'm good about ForceNetUpdate and low update times

winged badger
#

when the gem is picked up, you just FlushNetDormancy for that one gem, causing another update

low helm
#

what I worry about is just the sheer number of IsNetRelevant checks on a larger map

thin stratus
#

Oy

#

Discord sniped the reaction

low helm
#

So I'd considered turning whole sections of the map to Replicates - Off

#

(large map, somewhat small player counts)

thin stratus
#

Keep in mind, that Multiplayer without C++ will be a minefield anyway

winged badger
#

there is a problem with the grid approach

low helm
#

yeah I'm limiting my scope pretty well I think, 2kmx2km only for now

winged badger
#

say you are standing on the lower right side of grid area 1,1

#

and you don't see any close gems from 1,2 2,1 and 2,2

low helm
#

Yeah you have to load up the adjacent 8 grids

winged badger
#

even if they are within a few meters

#

dormancy will do the work for you and it will do it well

low helm
#

So to recap, if the server spawns a Dormant gem far away, it will perform IsNetRelevant updates for that gem, up until I see it, and then it will never run those updates for me again?

#

Just sitting dormant on my client computer

thin stratus
#

IsNetRelevant has nothing to do with the dormancy afaik

winged badger
#

close, but not exactly

#

if server spawns a Dorman Actor far away it will not exist on your clients computer

#

until you come close enough to get that single update

low helm
#

right

#

with you

twin juniper
#

Hey there! Does anybody know what ServiceResponse and ServiceRequest UFUNCTION specifiers mean and how do can you use them?

thin stratus
#

All in all, you have a limited amount of solutions for a BP only approach to this.
Starting with lower updated rate and prio + utilizing dormancy is probably the best.
If you later down notice that all available BP methods aren't cutting it, you might have found the reason C++ is required for some projects, especially Multiplayer ones

winged badger
#

you literally have only 10% of the tools available in BP to optimize your network

low helm
#

Well I'm really just hoping to get 8-10 people in a playtest environment for a few weeks

#

the final product would be like....20 people on a server, 40 tops

#

Valheim style, but smaller maps with much less objects

winged badger
#

that is a very tall order for BP

#

i would not be comfortable with more then 8 using just BP tools

low helm
#

k

winged badger
#

on the bright side, learning some c++ to use the tools BP can't is not that bad

low helm
#

Yeah I imagine that if the development is going well enough and the playtest can handle a few lads that'll be motivation enough to press deeper

thin stratus
#

:P we can't stop you from trying I guess

low helm
#

Ok so here's another thing, I tested this big white cone with INITIAL dormancy, and once I get close, it's always relevant at any distance, so now am I correct that now I need to start thinking about draw thread issues for the client?

winged badger
#

definitely not

#

eventually, maybe

#

but until you have a working prototype

#

its too early to think optimization

thin stratus
#

That's also probably not that much of a networking problem

#

Culling is a thing. LODs are a thing.

#

What I would be more worried about is having that thing tick for no reason :D

winged badger
#

when you have enough experience, you can write reasonably performant code on the first pass

low helm
#

So yes it will be an issue

winged badger
#

but before you do, thinking optimization right away clutters your task complexity beyond what you can be reasonable expected to handle

low helm
#

I'm well past the point of "working prototype", I've been doing that for 5 years, had 4 people playing a multi server MMO 3 years ago and have only improved since then, just trying to plan well for this project

#

but I appreciate the concern, I've seen plenty of folks get lost trying to chase optimization they don't grasp

thin stratus
#

Well, fwiw, I don't think we ever optimized in that direction on The Ascent

#

The only thing we massively optimized was Tick and overlapping BeginPlay code

low helm
#

that's interesting, can you elaborate a bit more on what you mean by overlapping beginplay, like staggering out some of that logic so it doesn't all hitch at the beginning?

thin stratus
#

Yap

#

And also things like Spawners vs placing the Actor into the scene directly

#

Spawners are lightweight. Paired with proper SoftObject Refs to DataAssets, the level can become quite small in memory size

#

And only loads and spawns stuff if needed

#

There are a bunch of things you can do before you have to think about a cone in the distane that the player isn't looking at 90% of the time, causing it to not be rendered anyway

#

Something that UE4 isn't utilizing by default (not sure they have a base implementation in C++ somewhere), is what "isNetRelevanceFor" does but for Tick

#

Which one would call Significance

#

But you can probably see that in some games already, where the tickrate is reduce when the actor is far away

#

Or even turned of

#

But again, less of a Multiplayer problem at that point

low helm
#

well, imagine the player ran by 300 gems while exploring, now just need to be sure it has at least some reduction solution

thin stratus
#

Yeah, reduce tickrate on far away gems, or turn it off. Use very simple meshes or even turn off rendering for very distant ones

low helm
#

no tick at all

#

just pickups

thin stratus
#

Stuff behind the player isn'trendered anyway, so your worst case is if the player looks at a flat area with tons of them in the distance

low helm
#

well the cull steps can be expensive in their own right

thin stratus
#

If you want to check what is actually rendered and what not, you can enter the Debug Camera and disable the render update

low helm
#

if the counts get bloated

thin stratus
#

Then fly around abit

low helm
#

congrats on The Ascent, it looks like a hit

thin stratus
#

Thanks, my company was contracted for 2 years full-time on it. So can only partially take credit hehe.
It's Neon Giant's game, not ours.

low helm
#

Don't be modest, just say "I made most of it by myself, some other people helped"

thin stratus
#

Haha, to be fair we did a shit ton on it, that's not wrong

timid moat
#

I'm using a blueprint widget to show the PlayerState->PlayerName above of the head of all of the players. If none of the players can see the other players name updated on the blueprint widget. What could be happening?

#

Thanks.

low helm
#

about 17 different things

#

post pics of the code

timid moat
#

I'm going to update my question on Unreal's forums and I will share the link with you, because there are a lot of code to show.

fathom aspen
#

Hate to say it, but dormancy is totally bugged in BP @low helm

#

It's unfortunate, but good to keep that in mind

low helm
#

how

fathom aspen
#

Indeed, sad day for BP-only MMOs πŸ˜”

low helm
#

thanks I will test that

fathom aspen
#

You're welcome, hope you fix it

low helm
#

we're BP goblins

#

we don't fix things

#

we work around

timid moat
# low helm post pics of the code
timid moat
#

Thanks.

celest bough
#

Any one able to tell me why my pawnparameters struct isnt being correctly set within the pawn when it is spawned? this is my code:

#

the parameter struct is set locally and then passed to the server when the pawn is spawned, but when i check the variables in the pawn once its spawned its just using the default struct values

eternal lake
celest bough
#

player controller

fathom aspen
celest bough
#

they are mostly just floats

#

with 1 int

fathom aspen
#

Ah I totally misunderstood your question. So you are expecting to see the changed values on spawn while in fact you are seeing the default ones

celest bough
#

yeah

fathom aspen
#

Two questions:

  1. Where is this server RPC called from?
  2. Where do you examine if the struct members have changed?
celest bough
#

on mine, i check the params on the client when calling the event to spawn pawn and they are correct, and then again i check them on the server and they are also correct

#

but when i check on the pawn and they are incorrect

#

this all happens on PC

fathom aspen
#

I think I know that already, I meant what native function calls RequestBeginGameplay

#

And answer question 2

celest bough
#

that is also called from PC

#

im not sure i understand q2

#

you mean like where do i use the struct values?

fathom aspen
#

You keep restating yourself without giving me any meaningful answers

#

RequestBeginGameplay is called by a function

#

Name me that function

celest bough
#

ah

#

the function is called setup game and its called locally

fathom aspen
#

Locally, how do you know? Ah maybe it's on BeginPlay locally?

#

I will keep guessing

celest bough
#

i have it set to run on owning client

fathom aspen
#

And where you call that owning on client event

#

The name of the native function is the thing I'm looking for

#

But anyways I will suppose that RPC is being called and it's all fine

celest bough
#

from the game mode when the player joins the game

fathom aspen
#

You said inside Pawn

#

What function inside that Pawn?

#

BeginPlay?

celest bough
#

yeah the struct vars are use inside the pawn

#

no they are just used for various functions

#

like jump etc

#

it will get the jump strength from the struct

#

like this for example

fathom aspen
#

They should be mutating the CDO values just fine. My only guess is that you are somehow resetting them back to their default values somewhere

celest bough
#

hmm. there are no set values in my pawn

#

it works for the server player

#

only the clients it doesnt not

fathom aspen
#

Oh then my doubts were true

#

Back to question 1

#

You are calling the server RPC too early it seems

#

Causing it to drop

#

But that doesn't explain how a pawn is being spawned

celest bough
#

it starts here

#

in the game mode

#

which eventually calls the begin gameplay

#

and that leads to the initial image i posted

fathom aspen
# celest bough

Finally you answered my question. That function is the first safe point in time to fire RPCs on the PlayerController. So that's not the issue it seems

celest bough
#

i wonder what the issue is then

#

its working as expected on the server

fathom aspen
#

Debug, like I would

golden zealot
#

Hey I almost figured it out!
I'm using EOS to create sessions and join them.
Everything is perfect on pc.
The only thing left is that Account Portal is launching web browser in pc but not in android and login gets failed in android.
Any solutions to make it work in android as well?
Ohh I'm so close to make it work! Please guide me if you can πŸ™‚
Thanks

fathom aspen
#

The last resort tool to every sane programmer @celest bough

celest bough
#

i have no idea how to debug this, i normally just use print string for everything xD for this i can see the server is passing the correct value but then as soon as i print the value from the pawn, its the default value

fathom aspen
#

The grapes is what I was going to add but you are speed 😭

celest bough
#

ty

golden zealot
#

Isn't it multiplayer :/?
Its just not launching web browser to login. I know to be more specific it is of #epic-online-services but if you can help, 😦

fathom aspen
#

No it's not. Pretty much like #online-subsystems isn't. That's why they have their own channels

#

(I would if I knew, happy I could help guiding you to the correct channel)

golden zealot
#

Ok alright thanks.

tawdry ermine
#

Hey, I am very new to multiplayer and I am trying to figure out the RPCs for Objects that exist within my level. Therefor I created a quick TicTacToe setup. Upon a tile getting clicked I want to spawn a decal.

As I read I will have to do this via the GameState or PlayerState, as the object is serverowned. So I set up a cast to the GameState and then did a serverRPC/Multicast there. But if I click the tile on the server the multicast works fine, however clicking the tile clientside does not RPC to the server. Could anyone help out why that is?

keen sigil
#

Does anyone know of a course or tutorial that explains how to set up a server for multiplayer game production in unreal engine 5, friends, it is very important to me

dark edge
#

The only communication from client to server is "I clicked on this tile" or "I clicked in this location"

fathom aspen
# keen sigil ?

Check pinned messages, starting with the multiplayer compendium

dark edge
tawdry ermine
#

thanks a lot ^^

fathom aspen
kindred widget
fathom aspen
#

Also found in that compendium ^, you will find out that multicasts when called from client will execute like a normal function on client

daring portal
#

If I have an actor in the level and want to call RPCs from it without needing to do so through the player controller to solve ownership, is there a best way to do that? Is it reasonable to set the actor's owner to the player 0 player controller on every client so that each client can call RPCs?
(thought I'd sneak that in here while it's relevant πŸ˜„ )

keen sigil
fathom aspen
#

Also you don't use GetPlayerController(0) because that means they are all owned by the first player and that might be unpleasant for your game

#

GetPlayerXXX(0) nodes are avoided in multiplayer

daring portal
#

I remember I had a project that ended up with a playercontroller with dozens of functions that were primarily for calling rpc's on objects.

#

Maybe there's a nice way to do it by passing a lambda to a single function in the controller instead πŸ€”

fathom aspen
#

Live example from that project: You want to open a door on a button click. You should be calling a server RPC that involves that door. Peeps usually think that they have to own that door, but that's wrong

#

You literally have a generic interact function that examines what object it's interacting with and call that server RPC accordingly

#

All done on PlayerController for example

#

Aside from eliminating the need to hold too much of hard refs, you also have a modular code

daring portal
#

I'll take a look at that! Which project is it? Discord isn't redirecting me to the right spot for some reason.

fathom aspen
daring portal
#

I may also be overly used to all the boilerplate from previous industry experience πŸ˜…

tranquil yoke
#

is it possible to make one Client gets connected to 2 server.

What i am trying to do is, trying to Join 2 server using beacons, so one server can interact with another server.
Now once my connection is established, I want to decide for some Pawn that they can be seen in another server too, so I was thing if i can do some manually call from server1 to server2, which can create a client for me on server2 and but it should be control via the client which is sitting on server1.

as far as i understood this, there is NetDriver which has ipConnection, which i think is the representation of a user for a server, and ipConnection can have Actor Channels.

and all of the Client to server connection is done by a class (stateless something) and this class has a call AddNetConnection() , i was thinking if i should make this function call from server1 to server2 sending all the necessary data to create a IPConnection,
After that i probably have to customize the updates to these ipConnection.

anyone have any experience with this ?

other Approach, as i already have connection between servers, I can just create a psuedo Pawn, which will be a replicated Actor, i can spawn that, and make movement replication go through via Beacon, drawback of this approach is, everytime i add some functionality to my main pawn, and i want that to also work between server to server, I will manually have to add this via beacons also.

daring portal
#

If it's alright, let me ask a more specific question about working with actors in the level!
I have an actor like this, which is, I think, pretty standard.

class ANetworkedActor : public AActor
{
public:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_Property)
    float Property = 0.f;

    UFUNCTION(BlueprintCallable, Server, Reliable)
    void ServerUpdateProperty(float InProperty)
    { // impl
        Property = InProperty;
        OnRep_Property();
    }

    UFUNCTION()
    void OnRep_Property()
    {
        if (ensureAlways(ActorWidget != nullptr))
        {
            ActorWidget->UpdatePropertyTextBlock();
        }
    }
}

Then in the widget I have:

class UActorWidget : public UUserWidget
{
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Widget, meta = (AllowPrivateAccess = "true", BindWidget))
    class UButton* IncrementPropertyButton;

    UFUNCTION(BlueprintCallable)
    void OnIncrementPropertyButtonPressed(float value = 1.f)
    {
        if (ensureAlways(OwningActor != nullptr)) {
            OwningActor->ServerUpdateProperty(OwningActor->Property + value);
        }
    }
}

From the client, I get No owning connection for actor.
There's no way to use the ServerUpdateProperty from the client directly?

latent heart
#

HAve you actually copied+pasted your actual header?

#

I thought you'd need to use _Implementation methods for those Server methods.

daring portal
#

No, I tried to extract the important stuff to reduce the noise πŸ˜„

#

Yeah, I moved the _Implementation in there with the little // impl comment.

fathom aspen
#

OwningActor has no owning connection

latent heart
daring portal
#

So I know I can do something like this in my player controller:

class AApplicationPlayerController : public APlayerController
{
public:
    UFUNCTION(Server, Reliable)
    void ServerUpdateActorProperty(class ANetworkedActor* Target, float NewValue);
}
void AApplicationPlayerController::ServerUpdateActorProperty_Implementation(ANetworkedActor* Target, float NewValue)
{
    Target->ServerUpdateProperty(NewValue);
}

void UActorWidget::OnButtonPressed()
{
    const auto World    = GetWorld();
    if (ensureAlways(World != nullptr))
    {
        auto PlayerController = Cast<AApplicationPlayerController>(World->GetFirstPlayerController());
        if (ensureAlways(PlayerController != nullptr))
        {
            PlayerController->ServerUpdateActorProperty(SyringePump, NewValue);
        }
    }
}

Two questions:

  1. Is there a cleaner way to do this?
  2. Is there value in the UpdateProperty function on the actor being a Server, Reliable function if it's going to be called through the PlayerController anyway?
fathom aspen
#
  1. Too generic names to be able to tell what's the end purpose here.
  2. No. A server RPC will exist on an actor that is capable of running it.
latent heart
#

You can't call a server rpc on something not owned by the client.

daring portal
#

To be more specific, I have an actor in my level representing a syringe pump in a hospital that has a large UI giving access to some of its internal state. A networked player in virtual reality is adjusting those properties using the UI for it. For the syringe pump, it's not so bad to have a function on the player controller for each of these properties. For some of the other machines in my level, there are going to be dozens of properties, so making a function in the player controller for each would be a bit of a mess.

latent heart
#

(player state, controller, pawn)

daring portal
#

Having said that, I was fine with the mess. This is how things were done when I worked in AAA way back.

#

Buuuut if there's a way to not have a specific function in the player controller for each of these updates and to instead have a generic UpdatePropertyXOnActorY function, that'd be pretty sweet. I'd normally do that with a lambda, but that isn't supported with Unreal's networking.

fathom aspen
#

ServerInteract(GenericObject)

#

GenericObject will have that function that you hate placing in PlayerController

#

It's just that the PlayerController is guaranteeing you are on the server by the time that object-related function is called

#

Literally no boilerplate

#

So clean

#

And nothing hard about it

#

GenericObject for example will have a generic Interact function

daring portal
#

I feel like you're telling me something very obvious with the GenericObject and I'm somehow missing it πŸ˜‚

fathom aspen
#

Interact for door is not the same for rock

#

Every object will define how a player interacts with it

keen sigil
#

Guys steam subsystem is work in unreal 5?

#

Do u know about that?

#

With bluepront

fathom aspen
daring portal
#

Ah, you're saying the cleanest way to do it would be with an interact interface.

fathom aspen
#

Right, an interface.

young spoke
#

was trying to multicast on a PlayerController for a couple hrs, RIP

#

🀣 well at least i have learned... painfully

keen sigil
fathom aspen
fathom aspen
cedar knot
#

Hello, I have a quick question.
On a programming level, how do we build an Unreal Engine 5 MMO (Metaverse) on a dedicated server?
What would be a suitable place to start?

daring portal
#

I hope you get a nice answer, though!

kindred widget
#

I think it's a super quick question. You start with the game. πŸ˜„

fathom aspen
#

And you have a very good understanding of Unreal's networking, and the tools it has

#

FWIW UE is not MMO friendly, meaning you will also going to heavily modify the engine

kindred widget
#

The issue with that question is understanding that you can't have a dedicated server to build until you have a project. If you get that far, then you can worry about a backend that spins up the dedicateds and tears them down, or manages their properties.

fathom aspen
#

Cries in distributed servers

daring portal
#

For a proper MMO, you'll also need to handle things like region-based relevancy, resizing regions, server management, etc.

quasi tide
#

Just buy one of those marketplace plugins. Easy.

kindred widget
#

Guess it depends on the definition of an MMO. Everyone has their own view. It's not really that easy of a question given how many different variations of MMOs there are. Games like The Cycle or AnarchyOnline for instance just fake it with instanced lobbies where you're rarely connected to more than a dozen people at a time. Can still chat globally but that's about it. Versus something like ARK where there are separate shards, no global chat for everything online. Or something more like WoW where there is very little hard cut instancing outside of specific dungeons.

prisma snow
#

yeah MMO sounds like a multiplayer+infrastructure nightmare

cedar knot
kindred widget
#

Make the game multiplayer, but don't worry so much about the MMO part at first. You can do 80% of the work before you even build a dedicated server.

prisma snow
latent heart
#

Don't ever try to convert a SP game to MP.

#

If you want to even attempt that, run your SP game from a dedicated server.

cedar knot
#

First of all thanks to all for the answers, the team are reading all and adding it to our investigation. If any one have other advices they are all welcome, we know this is not an easy task.

daring portal
#

Why do we need to have ownership of the object to call an RPC for it if the RPC is run on the server? This seems to necessitate a lot of extra code, and I'm not seeing the benefit of it.

dark edge
#

I can only tell the server about things I own.

#

Otherwise you'd be doing tons of ownership checks all over the place. Only being able to RPC through objects you own is the best default.

daring portal
#

Is there a way to disable that behaviour for some objects? To have an object owned by everyone?

jade patrol
#

hey guys, is there a way to stress test the mp game ... smth like dedicated server where it does not render the game but acts like a client ?

dark edge
latent heart
#

It's connecting to the server?

#

You might be able to spin up multiple headless clients in an automated test or osmething.

jade patrol
#

yeah, is there a way to do it out of the box?

dark edge
#

Just fire up a bunch of instances and melt your gpu

prisma snow
daring portal
#

In this case I have an object in the level that has a bunch of properties that I want to be able to update and then call an OnRep. Anybody can walk up to the object and change it through a widget. As I understand it now, I need to have the widget get the world, get the player controller, and call the server RPC on the player controller that passes the pointer to the object I want to change and the new function. I can't have a server RPC on the actor itself because of the ownership rules even though anyone can change the object at any time.

dark edge
latent heart
#

As Adriel says, right now the only way would be to start multple clients and ahve them all connect.

fathom aspen
dark edge
daring portal
#

The widget doesn't change the state. The widget has a pointer to the actor that owns the state.

fathom aspen
#

Also you are welcome to override UNetDriver::ProcessRemoteFunction and have your rules of when you are able to fire RPCs

#

I won't be responsible of the chaos that happens tho

dark edge
#

What I'm getting at is, can the properties be put into a struct?

#

Then you could make it a simple passed struct in the update state RPC

daring portal
#

Ah fair, throw everything in a struct and a single RPC.

dark edge
#

HeyMrServerIWantTheThingToBeLikeThisNow(NewStateStruct)

daring portal
#

It'll result in a lot of extra data being passed, but I can leave that as a problem for another day.

dark edge
#

It's not being sent on tick so it's like zero data

prisma snow
#

for my RTS I pass hundreds of structs to sync unit positions

#

it's not that crazy

dark edge
#

You could also make it more of a transaction "Change field X to value Y"

azure hull
#

Hi. Has anyone done - server trigger local save for each player and server trigger local load for each player (local file/steam cloud file). Something similar like in Terraria or Phasmphobia.

dark edge
#

whatever makes it so you don't need a different RPC for every field.

#

@daring portalJust curious, what's the actual gameplay here?

#

automation game?

#

Space Engineers style?

daring portal
#

Virtual reality simulation with a controller using a desktop and multiple virtual reality trainees. It's a simulation for training anesthesiology residents. It's mostly working, but I'm reworking the networking to make it more reliable.

#

For objects like syringe pumps, the anesthesia machine, etc. there is a lot of stuff to control and any of the trainees can approach the device and change it either through physical interaction or through a widget depending on the property. The desktop proctor has its own UI that gives access to all of the properties.

dark edge
#

Yeah you'd definetly want a transactional approach. Basically spell out which property, what change you want, and server either does it or doesn't (not allowed)

daring portal
#

Now by "a lot of properties" we're talking less than 20 still.

#

So I think a struct would be fine.

dark edge
#

Cool thing is you could record that

#

and audit it "Hey mr whoever never turned the machine on and now the patient is dead"

#

or XXX person cranked up the flow rate to X number

#

you could record all that

#

hell you could automate a procedure. It'd basically be a flowchart of transactions.

daring portal
#

True story! I have a system for recording the events, but baking it into the networkign would be nice.

#

I also have a system for automating procedures or making a set of procedures as a text file that triggers a list of exec commands on the server. It's ugly as hell. I'm hoping to make it nicer and post it up as a plugin on Github at some point.

#

And preferably make it work in a safer way than triggering random exec commands, which was sloppy to the extreme πŸ˜‚

#

So based on everything I've learned here, this should be a reasonable approach?

USTRUCT(BlueprintType)
struct FNetworkedActorProperties
{
    float X;
}

class ANetworkedActor : public AActor
{
public:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_Property)
    FNetworkedActorProperties Properties;

    UFUNCTION(BlueprintCallable)
    void UpdateProperties(FNetworkedActorProperties InProperties)
    { // implementation function in cpp
        Properties = InProperties;
        OnRep_Properties();
    }

    UFUNCTION()
    void OnRep_Properties()
    {
        if (ensureAlways(ActorWidget != nullptr))
        {
            ActorWidget->UpdateProperties(Properties);
        }
        // recording and other nice extra features
    }
}

class UActorWidget : public UUserWidget
{
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Widget, meta = (AllowPrivateAccess = "true", BindWidget))
    class UButton* IncrementXPropertyButton;

    UFUNCTION(BlueprintCallable)
    void OnIncrementXPropertyButtonPressed(float value = 1.f)
    {
        const auto World    = GetWorld();
        if (ensureAlways(World != nullptr))
        {
            auto PlayerController = Cast<AApplicationPlayerController>(World->GetFirstPlayerController());
            if (ensureAlways(PlayerController != nullptr) && ensureAlways(OwningActor != nullptr))
            {
                auto NewProperties = OwningActor->Properties;
                NewProperties.X += value;
                PlayerController->ServerNetworkedUpdateActorProperties(OwningActor, NewProperties);
            }
        }
    }
}

class AApplicationPlayerController : public APlayerController
{
public:
    UFUNCTION(Server, Reliable)
    void ServerUpdateNetworkedActorProperties(class ANetworkedActor* Target, FNetworkedActorProperties NewProperties)
    { // implementation function in cpp
        Target->UpdateProperties(NewProperties);
    }
}
chrome bay
#

Keep in mind when you call that RPC, you're sending the entire struct each time

#

So depends how big the struct is. FNetworkedActorProperties params should be const-ref also

daring portal
#

I guess from here the biggest improvement would be caching the local controller in the widget. That doesn't seem to cause any problems I can think of.

kindred widget
#

The widget already has access to the local controller.

daring portal
#

That'll make a lot of my GetWorld in my codebase disappear!

kindred widget
#

GetLocalPlayer or something I think.

#

Basically when a UserWidget is created it can have one of two different outers. World or GameInstance. Regardless of which or how you create it or where from, it will pull the local player from somewhere to populate the widget's local player, which it can use to get the controller for that widget. The only time you need to care about passing it a specific outer is for local coop games where there's more than one local controller.

daring portal
#

GetOwningLocalPlayer. Beauty!

dim trail
#

are on rep functions called on the server?

kindred widget
#

Generally speaking BP style OnReps are frowned upon because it's nice to be able to breakpoint specifically an OnRep and know it's on a client.

hexed pewter
#

referring to response above. How do you usually debug client-only behavior or multiplayer in general. Say your game uses steam, do you have to make a shipping build every time and attach a debugger?

fathom aspen
#

Single-player heretic detected alert

fathom aspen
daring portal
#

Or if you're deploying to Quest you just cry a lot 😭

fathom aspen
#

I don't know if that's just me, but I hate VR

#

I know it doesn't interest anyone, but happy to share with you my feelings

#

They are Meta now

#

Obviously the name was the reason to the chaos

daring portal
#

I was excited for VR then I started developing for it and now it just represents pain and dead dreams

fathom aspen
#

I'm purple, remember?

#

I will tell you once you're purple

#

You're not purple enough to understand now

#

I could get you one patrick_hehe

latent heart
fathom aspen
#

Not rich enough to buy that. I'm Zuck now depression

quasi tide
#

The $3 tier was almost convincing enough. But alas, still not enough features.

#

I don't care enough about emojis

delicate adder
#

heyo, I'm trying to just hack together some simple session connectivity stuff for demonstration purposes using Advanced Sessions. I can successfully create an advanced session and join it just fine, and see two pawns appear, one for the host of the session and one for the newly connected player. However, I then want to open a new level. I call Open Level on the host, and simply doing so also opens the level for other connected player - however, it seems like they go to different "instances" of that level, insofar as there is only one pawn in each. How do I call open level from the host, and have this cause the connected player to open the same level as the host (with both pawns present)?

fathom aspen
delicate adder
#

That's some good obscure stuff

fathom aspen
delicate adder
#

Very wizardry

dim trail
#

if i have a timer delegate to a server RPC do i have to invalidate that timer on the client or server?

delicate adder
#

worked a treat, cheers @fathom aspen

fathom aspen
dim trail
#

i dont need to set a timer through the server? can i set a timer via the client and bound it to the server will it tick on the server?

fathom aspen
#

No. Timers are local.

#

Pretty much like delegates are.

#

They have no idea networking exists.

dim trail
#

would it be stupid then to have a timer that is connected to something like attack speed, to make it execute an attack every x seconds according to attack speed? if timers are local are they not hackable

sinful tree
ashen pebble
#

Anyone know why this isn't replicating to the clients?
This is inside the game state

kindred widget
#

Presumably too early. Put a 0.5 second delay on it and test again.

ashen pebble
#

That worked! Thanks

quasi tide
#

Don't stick with the delay solution

#

Want to avoid delay in actual networking

fathom aspen
#

Trying to repro (and no matter what I do), I'm getting only the server to execute the multicast!!! What sin did I commit to deserve this dragonHell? aPES_Sob

quasi tide
#

omg - I forgot about that πŸ˜…

fathom aspen
#

(Don't judge me if it doesn't)

#

I hate them anyways

twilit radish
#

Hold up.. Negative?

split siren
#

It's a marketing term

pallid mesa
#

that's the whats-so-called input prediction

#

the machine can predict your input even before you press it 🀣

fathom aspen
#

That's obviously being developed by dragonHell

pallid mesa
#

THATS SO COOL

#

tbh I recommend everyone to give a try on making a game on an old architecture, ie: amstrad

dark edge
#

Speculative execution has gotten crazy, it can tell what you're gonna do before you do it

pallid mesa
#

yes, with a very great accuracy

prisma snow
#

client prediction in multiplayer context always seemed to me a fancy way to say "simulate no lag"

prisma snow
pallid mesa
#

well this has more to do with hardware design

dark edge
prisma snow
#

still dunno how

split siren
#

Any tips on making throwable grenade with client-side prediction? I was thinking spawning a "dummy" client-side nade, which travels 20% slower than proper (replicated) one.

Once the replicated one is spawned on client, set it to be Hidden in game.
Over multiple frames lerp the old dummy one to the replicated location. And destroy the dummy on when in sync.

So it looks like the projectile speeds up after a bit of time.

chrome bay
#

The chances that players will actually see it by the time you have animation and everything else are pretty slim

split siren
#

It looks fine with the animation when player is stationary, but you can see the grenade spawned next to you when you are moving from side to side. Not sure how to cover the spawn location with an animation.

chrome bay
#

Other problem is the grenade you get from the server is going to be behind by a factor of RTT + processing time

dim trail
#

if i call does timer exist by handle and the delegate is executed on the server will the check for this call have to be done on the server as well

chrome bay
#

Timers are local only

#

zero network functionality

split siren
chrome bay
#

Isn't that going to be wierder though? Seeing a slow grenade suddenly start moving faster? I'd think that'd be more jarring

#

If the "throw" is initiated by the server, you could get the server to throw it earlier to mask the latency slightly

pallid mesa
#

you can hide some latency in the animation time

#

ye

split siren
#

I think I am being a massive dummy, I think I can just do the "release" on the server which should spawn the nade at the current location.

#

So the player "holds" the nade for a tiny bit longer

#

Thanks @chrome bay as always!

chrome bay
#

prediction just gets messy fast, if you can avoid it I would

split siren
twilit radish
#

This is how Bungie did it:

split siren
#

Is that from the Halo talk?

chrome bay
#

Oh yeah, Halo has a presentation on that

chrome bay
#

Tricky part of releasing early on the server is making sure it still goes the same direction the client wants

dim trail
#

if i set a timer handle to be replicated shouldnt it replicate from server to client?

#

doing this check on the client always returns false

twilit radish
#

You're replicating the timer handle. Like Jambax said:

Timers are local only
zero network functionality
Your timer doesn't exist on the client because you created it on the server. Replicating the handle doesn't just magically start a timer πŸ™‚

dim trail
#

but you have to create a timer on the server, no matter if the delegate is connected to a server

#

for it to be on the server

twilit radish
#

Correct.

dim trail
#

now that makes sense, lol

twilit radish
#

A timer that starts on the server exists on the server, one created on a client lives on a client.

dim trail
#

someone told me on here that if the timer is created on the client and the delegate points to a server call then the timer exists on the server

chrome bay
#

dey wrong

fathom aspen
#

No one aside from me spoke to you and neither that I told you that

twilit radish
#

Wizard is lying to us confirmed.

#

πŸ˜›

fathom aspen
#

Waiting for the proof, while I know it doesn't exist

dim trail
#

it was a while ago, but they may have misread my question

#

i know it wasnt you, lol

twilit radish
#

Like we said. If you start a timer on the server, it exists on the server and only the server. Start one on a client and it lives on that specific client. If you want to communicate between client and server something then either use a RPC or the replication system πŸ™‚

fathom aspen
twilit radish
#

You're always misleading Wizard πŸ‘€

dim trail
#

i never said your answer was misleading papa

#

😦

fathom aspen
#

Sorry for the accusations then. I would be happy if you go back and correct that individual tho.

fathom aspen
twilit radish
#

Bold of you to assume I have touched that any time recent 😭

fathom aspen
#

||How about blog posts then?||

twilit radish
#

||crying intensifies||

ebon loom
#

Hello ,how to I get motion warping replicated? I used the "run on server to multicast" way. But client keeps jitters back and forth

graceful flame
# fathom aspen ||How about blog posts then?||

I'd be very interested in reading a blog post about server hosting setup using the third person starter project or Lyra. I know there's a very long video series out there by flopperam for UE4 with AWS but I think an article would be better.

fathom aspen
#

Hehe, you're lucky because the next planned blog post (soonℒ️ in the making) will somehow touch upon that. Wasn't my idea, props to vori for pushing me towards it πŸ˜„

pallid mesa
#

call it a blog, call it a sample... lol

fathom aspen
#

Call it a...? Nah that word can't be disclosed now xD

#

What if it ends up not being it... u never know

pallid mesa
#

/s

split siren
#

The grenade still looks so weird when it spawns next to the character. Grrrrr

short lily
#

In a multiplayer game, need a local single player scenario, such as some editor. How to do it.

dusky yarrow
#

is it possible to replicate physics object accurately between clients? i wanted to make a grenade but when the client 1 throws it, it falls in a bin for him while for client 2 it completely missed

#

or should make a custom deterministic physics solution for the grenades?

prisma snow
#

Unreal doesn't have a deterministic physics engine, although iirc Chaos is better at it.

#

Idk how granades are dealt with traditionally - but it seems like a common thing to sync between clients/server, so there must be some good solutions

#

Another option is to make some kind of server-only simulation that sends updates frequently to interpolate in the clients

#

Some informative articles about networked physics: https://gafferongames.com/post/introduction_to_networked_physics/

dark edge
#

The built in physics replication is pretty good but it doesn't do anything for you regarding prediction. Perfectly fine for server-auth physics tho

#

If you're ok with the ping delay between client hitting the button and grenade appearing on their screen, then it'll work out just fine for you.

prisma snow
dark edge
#

ya

prisma snow
#

is that new with UE5, or from before?

#

I didn't knew

dark edge
#

Ancient

prisma snow
#

How does it work?

#

Does it replicate all physics, or does it need more setup?

dark edge
#

I think it's opt in per body but it replicates all physics. You have some tuning values in the project settings

prisma snow
dark edge
#

Yeah it's great, you just can't do prediction without a TON of extra work. I use it for my vehicle game just fine but my vehicles are slow and tanklike, not F1 cars.

prisma snow
#

Just thinking of client-side prediction with complex physics makes my head ache

dark edge
dark edge
#

I don't think I'll make a system to robustly predict the motion of XxX_Sephiroth42069_XxX's divide-by-zero-mobile with 12 engines and 34 wheels and guns with propellers on them

#

I just spam inputs to server and let it do the physics. I only replicate the chassis and turret movements tho. I don't replicate wheels and the like, who cares if they disagree as long as the motion of the actual vehicle is the same.

uncut schooner
#

Hi everyone

#

lol was just about to ask about vehicles

#

I see that in UE5 the Chaos vehicles are all driven server side

#

Is it the same with the Chaos vehicles in UE4?

#

If not do you think they might update it anytime soon or is that something that I will have to look into myself?

uncut schooner
#

I want to get prediction for a tank

#

How did you get it done, also what engine version is it

split siren
#

@chrome bay Just out of curiosity I tried this. When grenade is replicated to owning client, instead of spawning it where it was when player threw, it spawn it where the player is now.
Then it follows the same movement as server, but it lerps toward the server one.

Looks something like this, and it feels much better imo. Not sure if this information is of any use to use, just wanted to share my findings from experimenting.

#

This image is from character moving left. Red is the "fake" location, and green is the server location.

graceful flame
#

I know that wrapping sensitive c++ code with #if UE_SERVER /*code here*/ #endif makes it so that code block isn't shipped with the client build but what happens when you do that on a player controller?

daring portal
# split siren

Very cool! Would look a little funky but better than the alternatives.

graceful flame
#

or maybe I'm confusing player controller as being client only like widgets are

ivory wolf
#

What else that can cause a charactermovement replication become client authorized? I was tinkering to reduce the lag and switch/edit so many things I couldn't remember, and now the multiplayer is become client authority, not server's
I've checked "Ignore Client Movement Error and Correction" and "Server Accept Client Authoritative Position" both are turned off

#

The only thing I havent check is GameNetworkManager, but I cant locate it

graceful flame
#

Are you using the built in character movement component?

split siren
ivory wolf
graceful flame
#

That's like the main part

#

your modifications are probably what's causing issues here

#

What sort of changes did you make to it?

ivory wolf
#

lemme open my vscode first
but iirc, I only change the acceleration part

ivory wolf
#

I just want 'almost' instant velocity change, so I use 10000

    if (!bZeroAcceleration)
    {
        const float NewMaxInputSpeed = IsExceedingMaxSpeed(MaxInputSpeed) ? Velocity.Size() : MaxInputSpeed;
        --Velocity += Acceleration * DeltaTime;
        ++Velocity += Acceleration * 10000;
        Velocity = Velocity.GetClampedToMaxSize(NewMaxInputSpeed);
    }
graceful flame
#

I suspect what's happening here is that the GameNetworkManager has some built in speed cheat detection / prevention stuff and whatever changes you made to the calcvelocity function are not compatible with the cheat detection. Is that data being replicated? validated?

ivory wolf
#

I dont think I do any validation
btw, I switched back to builtin charactermovement, and it still client authorized

graceful flame
#

What do you mean by client authorized? what makes it client authorized? are you getting lag and corrections?

ivory wolf
#

client authorized, like all the movements are simulated in client and replicated to server instead of the client send commands to server, and the server simulate it then replicated to clients

#

I only noticed it when the animation only works in client. Before, the animation works in both server and client

graceful flame
#

So on a listen server?

ivory wolf
#

yep, on listen server

graceful flame
#

ya, no pretty sure movement is still server side even if its listen and not dedicated, otherwise how are the other players going to see each other run around?

dark edge
#

it's insanely hard

#

Why would you need to do prediction for a tank anyway

#

a tank doesn't do anything in 30ms

graceful flame
dark edge
graceful flame
#

Otherwise you'd have clients ending up with different simulations

#

which is just desync

ivory wolf
#

I can tell that it's client simulated since the movement is smooth on client but stuttered in server (with simulated lag)

graceful flame
#

No its client predicted

#

The character movement component does client side prediction to reduce the feeling of input lag. When you press a button you expect something to happen right away, correct?

ivory wolf
#

I can tell it's client simulated since what the server see is different with the client.
When both start at the same time, in server, player A(server's) is in front of B(client's), but in client, its the other way (It's a racing game, I forgot to mention)

#

Also, before, in client, there was this bouncing movement (to sync with server I guess) from time to time, but now it somehow magically disappeared.

graceful flame
#

A car racing game?

ivory wolf
#

not actually car

graceful flame
#

well any vehicle I suppose probably shouldn't be using the CMC in the first place

dark edge
#

The differences come when the client and server disagree on something

#

You choose the server's result normally, or the clients result if you're doing client authoritative simulation

ivory wolf
dark edge
#

Either way the client is in the future relative to the server on their own screen

graceful flame
#

oh well in that case sure

#

I guess you can use jump and crouch

dark edge
#

Yeah a snowboarding/skiing game would be doable with the CMC, you'd have to do some fancy math in the update step tho

#

boarding is a bit more complicated than walking

#

if you want momentum and energy conservation etc

ivory wolf
dark edge
graceful flame
#

yea

ivory wolf
#

It's best to use server's authoritative

dark edge
#

They'd still see themselves crossing the finish line before the server does

ivory wolf
#

but the problem is, I somehow made the game client authoritative

dark edge
#

that's what prediction is, it lets you see stuff in the future

#

I doubt you did

#

How do you know it's client authoritative and NOT just predicted?

#

There might be a setting on the CMC to change that, look around

ivory wolf
graceful flame
#

because it predicted forward

dark edge
dark edge
graceful flame
#

there was no correction made and so the winner appeared as the loser

dark edge
#

Does server accept client or client accept server?

#

with prediction you will NOT have everyone agree on the state of the game. That's a fundamental problem

dark edge
#

You might have broken the correction system somewhere

#

idk

#

what does a 3rd observer see?

graceful flame
#

I suspect its due to some sudden speed change that CMC cheat detection doesn't like because it wasn't done through a RPC

ivory wolf
dark edge
#

If you're talking about the finish line, that's normal. Assume you have a host and 2 clients and they all are moving exactly the same.
Each client would see themselves IN THE FUTURE and other characters IN THE PAST. Everyone thinks they're winning.

ivory wolf
dark edge
#

Core fundamental problem to racing games with prediction.

latent heart
#

Surely the answer there is for the client to predict the other clients in the future too?

dark edge
#

Snowboarding is smooth and slow enough that you could NOT use prediction or yes, use extrapolation.

#

You can't extrapolate parkour, but you can sorta extrapolate cars, and can very easily extrapolate airplanes.

latent heart
#

Depends on your update frequency, really.

dark edge
#

well that and ping

latent heart
#

Yeah.

dark edge
#

mispredict by 30ms on an airplane, it's not much different

#

mispredict someone jumping by 30ms, big deal

#

If I was making a snowboarding game I'd use physics and NOT predict but that's just me

ivory wolf
#

Using server's authoritative should solve it I guess?

dark edge
#

You'd still be predicting

ivory wolf
dark edge
#

That's the fundamental problem

#

you have 300ms error SOMEWHERE. Either it's lag between input and seeing something happen, or you're predicting

ivory wolf
#

yep, but the prediction is only so the client "doesnt feel" like his/her input doesnt do anything for the next 600ms .

dark edge
#

it'd be 300 but yeah

#

ping is round trip usually

#

those are your options. I'd choose non-predicted if it was VERY important that everyone aggree on everything. Especially if collisions are common

ivory wolf
#

Ah right, I forgot

dark edge
#

Say 2 clients predict and collide. There's 3 ways that collision played out. Which one should be the "truth"?

#

That's why collisions in PUBG vehicles are so ass

ivory wolf
#

I was using pawn movement as 1st attempt, and ended up handling all the networking manually, although no prediction yet.
Then I switched to CMC so I can let it do all the networking, including the prediction

#

But then somehow, the prediction is not working and it switched back to client authoritative, which means back to square one πŸ˜…

ivory wolf
graceful flame
#

If I were you I'd make a backup copy of whatever changes were made to CMC then revert it back to default and try doing what Adriel said by changing default values for the same effect.

#

Acceleration, speed, sprint speed... etc that sort of thing but since you mentioned its a snowboarding game you may also want to try adjusting friction and braking too.

ivory wolf
#

Thanks, I'll try that πŸ™‚ πŸ‘

tranquil swallow
#

Hey! guys back once again. I'm just wondering how I might save a variable to a player when transporting between two levels.
|
Lobby(Player selects character) --> Game Starts --> Each person in game has their Character is set to selected character
|

plush wave
#

Why does only FNamedOnlineSession have player counts?

#

FOnlineSession lacks this

dark edge
fossil spoke
#

AGameModeBase::Login gets passed this value in the Options param.

#

const FString PartyId = UGameplayStatics::ParseOption(Options, TEXT("PartyId"));

#

UGameplayStatics has some helper function for parse Options

#

That take the form ?Option1=Value1?Option2=Value2...

latent heart
#

Silly Unreal. Didn't use proper URI format!

fossil spoke
#

I wouldnt be surprised if the Options format is legacy from way back.

#

lol

latent heart
#

Oh it is. It was like that in udk lol

fossil spoke
#

Yeah but im talking UE1

latent heart
#

Lol

#

Tim just didn't know any better in them days!

fossil spoke
#

Kind of like how the 3D XYZ is the way it is, cause Tim was confused.

#

lol

latent heart
#

The worst part is that world and mesh axes are different. Even in UE5.

fossil spoke
#

🀷

latent heart
#

Like a mesh pointing in +y will point in +x in the world or something really stupid.

dark edge
dark edge
#

That's totally the wrong way to go about it.

dark edge
latent heart
#

I'm not sure in the details. I don't do graphics!

dark edge
#

The actual looting should happen on server only.

#

The thing that totally boggles my mind with FBX -> Unreal is that I have never once found any combination of export or import settings that ends up with a skelmesh facing the right way.

#

Like it'll face to the right, I'll change the export settings to rotate it 90 degrees, and it'll still face to the right

#

WTF

daring portal
#

What's the best way to network on object that doesn't belong to an actor?
Attach it to an actor anyway?
In my case, I'd like to have a networked UUserEventLog.
Right now the UGameInstance has a copy of the log and it is updated over RPCs by the PlayerControllers, but it would be nice if the UUserEventLog itself was replicated so that all the clients could be more easily in sync with the server.

daring portal
#

Ha just read that article, thought about tagging Jambax πŸ˜„

#

I could make it a struct. The question of what do I attach it to remains, though.

dark edge
daring portal
tranquil swallow
dark edge
ebon loom
#

Hello ,how to I get motion warping replicated? I used the "run on server to multicast" way. But client keeps jitters back and forth

dark edge
#

You don't run on server to multicast jumping or walking

fossil spoke
shy prism
#

Hi, I was wondering what is the best way to detect if a player has used their double jump in a networked environment. The ideal behavior would be having players ragdoll with a different jumping force when they use their double jump. My current implementation overrides DoJump from UCharacterMovementComponent. The issue seems to be that my check for double jumping "(CharacterOwner->JumpCurrentCount == CharacterOwner->JumpMaxCount - 1)" returns true for the client but false when the server simulates that client move.

bool URiderMovementComponent::DoJump(bool bReplayingMoves)
{
    if (CharacterOwner && CharacterOwner->CanJump())
    {
        // Check to see if this is a double jump (or last jump or whatever)
        // WHEN CLIENT IS DOUBLE JUMPING THIS EVALUATES TO TRUE FOR THE CLIENT
        // WHEN CLIENT IS DOUBLE JUMPING THIS EVALUATES TO FALSE FOR THE SERVER
        if (CharacterOwner->JumpCurrentCount == CharacterOwner->JumpMaxCount - 1)
        {
            // Have to ragdoll the character
            if(CharacterOwner->IsLocallyControlled())
            {
                WantsToRagdoll = true;
            }
            Velocity += CharacterOwner->GetActorUpVector() * DoubleJumpForce;
            SetMovementMode(MOVE_Custom, ECustomMovementModes::CMOVE_Ragdoll);
            return true;
        }
            // other basic single jumping implementation here
        return true;
    }
    return false;
}
#

is this just not the proper way to do something like this?

meager fable
#

What is the first function that gets called on a controller after we end travel to dedicated server? Sth like postClientTravel

plush wave
#

Ok ok

#

How do I get a Named Session from a normal Session?

keen sigil
#

Guys strach game what is that ?

#

In multiplayer?

pastel estuary
#

Hi everyone - I'm trying to connect to a PlayFab (dedicated) server while also using Steam. It does find a match through the matchmaking when 2 players queue, but the players will be thrown back to Main Menu instead of connecting to the server. I think it's working 100% without Steam but for some reason, it will not connect when Steam is enabled. Anyone who can help? Thank you so much. prayge
https://youtu.be/pRL2NhnJA3E?t=106

hexed pewter
#

I have this issue where I'm using virtual machine and second steam account to test SteamOnlineSubsystem, but only the instance of the game that is run first, shows that the SteamSubssytem is actually being used (other always shows NULL). So e.g. if I run an instance from my virtual machine first, it will have steam, and instance on my actual machine will show null.
It is worth mentioning that both instances of the game show Steam UI properly (after shift-tab I can see friends list and all that jazz). Is this because in the end I'm in the same network in a sense that I'm using a single router?

thin stratus
#

If that would be the case, then you could never play with more than one person on steam in one house :P

latent heart
#

(And that definitely does work)

hexed pewter
#

Right, makes sense now that you put it that way.

latent heart
#

That doesn't mean that it will work fine on the same pc inside a virtual machine, though.

quiet fjord
#

Guys I have a problem. I'm playing on a dedicated server that I've created in aws. But at the time of the replications when I generate an object in run on server it does not work and if in multicast I must remove the replications of the objects so that it does not find duplicates?

twin juniper
#

How many dedicated can handle one vps or vds?

bitter oriole
#

Depends on the game and the VPS

#

It's completely impossible to say

twin juniper
#

well i just wanna understand order of number, like 5-10-20-50-100. Game mmorpg, not fps shooter. If middle count of players 20 in one server. Vps 8 core 16 Gb ram

bitter oriole
#

Depends entirely on your code, level, assets, desired tick rate, etc

#

Try 5 different instance types, profile your server

fathom aspen
fathom aspen
winged badger
#

i get a feeling this was client side question

#

in which case, PostNetInit is first good place to start putting custom client code in after hard travel to server

#

in case of seamless travel its more complicated, as it will call NotifyWorldLoaded and ServerNotiflyWorldLoaded on departing PC instance, after which its AGameMode::HandleSeamlessTravelPlayer on server, after which new PC replicates which brings us back to PostNetInit

fathom aspen
#

Was going to mention ServerNotifyLoadedWorld but it can't be overridden πŸ˜”

#

Pretty much why we couldn't fix the seamless travel bug like normal human beings, but they fixed it in 5.1 πŸ˜„

fathom aspen
# winged badger in which case, PostNetInit is first good place to start putting custom client co...

While you mentioned it, me and Authaer had a discussion lately on when it's the safe point to start firing server RPCs on arbitrary actors and he found that it's when OnRep_Owner is called. IIRC you said for PlayerState it's PostNetInit, but I think that could be it because PlayerState's UpdateFrequency is lower than its owner, so by the time PostNetInit is called Owner has already replicated. Might that be it?

winged badger
#

its not frequency for PS

#

default PS has priority 1, just like a vanilla actor

fathom aspen
#

I see, but for PlayerController it is higher, no?

winged badger
#

PC and Pawns are on default 3 iirc

#

so PS comes last in initial replication

#

unless you change priorities

fathom aspen
#

So that would prolly make Owner of PS replicate before PostNetInit gets called for PS

#

And that would explain why it is safe to start firing server RPCs on PostNetInit in PS

woeful ferry
#

If I set an actor to replicating and disable NetLoadOnClient, but spawn an actor with the same name on server/client, do they link up?

#

Just curious πŸ˜„

quasi tide
#

@fathom aspen @chrome bay 5.1 release notes

fathom aspen
#

That's insane. James might want to consider a follow-up writing to his article now πŸ˜„

quasi tide
#

There are a lot of very nice changes in this release. Touch various parts of the engine.

dark edge
#

We 5.1 now?

fathom aspen
#

The Iris part πŸ‘€

#

But they have no docs for it πŸ˜”

fathom aspen
#

I can die waiting for 5.1 to install now while guessing what Iris provides

quasi tide
#

Still too young for me to mess with Iris, lol

fathom aspen
#

I like how they say these are opt-in features, and that the old systems will continue to work along them for the foreseeable future

kindred widget
fathom aspen
#

Nasa internet speed detected

kindred widget
#

Faster. Finnish internet speeds. πŸ˜„

fathom aspen
#

I was going to download the preview yesterday, but I forgot to do it, and I'm still on hotspot 😭

#

Fiber internet in 2 weeks πŸ™πŸ»

quasi tide
young kestrel
#

Does the iris thing explain how to actually use FCharacterNetworkMoveData to extend Saved Move Data?

Because that little footnote in the docs isn't helping.

kindred widget
fathom aspen
#

Oh here we go, we are already getting Iris questions. The bar has been raised way too high now

#

πŸ˜”

fathom aspen
young kestrel
#

Well more like if someone skimmed through it, because I'm at the moment not able to.

young kestrel
fathom aspen
#

You technically turn on bUseIris in ProjectSettings. You're welcome, glad I could help

quasi tide
#

Where's my Iris blog post? @fathom aspen

fathom aspen
#

This is the point where I hide

#

Unless vori makes it before me, I will be happy to make the comparisons and explanations in one lenghty af compendium blog post

fathom aspen
#

He made it before me aPES_Sob

fathom aspen
pallid mesa
#

get your ass back to work

#

🀣

devout dagger
#

I am running a RPC (run server) that changes a replicated variable of my character, but that variable does not change in the rest of the clients, why?

fathom aspen
#

Because of few different things

#

RPC being dropped?

#

Actor not properly replicated?

#

I will keep guessing until you post code

devout dagger
#

oh sorry

fathom aspen
#

Too easy, you don't have any patrick_hehe

quasi tide
fathom aspen
#

Have you tried hot reloading?

#

Maybe you should make sure to live code too. worth to try

devout dagger
#

My problem is that the other players can see the change, but I can't see the change.

#

I read that this can be solved with another multicast rpc, but having 2 rpc doesn't seem like the best idea.

worn wagon
fathom aspen
#

It does in BP

quasi tide
#

Onrep always gets called when the variable changes in BP land

worn wagon
#

Oh really? I just need to stop trying to help people with bp code

quasi tide
#

You only have to manually call it in C++

fathom aspen
fathom aspen
woven otter
#

Hi, apart from encryption for requests and sanitizing them what other security related task should be implemented for Multiplayer games on a client server model?

devout dagger
fathom aspen
#

It is absolutely not. That guy I proposed the debugging pack to had a farewell to the print screen function

vague spruce
#

Hi
I have a "simple" question. Does a dedicated server require an online session? If so how do I implement one?
Thanks

chrome bay
fathom aspen
chrome bay
#

fkn Epic making things easier for us

quasi tide
#

How dare they

twilit radish
# woven otter Hi, apart from encryption for requests and sanitizing them what other security r...

Most security things are handled by Unreal it self already to my knowledge, for very good reasons. So just don't do any dumb things honestly and you should be fine, Unreal doesn't seem to give too much opportunity to mess up things in a truly fundamental way. Unless we are talking general cheating, but that's a different story πŸ˜›
Just be sure to like you said your self 'sanitize' / check whatever is needed from RPCs. Having seen stories from Rocket League as an example seemed like most of their security issues came from gameplay logic being exploitable πŸ™‚

chrome bay
twin juniper
#

@chrome bay your replicated instanced struct pr didnt make it into 5.1 did it?

chrome bay
#

Sadly no

#

Blueprint mod did though

twin juniper
#

☹️

chrome bay
#

You can still move the plugin into the project and integrate it though if you aren't using source

fathom aspen
#

Didn't want to tell you about it, so you don't lose hope

twin juniper
#

does this mean we finally can more easily choose what to replicate to specific clients?

chrome bay
#

ooooh

devout dagger
dark edge
#

make sure it's correct

fathom aspen
chrome bay
#

They do it on purpose to spite me I'm certain of it

devout dagger
#

As I said before, other customers can see the change, but I cannot.

dark edge
#

either the bool isn't getting replicated right, or the material isn't set up right

#

figure out which one

fathom aspen
devout dagger
chrome bay
#

Ah if they think this BS is going to replace net instanced struct, no chance

twilit radish
#

What do Instanced Structs do again?

quasi tide
#

idk - but James is excited about it

#

Because of that, I am too. He seems to know what he's doing.