#multiplayer

1 messages · Page 33 of 1

fathom aspen
#

Up to this point it was all guesses, I haven't seen any code really

frail skiff
#

I moved it out of BeginPlay after you said that. Just replaced GetPlayerCharacter with GetController and then ripped that whole portion of code out and copy-pasted it anywhere where I needed the reference in the class for now, just to test

#

oh wait wait wait

#

let me check on the blueprint though

#

I forgot about blueprints, only checked through my C++

#

It's okay I'm not RIP'd yet. My C++ codebase is much more extensive than my Blueprint codebase

#

Uh weird. It looks like the culprit was my custom character controller itself, but there's literally only 2 functions in there and I don't understand how either of them is an issue

fathom aspen
#

Yeah they are clearly not the issue, I see

frail skiff
#

I said I don't understand how either of them are they issue

#

Presumably one or the other (or both) is the issue

fathom aspen
#

I could try figuring out the issue if I saw code

frail skiff
#

You mind if I DM it to you rather than posting it here?

fathom aspen
#

My DMs are closed for help unfortunately

frail skiff
#

Alright

ashen pebble
#

So this code works with creating a listen server, but when a client tries to join the server--the game crashes.
This is in a widget blueprint, and the session is set as a variable in a separate widget blueprint, where the joining logic resides (JoinSession node)

#

In the other widget blueprint

uneven chasm
#

Am I incorrect to think one ue dedicated server only has 1 map loaded. If I started a match of 8 people in a map that server is taken. Then the machine itself can have many ue servers running on it. am i missing anything, or is ue able to multi-instance maps?

ashen pebble
#

I'm trying to get a listen server working, not a dedicated one

#

I wonder if the code is correct but some replication errors are happening when the map loads

fathom aspen
#

No one was replying to you and your question (session questions) should go to #online-subsystems

uneven chasm
#

thanks @tender jay I figured so but just making sure when scaling out I'm understanding overhead of the service. part of our design is similar to gw 1 where once you leave a town you may only have 1 player or up to 8. more stuff to think on 😄

uneven chasm
#

hey hey Wizard been a bit since we chatted, appreciate the response I checked out multiworld but "the standard UE5 network-replication for multi-player games is supported on the Main World (Secondary Worlds are not replicated);" would be a blocker. Ill take a look at sublevels, never thought I would be concerned about small number of players x many servers 🤣

fathom aspen
#

Oh that's good to know, will keep that in mind for the future 😄

uneven chasm
#

sublevels is for designing though not playing runtime scenarios unless im missing something

fathom aspen
#

Yeah, but you could make each sublevel as a level in itself. So you end up having different "worlds" under the same server

uneven chasm
#

very interesting I do think this is something i need to share with our other designers ty ty

twin juniper
#

anyone know a good way to "predict" RPCs? Not sure of any other way besides making server wait a certain amount of time like ping of one of the players with most ping (but clamped). It would be fine if calls came from client as then could just predict, but for server only and client has no idea it is going to come?

fossil spoke
#

Prediction is usually initiated by the Client when they perform some action expecting it to be accepted by the Server.

twin juniper
chilly arrow
#

Without downloading plugins, or using C++ to expose the api, is it possible to get custom settings from blueprints for multiplayer when creating a session? If I use the Set(FName, FString) (in C++) to set for instance the rank or gamemode, is it possible to set and get those in blueprints? I have not seen any option for it yet.

reef steeple
#

I'm not sure if anyone has experience with networking fighting games but how much of the engine needs to be modified to support full determinism, in the case of rollback netcode? I recently learned that in this case, floats can't be used at all for gameplay, so does that mean having to rewrite physics, GAS and state machines? I'm so sorry if this is too open ended,

hollow eagle
#

rollback doesn't require full determinism, fyi. It makes mispredictions less likely (thus improving the experience) but whether it's enough to make a difference really depends on the game.
But yes, if you want full determinism you're going to be resorting to a lot of custom stuff. You don't need to modify the engine per-se, but you'll at least be using a separate set of structures to contain your world state than what the engine provides.

plucky prawn
#

What do you need determinism/rollback for? Isn't that for lag/desync?

hollow eagle
#

it's for lag compensation and network prediction

plucky prawn
#

Ah nice. I should really find more resources to learn about this stuff

hollow eagle
#

Also worth noting the existence of the WIP network prediction plugin, and chaos has some determinism stuff iirc

reef steeple
#

big oof. thanks for the response 🙏

prisma snow
prisma snow
rugged turtle
#

there's like no info on iris really

#

😠

#

where is my unreal engine video on YouTube

white wigeon
#

Hey ! I'm having a little issue with replication, and although i've watched quite a lot of tutorials, I can't explain what doesn't work.
I spawn an actor, on the SERVER, when a player presses a key.
Later, if a player interacts with with the spawn object, I cannot find out how to destroy it. The spawned actor is fully replicated.
Here are the screenshots. Thanks in advance !
The first screenshot is from my player controller, the second is from my spawned actor blueprint.

#

Spawning works well, the issue is about the destroying part

dapper obsidian
subtle patrol
real ridge
#

Guys How to notice when I Lost connection on client ? So I will send him to menu?

#

bcs I was joined in session I disconnected internet and I stayed there

#

in map

white wigeon
white wigeon
subtle patrol
#

I guess yes but you can try to do a multicast just I case

#

I am not on a pc to test it

subtle patrol
# white wigeon In what sense? It should only exist on the server, so the replication should wor...

If you destroy an actor an the server and it does not get destroyed on clients, then the actor is not set to replicate, or not set up properly to replicate.
If an actor should get replicated, then you should declare that in the actor’s constrctor.
Also, only actors spawned by the server (and set to replicate) are replicated at all.
If a client spawn’s an actor, even if set to replicate, then the actor is NOT replicated, meaning it only exists on the client that spawned it.

#

Found it in unreal forum I don’t know if this helps

real ridge
#

I am trying log out from session on with my player ( session is made on dedicated server) and I am getting still this error what can be problem?

rose egret
gusty raptor
#

Hi. I wrote some blueprint to spawn the default pawn manually. However so there seems to be a difference than when i set it in world settings. For example, it seems this local player returns false, and it returned true when spawning automatically...

#

I spawn the pawn in gamestate.. Anyone knows what i might do wrong?

fathom aspen
#

You're doing two wrong things at least.

#

Server RPCs will be dropped on actors that are not owned by client, i.e. GameState.

#

GetPlayerXXX(0) nodes are avoided in multiplayer, especially when you're on server.

#

Read the multiplayer compendium pinned in this channel

fathom aspen
# white wigeon

Same goes for you, server RPCs will be dopped on actors the client doesn't own.

#

They are usually handled in actors like PlayerController/Pawn/PlayerState

white wigeon
white wigeon
gusty raptor
#

@fathom aspen Would u like to explain the best way to manually spawn pawns?

#

E.g. would i have to spawn from playercontroller?

fathom aspen
#

No. I would stick to how the engine does it, by handling that inside GameMode.

#

Say AMyGameMode::RespawnPawn(APlayerController* PC)

#

And you would call that function OnPawnDeath

#

OnPawnDeath will happen server-side, so no server RPCs involved

gusty raptor
#

Actually, i want to spawn my pawn when my custom terrain load is complete

fathom aspen
#

You already have a function in GameMode that spawns pawns

gusty raptor
#

I actually have a event OnTerrainGenComplete inside GameState.. Would i be able to spawn from there?

fathom aspen
#

HandleStartingNewPlayer that is

gusty raptor
#

I see

fathom aspen
#

Do what it does, or defer calling it until your terrain has loaded

gusty raptor
#

When and from where is HandleStartingNewPlayer called?

fathom aspen
#

I won't make GameState spawn pawns

#

It's not that it doesn't work, it's just bad design

gusty raptor
fathom aspen
#

You're looking for 12. Pawn

real ridge
#

Guys how I can find out that my internet connection was dropped? For example I am joined to the session and I will turn off wifi, I will stay on map I need return player to player menu but I Dont know how to find out there is no more internet connection I tried it by looking what ping will be after inrernet off by this blueprint , but I am still getting normal ping 30 -60 i dont understand how I can get ping if I am disconected

fathom aspen
#

First of all you're using GetPlayerXXX(0) and that's bad

#

You don't use these nodes in multiplayer at all

#

To get PlayerState in this context for example you do

#

GetOwningPlayer->GetPlayerState

real ridge
fathom aspen
#

AFAIK players will auto disconnect when their internet drops. But if that doesn't happen, then session stuff might have to handle that

fathom aspen
real ridge
#

but sometimes it didnt kick me I dont understand

#

I need make it like my internet drop and after 10 sec I will be immediately kicked to menu

#

with warning internet dropped and dont know how

real ridge
fathom aspen
#

GetOwningPlayer->GetPlayerState->GetPingInMS

#

But that's from widget

#

You don't let widgets dictate a player should disconnect

#

Widgets are just placeholders that display state

#

Your session should probably handle this stuff

#

And session questions are the next two channels

real ridge
fathom aspen
#

It is

real ridge
real ridge
gusty raptor
fathom aspen
#

I don't know how you load your terrain, but you should be able to tell when it "has loaded" to broadcast that delegate

gusty raptor
#

Hmm so i guess ineed c++ for that right?

fathom aspen
#

Well it's not just that but too many other things

#

BP is too limited for multiplayer

gusty raptor
#

Yeah

#

I'm okay with c++ for it though

fathom aspen
#

For example you might end up making it an AsyncTask, and I don't think is viable in BP

gusty raptor
#

Just were like a fast snack test 😄

#

Actually spawning seems still a little complicated in my point of view

fathom aspen
#

It is not if you know what you're doing

gusty raptor
#

😅

real ridge
#

weird

gusty raptor
fathom aspen
#

Correct

gusty raptor
#

Right so thanks for the advises

timid moat
#

Hi!

#

How can I control the server player, eject player, and then control the client player? F8 doesn't eject the player.

#

Thanks!

fathom aspen
#

Ejecting the player is not moving between windows though

#

To move between windows you could just press the Esc key

#

Or the Windows key

timid moat
fathom aspen
#

Now that you edited your question, to eject a player you need to EnableCheats and then ToggleDebugCamera in console comand

#

And for mouse control you need to do Shift+F1

real ridge
fathom aspen
#

You can do whatever works for you 🤷🏻‍♂️

woven basin
#

i've seen some high profile games "ship" as what appears to be the Test build, so they keep the console, profiling etc. Conan, 7D2D and ARK are some of them that come to mind...

(Unless they are just modifying the source build to force include those modules in the "shipping" build)

#

Actually - there seems to be a ALLOW_CONSOLE_IN_SHIPPING option, so they are probably enabling that....

#

apparently its fixed in UE5 according to the Epic staff reply there from Ari

#

yeah - seems to be an error in the documentation :suprised pikachu:

shy radish
#

hey guys im a complete beginner to networking in unreal engine. im trying to make a simple fps game. I used RPC calls for BeginFire and EndFire that calls the Fire method and whilst everything seems to be working correctly on the server. clients however arent showing the same result

#
void AWeaponBase::BeginFire()
{
  if(!HasAuthority()) { ServerBeginFire(); }
  Fire();
}

void AWeaponBase::ServerBeginFire_Implementation() { BeginFire(); }

bool AWeaponBase::SerberVeginFire_Validate() { return true; }

The Fire function just draws a debug line from weapons muzzle location to eye view direction

upbeat basin
#

What is the result you get on server that you can't on the client? Seeing the debug line?

shy radish
upbeat basin
#

I would say that you at least should see your own debug line even if others can't, that Fire() function is called whether you have authority or not

#

How do you setup/spawn your weapon actor? Do each client own the weapon actor they hold?

shy radish
upbeat basin
#

Is the actor itself set as replicated as well?

shy radish
#

yes

rich dune
#

Hi,

I'm running into a strange issue where a delay node in UE 5.03 on a server will start but never will tick down. If I set a delay of 5 seconds it will start at 5 seconds and stays at 5 seconds forever. Any idea why and how I could fix this?

rich dune
#

no. gamemode is also set to not pausable and even made sure the gamemode ticks even when paused.

kindred widget
#

GameMode won't matter there. Timer comes from the world's TimerManager. Not sure what else to check besides TimeDilation and Pause

thin stratus
latent heart
#

I'd fix the replication issues when you disable movement replication.

#

No idea honestly.

sharp hound
#

Hi, like I wrote yesterday, I have troubles to travel to another map after I logged into a dedicated server. I'm using clientravel from playercontroller, but I'm unsure if I have to insert something like $IPADDRESS//Game/Maps/SecondMap or something else. Can anyone help? Thanks.

thin stratus
#

Travel to another map after logging into a dedi server? What exactly do you mean with that

sharp hound
#

Hi, I mean, after I enter in the server default map ("loadingmap" in this case), can I unload this map and load another one?

rose egret
#

how do i know my OnRep_ happend right after creation if actor ?
using GetGameTimeSinceCreation() == 0 ?

#

or maybe anyother way

#

🤔

latent heart
#

You could have a non-replicated bool that is set to true the first time an onrep is run

fathom aspen
surreal wadi
#

can someone tell me if a USceneCaptureComponent2D works on a dedicated Server without a graphics card?

fathom aspen
#

I'm not sure what you mean, but a dedicated server doesn't do any rendering/cosmetic stuff

#

It's headless

surreal wadi
#

mhh, yea thats what i feared 😄

#

just realized that my dedicated server atm for one function needs to take a screenshot 😄

fathom aspen
#

Possibly you want to do it locally, on client

surreal wadi
#

it's sending an email with an attached screenshot, atm i do it serverside to not have the authentication on the client

sharp hound
#

I've read that if I use ServerTravel all connected clients will follow, shoud not I use ClientTravel?

rich dune
fathom aspen
surreal wadi
#

so either i need to sync the render target to the server, last time i did not have success with that >.> or need to trust the client which feels worse

fathom aspen
#

Only one map can be loaded under a server

sharp hound
#

Thanks @fathom aspen, so if I want to have two different worlds, I must have two different servers, is this correct?

fathom aspen
#

By default, yes. Or you are welcome to modify the engine

sharp hound
#

Ok thank you very much.

fathom aspen
#

You can have sublevels if you want, and each sublevel will act as a level per se

sharp hound
#

Do you mean something like level streaming?

fathom aspen
#

Yeah it's related.

thin stratus
sharp hound
#

Ok I see. Thanks again

fathom aspen
#

Though you have to make sure APlayerCameraManager.bClientSimulatingViewTarget is set to false, so the server has authority over setting view target

fathom aspen
# shy radish yes

But it doesn't seem that the character is owning that weapon actor, so server RPCs will be dropped. You can own it either via FActorSpawnParams.Owner or SetOwner

shy radish
#

now client can fire but for some reason when trying to get muzzle location which is simply just gets socket location by name, would set it at vector zero...

low helm
#

What's a common rpc count for an RPG ability

#

I'm at 3 with an unreliable multicast for effects

fathom aspen
#

2~3, but you could try batching them if they are all done in one frame

low helm
#

Well it's start animation, effect consummated (includes mana payment), and then a VFX message

#

I suppose I could combine the VFX with the effect consummated because they happen at the same time

#

Is it preferable to send one big event with lots of parameters instead of two rpcs

fathom aspen
#

It is preferrable to batch RPCs yes

#

It is an optimization

low helm
#

Thanks

loud cove
#

I have a parent actor Actor In Space that has as Child Actor an Orbit Actor AOrbit. As soon as I set AOrbit to replicate, the multiplayer breaks: the connecting client freezes upon join. Not even AOrbit::OnConstruction is called (that's where I put the breakpoint for debugging)

#

I don't use ChildActorComponent, just Owner and the Children array (setting the parent actor when spawning the child actor with FSpawnParameters Params; Params.Owner = SomeActorInSpace;)

fathom aspen
#

Where do you set AOrbit to replicate?
Share code?
Look inside the logs?

loud cove
#
AOrbit::AOrbit()
{
    PrimaryActorTick.bCanEverTick = true;
    bNetLoadOnClient = false;
    bReplicates = true;
    //bReplicates = false;
    bAlwaysRelevant = true;
    AActor::SetReplicateMovement(false);
    
    Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    Root->SetMobility(EComponentMobility::Stationary);
    SetRootComponent(Root);
    
    Spline = CreateDefaultSubobject<USplineComponent>(TEXT("Orbit"));
    Spline->SetMobility(EComponentMobility::Stationary);
    Spline->SetupAttachment(Root);

    SplineMeshParent = CreateDefaultSubobject<USceneComponent>(TEXT("SplineMeshes"));
    SplineMeshParent->SetupAttachment(Root);
    SplineMeshParent->SetMobility(EComponentMobility::Stationary);

    TemporarySplineMeshParent = CreateDefaultSubobject<USceneComponent>(TEXT("TemporarySplineMeshes"));
    TemporarySplineMeshParent->SetupAttachment(Root);
    TemporarySplineMeshParent->SetMobility(EComponentMobility::Stationary);
}
loud cove
fathom aspen
#

AActor::SetReplicateMovement(false); I'm not sure how this works

#

bReplicateMovement = false

loud cove
#

the logs say:

[2022.11.18-20.31.34:181][ 12]LogMyGame: Display: BP_RockCylindric_C /Game/Maps/UEDPIE_1_Spacefootball.Spacefootball:PersistentLevel.BP_RockCylindric_C_1: OrbitOnConstruction: not authority
[2022.11.18-20.31.34:181][ 12]LogWorld: Bringing World /Game/Maps/UEDPIE_1_Spacefootball.Spacefootball up for play (max tick rate 0) at 2022.11.18-15.31.34

so contrary to what I said, the OnConstruction does get executed and the problem might be there, still.

loud cove
fathom aspen
fathom aspen
loud cove
#

so the Parent Actor spawns the child actor in its own OnConstruction. This causes some headaches because OnConstruction is called a lot. For replication, I don't want the child to be spawned in OnConstruction and I might still have to make sure that I really don't do this accidentally

loud cove
fathom aspen
#

SetReplicateMovement speaks to Push Model

#

I don't think there is any PushModel at compile time

#

Or at the time of construction to be clear

loud cove
#

SetReplicateMovment really only sets bReplicateMovement

fathom aspen
#

Because it's meant to be called at runtime

#

And it marks the property as dirty and could have another side effects

loud cove
#

as I said, different function. note the "d"

fathom aspen
#

I wouldn't call it myself in the ctor

fathom aspen
#

And you're replicating it too

#

OnConstruction is not the function u want to use

#

You could for example use PostInitializeComponents with checking for authority/NetMode

loud cove
#

Maybe my problem is that one of the "Actors in Space" is actually a pawn that then gets possessed.

#

The other actors in space don't cause trouble. I can't verify that their orbits are replicated properly (because the game crashes before I see them), but by passing through my code with the debugger, I know for sure that the pawn's orbit causes the crash, and not the other actors'

jolly siren
#

Why does RootMotionSource have a Duration if RestorePreAdditiveRootMotionVelocity just restores your velocity back every tick the root motion source is active?

#

I want an additive root motion source that is meant to continuously increase your velocity

low helm
#

Not home to confirm

quasi tide
#

The actor is being created.

fathom aspen
#

The path I linked earlier has to be executed for the actor to spawn properly

dim trail
#

how costly are replicated variables vs server RPCs?

fathom aspen
#

It's not a matter of cost, but which to use. You don't choose one over the other because of performance, but because which fits the particular circumstance.

#

Also they could be structured different, so it's hard to find a general answer.

#

But generally speaking I believe replicated variables consume less resources.

elder sable
#

Hi, does all playerstate have a pawn ?

fathom aspen
#

They have a property called PawnPrivate, but there's no such requirement that it will be set.

elder sable
#

Mhh if i set a pawn to each player and i never unpossess/destroy, how a playerstate can have a null pawn ?

sinful tree
elder sable
#

Ok thanks !

merry pebble
fathom aspen
#

Check the logs

timid moat
#

Hi!

#

It seems that with OpenLevel each player appears in a different level. How do I fix this?

#

Thanks!

fathom aspen
#

You ServerTravel

#

Using ExecuteConsoleCommand(ServerTravel MapName)

#

Also has to be done on the server

timid moat
#

Thanks. I have two players, they have to set up their names before move to the next level: there is an empty level with a blueprint widget to set the name, and when they set it, they will travel to the next level. Reading the documentation about UWorld::ServerTravel it says: All connected clients will follow. But if one player hasn't set his name yet, it will travel also, isn't it? Thanks.

rocky topaz
#

does anyone know how the replication of the WheeledVehiclePawns in the vehicle template works?

#

I'm looking at the code but I don't see any replicated properties

bitter oriole
#

Well, is it replicated at all?

timid moat
#

I'm going to re-read that part in the compendium.

rocky topaz
bitter oriole
rocky topaz
#

I tried it a couple months ago by setting more players but the template doesn't have multiple player starts so it spawned the others in the ground which made me assume they weren't

rocky topaz
bitter oriole
#

That's my point though

#

Handling autonomous proxy at 100 ping is the hard part

#

For pretty much any movement

rocky topaz
#

yup it's really terrible

#

and I'm trying to think of it but I can't figure out a good solution

#

it's for a school project and we only have 2 months left

#

(and I'm the only dev)

#

I'm thinking of basing myself on the template and trying to improve it if I can

bitter oriole
#

The good solution is rollback+replay and a few months of hard work

#

Hoping the physics engine is deterministic enough

rocky topaz
#

I could do that but idk how I could simulate a physics step

bitter oriole
#

The realistic solution is fully client-auth simulation

bitter oriole
#

As in keep everything on the client, have it upload the velocity, inputs, transform on tick, implement some cubic interp on other clients

#

Hope no one cheats

#

Still hard

rocky topaz
#

we have a "multiplayer programming" teacher that never touched unreal or made a multiplayer game I'm afraid of how he's gonna grade this

bitter oriole
#

Fortnite does precisely that approach, if that helps

rocky topaz
#

nah that's easy honestly but hope no one cheats should imo not be accepted in a multiplayer game

bitter oriole
#

Last I heard anyway

rocky topaz
#

really?

bitter oriole
#

Presumably there's a massive amount of server-side checks

rocky topaz
#

they just validate to check for cheating? or check of tampered clients?

#

yeah

#

well maybe I should do that then tbh

#

still I don't know how it works in the template now I can't find the replicated code but since the vehicle doesn't move until it gets an answer from the server I guess the input is handled through an RPC

#

should I just use physics without the wheeled vehicle? (my vehicle doesn't even have wheels anyway)

bitter oriole
#

Probably best to use physics + client auth, quality wise

rocky topaz
#

thanks a lot

thin stratus
#

Most vehicle implementations are client auth, yop

#

Especially in games where it matters, like racing sims

rocky topaz
#

yeah, I was watching a course by gamedev tv and they were using a system to save a move history and replay it but it was using their own physics simulator (which can't handle gravity, ramps or anything)

thin stratus
#

I once started a coop race in F1 and the game thought it was a wet race while my friend had a dry race. And yes I did slip away while the bots were on dry tires just flying through the wet track

#

Move history is what the character movement component does

rocky topaz
#

yeah I can see it work well for simple physics

thin stratus
#

But that's not a thing for most complex physics

#

Especially if you really use physics

#

Chaos might support it somewhat though

rocky topaz
#

support what? :0

thin stratus
#

The problem is basically that you would need to save the whole physics scene

#

Cause when replaying you'd need to also replay the rest of the physics shit

#

That's why CMC doesn't support physics at all

rocky topaz
#

that's quite cool but this sounds like it would be so heavy on the server

thin stratus
#

Yeah it's totally unreasonable

#

Hell Let Loose has vehicles server auth

#

But that's not a sim and frankly doesn't care about delay and corrections

#

But most other racing games are client auth. F1, iRacing, Trackmania, Assetto Corsa ( or however you spell that )

#

Or. They are so arcade that the car is just a sphere in terms of collision

clear island
#

hmm I wonder what type of server side checks could one do for such cases

rocky topaz
#

I don't understand why the vehicle template isn't client auth though it's so painful to try it in multiplayer with any ping

thin stratus
rocky topaz
#

and I still can't figure out where their replication is done, rider isn't allowing me to jump to the components outside of my project so I'm exploring very slowly

thin stratus
#

And even there were lots of cheaters who modified the replay files

#

Or played the game in slow motion

#

Cheaters gonna cheat

clear island
thin stratus
#

You should be able to jump to plugins and engine code just fine

rocky topaz
#

I forgot where it's enabled

thin stratus
thin stratus
#

The F1 bug that I had also raises the question if one can easily cheat wet races by making the local game think it's dry

#

But who cares about that game anyway...

#

Ultimately if you cheat and you get reported with video and replay proof you are f'd anyway

clear island
#

when it comes to vehicles I just decided to buy a vehicle system off the marketplace, I cant be bothered dealing with all its complexities, not even talking about the cheating aspect of it but more the networked vehicle physics

thin stratus
#

The thing is, you can network a lot for vehicles. After all they are mostly just vector driven

#

They might have a few more state variables, like tire data, grip etc, but you can fully network them

#

But it's not fun for the driver if they get corrections

#

Not even a single one

#

At least in sim racing that is

rocky topaz
thin stratus
#

You have to diff between physics and just vector math

#

I wouldn't use physics if I want it networked

#

Not sure about chaos ATM though

clear island
thin stratus
#

I would not bother predicting actual physics

#

Again not sure about chaos

#

But pre chaos def wouldn't bother

clear island
#

the vehicle system I bought uses chaos

#

and it looks consistent

thin stratus
#

Yeah chaos might work. I haven't read into it yet

clear island
#

but its ticking the physics manually

#

as in, in a fixed timestep manner

thin stratus
#

How does it handle reconciliation?

clear island
#

no idea, I just bought it 😄 but I know the collisions are server side

thin stratus
#

It must keep track of the moves for ping and replay reasons

#

Wonder what they all keep track of

prisma snow
#

Fixed timestep is one of the requisites for determinism, but not the only one.

clear island
#

I really like it, but there's still some issues when it comes to colliding with players because CMC's replication and this vehicle system have different replication intervals from what I learned

#

to there is some replication fighting going on at times

thin stratus
#

Collision between two predicted actors is going to cause issues either way

clear island
#

which I have reported so atm I'm wating for a fix on that

thin stratus
#

One of the two will be wrong

#

When you drive into a player, the player might already be gone

#

Cause you only see the ghost that is more or less a full RTT late

clear island
#

when I drive into the player the collisions are pretty ok, its more the other case thats the problem, when the player runs into the vehicle

thin stratus
#

So either the server trusts you and the player on their end dies even though you missed them on their screen

#

Or other way around

#

Right

#

Does it just freak out?

clear island
#

kinda

#

thats the result^

thin stratus
#

Strong person

clear island
#

only happens on the front of the vehicle

thin stratus
#

Can't you disable the pushing?

clear island
#

because character replication seems to "push" the vehicle down, and then the vehicle replication kicks in and pulls it back up which results in that

clear island
#

I created a passenger type system , when the player enters the car I'm disabling the CMC's tick completely and that prevents the replication fighting from happening between CMC's and the vehicle rep system but in the other case from the video above I cant do that since I'm still moving the character

gusty raptor
#

Hi, anyone knows how to manually spawn the player pawn by a event?

#

How would i call `Event Handle Starting New Player After my custom terrain is loaded?

civic seal
#

Any clue where I can inject a fake input vector on the serverside to mimic inputs coming from the client?

#

I mean I'm reading the code in the meantime etc etc, but advice is always appreciated

woven basin
#

just call the function and pass a vector? That's all the client is doing to the server, so you can do that yourself for the "same" result

thin stratus
#

You can either change acceleration or the velocity vector directly

civic seal
# thin stratus PlayerInput is just acceleration

The issue I'm having is that it's protected, and there's a pawn with a whole bunch of stuff in it that is derived from Character. I really want to avoid modifying the engine which is what afaik I'd have to do to access a protected variable. In general I'm kinda writing my own movement component anyhow because I wanted to have some esoteric oldschool movement mechanics, so it's something that'll fix itself eventually and yet

I'm working for an employer and I recently wrote an AI system that is meant to feed inputs to pawns, the issue is that the pawns spawned also belong to dummy controllers spawned on the server side. My best guess is that since there's no clientside versions of these Controllers, the whole back and forth between client/server versions of UCharacterMovementComponent can't happen.

I am in the process of writing my own stuff that would address this, but I need to deliver results(tm) on a system that is meant to be marked as completed. Which works in PiE but the CMC fuckup I created completely bricks the movement on a packaged server

#

Thats why I'm kinda digging for a way to get CMC to gobble down my inputs in whatever cursed way I can given the current circumstances

#

I'm thinking as to what should actually cause this, because CMC works in Standalone games right? And in PiE there shouldn't be a client version of the controller either because it's just a local player that gets created on the server side.

@thin stratus I'm sorry for the ping, but just one question - what fundamental difference between a packaged server and a PiE server produces these different behaviors there? Given my cursed setup (which I promise I'll fix, I'm just lowkey drowning rn)

#

Because of course there would be a difference, I'm sure, but I think maybe switching ownership around on the pawn may resolve this temporarily while I put the fires out?

thin stratus
#

So

#

One thing after another

#

You should be able to just modify Velocity

#

I can't recall that being protected

#

Difference between packaged server and pie should not affect the cmc

#

The Tick function of the component only goes through the whole client code if it's a client autonomous proxy

#

The only other paths are simulated proxy and then server itself

#

@civic seal

#

Ownership might not solve this as only a possessed pawn gets autonomous proxy iirc

#

Characters controlled by AI in a Multiplayer setup have no client prediction etc. You can only rpc to the server and feed the CMC with data there, but that has no prediction and reconcilation then

#

The CMC is very much build for the single controlled character situation of a traditional unreal tournament

civic seal
civic seal
#

That's why I was trying to figure out exactly what it was that I broke

#

but considering that I simply needed a bandaid, I think I can get away with my crimes by just altering velocity

#

until I clean up this mess

civic seal
#

I've been reading up on how CMC works as a whole just recently, my knowledge is spotty at best, but thats just my guesses

thin stratus
#

Not sure. I didn't follow the ai stuff much in the cmc

civic seal
#

Regardless tho, I do appreciate your nudge towards the velocity thing.

thin stratus
#

There is some requested acceleration

#

For ais

civic seal
#

Oh I wrote my own caveman AI

thin stratus
#

Maybe that's what is used so input are not even taken into accohnt

#

Account

#

Fwiw breakpoint CalcVelocity

civic seal
#

The way it works is it's a separate object that gets a playercontroller spawned for it which is identical to the one players use. It's on the server side only

thin stratus
#

And see what is actually used for the ais

civic seal
#

roger, will do!

timid moat
#

I want to travel to a level for the first time. Do I need to use non-seamless?

#

Thanks!

fathom aspen
#

No. But if that's the first level the connection loads then yes.

timid moat
fathom aspen
#

That's hard travel, because these two levels are different servers.

fathom aspen
#

Unless by Main Menu you mean you have all players together, pretty much like a pre-game map

timid moat
fathom aspen
#

Yes then they need to hard travel 100%

#

The game map/session is hosted on a different server that they connect to

#

Any server that you connect to the first time will end up in a hard travel

timid moat
#

I though both were on the same server.

#

Now I'm testing with the Editor, and one is a Listen server and the other a client.

fathom aspen
#

A seamless travel could occur if say for example you make them travel to a newer map from that map they are already in.

#

When you travel you should specify a URL. You can either specify a server url or a map. You can't specify the game map from MainMenu level and hope that all other clients will connect to it.

#

It just doesn't make sense

#

You need to have a server hosting the game map so they can connect to

timid moat
fathom aspen
#

When they are connect to the game map, say you want to make them all to move to game map 2 then you could seamless travel for example

kindred widget
#

Makes me curious how Apex handles this with parties.

fathom aspen
#

Apex isn't made with UE right?

kindred widget
#

No. Source Engine if I recall correctly. But I mean how you'd manage that in Unreal.

fathom aspen
#

Yeah, I haven't played it in a while, but I would guess they use the so-called beacons in Unreal

#

I think beacons are already part of the EOS framework, and they are so powerful when it comes to party stuff

timid moat
#

Do I have to use sessions for every multiplayer game I make?

kindred widget
#

Yes.

#

Session are connection info, nothing more nothing less really.

timid moat
#

OK. So I need to use it.

kindred widget
#

Funny enough, Epic even started using Sessions for Offline gaming recently in UE5.

fathom aspen
#

Well you also get created a GameSession by default, which is like an interface with sessions and stuff

kindred widget
#

Offline, single player map for example.

#

It's less useful for Steam. Not sure if EOS is using it, but consoles have specific online/offline requirements for stuff. So I guess it's easier to just make a session to handle holding the same data you'd look up if you were looking for connection info.

timid moat
#

Where can I learn more about this? Yes, the compendium is really interesting, but I've read it twice and I don't know how to use sessions (because I don't know what they are). Thanks.

kindred widget
#

A Session is just connection info. It holds information a client would need to connect to the host and join their map, and also extra info based on what the game wants to show in their session UI.

timid moat
#

I don't understand what the host is or why they are on different servers. Now I have one player in a Listen Server, and the other one in a client. Who is the host in this scenario? And what are the different servers here? Thanks.

sinful tree
# timid moat I don't understand what the host is or why they are on different servers. Now I ...

When you're testing in editor, you're not getting the real experience.
Play In Editor forces any clients to automatically connect with the server, whether that's a listen server (play as listen server) or a dedicated server (play as client)
In a real world scenario, a player would boot up their game and not be connected to anything.
If you're using listen servers, then a player would choose (or in some instances, you make the game choose for them) to host a game, and that is where you would then establish a session.
Once the session is established, other players could then find said session, and have their game connect to that session.

The host typically refers to when you're using listen servers and it's the player who's copy of the game is acting as the server. Other clients connect to the host's instance.

ember vine
#

is it possible for a multicast to get lost in the void and soemhow never make it to a client ? even with reliable

pallid mesa
#

yeah if your bunch size exceeds max bunch size (had that happen to me lol)

#

or if the reliable buffer gets filled

#

or if you get disconnected 😄

#

but remember that multicasts are only sent to relevant connections

ember vine
#

luckily all my players are always relevant popoga

#

by the way, i got that up and running, but i still ended up using the paragon approach as doing a world override in that start play is significantly more overhead @pallid mesa

#

i have a stripped down uobject that can play killcams and return back if you ever would want that for some reason

pallid mesa
#

I do! I would be interested in a blog post or some sort mainly to share knowledge amongst the community

#

so if you can make it accessible to developers across the world by the means of a post or a github sample project it'd mean a lot for me as an advocate for open source solutions

ember vine
#

yeah i plan on doing that very soon, i am keen to finally contribute somethign useful to the UE community LUL

pallid mesa
#

😄 huuray!!

#

just lmk when you do

#

and dont postpone it too much

#

because what ends up happening if you do is that you never get to do it

#

XD

ember vine
#

very true, and only thing delaying me currently is i've still not fully got my head around the functionality yet, even though it works perfectly, and if i write a blogpost for it i wanna make sure its all factual/good info in there about everything - since there's a ton of stuff going on

#

1 thing thats crazy about that paragon sample is how messy it is though, literally like 40% of the code in there is unused and ripped directly from UT

#

and the rest is also just weird

#

also many things need to be done on next tick otherwise it just crashes with random errors every time, but trying to truly understand why thats teh case

pallid mesa
#

what you can do is to start writing as you work on polishing the system

#

thats what I do when I draft create a system

prisma snow
#

wait the buffer is not relevant, I am using unreliable RPCs for the big chunks of data

pallid mesa
#

the current maximum size is 65536 bytes (64Kb)

#

and the realiable buffer size is 256

#

iirc

#

@prisma snow

prisma snow
#

oh wow, I am only at 12Kb in the worse case scenario I think

pallid mesa
#

I had a use case where I exceeded it

#

and I had to do chunking

prisma snow
#

My first test with the networking system we are doing went well but it is pushing bandwidth quite a lot

prisma snow
pallid mesa
#

any instance of streaming massive amounts of data

prisma snow
#

yeah I see

#

I am RPCing big arrays of ints, to sync positions of units in RTS context

#

but the updates are batched and broken into chunks

#

so it's max 200 structs per RPC, each with ~4 int16

#

probs we can diminish it a bit more still

#

BTW, if I send a 0 value for an int16, does it get compressed so that it is not 16 bytes in the final package?

frail skiff
#

Hi guys, I'm trying to figure out how to replicate destroying an actor where the client looks at the actor on their screen and then asks the server to destroy it. Sadly, so far this only works when I play as the server in PIE - it replicates successfully. But when I'm playing as the client, asking the server to destroy the actor does nothing.

#

For the record, the client asks the server to spawn the object to. It's basically some building functionality where the player can place down objects. The player makes the request to place the actor, and that all replicates nicely. Destroying the actor from the client isn't replicating when the RPC is made by the client, though

#

Not sure if this is the problem or not, but I'm curious: if the object you want to destroy is targeted by hitting it with a line trace, and you pass that targeted object onto the server to destroy, does the server know automatically to destroy that "same" object on all clients? Or does that not really work?

prisma snow
frail skiff
#

Does that mean the client doesn't have authority even to make the request of the server to destroy it?

sinful tree
#

If you're calling the client -> server RPC in the spawned actor, and the actor is not owned by the client, the RPC will not go through.

prisma snow
prisma snow
frail skiff
#

To place the actor, the client provides a location, rotation and class to the server, and the server spawns it

prisma snow
#

What Datura said is key

frail skiff
#

To destroy it, I'm hitting it with a line trace and passing that hit actor onto the server with a request to destroy it from the same component on the player pawn

sinful tree
#

Are you multicasting anything?

prisma snow
#

The instance of the class that makes the RPC has to be owned by the client I think. The network compendium has a nice table with all possible cases and outcomes

frail skiff
#

I've tried switching from Server to NetMulticast on that function a number of times, neither works

sinful tree
#

So right now when spawning it, you're doing something along the lines of:
Mouse Click > Go into Component > Run On Server RPC > Spawn Actor?

sinful tree
#

and when trying to destroy you're doing the same?
Mouse Click > Go into component > Run On Server RPC > Destroy Actor?

frail skiff
#

Correct

sinful tree
#

You're sure you have the component marked to replicate?

frail skiff
#

Can actor components themselves replicate?

sinful tree
#

Yep

frail skiff
#

Hmm, let me check

sinful tree
#

They need to be marked to replicate if you want to RPC through them, receive replicated variables, etc.

frail skiff
#

Well, in the player character blueprint the component was not set to replicate. I just hit that checkbox and that didn't change anything, unfortunately

#

The actual functions are all done in C++ though, and iirc when I tried to set up replication of the component in the cpp class none of the replication variables were recognized

#

Maybe they are different for actor components though?

#

Checking the docs. Apparently there's a function, SetIsReplicated() for actor components, instead of just the replicates bool

#

@sinful tree that doesn't seem to be it. Putting SetIsReplicated(true) in the constructor of the component doesn't make any difference. The object still doesn't get destroyed

#

(also tried SetIsReplicatedByDefault(true))

sinful tree
#

You were saying the functions were defined in C++ too, were they properly set up to be replicated?

frail skiff
#

There's got to be something I'm not understanding. I can post some code though

#

Here's where the client asks the server to destroy the object:

void ULHPlayerConstructionComponent::DestroyPlacedObject()
{
    if (ObjectHitResult.bBlockingHit)
    {
        AActor* hitActor = ObjectHitResult.GetActor();
        if (hitActor)
        {
            APlaceableObject* hitActorAsPlaceableObject = Cast<APlaceableObject>(hitActor);
            if (hitActorAsPlaceableObject)
            {
                Server_DestroyPlacedObject_Implementation(hitActorAsPlaceableObject);
            }
        }
    }
}

void ULHPlayerConstructionComponent::Server_DestroyPlacedObject_Implementation(APlaceableObject* objectToDestroy)
{
    objectToDestroy->OnDestroyed();
}
#

Here is the code that then gets called on the objectToDestroy:

void APlaceableObject::OnDestroyed()
{
    Server_OnDestroyed_Implementation();
}

void APlaceableObject::Server_OnDestroyed_Implementation()
{
    DoSFX(destroySFX);
    DoNiagaraFX(destroyVFX, GetActorLocation());
    Destroy();
}
sinful tree
#

Post the .h for these functions.

frail skiff
#

.h for the functions on the construction component:

void DestroyPlacedObject();

UFUNCTION(Server, Reliable)
void Server_DestroyPlacedObject(APlaceableObject* objectToDestroy);
#

.h for the objectToDestroy:

void OnDestroyed();

UFUNCTION(Server, Reliable)
void Server_OnDestroyed();
sinful tree
#

UFUNCTION(Server, Reliable)
This is what I meant when I was asking if they were set up right 😉
Everything looks ok at least to my eyes.

Last thing I can think of is if the Placeable isn't marked as replicated, but I think you have that covered if you're seeing it spawn on clients.

frail skiff
#

The placeable is marked as replicated. This is what's in the constructor:

    bOnlyRelevantToOwner = false;
    bAlwaysRelevant = false;
    bNetLoadOnClient = true;
    bNetUseOwnerRelevancy = false;
    bReplicates = true;

    NetUpdateFrequency = 100.0f;
    NetCullDistanceSquared = 1000000.0f;
    NetPriority = 1.0f;
timid moat
frail skiff
#

omg I fixed it

#

The issue was the dumbest thing. In the RPC's, I had written Server_DoXYZ_Implementation, when I should have just written Server_DoXYZ 🤦‍♂️

sinful tree
#

D'oh >_<

frail skiff
#

thanks so much for your help though Datura

#

at least I know this method was right other than the dumb suffixes

cerulean juniper
#

Hey everyone, I got me questioning: is there a rule to when to use Reliable RPCs

kindred widget
#

When you need to make sure it gets through.

#

Generally anything on tick, like movement inputs and such are unreliable. Doesn't matter as much if some are dropped. Interaction where you press the button once on the other hand you probably want to be sent reliably.

cerulean juniper
#

Humm... I see
thanks buddy

keen sigil
#

Can anyone suggest a tutorial for the combat multiplayer battle royal game?

#

Or any course from udemy or from any platform

fathom aspen
#

Do you understand the basics of networking in UE?

keen sigil
#

Yes

#

Also we connected 7 person with steam subsytem

#

With Advanced session plugin

#

I understand that point i need to make replication always for work to my multiplayer blueprints stufss

fathom aspen
#

Ok, if you understand the basics, then tell me why would a server RPC be dropped when fired from an arbitrary actor?

keen sigil
#

Just host and join

#

We had now

fathom aspen
#

That's not the answer, no.

#

I would suggest you look into pinned messages of this channel and familiarize yourself with them

keen sigil
#

For combat?

fathom aspen
quasi tide
#

Combat isn't all that special in battle royal. It's just an FPS/TPS but with a bunch of people

prisma snow
#

I have been looking at how Unreal handles network compression of some types - for example, FRotator converts floats to int16. I also know that bools are packed into just 1 bit.

However, I'd like to see how ints are handled in general - basically, I want to know if a int32 representing the number "3" will occupy the same size in a package, than for example a int8 representing the same number.

#

Which engine files could I look into?

summer tide
#

Hi - When you load a map in a multiplayer project, where do you put the code to load a loading screen so that it appears to all players?

prisma snow
summer tide
clear gate
#

hello, i need help.
i followed a guide for a synced network clock, but my results are far worse than theirs.
can someone tell me the formula to getting an accurate time from these?

fathom aspen
clear gate
#

do i have to do something with the values those functions give me?

fathom aspen
#

You would have to do what is told their.

#

I will let myself summon @pallid mesa considering he wrote that

summer tide
pallid mesa
#

or the moving window with the circular buffer?

fathom aspen
clear gate
pallid mesa
#

so it depends on the frequency that you are using, and on the size of your circular buffer

#

play around with these values until you get a desirable result

#

in the example i provided in the post I was using 1 second frequency and a circular buffer of 10 elements

#

how are you measuring the error?

clear gate
#

by trial and error i found this to give the smallest error

#

what were you using?

young spoke
fathom aspen
#

You passed the basics of unreal networking exam

pallid mesa
#

or how you test it

#

mainly because you are eating latency time by the time you want to print it on the server

#

the way you have to test it is on tick

#

since tick executes on the server and on the client

#

so you can have a parallel print of timings

#

and the one you'd use is GetServerWorldTime

#

you don't need to add the delta

clear gate
#

ahh

#

thank you so much!

#

it seems to work great now

pallid mesa
#

sorry for the high latency responses, I'm not paying much attention to discord lately 😅

clear gate
#

no prob man, thank you for help

#

im a big noob at networking

pallid mesa
#

remember, that in nteworking latency is your biggest enemy

#

and this clock tries to leverage that using NTP techniques 😄

#

so if you want to perform a proper test you need to do as I said and see tick printing the values (no need for an rpc there)

ember vine
#

so - in a client/server scenario, i'm tracking down a standalone-only bug. i wanna have a server run, but be able to keep recompiling and launching clients and autoconnect them to a server
i've always just launched the editor as debug game, run standalone with -waitforattach, attach to both, eventually load, start messign around
can anyone reccomend me a less painful way i assume there is one ?

fathom aspen
#

But what does -waitforattach do?

ember vine
#

wont startup the server/client until you attach teh debugger

#

pretty useful to find initialization issues

fathom aspen
#

Oh that's amazing, always wondered how could I do that heh

grave fog
#

Should the server open a port on listen server to allow other players to join ?

fathom aspen
#

Oh what does this do? (feels like I missed a lot of those)

#

I think it's a console command though

fathom aspen
#

Thanks for the explanation, I need to start using those

grave fog
#

do the server must open port on listen server ?

#

is there option that doesnt require to open port ?

fathom aspen
grave fog
#

is EOS Completely free?

grave fog
#

for Epic online services creating and joining sessens what to do if the server disconnect ?

grave fog
#

do epic online services work with any platform or only with epic games ?

quartz iris
#

Why's the linetrace not damaging the enemy player?

#

It has a trace going from the top of the saber to the bottom in the game

#

But it doesn't seem to work

sinful tree
#

Also, you need to supply the "Apply Damage" node the reference to any actor you want damaged in the "Damaged Actor" pin.

ember dagger
#

Also like you said it's using multicast I don't think apply damage can be called on multicast needs to be on server

quartz iris
sinful tree
#

If you're only spawning the effect & sound on the server, then no clients will see it. You do need a multicast, but all it should do is spawn the emitter & play the sound, and you only call it from the server when you want others to see the effect & hear the sound.

quartz iris
#

It doesn't even hit the player though aha

sinful tree
#

Check what your line traces are hitting? Verify what the world locations are on the server vs. what the world locations are on the client. Check if there is actually a return value on your trace. If there is, verify if the hit actor is actually a Phantom_BP (you can take Hit Actor and drag it into a print string node for example)

quartz iris
#

I can see the trace

#

It should be working..

#

It doesn't go green

#

from red

sweet ore
timid moat
#

Hi!

#

I'm developing a multiplayer game for the first time. The game starts on an empty level with a blueprint widget to let the player set his/her name. When the name is set, all the players have to go to the same map. Now, I'm using OpenLevel, but they don't go to the same map. One player is a Listen Server and the other is a client. What do I have to do to travel all the players to the same map? By the way, if I'm asking this again is because I still don't know what to do. Thanks!

olive kraken
#

Hello! We migrated our project from 5.0.2 to 5.1 and we have this weird behaviour of what could be a potential bug.
The rock of the left is component of an actor, the rock in the right is a static mesh. The character teleports when a montage with root motion is running and touches the floor of the Actor (most likely when is in walking movement mode, since when is flying replicates properly). We are seeing from client perspective. The glitching character is the server. It also happens with AI and replication is based on GAS.
Any clue of why this happens on top of actors would be awesome, or if I should proceed with a bug report.

magic furnace
#

bug or epic devs edited a function you're using, could also be some weird issue during migration

#

I had issues which required me to duplicate a blueprint after migration

#

because it would get corrupted or something (really unsure)

olive kraken
#

I found the issue and the fix, but not the whys. If you delete the SM component and reconstruct it will fix it.

#

I can't compute the connection between the SM and root motion replication, but the bug is fixable with just that, deleting and adding a fresh SM

magic furnace
#

yup

#

have the same thing happening during migration

#

it's very random

olive kraken
#

yeah, got also a couple of classes with unchecked replication

#

and in 5.0.1 was checked

#

like, really, really random

#

a couple of weapons here and there

magic furnace
#

it cost me like 10-20h for sure banging my head against a wall because I thought my code was bugged after migrating

olive kraken
#

likewise

#

It's been a bit bumpy

magic furnace
#

I haven't migrated my project yet to 5.1 as it seems it's not a good idea yet

olive kraken
#

and still finding odd things, with the dilemma of considering if is from my side or 5.1 side

#

I'm giving it a couple of extra days

#

I almost got all the things back to normal

magic furnace
#

I'm waiting for 5.1.1

olive kraken
#

but this one was worrying

#

yeah, the x.x.1 is the classic clean up 😛

magic furnace
#

got word that right now 5.1 is just a buggy mess

#

that loves to crash

olive kraken
#

will try a bit more till new red flags

#

otherwise yeah, back to 5 till next time 🙂

woven basin
magic furnace
#

Now I know it's not me unticking that box

#

I always thought I am insane

#

and doing it without realizing or something

gusty raptor
#

Hi, Anyone knows how to manually spawn the PlayerPawn when my custom terrain is loaded? I have a event inside GameState that is fired when the terrain is loaded.

hoary spear
gusty raptor
#

Ive tried spawning my pawn like in this video from my PC, however i got a issue..
https://www.youtube.com/watch?v=H0JZnWdY0k8&ab_channel=Kekdot

🧑🏻‍🚀Support us on our 💲Patreon for awesome benefits: https://www.patreon.com/kekdot

In this video we take a look at how we can spawn characters in multiplayer in Unreal Engine. We take a look at installing a function in the Game Mode that will locate player starts for us, which we then use in a Game Mode function that will spawn our players. Th...

▶ Play video
still arch
#

I have a general question, was looking in to some lyra code and noticed that in some cases lyra does not declare GetLifetimeReplicatedProps in the header file, but implements it. How does this work exactly? I always assumed one had to declare it in the headerfile.

gusty raptor
#

Inside my gamepawn, how can IsLocallyControlled be false?

#

It seems like i'm controlling on the server? why?

fathom aspen
gusty raptor
#

Tx 😅 i was confused about something

#

Its kinda obvious @fathom aspen though but thanks

fathom aspen
#

Lol it is

#

UE is the future

viscid tapir
#

Hello ! I need answers please ! I'm working on a special inventory system (a moba inventory like) and i'm keeping track of items being purchasable x times, so a player cant buy this item anymore if it has reached its buy limit. But how should i keep track of that ? i was doing it in the game state but i'm not sure if it is correct.. I was using an array for this

#

looks like that

fathom aspen
#

I'm not sure what a moba inventory is, but that seems to me like a shop in mmo. GameState seems reasonable, but it's always relevant, and I don't think you are able to always buy from that shop. But if it works for you as a prototype then it works

viscid tapir
#

a moba inventory is when you cant throw away the items from ur inventory. Only an add-remove system for the inventory but yeah def similar to mmo shops

#

what did you mean by "from that shop"

#

am i missing something ?

fathom aspen
#

Are you able to buy items at any given place in the game?

viscid tapir
#

Yes, there are many shops ( 6 i think) in the world

#

and each one is totally similar to another one

fathom aspen
#

So they are actors

viscid tapir
#

yes

fathom aspen
#

Why would you have their logic in GameState?

viscid tapir
#

I mean just the item max stacks in the world would have logic in GameState

#

am i wrong ?

#

bc it is replicated

#

Each shop (actor) can access gamestate

#

i believe

fathom aspen
#

An actor shop could be replicated too

#

Also GameMode dictates rules, not GameState

viscid tapir
#

oh ok

#

i'm a bit confused sorry

#

so i should move this code into their respective blueprints ?

#

i mean in the parent blueprint

fathom aspen
#

Also each shop could have its own buy limit that you check against

#

If you are blindly implementing these stuff in GameState you could end up in having a unified buy limit

viscid tapir
#

😳

#

Yes but it was just an example

fathom aspen
#

I'm not that familiar with your end goal as last time I played moba was in 2017

#

RIP Paragon

viscid tapir
#

oh i see

#

haha

#

moba are cools

glacial perch
#

Hey guys I got a quick question;
I use a vehicle from the marketplace that has full replication going on, so many multicasts and all for all interactions. But my game will be a single player game so actually don't need it.

Would removing all replicated BP content improve the performance or does it not matter if there is no server connection? To me it seems like a lot of extra code running for nothing.

fathom aspen
#

It wouldn't. You would probably end up having less memory, but not something noticeable at all.

olive kraken
#

5.1 issue if you get crazy about replication. I can confirm that specific classes, with no clear pattern, can override properties when you restart the editor. i.e I got a class that turns off replication property every time I restart the editor.

#

and I can also confirm, that while the change of a SM in editor fixed the root motion no rpc properly, once is packed, any SM component will break root motion rpc, even if in PIE worked

#

Here you can see the bug. This is recorded from client, the bug is visible in AI when using root motion and listen server player when using root motion too.

The shrine is a SM (Nanite) that belongs to a replicated actor.
This behaivour is visible in actors migrated from 5.0 to 5.1, as long as is and Actor + SM.

I fixed this teleport on PIE, replacing the SM by a new one. However, once is packed, the teleporting behaviour comes backs.

Funny point is that I died because velocity (impact) after a small jump from the shrine, usually in this happens from way higher velocities.

If anyone is migrating a multiplayer project to 5.1, with walkable rpc actors with SM, would love to see if you can reproduce this behaivour when AI/listen server uses root motion on top of those actors and you watch as client.

fathom aspen
#

Which you already did

timid moat
#

Hi!

#

What are Multiplayer Sessions?

#

Thanks.

still arch
#

Does #if WITH_SERVER_CODE work with listen server? I get some mixed answers where some are stating this does only work for dedicated servers.

#

And if it does not work for listen server is there an equivellant variant that I could use?

latent heart
#

No reason ti shouldn't?

prisma snow
#

sounds like a good candidate for a test

still arch
#

Actually first time seeing that macro looking in to LyrasHealthComponent, still consider myself a beginner when it comes to UE. But continue looking in to this it seems UE_SERVER macro is for dedicated only while WITH_SERVER_CODE works for listen servers as well.

#

I'll just assume that's how it is and add a mental note to self.

prisma snow
#

maybe wrap some ue log with the macro, and see if it is getting executed with a listen server

still arch
#

Do you see UE logs in packaged projects? It's when it's packaged some said that the block of code did not work as intended on listen servers.

prisma snow
#

mmm I think you can on debug packages, maybe on development as well.

#

If logs are not a good fit, you can also put another dummy thing to test inside the #if, which is easy to notice

still arch
#

Indeed, I'll figure something out, appreciate you!

latent heart
still arch
#

Is there a collective name for these types of macros? Maybe I could find some blog or something listing them all with explanations?

#

There is so much to take in learning UE, always great to find good sources of documentation.

prisma snow
#

there is also a NetMode enum that can be queried, cannot remember the name of the function

latent heart
#

In this case he's trying to completely exclude code, not just create different code paths.

still arch
#

Exactly, it's the HandleDeath logic, guess that's why they would want to exclude it.

latent heart
#

However

#

Remember that just because something is compiled as a listen server, doesn't mean it's always running as a listen server.

#

It can be a client too.

#

So you need both code exclusion and code paths.

quartz iris
#

Guys

#

Why do the effects not play on the client and only the server?

sinful tree
#

Don't pull variables across execution paths. Clients will not know what that "Location" value is as they never performed the line trace. You'd need to add a vector input to your multicast and feed in the value from your hit result when calling it. Then on the event output plug it in to your spawn emitter and play sound nodes.

rocky night
#

Question in General, is it necessary ( in most cases ) to change the bandwidth max and such in the Project Engine ini ? Its now set to max 10kb… isn’t it really low?

young spoke
#

Are there any available macros/templates for compile time server or client branching (as opposed to runtime if statements)

sage light
#

My client crashes with that error which is probably related to networkphysicsprediciton, do you have any advise?

grave fog
#

does client can read and write gamestate and player state ?

#

@tender jay thank you the gamestate is one for all the game and each player has his own playerstate . right?

proven fog
#

How do I make an actor (an FPS counter, created via a UChildActorComponent on the player's Character) exist only for each client? If I can only make it hidden to other players, that's fine, but since it's running every tick, I figured that not creating it at all would be better.

grave fog
#

@tender jay So on gamestate and playerstate no need to set variable to replication?

fathom aspen
#

You do if you want the variable to be replicated

fathom aspen
#

Second of all what is an FPS counter?

proven fog
fathom aspen
#

And why is that an actor?

proven fog
#

It's a VR game, so I'm doing it via some TextRenderComponents in an actor attached to the wrist.

#

Instead of a basic widget solution

#

It's one component for the rate, and another for the title "FPS" below it, so I did an actor.

fathom aspen
#

Actors are resource heavy

#

You could do it via WidgetComponents

proven fog
grave fog
#

@tender jay thank you

grave fog
#

does onpostlogin get called when the server login?

fathom aspen
#

It does for host and for every other player on hard travel

#

Disconnection bookkeeping I would say

#

Correct, I wouldn't subclass it really if it's not match based

#

But the disconnection part could really make it into any game

#

I still wonder why it's not part of the GMB

#

Oh yeah, that's right

fathom aspen
#

I wish I did by now

#

But real talk, I would if they subclassed baseless GM

prisma snow
#

What is "baseless" GM? I know regular Game Mode and GameModeBase, but not that one :D

fathom aspen
#

That's one of the Wizard-Laura codes

#

㊙️

prisma snow
#

damn xD

fathom aspen
#

Actually it's the former

#

It's baseless because it's missing "base"

prisma snow
#

hahaha

#

makes sense but in the context of OOP I wouldn't figure it out xD

#

Also I didn't know your compendium, have to read it

fathom aspen
#

Great news, will be here for any questions 🤓

#

Treaty of Alliance when?

prisma snow
fathom aspen
#

Easy, 10^32 options to guess

fathom aspen
#

We are double hexa now

prisma snow
#

Much better than manually saving the options in local GameInstance or something like that

fathom aspen
#

Of course, but to be fair I'm more biased towards having a local saving system, pretty much a LocalPlayer Subsystem

#

Because the things you are saving could get really complicated

#

And I find URL options useful more for basic data types

#

But yeah it's a self-preference

#

The options are really endless, and I would suggest you read it to the fullest and then reconsider your own preference

prisma snow
#

Mmm I see, didn't consider using a subsystem. Tbh it's a topic I've not researched much, I'm more worried with the core of the game for now.

But a nice and well made setup from menus and UI until the multiplayer game starts will require thought and design in the near future :D

grave fog
#

when I use get playerstate .what is playerstate index ?

fathom aspen
#

You don't use that node

#

Neither you do use any node that has the index part when getting game-framework actors

#

There are always other ways to get the actor in question

quartz iris
#

How do I show the winner of the game on text in a widget?

#

This method only works locally

fathom aspen
#

Of course because widgets are local

fathom aspen
#

Replace it with GetOwningPlayer

#

Actually this is not how this is all done

#

You are using PlayerController and it doesn't exist for other connections on client

#

You have been told that before

#

PlayerName is already part of PlayerState

#

You use it instead

quartz iris
#

Interacting with widgets in multiplayer doesnt make any sense to me

fathom aspen
#

The name of the winning PlayerState will be broadcasted to all clients

fathom aspen
fathom aspen
#

Player7 wins, they have the name "Wizard", then the GameMode tells GameState this happend, GameState in return has PlayerArray which it iterates and sends client RPC that access HUD which displays the widget with the name "Wizard"

#

Glad I won that game

quartz iris
#

gg

grave fog
#

how to get owning playerstate ?

fathom aspen
#

From?

grave fog
#

I run rpc run on server

#

and I want to get this players playerstate !

fathom aspen
#

From which actor class you do that?

grave fog
#

player controller

fathom aspen
#

Unexpectedly it's through a property called PlayerState

grave fog
#

I think its will get the servers playerstate

fathom aspen
#

Yes, you're on server, that's normal

grave fog
#

bet I want the client one

#

the client who call that rpc

fathom aspen
#

You can't get it

#

It also doesn't make sense to get it

#

What are you trying to do?

grave fog
#

for Example I if I store players names on players states I want to get this players name

#

from his playerstate

fathom aspen
#

PlayerName should be stored on server and replicated to client

#

So you have your name on both sides

grave fog
#

yes server who stored them

#

but I want the client read his name

#

how can I make the client read his playerstate

fathom aspen
#

They will if they use PlayerState property

#

No matter if they do it server-side or client-side they will end up getting their PlayerState

#

Name will be available on both sides

grave fog
#

thank you so much

#

@fathom aspen I want the srever to chane the clients variable not the servers one

fathom aspen
grave fog
#

I think the srver change his player state like this

fathom aspen
#

Already told you not to use that node

grave fog
#

what node to use

fathom aspen
#

Just PlayerState

grave fog
#

this one

#

oh thank you

olive kraken
#

I reported already this bug, but just have this video for the record about the root motion issue in 5.1
Boxes are just normal actors with a cube inside. Ground is a Static mesh. RM in AI/Server is erratic on top of the boxes (actors) and updated properly on top of SM (grass floor). Captured from client side on steam.

#

worth mention this is a new behaivour didn't have in 5.0.2

#
  • on PIE works, packed doesn't
real ridge
#

I have no idea How I can check if I am connected to internet , so if connections will drop I will tell.player he is offline, any ideas?

rocky kestrel
#

If I do save game to slot in ThirdPersonGameMode (Dedicated Server) where save file goes? To Server folder or? Shipping build

olive kraken
#

A new update on this new 5.1 teleport root motion behaivour.
Now all characters use vanilla movement component. There are two actors with a white box static mesh. In the first one root motion replicates as expected, in the second one the teleport glitch comes back.
Funny point? Well, they are both exactly the same actor with a cube.

dim trail
#

would it be a smart idea to use a replicated bool value for status effects such as a stun and on rep them to multicast an animation

echo dragon
#

hello people, what would be the best class and method ( i guess between character and player controller) to create a UI after server travel ? i tried OnRep_Controller, Restart, OnRep_Owner but thex don't work as expected

echo dragon
#

I did that,

{
    Super::Restart();

    FCharSavedData CharData = Cast<APlayerStateBase>(GetPlayerState())->CurrentPlayerChar;
    if(IsLocallyControlled())
    {
        UE_LOG(LogTemp, Warning, TEXT("MTD char Restart") );
            CreateHUD();
    }
    
}
#

that was one of the first thing

agile loom
agile loom
echo dragon
agile loom
agile loom
echo dragon
agile loom
buoyant ridge
#

does unreal engine 5 support online multiplayer deterministic physics?

chrome bay
#

no

buoyant ridge
#

💀

echo dragon
chrome bay
#

Just have the HUD keep track of all widgets and remove them when it's destroyed

prisma snow
buoyant ridge
#

nope i need full determinism

dim trail
#

would it be a smart idea to use a replicated bool value for status effects such as a stun and on rep them to multicast an animation

prisma snow
# buoyant ridge nope i need full determinism

even if Chaos was deterministic, Unreal engine isn't by default, so full determinism is bordeline impossible.
What it is possible though, is to make a separate module in another thread, that ticks independently from the engine, and build your game logic there, and only use Unreal as a rendering & input/output system.

echo dragon
ocean vessel
#

Hello, I've done the impossible and I managed to somehow desync Character Movement between Server and Client

I have a character that when hit, Calls a function that applies impulse and sets velocity to bounce off stuff based on reflection normals.

90% of the time it works well, but in some crazy cases(lots of obstacles, rounded reflection surface) the server and client bounce with different velocities and client doesn't "snap back" until a random moment (usually hitting an obstacle on the server), which for some time generates a butterfly effect (server bounces off stuff, Client also does but as he's in different position he goes into different place, also sometimes bounces when server doesn't, and suddenly the character's position on the server and client differ in thousands of units before randomly snapping back)....Does anyone know what can be the cause for such big desync?

real ridge
#

I have no idea How I can check if I am connected to internet , so if connections will drop I will tell.player he is offline, any ideas?

oak hornet
#

hi, can someone answer this two questions

  1. is logic to have windows server package, and android astc clients?

  2. can i have different plugins in clients and in server?

thanks

oak hornet
real ridge
real ridge
#

best way is to try it

oak hornet
#

i cant paste the link, dont know why but search for "unreal c++ http rest request"

real ridge
real ridge
#

and if destination won't he accessible then flag it as internet lost

#

right?

oak hornet
real ridge
#

i just don't really know what is ussual way to notice player that he lost connection and based on this information print it on monitor and try to reconnect him, that's why I am asking I have no idea what is best way 😦 so i will try make it via varest tho @whole grove @oak hornet or better tips ? firstly I thought there is native function for it in unreal BCS in log of standalone after no internet connection I get disconnected from session and there is message connection lost but I dont know how to detect it in code

woven basin
#

If I wanted to pause a multiplayer game (dedicated or listen server) - conceptually I could just do an RPC to the server from the PlayerController, have the server "pause" the game there, and then do an RPC to each playercontroller client to "pause" thier local copy as well?

Does "pausing" cause any strange things to occur with replication? i.e. will I be able to simply broadcast "unpause"?

real ridge
#

gonna check it on pc I can't open it on mobile , I did search for it maybe u won't believe me but I really did

#

i checked it but after my internet drops I am still on "map" and I can move

#

I don't know but when I was testing it sometimes after 2 minutes without internet I was automatically kicked from session to menu and sometimes not I don't understand this logic, also I will try this destroyed() what u sent in link

#

true

dim trail
#

What would you consider a low frequency timer

modern cipher
#

Is there a function that gets called when the player array is updated in the game state?

agile loom
modern cipher
fathom aspen
#

OnRep_Score for example

timid moat
#

I have two players, one as listen server and the other as client. Both are in an empty level with a blueprint widget to set their names. When a player has set his name, he presses enter and I run this code:

#

When the player on the server runs the Open Level node, the level on the client reloads (it reloads the blueprint widget), and now it runs as the server.

#

Do you know what I am doing wrong?

#

Thanks!

timid moat
# agile loom I'm not sure but try this node

No, because I have no idea about what I'm doing. I think I trying to use a lobby where all the players land and then go to the game. By the way, I haven't use it because in the documentation say that it will travel all the players to the new level.

#

Thanks.

agile loom
timid moat
#

Imagine I want to do a first screen where the player set his name. Once set, he goes to the game. If I'm using a Lister Server architecture, with one player as a server and the rest as clients. What steps do I have to do?

#

Thanks

agile loom
agile loom
timid moat
#

OK. So, the server create the session and let the player playing in the server set his name. After that, the player in the server, will join the session?

timid moat
agile loom
#

For example, while the player is in the main menu (and has not joined any session) get the name, save it in the game instance, then search for the session, after joining the session, use a Server function to send your name to the server, after that server should multicast it to other clients

agile loom
timid moat
agile loom
timid moat
#

Thanks. Will the player on the server join the session? or he doesn't need to join the session?

agile loom
#

And I guess you need to enable the Use LAN if you testing in the editor

#

Modify the Public Connections and Max Results based on your need

timid moat
#

I have a lot of things to learn.

#

OK. The player on the listen server will set his name, and after that the server will create the session.

agile loom
copper grove
#

when you replicate an actor, does it replicate the entire actor across the network or just a ptr to it

#

like for example : i have a gun varaible in my player, its replicated

agile loom
timid moat
agile loom
#

First create a session and open a map, now you have a session to join
then on the client try to find sessions, after finding the session join it
I'm not sure, but I guess in the editor in order to test and connect, you need to enable Use LAN

timid moat
agile loom
#

You can change a replicated variable on the client without telling the server, and the next time server updates this variable, clients will receive the update as well

#

For example, you should replicate the player's health so that the server decides to kill the player or not and the client only receive the health value to display it on the screen

sinful tree
#

You normally do not trust the clients to tell the server any values. The server can normally determine most values on its own without client input. In the rare case where you do have to trust client input, you should limit what they tell the server and validate what they are asking.

Therefore, any values that are fine to set on the client only are things that should not be gameplay related and can be cosmetic. Example: The player opening & closing UI - the server doesn't care about this really, you're setting values on the client when doing so, and it shouldn't impact gameplay at all.

pine reef
#

Hey, I dont know if there's a channel specific for this, but I'm looking for a tutor to help me with multiplayer. I posted a request in CodeMentor can I share the link here?

sinful tree
pine reef
#

alright, thank you

clear gate
#

can someone tell me how does unreals get ping in ms node work?

#

from the player state

#

is it accurate?

kindred widget
#

Define accurate?

clear gate
#

how often does it update and how does it determine said ping

#

i cannot find information about this on the net

kindred widget
#

It seems to update via UNetConnection's ReceivedPacket.

prisma snow
#

#sourceCodeTime

#

I found ping accurate enough to be useful, but I wouldn't rely on its accuracy for something that needs precision

pallid mesa
#

if u need timestamped precission feel free to use the synced clock™️ at my blog

prisma snow
pallid mesa
#

but now with more circular buffers illojuanPOGGERS

thin stratus
#

Ask Nick to add it to the faq

cosmic epoch
#

Anybody else having 2nd gamepad not working after upgrading to 5.1?

fathom aspen
#

Hey there, I'm wondering if you did something special that got Iris to work when compiling engine from source?
I did similar to what you did, and got it to compile fine, but when debugging I always get UE_WITH_IRIS=0. Maybe I need to add IrisCore to a dependency modules list?

lost inlet
pallid mesa
#

you can use the gamestate one in such case @lost inlet therefore the "non destructive bit"

#

you know, tools in the toolset

lost inlet
#

with the default one, you do have to adjust the update frequency a lot because otherwise the clock drift is very real

pallid mesa
#

I think that by default it updates every 5 secs?

#

you had to turn that val down?

lost inlet
#

I had to make it more frequent and actually add ForceNetUpdate calls because it would sometimes be wildly out of sync

winged badger
#

clock drift also has variance done via GS

lost inlet
#

after this, it functioned for the bullet hit validation on a previous game I worked on

winged badger
#

so you were force net updating GS every time a shot was fired?