#multiplayer

1 messages · Page 114 of 1

digital marten
#

I also recommend you learn how to use Network Emulation. It will take you 10 minutes or less to learn, and it will allow you to playtest solo without having to have people help you out each time. https://docs.unrealengine.com/5.2/en-US/using-network-emulation-in-unreal-engine/

(Note Network Emulation is not real internet, so testing with real users is still needed, but this helps with most debugging before needing to live test.)

Emulate network packet lag and loss in Unreal Engine.

south crane
#

thanks! I started using it recently sadly a bit too late as most of the game is networked already

#

seems like i gotta re-do a decent amount of things

meager hazel
#

Hello anyone know what can i grab players chat text?

#

i would like to display each player message above head

#

(proximity chat)

worthy knot
#

Does control rig work in multiplayer?

#

That means the city sample destruction vehicle deformation would work in multiplayer

#

Because they are control rig based

#

Well to make the blueprints of server and multicast yes

#

All that

#

Could you name some others if you know

unique cloak
#

Does anyone knows what he meant maybe?

unique cloak
shrewd ginkgo
#

I want to add skill to one of my characters in game. a phone call will be made and when he make a call, the phones of all remaining players will ring and continue to ring until you press and hold the e key for 3 seconds. how can I make it

latent heart
#

Get the calling player to tell the server it's doing a call. The server tells everyone else, except the calling player. Whether you want everyone to know who is making the call will inform how you do that. The receiving player can probably use an enhanced input trigger started/ended to register the 3s thing.

#

Whether it tells the server if it's answered or not is up to you.

#

Use RPCs for communication.

#

If you want to know more, read the multiplayer compendium in the pinned messages.

silent shard
#

When working with projectiles, I have them spawn on the server, but sometimes if the target is close by, the projectile spawns and hits the target on the server, before it spawns on the client, and there is no indication it ever happened.

Should I spawn the projectile on both the server and the client, with the server being the authority on if it "hit"?

I think that's the correct path, but how do I make it so that the replication skips the client who fired the projectile, so they don't see two projectiles?

jolly patio
lean current
#

just to be sure: I would have to remake pretty much everything if I want to convert a singleplayer game into multiplayer right?

#

I was working on my multiplayer game but didn't do anything to do with networks, just the game itself, then I was told that I would have to do it all over again anyways if I want to implement online. So Im doing the online bit first

dusk fable
#

Hello , i have a logic i want to implement in blueprint , i could really use some help with:
-basically , im making a multiplayer , of 8 players , in a map , each player gets a turn to play for x amount of time ( play in turns ) , how do i achieve that ?

#

not the timer , just changing player controllers /players from index 0-7

hoary spear
#

Id think a replicatd int matching the current players controller along with some time value for the remaining time would be a good start

#

The time on the client side would be purely visual and a lazy sync

The controller who's turn it is can probably locally play forward its turn (depends a bit on gametype etc) and possibly only on commit turn send the delta to the server for validation

#

Or just rpc every move during the turn.

tardy fossil
#

or you could set the server projectile not to replicate at all and use RPC's to spawn a local projectile on all clients and have them simulate the physics

indigo steeple
#

I'm having an issue where im taking a singleplayer game to MP and the second players functions of the player controller doesn't work the same, like the cursor isn't moving or anything... anyone know how to fix?

hoary spear
#

Start from scratch, read up on stleast the compendium, grasp rpc's replication and server authority 😅

queen escarp
#

hm why would this give null reff :/ ?

#

anything obvious wrong ?

#

As player character Bp parent gives null ref

#

running on remote

sinful tree
# lean current just to be sure: I would have to remake pretty much everything if I want to conv...

If you build a game without multiplayer in mind, then you'd end up having to go back through all of your systems and make sure they/make them work correctly for multiplayer, so in essence, yes, you'd pretty much have to remake everything. There's a lot of consideration of how one does things in multiplayer and some things you just can't do in multiplayer that one may have already set up to work in single player. For example, you can't replicate Map variables, objects don't replicate by default so if you were using those for logic you might have to rework them, game mode is inaccessible to clients in multiplayer so again, any coding you may put in there is useless for clients to use. In single player, you can very easily call around to other classes and do things but in multiplayer you have to be a bit more thoughtful of how you're coding so you can properly maintain references to the particular player that you may be trying to do something with so you can call back to them or manipulate their particular actors/components.

hoary spear
unkempt tiger
#

So I have an actor component with a replicated property that should be replicated with the InitialOnly condition since it's only set up during construction, however setting it immediately after the owner actor has been created is seemingly too late since it doesn't get replicated, how can I set it earlier?

unique cloak
sudden plinth
#

Who you on about @unique cloak

unique cloak
#

I’m talking about the messages he sent and I don’t understand it

#

@sudden plinth

keen condor
#

Hello , can i pm someone about multiplayer collision, i have some little questions and i don't wan't to flood here. I made a projectile that is properly replicated but thing is that i wan't it to ignore the instigator but it keep doing weird things

pale nimbus
#

Guys i need help, i created some Widgets in a multiplayer system. What should i do so that when the client joins the session also sees the session's widget?

#

to make myself clearer, player one create room, "created room widget" opens. Players 2 join room, how can i display the same widget to both?

fossil spoke
#

The TP Weapon is created on Clients via the Replication of its class on the FP Weapon.

#

There is a property on the FP Weapon called something like ThirdPersonWeaponClass

#

Which is set and replicated when the FP Weapon becomes the primary Weapon, which is what handle bringing it up for simulated proxies.

#

You need to read the source code.

solar stirrup
#

Does GC mark properties dirty for replication when it sets the property null on garbage collection?

#

i.e. UObject gets GC'd, UPROPERTY() referencing it gets null'd

#

Does it also mark it dirty for the push model?

hollow eagle
#

it shouldn't matter, that object should be removed from replication which will (eventually) null it out on clients regardless of whether the property changed from replication or not

solar stirrup
#

yeah, but it could miss a rep notify right?

hollow eagle
#

object replication isn't tied to properties referencing them

#

I guess?

solar stirrup
#

That's my point mostly, I know clients are gonna have it null'd out anyway

#

Just don't want an edge case where the rep notify isn't fired

hollow eagle
#

hook object destruction properly and you won't have issues 😛

solar stirrup
#

fair

#

would be nice if the engine did it though :^)

daring gorge
#

hello,
im making movement for custom cmc; ive made a compressed flag for like moving forward and then the safe_move forward, now on button press i change the value of my bool to true and etc etc. i now have a function for performing the actual movement; im not sure how im supposed to call this as from what im reading around, for the client side prediction to work id need to make sure that the movement is performed both on the client and the server, can someone help me understand how exactly or where exactly would i call my move forward function?

#

currently going through it, yet im still confused

pale edge
#

i've got a puzzle where each player needs to be on either side of a central gate. how can i get the second player to spawn in a different location?

boreal bison
#

To make changes to everyone's UI, I've been doing this:

#

is there a way to do it more efficiently with a multicast or something?

#

first image is the gamestate, second is the player controller, third is the main UI widget blueprint

fossil spoke
#

@boreal bison What exactly are you trying to achieve here?

pale edge
#

so just add another one? cool

boreal bison
#

players submit words and those words get passed to the gamestate to undergo a bunch of validation logic

#

and then I want the gamestate to pass it to the players for their UIs to update

fossil spoke
#

And then another, which would be a Multicast in the GameState that notifies all Clients that a word was Submitted.

#

After that you can use the GameState to pass the word along to things

#

You could use a Delegate (Event Dispatcher in Blueprint) to let systems subscribe to it to know when a word was submitted.

boreal bison
#

And then call the event dispatcher in a multicast?

fossil spoke
#

Yes, because the Multicast is sending it to all Clients GameStates

#

Keep in mind, that the Player who submitted the word will also be notified.

#

So you may need to setup logic that ignores it for the owner (submitter)

boreal bison
#

yeah that's fine

#

Is that a lot more efficient then looping through playerstates and RPCs for each one to update their UI?

#

or marginally

fossil spoke
#

Not really

#

But it is more logical

boreal bison
#

it is more logical lol

#

definitely would look nicer

fossil spoke
#

A Multicast is still N number of RPCs

boreal bison
#

ahh right

fossil spoke
#

Also, just so you know, Widgets cannot have RPCs

#

You mentioned your third image was a Widget?

#

Which seems to have an RPC

boreal bison
#

uhhh yeah that's probably redundant since it's already run on owning client from the controller

fossil spoke
#

Widgets do not support RPCs or Replication of any kind.

boreal bison
#

while I have you, do you know how to attach something like a scroll box to follow the mouse?

#

I want to use some sort of set position type thing but all I find is this and it doesn't seem to do what I want

fossil spoke
#

You would need the scrollbox to be in something like a Canvas Panel

#

So you can use the CanvasPanel slot that holds it to set its position to the Mouse Location

boreal bison
#

It's currently in a canvas panel that holds everything in my main UI

#

does that count?

fossil spoke
#

Yes, it will be in a CanvasPanel Slot, you need to find that slot and set the slots location.

#

There should be helper functions for that

#

But I wont go in detail here as thats getting far offtopic.

#

Ask in #umg if you need further guidance.

boreal bison
#

thanks!

woven basin
#

Dont think it a copy is live yet on YouTube

fossil spoke
#

You can make any system do anything if you extend it...

boreal bison
#

I have a game that has working multiplayer, creating and joining sessions etc.
How do I start transitioning it to use Steam?

latent heart
#

Steam is just a different type of session.

#

Replace what you have already with steam stuff.

languid ridge
#

also when i tried to run on server and replicate it just sent player to the sky

#

this is the implementation of the function

#

this was the implementation I did when I tried to do it on server and replicate

devout owl
#

I've been trying to figure out how I can make a togglable camera view for a second player while my player one view is in VR. I imagine I'd do this in "VRGamemode" but I'm not sure how to start and can't find any documentation or videos about the process.

rose turret
#

does anyone have a good tutorial for Unreal replication internals, specifically anything about UPackageMap?

errant glade
#

anyone who use AWS Free Tier for Dedicated Server?

solar stirrup
silk sapphire
#

i have this code for doors
but the problem is isOpened variable stays the same

#

so i can walk through door
but it isnt being rotated

pale nimbus
#

Guys i need help, i created some Widgets in a multiplayer system. What should i do so that when the client joins the session also sees the session's widget?
to make myself clearer, player one create room, "created room widget" opens. Players 2 join room, how can i display the same widget to both?

woven bramble
#

I'm wondering how the player array in GameState is determined. Does it automatically remove the Index when someone leaves the game?

unique forge
#

does somenoe have knowledge about this

#

from what you begin with

#

or whats the first to do before makning a multipalyyer

icy jetty
#

Prly to read the compendium (pinned)

woven bramble
icy jetty
# woven bramble .

I think it works that way but not sure. I’d imagine you can test it with a for loop and a print string

errant glade
#

anyone who use AWS Free Tier for Dedicated Server?

undone notch
#

any one know how to setup dedicated server with ovh vps in unreal engine for create session , join session , i am ready to pay , if anyone can give me tutorials video or setup

#

hmm

stable bloom
#

Hi everyone! Can someone please help me understand the difference between NetDormancy and PushBased replication model?
For me it seems like both of them provide a way to specify WHEN I want replication to happen. PushBased also allows you to specify what exact properties you want to replicate, but that's not that big of a deal.
Soooo why do we have both of them? Which one of them and when should I use?

thin stratus
#

I don't think you usually switch NetDormancy around a lot

#

If an Actor is not dormant, it will constantly try to check if its network state is dirty, even if nothing happened

#

Which is what PushBased is supposed to fix

#

The Engine doesn't need to scan all properties, and also not every cycle

chrome bay
#

Dormancy is really just to turn actor replication off either initially, or for long periods of time. Rapidly entering/exiting dormancy would be more expensive than just leaving it non-dormant.

#

The push implementation is really a bit pants, actors are still compared, just properties you haven't marked as dirty won't be checked. The savings are negligible at best. Supposedly IRIS is going to fix all of this.

#

Even Epic didn't notice any real different with Push Model in Fortnite from what I gather.

stable bloom
#

I guess I am talking more about DormantAll state, when you use ForceNetUpdate to update everything when you need and then stay dormant

chrome bay
#

The problem with dormancy, is waking an actor from dormancy means opening a brand new channel - which also means sending all properties (including Initial Only properties btw)

#

The history state is lost when an actor channel is closed, so if you have actors with lots of data, or actors constantly going in/out of dormancy, it's going to cost more than just leaving them on a lot of the time. Depends what it is. A loot chest, or a tree in Fortnite? Sure. Regular actors, no chance.

thin stratus
#

BP properties aren't push-based, are they?

#

Half the engine is neither

stable bloom
#

Yeah, I understand that and actually thinking of what should I use for chests, doors and all this stuff

chrome bay
#

I can't recall, but it was mentioned a few times. The only thing it really does is reduce the number of property comparisons on the server, but for most properties where comparisons are absurdly cheap anyway, it's worthless

thin stratus
#

Maybe Iris is better in the long run, who knows

stable bloom
#

They should be pretty light weight, with only a few properties
And they update not that often

chrome bay
#

Yeah, dormancy is quite good for things you barely interact with

stable bloom
#

Especially if as you are saying actors comparison still happens

chrome bay
#

I believe this chat, and also UDN I'm sure mentioned that the savings were barely noticeable with push model

chrome bay
#

No server overhead

stable bloom
#

Yeah, I mean happens with PushBased
Dormancy doesn't have this problem

clear island
#

its on the code as a comment "PushModel.h" I think was the file name

chrome bay
#

Unfortunately the minimum time between actor comparisions is 1 second. If you try to set net update frequency any lower than 1, the actor simply never replicates.

clear island
#

I think it might have a big impact if you have many replicated actors though, maybe inventory systems and such

#

also if you server is really weak (weak cpu) you will probably notice

chrome bay
#

It's really not that big at all

stable bloom
#

there are a lot of interesting speeches on Unreal Engine youtube channel
I've learnt about dormancy from there

clear island
chrome bay
#

This is Epic ~1 year ago:
Internally, we didn't see any major benefits from enabling it, but there is still work being done to improve the system.

clear island
#

there was a significant difference in his test there

dark edge
#

Do your logic like
Serverside Event -> Open = NOT(Open)
OnRep_Open -> do the stuff that depends on if it's open or not

chrome bay
#

To be fair 900+ replicated actors at anyone time is a lot

clear island
#

true

chrome bay
#

And if you've got 25 as a frequency (25 comparisons per-second), that's quite an expensive starting point already

#

that's 24,400 actor tests per second - so no doubt you'll gain something - but you wanna try to avoid that in the first place

stable bloom
#

but I guess fortnite has more even at the start of the game?

chrome bay
#

Well most of Fortnite is dormant initial

#

So trees etc, while replicated, have no initial network cost since nothing has changed/is replicating. You'd likely get a lot of comparisons initially, but that initial spike would get lost in loading

#

Any map-startup actors that are destroyed get replicated as a big list also, so you're not paying much for those. Can't recall if Fortnite has join-in-progress or not, but figure it should.

stable bloom
#

yeah that's also a valid point
I've thought abouth this, but when you think about the gameplay, many many and many of these actors will become active due to chaotic shooting and etc

chrome bay
#

Yeah for sure

#

But when you have 50K+ actors, them being dormant is a larger saving than not

#

Still, you'd be surprised at how much you can get away with

keen condor
#

Hello can i ask someone in private about multiplayer collision, i don't wan't to flood here

stable bloom
#

I guess they've done a lot of optimisations and custom replication even of GAS before pushbased model was implemented so maybe that's why there were no major perfomance boosts with enabling of pushbased?

chrome bay
#

Maybe.. IDK

#

We had 100 players before Fornite so party_manny

#

Not saying it wasn't better once we had their optimisations too though 😄

stable bloom
#

still a magic for me

stable bloom
chrome bay
#

Depends. Proxy replication can certainly have advantages at scale.

#

Certainly wouldn't do everything like that though

clear island
chrome bay
#

Yeah

clear island
#

nice, I've been meaning to look into it but there's not much info about it except shooterGame

chrome bay
#

To be honest with Iris on the horizon, there's not a great deal of point, Mind you Epic aren't following through on most of the new networking tech that is repeatedly teased so you never know..

#

Rep graph benefits scaled projects, but little else

#

Lots of players + lots of actors, usually actors with the same properties

queen escarp
#

this is from an Actor_BP

#

"from server"

#

im getting failed cast

#

why ?

clear island
stable bloom
#

@chrome bay @thin stratus want to write a little followup of this discussion in mastodon, is it okay if I mention you?

chrome bay
#

If I was on that Platform you could 😄

thin stratus
#

eh, it's an open platform, so w/e. I don't use it though, despite having an account

stable bloom
#

kk

chrome bay
stable bloom
chrome bay
#

I probably made one to claim a handle then immediatelly did nothing with it

thin stratus
#

Is this a BP only project?

#

Hm, tricky

#

I would fall back to UObjects for the Items, cause that's a hell lot easier

#

But that requires some C++ for the replication of them

#

UObjects would allow for functions, such as "SaveItem", which for the nested Backpack would just call SaveItem on all its items fwiw

#

I mean you can do that with Structs too, but you'd need to somewhere outside write the logic for the backback

#

which is kinda mäh

#
SaveInventory(InventoryItems)
{
  for (SomeItemStruct : InventoryItems)
  {
    if (SomeItemStruct.Type == Backpack)
    {
      SaveInventory(SomeItemStruct.Items)
    }
    else
    {
       SaveItem(SomeItemStruct)
    }
  }
}
#

Something like this I guess?

#

BP Struct Inventories are also so dangerous cause Structs in BPs break and corrupt quickly

#

But yeah

queen escarp
#

@chrome bayyeah but if i use it with Authority it cant cast to player character bp?

rose turret
#

is there anything on UDN/etc. about the new Physics Prediction work? I'm mostly wondering if it's heading towards being a full prediction framework that will take over the sorta abandoned NetworkPrediction plugin

thin stratus
#

Not sure I understand the circular struct stuff

#

The "Cicular" stuff is recursively solved by SaveInventory being called on the Backpack

#

Even if there are ten backpacks inside of each other

keen condor
#

Hello , i'm trying to ignore the instigator when spawning a projectile (with a rpc) but it's not working , i don't know what i did wrong , currently the projectile is just disapearing when hiting the instigator... :

fierce egret
sinful tree
#

Just create another struct with the same setup that your inventory has that you'd then use for container objects that can go inside of the inventory? Might be better to use objects instead of a structure?

fathom aspen
fierce egret
sinful tree
#

Not if you want them replicated.

fierce egret
#

Server has to handle everything about inventory, so it must replicated i guess

fierce egret
#

Is it safe if i store its containers on its widget? I can send its data to server anytime but i dont know its safe for cheating

thin stratus
queen escarp
#

this Gives me error AsmygameMode access none

#

why ???? its a actor on the server calling it

thin stratus
queen escarp
#

it is tho :/

#

100%

#

so it fails casting to my_Gamemode so its not setting it

#

why would it fail O.o

#

the map 100% have MY_Gamemode as game mode

hoary spear
#

print the displayname

queen escarp
#

hm it says on the client tho

hoary spear
#

Client cant reach gamemode

queen escarp
#

yeah but this is a Actor running on the server

#

so no client trying to use it in this case

hoary spear
#

Except your example^^

queen escarp
#

how is that a client trying to use it :/ ?

#

or well

hoary spear
#

Beginplay runs on server and client

queen escarp
#

sry forgot to show change Ä*

#

shit gives error

#

sry for spam

#

i just dont get it

thin stratus
#

@queen escarp What is it printing if you have the Print behind the SwitchHasAuthority?

#

And what is that Actor and where is it spawned from?

#

Need more infos to help

queen escarp
#

the actor is Preplaced is a collision box with overlapping trigger from player character

thin stratus
#

Well if it's pre-placed it will call BeginPlay on everyone

#

So you will need the SwitchHasAuthority either way

#

Does the Cast work now?

#

@queen escarp

queen escarp
#

the cast works

#

but still gives errors :/ ?

devout owl
keen condor
#

hello , if i have a property that hold a referrence of an actor , if i wan't to replicate the referrence , will it pass through the network a copy of it or just an "id" ?

thin stratus
# queen escarp but still gives errors :/ ?

Hm, you might want to print the name of the instance (Self) when this happens. Not really sure why the Pointer would suddenly be null in the loop if this is in the same BP. Unless it overlaps before BeginPlay o.o

queen escarp
#

ok so the error comes from another one i remade it

#

sending info to the game state

#

wich calls the player

thin stratus
queen escarp
#

where is state runned

#

both server & clients right ?

thin stratus
#

It will not send the whole Actor (:

thin stratus
# queen escarp

I mean, not sure where that even is, but your code will call this on every local splitscreen player

#

So AsMyGameMode is def invalid

#

Also not sure why you use a Multicast to set local split screen players in combat

#

InCombat sounds like a State

#

So this should be a variable

#

OnRep if you need to call any other events from it

queen escarp
#

yeah i just tried them all seeing how they would react..

thin stratus
#

And also not sure what your loop is doing there

#

Why do you need the Number of Players from the GameMode?

#

This will replicate to everyone anyway if it's in the GameState

#

But if you are using a Multicast, new players that join late won't get this

#

If being in Combat is a global thing for everyone, then set an OnRep boolean

#

And the loop is only neede if you have local coop players

#

If you only have one Client Player per Local Game then this is wrong

queen escarp
#

aye so i fixed it

#

idnno what i was doing

#

it just got messy .p

blazing spruce
#

Hi, im having an issue with my health widget being updated after applying damage for the client, I have a throwing axe actor that when it hits a character will send a message to the Apply Damage interface function which calls a damage event on the StudentBase character class that was hit by the axe, this calls a OnHealthChanged delegate, which then calls for the HUD to update the widget.. the issue is that the HUD updates the health correctly for the server but when the client is hit by the axe the first time it does call the UpdateHealth event, but the number still stays at 100, when the client is then hit a second time the health widget will update and go down to 80, but the correct health is actually 60 because the axe does 20 damage. Any ideas on how I can get this working properly?

The other issue I'm having is that for some reason the Update Health event that is bound on the HUD class is being called twice every time the StudentBase class is hit if they're the client but called only once when the server is the StudentBase class?

#

So you can see the prints are the correct health, the widget updates fine for the server but for the client it doesn't on the first hit despite calling the UpdateHealth event, but starts decreasing every other hit after the first one being out by 20 health

devout owl
thin stratus
#

@blazing spruce you can't expect a variable to replicate in sync with an rpc

#

If you need health to do something on the client you'll need to use an OnRep for Health

thin stratus
#

Not sure how that would work with VR already being that screen

devout owl
#

What gorn does is show the left side on PC and the right side on the HMD

thin stratus
#

Honestly not sure. Is Gorn a UE game?

devout owl
#

Ah, made in unity

thin stratus
#

You might be better of asking in #virtual-reality . I'm not sure how UE would support this.

devout owl
#

So is waltz of the wizard

thin stratus
#

I only ever used VR OR Local Coop, not both

devout owl
#

Well I appreciate your attempts to understand and inquire 🙂

thin stratus
#

VR has some spectator screen I heard about but not sure it supports being a second player

#

Might need some cpp

devout owl
#

In some documentation I read that the VRSpectator can be a starting point for a second player, but finding how to implement that is challenging.

vivid seal
#

are OnRep functions called before or after PostNetInit?

fathom aspen
#

Depends™️

#

On property type

vivid seal
#

fun

fathom aspen
#

On owning Actor

#

If actor is preplaced is not same as spawned at runtime

#

OnReps for the former are usually called after while for the latter are usually called before

#

Ofc with the exceptions of unmapped properties which is usually always after

#

Ah you said PostNetInit and not BeginPlay 🤦‍♂️

#

PostNetInit is not called in the first place on preplaced actors

vivid seal
#

this would be runtime created actors

fathom aspen
#

So I will assume you are referring to runtime

#

There is none like that XD Indeed (post edit)

vivid seal
#

edited

fathom aspen
#

So it depends only on the type then

#

If it's a pointer to an actor/object then it will usually call after

#

If it's a simple trivial data type then it's before

vivid seal
#

okay, that's a little annoying but i'll work with it lol

#

just trying to initialize a decal material on clients using replicated properties from the server without having to create a giant mess

fathom aspen
#

Mhm. I assume those should be POD types, and they should all be ready in PostNetInit in such case

vivid seal
#

is a texture pointer considered POD? its not a replicated actor but it is a reference to an asset

fathom aspen
#

Ofc as long as they are set in a frame no longer than BeginPlay is called

vivid seal
#

yeah this is all set in an initialize function right after spawning on the server

fathom aspen
#

So I would strongly assume that it should be fine™️

#

So first time it sends path name, and subsequent times it's done by netguid

vivid seal
#

i think the worst part about multiplayer is straight up just figuring out where to initialize stuff on clients

#

feel like im asking this question or something related to it so frequently

#

is there a helpful cheat sheet somewhere of lifecycle for replicated actors on clients? just a graphic i can quickly look at to remember when PostNetInit/BeginPlay/OnReps are called and all the other init-type stuff

fathom aspen
#

It's painful, but if you have multiple OnReps that you are forced to listen to, usually you use fancy functions like PostRepNotifies with making sure that your data is valid

#

As that fancy function can be called multiple times through the life time of an actor and you don't want bad things to happen if data is not valid for w/e reason

fathom aspen
#

Usually it's OnReps -> PostNetInit -> BeginPlay

vivid seal
#

i know there are a few other related functions, postnetreceive or something?

#

just would be cool to have a quick reference and not have to dig through the source code if i forget

fathom aspen
#

This part is always true: PostNetInit -> BeginPlay

#

Always

#

the OnReps part is with a grain of salt

vivid seal
#

okay, thanks for your help

fathom aspen
#

Any time

uncut schooner
#

Hi everyone, I am using a tickableworldsubsytem, I heard subsystems are not replicated and to use an actor to do replicated functions etc, The issue is I need each local player to get the subsystem and call a function, So what I thought I would do is, GetSubsystem->Call Foo() then call a similar Foo() function on a Proxy actor, the issue I am having is, if subsytems are not replicated how can I spawn a the Proxy actor and have each local player call that throught their local subystem?

#

I could place the actor in the world, but that feels, unclean

fathom aspen
uncut schooner
#

I mean manually

fathom aspen
#

Literally crate the actor server-side, cache on each local SS client-side

uncut schooner
#

I want the Subsystem to spawn it

fathom aspen
#

Yup that's your answer

uncut schooner
#

But how can I check if the world or level is on the server

uncut schooner
fathom aspen
#

There you go

#

That's for subsystems

#

For world it's ez

#

World->GetNetMode < NM_Client

#

But with subsystems you need to do shenanigans like that

uncut schooner
#

Thanks

fathom aspen
#

But now that I'm thinking about it, waiting for the subsystem to initialize should be fine to just retrieve world and check NetMode on world

#

The code snippet above is literally to prevent a subsystem from being created on a certain end early in its lifetime

#

Which is obviously not what you want

uncut schooner
#

Like this?

fathom aspen
#

Too close

#

Use < instead

uncut schooner
#

<

#

Ty

#

Wait I am a bit confused, Doesn't
GetNetMode() > NM_Client mean greater than client

#

@fathom aspen

fathom aspen
#

Have you looked at ENetMode?

uncut schooner
#

Erm

fathom aspen
#

All the server net modes come before

uncut schooner
#

Ah I see

#

I misremembered something sorry

#

And thanks again

wispy iron
brazen anvil
#

If I had a lean mechanic in my game I would want to replicate a variable like bool bIsLeaning. If I wanted to determine which direction I was leaning would it be best to have two bools bool bIsLeaningLeft and bool bIsLeaningRight. Or since a bool is a single byte, can I replicate a single uint8 which then I could use something like 0 = no lean, 1 = left lean, 2 = right lean.

latent heart
#

An enum.

fossil spoke
latent heart
#

NotLeaning, LeaningLeft, LeaningRight

#

You remove the useless state of bIsLeaningLeft && bIsLeaningRight.

brazen anvil
#

Ok, what if I wanted to add a degree of lean? Like if my leans had 5 different degrees?

#

Would I use an Enum like LeaningLeft1, LeaningLeft2, LeaningLeft3, etc

latent heart
#

Use a float.

fossil spoke
#

You probably need a struct that has the information you want then.

latent heart
#

-1 = left, +1 = right.

#

0 = not leaning

brazen anvil
#

If my leans were fixed degrees a enum would be better right?

latent heart
#

Maybe?

#

With a float you can use it to interp too.

brazen anvil
#

Hmm yeah

latent heart
#

I mean, you can do that with an enum too - let's say you have 11 vlaues (5 left, 5 right and centre) you can map those to float values and lean left/right to that amount.

brazen anvil
#

Yeah I was thinking something like that. Is the extra work worth it to save 3 bytes?

latent heart
#

Good question.

fossil spoke
#

No

#

It wouldnt be

#

Using Push Model and correct application of relevancy it would be negligable.

brazen anvil
#

UE needs to get a short

latent heart
#

It has a byte

#

I doubt you need more than 256 lean levels

brazen anvil
#

nah I don't. I think a byte would work for me. but it is good to know that if I run into an a similar issue going from a byte to 4 bytes isn't that big of a deal.

fossil spoke
#

It depends on what its being used for

#

Lean wouldnt be changing very often

#

Even for 100 players

#

So for that it wouldnt be a huge impact

latent heart
#

Enums are bytes, jsyk.

fossil spoke
#

But for something else that changes or updates a lot

#

Going from a single byte to 4 bytes could be huge

latent heart
#

Position/look direction, for instance, they are compressed over the network

brazen anvil
#

ok thats good to know that it matters in scenarios like that.

fossil spoke
#

Its just a matter of thinking about whats actually happening and what data is being sent and how often.

#

It becomes obvious when something will be an issue when thinking in those terms

#

Context is super important

brazen anvil
#

Yeah it makes sense. Thank you both for the help

latent heart
#

However, it does make sense to use the minimum data possible in all situations. You don't have to go out of your way to lose data, but there's no point sending a 30 page volume of text if you can just send an ID and it's loaded from the client's game.

#

Sending a lean Id instead of a float when you have a lean id value anyway isn't overly optimised. It's just being smart.

fossil spoke
#

You learn effective strategies for all types of data over time.

#

It becomes second nature to just know how to reasonably optimize for certain things

gleaming vector
errant glade
#

Okay

fierce egret
#

In my inventory system, every action is run by server. Client only does drag drop operations. At this point can i use objects for reference my items? I know i cant replicate Objects while using blueprint but what if i construct and use them on server side? Client doest need to know it

#

Sorry if it is silly question, i am new on replicated systems

hoary spear
#

Doesnt client read info from it ?

#

But if you use them purely on server side thats ok

#

Could limit your future options tho

proven kayak
# fierce egret In my inventory system, every action is run by server. Client only does drag dro...

FYI, this is the only code you need to make a simple replicated object:


UCLASS(BlueprintType)
class YOURMODULE_API UNetObject : public UObject
{
    GENERATED_BODY()

public:
    virtual bool IsSupportedForNetworking() const override { return true; }

    virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
        {
            Super::GetLifetimeReplicatedProps(OutLifetimeProps);
        
            if (const UBlueprintGeneratedClass* BPClass = Cast<UBlueprintGeneratedClass>(GetClass()))
            {
                BPClass->GetLifetimeBlueprintReplicationList(OutLifetimeProps);
            }
        }
}

even if you dont know c++, follow a basic tutorial to add a new class to a project and paste this code in (and fix the YOURMODULE) and it should work

#

with 5.2+ you don't need to go through the whole replicated subobject shinanigans anymore if you enable RegisteredSubObjectList

#

although, now that I think of it, im not sure that adding/remove from the list is BP exposed...

#

add this to the above class in that case

UFUNCTION(BlueprintCallable)
void AddToReplicateSubObjectList(AActor* Actor)
{
    if (Actor)
    {
        Actor->AddReplicatedSubObject(this);
    }
}
#

though im pretty sure that future versions of unreal will expose the subobject list natively, because they are deprecating the old system

fierce egret
#

Will i be able to create functions in that object by blueprint if i do it?

proven kayak
fierce egret
#

Thank you, i will try that

proven kayak
#

i use replicated UObjects for my game and they work just fine, so i can attest to this method

elder sable
#

Hi, what's the common way to call RPC from multiple clients on an actor ? I usually use an indirection on the PC but i wonder if there is another solution

proven kayak
stone hawk
#

hi, any possibility of transfering the ownership to another player in p2p sessions so that if a player ( who created the session) quits, all players won't get kicked out of session ? thanks for answers

elder sable
proven kayak
#

yes

fossil spoke
elder sable
#

Yeh i'm doing the same, i guess there is no other way, thanks :p

stone hawk
fossil spoke
#

It would require significant modifications to the engine to support.

stone hawk
#

ohh, way too out of my league 😂 , thank you for quick replies and clarification

proven kayak
#

there is a plugin on the marketplace that kinda adds host migration, but its extremely jank in my opinion

#

it claims that it even works if the host disconnects

fossil spoke
#

I cant imagine how they would be dealing with it in any reasonably acceptable way.

proven kayak
#

it makes you periodically save the game, shunt the saves to each client, then when the server disconnects, each player runs a beacon to try to reconnect, and it uses the most recent save to restore the session

small grail
#

I remember it was request in the last project we worked for the client, and finally they gave up. Because it is not possible for the small team to do this.

proven kayak
#

like I said. very jank

fossil spoke
#

Thats somewhat what I imagined they may have attempted I guess.

#

Very jank.

small grail
proven kayak
fossil spoke
#

There would still be a hard travel

proven kayak
#

and there is absolutely still travelling

fossil spoke
#

Back to default

elder sable
#

Make everyone a server and every clients connect to everyone :p

fossil spoke
#

As i said, there would need to be some decent reworks to the engine to support anything of that nature

small grail
#

I mean it is a hacky way, but the user experience is very bad. It is almost not usable though.

fossil spoke
#

Honestly, if you care so much to want Host Migration, you should be running on Dedicated Servers anyway.

#

And just setup a decent matchmaker and server martialing system

#

If you use EOS you are halfway there

#

Since it has a matchmaker

small grail
fossil spoke
#

It also wouldnt be able to deal with anything that isnt Network Relevant either

#

Since that information is only available to the Host permanently.

#

You would have to save out all Actor states, then pass that to the new Host before a disconnect could happen

#

If the Host dropped, there would be no way to recover that information

proven kayak
fossil spoke
#

And thus create an invalid game state

fossil spoke
small grail
elder sable
#

It's just for tiny games

fossil spoke
#

It has very limited use cases for sure.

#

Even then, its still pretty jank

small grail
#

I won't think it is useful for any commercial games, too risky.

fossil spoke
#

I would never recommend this for a commercial product

#

These days i feel like lack of host migration would just be something to deal with.

#

As inconvenient as it might be

proven kayak
#

it would be better if it let you use your own save system (I will only use EMS), but instead it locks you into its shitty builtin save component

fossil spoke
#

If its happening often (host disconnecting)

#

Then you have bigger problems

small grail
#

Just use DS, it is not that expensive now comparing to the old days.

#

Thanks to these cloud services at least for this point, they are doing pretty good.

fossil spoke
#

Using things like GameLift or Playfab can get expensive

#

But they are an all in one solution

#

Its certainly cheaper to roll your own, but comes with its own set of challenges

#

Namely development time and difficulty

#

Depending on your skill level

unique cloak
unique cloak
unique cloak
shrewd ginkgo
#

When I switch from the lobby to the game, the host cannot move. the rest of the players can move, why could that be

old knot
#

why replicatedUsing does not call automatically?

solar stirrup
old knot
# solar stirrup wdym?

i defiend a boolian variable with replicatedUsing property , but it's repNotify function does not execute atomatically

solar stirrup
#

In C++, rep notifies do not execute when you modify the value on the server

#

You gotta call them manually when setting it

#

It only calls the rep notify if the value is received by networking, like on clients

quasi tide
#

Most often done by giving a tolerance amount, so it doesn't have to be exact

#

Send the hit to the server, saying "i hit this person, here", and the server double checks that it is within the tolerance amount and okays it or denies it.

quasi tide
#

Sure

karmic briar
#

hey yall i want to ask, is there any good tutorial on how to setup lobby type system like fortnite and in that lobby ui, you can specify like matchmaking?

#

i dont know how to do this sort of thing so any of yall have experience making this system have any guidance?any dos/donts

#

i really want to do with EOS but Steam is one of my option too

#

😅

twin pendant
#

I want to disable "run under one process" for some multiplayer testing where this option causes to many issues, however when i disable this option, the client really takes ages to load and also doesn't load into the same level i am starting but into the game default map. Any idea why?

#

yeah i guess that is somewhat expected. though it really takes quite long, more like 15-30 seconds at least. and my pc is quite good as well

#

and it does work when i disable network emulation, but only when i play in standalone mode

pseudo merlin
#

hi, are the rates in net stat per second or frame?

#

did some searching, zlo answered per second so thats that

compact leaf
#

does EOS work with android or do i have to go with EOS SDK ?

daring gorge
#

how does one trigger a function in respect to compressed flags and make sure its client side predicted?

lucid viper
#

Hello!

Just something thats been in my mind, ive been trying to implement a locomotion / parkour system similar to what Fornite has but thinking about longterm issues down the road using blueprint vs C++ ...
I bought an asset ( multiplayer ready - replicated ) on the market that is mostly blueprint that has Climb, Vault, Mantling, Slide, Climb walls like Zelda, Gliding system like Fornite's, Rail grind, Wall run, etc ....

Concerned about the heavy calculations each player would do and wondering if im going to hit a scaling issue long term,
For example I would like to eventually create a Team Death match 8 vs 8 players maybe 16 vs 16 for larger maps in the long run,
Was thinking about swtiching to C++ and trying to implement Delgoodie's CMC system which has most of the same parkour system I am looking for but might be a bit more time consuming to get it working,

Just wondering if anyone would have any insights if there is any major gains swtiching to a custom movement component via C++ vs using a full blueprint system?
Using Unreal 5.1 if that makes any difference,

#

Im still setting up the locomotion / parkour system that i bought in the marketplace but how would I simulate 16 players?
I could run a listen server and add 16 players but running this on a single PC, how would I tell the difference between PC performance issues vs Asset performance issues?

#

Nevermind the editor only lets you test 4 players 😦

#

Thats a good idea, ill give that a shot

#

Thx!

dry pebble
#

for your own player

queen escarp
#

hm changing bools variables needs to only be changed on the server right :/

urban crystal
#

I am trying to pass a reference to a player state or character (either works) to a client side function but on the client it's seen as null

sinful tree
sinful tree
urban crystal
#

im using it in "on post login" is that too early for them to be replicated?

queen escarp
#

@sinful tree so for instance if i ´have a bool that i will use on server if i once change it locally then changing it on the server wont "override it" so i it will breake basicly right ?

sinful tree
sinful tree
queen escarp
#

hm ok

young drift
#

Anyone know how the unique identifing information of PlayerStates are generated? Like if Player A logs in and given a PS, then logs off the dedicated server, and Player B logs in, are they generated a unique PS for their client or will they inherit Player A's PlayerState?

Basically I just want to make a system where the server will check if the client has logged in before and if so, just proceed to spawn in their unique pawn and if not, have them generate one of their choosing.

Was thinking of using PS for this but not sure if ill need to make a custom class.

dark edge
#

Just like how a Minecraft server has a save file per player

sinful tree
silent shard
#

I have a replicating actor component, which contains a replicated AActor, and properties on that AActor are not replicating.

I'm trying to add replicated to the UPROPERTY definitions on the fields I want to replicate, and implement the GetLifetimeReplicatedProps but I get an error on that:
error C2509: 'GetLifetimeReplicatedProps': member function not declared in 'AObjective'

My class extends AActor, and I have no idea what exactly I'm missing here

dark edge
#

As far as I know the player state will not survive beyond the player logging off. When they log back on, a new one will be created with the same unique ID, which is typically provided by the online subsystem.

silent shard
#

ah..I needed to have at least 1 variable set to replicated

young drift
#

Ill try savegame then. Probably the easiest way. I was thinking if PS had a unique identifier from the client the maybe I could intercept it on logout and use data from the PS to save to the server.

Where do you guys usually store information like an inventory array? in a saveslot as well?

thin stratus
dark edge
daring gorge
#

anyone have any resources on physics based vehicles and prediction for them?
i have looked at a bunch of tutorials and still dont seem to understand where to trigger a simple move function in respect to compressed flags?

dark edge
daring gorge
# dark edge What do you mean by compressed flags? That smells like CMC which is not physics ...

im using cmc for my pawn since im trying to make a boat, as its a boat it should simulate physics; although it jitters a lot on client when doing so, and for movement im trying to implement client side prediction using the various tutorials using compressed flags and the FSaved struct to try and solve the jitter, however i dont know where and how to truly trigger the function for moving forward

dark edge
#

Are you actually simulating physics or are you running a custom movement mode in the CMC to make it behave like a boat? Which one is it?

daring gorge
#

only the movement is being handled by the cmc like a MoveForward() function

dark edge
#

Sounds like a nightmare, you are mixing two systems for the actual movement.

daring gorge
#

oh? how so?

dark edge
#

What you said your simulating physics and you're also moving the thing with the CMC. There are two things that have an opinion on how the boat should move.

#

I think your two options are to either make a movement mode in the CMC the behaves like a boat, or to try to figure out some way to do prediction with a an entirely physics driven boat. I'm doing multiplayer vehicle physics but I am not doing prediction because it is a gigantic pain in the ass and borderline impossible for my project.

daring gorge
#

what would be right way to do it where i can make it work with the buoyancy thingy and also have client side prediction

daring gorge
daring gorge
#

didnt know using buoyancy would cause issues w movement

dark edge
#

I mean it's two movement systems running at the same time. Of course you're going to have issues, they are going to contradict each other

daring gorge
lean cobalt
#

I have my pickup items with an actor begin overlap on them so characters can pick up the items. This works perfectly fine normally when replicated over multiplayer when testing on Listen Server.

But for some reason, when i try doing a full go through in my game in a Standalone window from the Main menu, to create a lobby session as a listen server, then do a Server Travel to the map, the pickup items just aren't even registering overlap events anymore. Any ideas?

nimble snow
#

hello, I have an issue with widget interaction component in multiplayer. it works on server and client 1 but when I try with the client 2, it doesn't see the widget button to interact with when I hover over it. any idea what can be wrong?

silent shard
#

Hey, having some trouble trying to get some subobjects to replicate.

I have the following in my ActorComponent constructor:

bReplicateUsingRegisteredSubObjectList = true;```

But the method `ReplicateSubobjects` is never called.

Is there anything else I'm missing here?
silent shard
#

Okay, after seeing the new way to do replicated sub objects, I've adjusted my stuff, but still not seeing the expected replication.

So I have the replicating component, which has an array of replicating actors, which have an array of replicating UObjects, which each have an array of replicating UObjects.

When an objective is made active, I want to add it to be replicated, so that all players can have the status of that objective updated on their respective HUDs.

AddReplicatedSubObject(Objective, COND_None);
for (UObjectiveTask* Task : Objective->Tasks) {
    AddReplicatedSubObject(Task, COND_None);
    for (UObjectiveRequirement* Requirement : Task->Requirements) {
        AddReplicatedSubObject(Requirement, COND_None);
    }
}

So when an objective becomes active, I call a method which does the above.

The Objective is an AActor, and everything else are UObjects. I have overriden the IsSupportedForNetworking and setup the proper GetLifetimeReplicatedProps

But it doesn't appear that my properties are being replicated at all. I added logging and I see the proper value on the server, but the wrong value on the clients.

Can I not do the subobject replication in this way?

spark owl
#

Hey so this is kind of a weird question about animation and replication. From what I can tell if I attach a collision body/static mesh to a bone of a skeletal mesh, it does not animate the collision body with the skeletal mesh animations on the server side, only on the client side. Am I crazy or is this true? i'm basicallly trying to get begin overlap events to work on the server side with the overlap collision attached to a bone on a skeletal mesh, the problem is it seems that the collision body is not moving with the aniatmions of the skeletal mesh and it's generating inaccurate begin overlap events.

silent shard
proven kayak
#

AddReplicatedSubObject is just the replacement for the old ReplicateSubobjects function where you had to push objects into a Channel

#

but other than that, you are correct, you don't need to use it for AActors

spark owl
silent shard
urban crystal
#

is there a onRep fuction for the whole actor? like a fuction that runs on client when it's actually recieved? is that just begin play?

twin pendant
#

I have a question about rep notifies, are they reliable, or can i make them reliable?
So for example if i have a int with rep notify, that i increment on the server every tick, how can i make that the client receives all these states one by one?

grave widget
#

Finally , I reach a correct workaround settings. Set the actor and all components to replicated, and also set the mobility of the generated instanced meshes to movable.

solar stirrup
#

Only way to do this is via RPCs, and spamming reliable ones every tick isn't generally a good idea

#

Property replication is eventually consistent, you don't get every property update from the server, especially if they occur at a rapid rate

vital bramble
#

Hi, I'm trying to solve something but I'm not sure it is possible
I'm in a multiplayer environement and have some actor placed on my level
I would like some actors to only be placed on the client map (because they are only use for cosmetics stuff) but not placed on the server
Is there any feature / tickbox that would allows that ?

fair latch
#

Spawn it on client

#

Or just untick replicate

vital bramble
#

The thing is that there is a lot of cosmetics stuff placed by artists, I would like to avoid to make all this thing spawned at runtime
And I would like to not have it placed at all on the server, If I untick replicate, it will still be here on the server
Atleast, If I get it right

twin pendant
fair latch
fossil spoke
#

The issue is when the server value changes multiple times within the same network update

twin pendant
#

I thought about eventually collect the changes and send them to the client with some delay to avoid rpc spamming

fossil spoke
#

It will only send the latest value

#

You can call ForceNetUpdate to force an Actor to do a net update outside of its normal frequency

twin pendant
fossil spoke
#

Depends on what you are doing

latent heart
#

There is still no guarantee it will replicate any time soon. All it does it set the last replicated time to zero.

solar stirrup
#

And abusing ForceNetUpdate() does more harm than good if you're not careful

fossil spoke
#

The answer to 99% of network questions like these is always going to be “it depends”

solar stirrup
#

For an SMG firing full auto I'd go unreliable RPCs

latent heart
#

For a full auto fire, assuming it's just an animation, why not just send a start and stop rpc?

solar stirrup
#

Depends on the game ig yeah hah

dark parcel
#

How would u guys handle playing montage?

#

Like in general

#

Do ppl use repnotify to play montages?

solar stirrup
#

If you need to predict and keep a sync'd ammo count though, I came up with a plan for my system:

  • Client shoots, stores the shot in an array with all of the data (shot num, timestamp, pos/dir)
  • Sends the array to the server via RPC unreliably, at an interval (i.e. tickrate)
  • Server replays the shots it receives, validates or not
  • Sends the clients the shots it acknowledged with the result (validated/not validated, ammo left after shot)
  • Client removes the acknowledged shots from its array so it stops sending them.

There's obviously a lot more to do but that's the surface stuff

#

Should in theory work fine but that depends on your game

vital bramble
solar stirrup
#

You don't want the actor on the map loading on the server?

#

Only on clients?

dark parcel
#

Would you let the player do it before validation

#

Cuz rewinding that part puzzle me

solar stirrup
#

Nah, I'd have the server start that

dark parcel
#

K

solar stirrup
#

The shooting part being unreliable and all is to avoid spamming RPCs, and that's if you need that kind of "precision" anyway

#

Wildly depends on your game

#

It's close enough to what most FPS games do (i.e. counter strike), without having to go insane rewriting the source engine in unreal

#

Haven't finished my implementation yet but it's promising

vital bramble
#

Yeah basically I don't want the actor on the map loading on the server

solar stirrup
#

bNetLoadOnServer = false; in the ctor of your actor

#

uh

#

sec

#

brainfart, lemme check some things

#

bNetLoadOnClient exists but I swear there's a way to do the same for the server

solar stirrup
#

Make sure bNetLoadOnClient is set to true

#

wait actually no

#

just disable replication in the actor's ctor and destroy it on the server in BeginPlay()

#

¯_(ツ)_/¯

#

should work fine

vital bramble
#

OK yeah this is what I thought about, destrying it on begin play! Thanks

twin pendant
#

for my inventory i have delegates like onitemadded, onitemremoved, and ui elements can subscribe to them

#

and if these delegates are not fired the ui would never be updated

dark parcel
#

Shouldn't that be handled right away. The server can always correct the data

#

U prob don't want to wait a sec before seeing your ammo change

twin pendant
# solar stirrup If you need to predict and keep a sync'd ammo count though, I came up with a pla...

what i do on auto is start local a timer with event looping with the rpm as the loop delay as well as send that notify to server to start auto firing as well as from server a mc to all clients except the initiator to also start that timer with event to play the animations & effects.
Only the authoritive client checks if he has enough ammunition to shoot, he has a local copy of the ammuntion and discounts every shot. it will be updated when reloading/equipping weapon

twin pendant
#

but if you are playing a shooter you probably have a decent internet connection anyway, so this is usually no problem

latent heart
#

Or, I guess, if that's you sending your own stop firing rpc, have hte server send one back instantly with the correct data.

#

RPCs instead of replication is generally a bad idea unless you need that instant update, though.

twin pendant
# latent heart Can it not just simulate that locally and have the server update it on the stop ...

yeah potentially i can do that, would just mean some hard coding for the inventory stuff.
What i do is for the client when firing, i instantly chamber the weapon as well, which means i consume the ammo from the chamber, remove the ammo from the mag, and add one ammo to the chamber again.
eventually i could do all this only on auto finish, but then again on tab firing it would be the same problem, and you can also pretty fast tab firing so wouldn't be an universal solution

twin pendant
# latent heart RPCs instead of replication is generally a bad idea unless you need that instant...

true, i initially thought about storing the changes in an array with rep notify, and then locally on rep notify call the delegates, but how would i ever remove items from the array, like i would constantly add items from the server to that array, but i eventually want to remove already called changes.
Though how do i know with a rep variable if the changes were done on the client, if i remove them too fast the changes might never arrive to the client, if i remove them too late it might create a significant overhead

latent heart
#

Is this for an RPC update? If you're thinking about that for rpcs, you're going in the wrong direction

#

Most of the time just let regular replication handle things. Only use RPCs if you need an instant update. Most of the time it doesn't matter if you simulate on teh client and confirm on the server, they will mostly agree unless here's serious lag or cheating.

twin pendant
latent heart
#

How do you initiate chambering?

#

Is it automatic or a button press?

twin pendant
#

automatic while firing

latent heart
#

Alright, so if it's jsut part of "firing" then you can just tell the server when you press fire and tell it when you stop.

#

You simulate everything locally (except doing damage) and the server does the actual shooting and rechambering and damage.

#

The server will update the client throughout this process on what the actual values are.

#

Just through regular replication.

#

At the end of firing, you can either wait for the server to replicate the current state back to the client (and it may just be the same as the client at this point anyway) or you can send an rpc with the current state and have it replicate (because you can't stop that part)

twin pendant
latent heart
#

Yeah.

#

Though. I would say, especially for an automatic weapon, if you try to fire (send start fire rpc) and the server says no, you should immediately send an rpc back saying you weren't able to fire to stop the client simulating it.

twin pendant
#

alright, so that definitely would reduce latency, but how about fast tab firing then?

latent heart
#

I have no idea what that is

twin pendant
# latent heart I have no idea what that is

i mean if you are on semi auto, you can still fire pretty fast but you have not the "advantage" of full auto that you know when you start & stop, so you probably have to have rpc calls everytime, but eventually not reliable i guess?

solar stirrup
#

tap firing would cause spamming reliable rpcs

#

that's why i went with unreliable ones

twin pendant
solar stirrup
#

why bother with two different paths

#

mixing the two will give you major headaches

twin pendant
#

on auto firing the audio needs to get told to play a tail sound, otherwise the auto fire sound continues to loop

#

so on auto the audio isn't played on every shot but at begin and end

latent heart
#

An unreliable rpc is really bad for crucial events - like firing.

solar stirrup
#

Treat is as unreliable, send shots until they get ack'd by the server, and then remove them from the shots to send. You can tailor it to your needs

#

You can also add a max time (like csgo/cs2 does rn, 200 ms and shots are invalidated)

latent heart
#

What's the point in that? That's exactly what a reliable rpc already does?

#

Except for the invalidation time.

solar stirrup
#

You're supposed to pack multiple shots in a single rpc

#

Depends on the rate at which you send them to the server

#

And unreliable rpcs are always lighter than reliable ones anyway

zenith osprey
#

Sup

solar stirrup
#

Allows you to predict and stay in sync without having to spam reliable rpcs, especially good with high firerate weapons

latent heart
solar stirrup
#

In theory yeah, haven't finished it yet, but it's promising

#

At least I hope, can't wait to meet surprise-unreal-engine-edge-case-#154845

latent heart
#

I assume you're including a timestamp with those?

solar stirrup
#

that'll be the plan yeah

#

the server will be able to rewind positions with it

#

with a margin of error because im not looking for esports standard 128 ticks

#

just "yeah it's a possible shot, sure"

twin pendant
#

hope it works for you!

solar stirrup
#

fingers crossed

#

Netcode for guns was always theory only for me until now, so I'm glad i get to test my skills heh

#

eXi about to strike my hopes and dreams down /j

thin stratus
#

That's one of those things that only really hits you when you start diving into it.
From the outside view of a beginner, having a weapon fire and hit someone is quite easy.
But after that initial naive setup it just becomes a nightmare of edge cases, boilerplate code and scenarios that one didn't think about.

stable bloom
#

Hi everyone! Does anybody know a way to see what properties of specific actor/component will be replicated during this frame? I'm trying to debug why my fast tarray inside of my chest actor is not replicating to clients when it awakes from dormancy with ForceNetUpdate
or perhaps any other solution

thin stratus
solar stirrup
thin stratus
#

Even if it's one RPC per Start/End

#

There is so much more

#

Add a bit of latency and you will have to figure out the Peeker vs Peeked At Problem

solar stirrup
#

Yeah that brings so many cases were it's desync'd between server, owning client and even other players seeing shots that never happened or missing shots that did

#

That too heh

#

It's a bit spooky but I'm hopeful

thin stratus
#

Ammo going async etc. you basically need more or less the same SavedMoves system that CMC has for literally every system you want to predict like that

solar stirrup
#

yeah that was the "inspiration"

#

and why im going with unreliable rpcs

thin stratus
#

Which is why the Plugin was such a dream that kinda died

solar stirrup
#

letting the server ack shots and have the client "replay" the ammo count if a shot was invalidated and the ammo count changed

stable bloom
#

but I guess you can connect to the live session in insights

solar stirrup
#

Network Prediction plugin? I thought that was a myth mmLul

thin stratus
#

Even has Editor integration by now or?

#

I mean you still have to actively click into the visual log to see what happened

#

But you would have that anyway

#

Unless someone literally coded a one time snapshot of data you are specifically looking for

thin stratus
#

I tried looking at it 3 times now to maybe revive it, but it's also pretty beyond my comfortzone

stable bloom
#

thanks, will have a look!

solar stirrup
#

Shame, I was really hoping it would come out

thin stratus
#

It might

#

Idk

solar stirrup
#

Also wonder how viable the GAS would be for weapons

#

I know fortnite uses it iirc, but I have no idea how that works under the hood

thin stratus
#

GAS does not have a prediction system like CMC

#

It has prediction, but nothing close to the CMC

#

GEs can be predictively added, and that's where it stops.
GCs can be predictively activated, not sure if removed.
GAs that are predictively run don't send any state to the Server for its own activation.
GAs that are rejected don't send any fixed up State from Server-side.
There is no Reconciliation for GA Activations either.

You will get some fixed up stuff via the GEs being removed again if wrongly predicted, etc., but that's about it

chrome bay
#

Start/Stop RPC's weren't good enough because they didn't have the accuracy

thin stratus
#

Reliable RPCs though, James?

chrome bay
#

Yeah, well you don't want shots to be dropped

thin stratus
#

Uff

twin pendant
#

every single shot with an rpc?

solar stirrup
#

don't worry they're all awful

chrome bay
#

Reliable RPC for every shot, second reliable RPC for every shot that hit's something damageable

thin stratus
#

Buffer says vrroooom

chrome bay
#

So worst case, 2 reliables for every shot. Lots of players running around with auto's sucks, but we got away with it

#

If only we did hitscan, then it would be one per shot 😄

solar stirrup
#

makes my soul cry though

thin stratus
#

How fast do those weapon fire though?

solar stirrup
#

that it even works

twin pendant
chrome bay
#

Highest ROF is 20 per tick

thin stratus
#

asdjkfalfjaks

chrome bay
#

Average is 10

thin stratus
#

But you send one RPC for those 20 or?

#

OR

#

You at least somewhat batch them?

chrome bay
#

could be 40 per second (worst case)

solar stirrup
#

it's like i'm trying my best to write something clean, flexible and maintainable and then you've got someone getting it working by banging a wrench on metal mmLul

chrome bay
#

But very very unlikely you'll actually hit that since players are dead within 2-3 hits, so no more "I hit something pls" RPC's

stable bloom
#

thats crazy

solar stirrup
#

Post Scriptum isn't any better

#

Did a test with 100 players spamming a high firerate machinegun in the air

stable bloom
solar stirrup
#

Server loved us

#

Squad mod that went standalone

#

using Squad's lovely base

chrome bay
#

The way I looked at it in the end was, it's a shooter - so stands to reason most of your network bandwidth can be allocated to either movement or shooting

solar stirrup
#

Yeah

chrome bay
#

The vast majority of other RPC's are very sparse in comparison

solar stirrup
#

If it works cool, still hurts to see such savagery unchecked

thin stratus
#

And there is no way to like Batch send some of those shots in one RPC? Does that even make a difference?

#

Especially if it's more than 1 per frame?

chrome bay
#

If you shoot + hit on same frame we do batch them, and shotguns would batch those together too

solar stirrup
#

I mean the second someone comes in and decides to optimize by batching, they'll also probably be smart enough to make the RPCs unreliable

thin stratus
#

Also I assume this is per Client Frame?

#

Does the Server run on a higher TickRate?

chrome bay
#

But because everything's a ballistic projectile from the moment it leaves the barrel and because bullets don't go all that far in 0.05 seconds, usually it ends up sendng separate

thin stratus
chrome bay
#

Server is 20TPS in HLL

thin stratus
#

20 o.o

chrome bay
#

We run the ballistic sim at 50 hz but send RPC's at 20

thin stratus
#

Ah

solar stirrup
chrome bay
#

Ballistic sim was fixed rate to try and avoid discrepencies etc.

thin stratus
#

Does that all run on the GT?

solar stirrup
#

In theory it doesn't change much from reliable, just lighter and i can do my own handling with batching

chrome bay
#

yeah

solar stirrup
#

More boilerplate, finer grain control

thin stratus
#

So is the GT TickRate 50 or are you artificially clamping the ballistic updates?

chrome bay
#

the ballistic sim is sort-of-but-not-really a lightweight ECS so simulation side is super fast

#

Ah no GT tick rate is whatever (20 on server but arbitrary on clients) - but we just substep the sim to 50 hz

thin stratus
#

Ah

#

Right okay

floral mauve
#

Is there a method to replicating animation pose data? I'm trying to replicate live motion capture data from LiveLink

chrome bay
#

I did want to try the thing UT does where you link weapon fire to character sim packets, but it's so tightly coupled so it was going to be more of an extreme optimisation thing. But also the problem with UT is, you just end up sending loads of movement packets instead since every shot fired has to be an "important" move

solar stirrup
#

I wish I had the time to do that

#

But work would probably shoot that one down heh

chrome bay
#

Yeah, I wanted to explore it.. just didn't have the time 😦

thin stratus
#

Yeah well that's just because UE only has the CMC with proper prediction

clear island
#

I also went with the reliable RPC per shot approach but all my weps are hitscan 😛

thin stratus
#

I was thinking about tying GAS to the CMC too

chrome bay
#

Yeah hitscan does make it a little easier/cheaper

thin stratus
#

But it just sucks

solar stirrup
#

If only we could hook into the CMC to sync other systems with it

#

(╯°□°)╯︵ ┻━┻

#

We could do a proper Source engine like implementation

clear island
#

other approaches have way too many edge cases

solar stirrup
#

Get almost perfect gun netcode

thin stratus
#

The proper way is to extract the CMC stuff, make it generic and reapply it to everything

chrome bay
thin stratus
#

Aka Network Prediction Plugin

thin stratus
#

With GAS and CMC

chrome bay
#

yeah, sucks

solar stirrup
chrome bay
#

Yeah I think that's the only way tbh

solar stirrup
#

even that's iffy sometimes

thin stratus
#

We are listening to GEs changing in the CMC, create custom Modifiers that are placed into the SavedMoves.
And have to give the Client some threshold cause GE removal can't be predicted

solar stirrup
#

Like i'm just about ready to give em authority over their stamina

thin stratus
#

It's an annoying setup to get correction free MovementSpeed Attributes working

solar stirrup
#

just so that players don't have to pay for the CMC's awfulness

chrome bay
thin stratus
#

Let alone the fact that most of you all probably never thought about the fact that a Server induced STUN is actually not properly updating SavedMoves.

chrome bay
#

I think that shooter sample did something like that, where I got the idea

plain nacelle
#

Can someone help me with this uber simple sheit.
I am trying to add two players. When do this incredible simple loop it STILL refuses to make two players. It seems like UE has changed this node to be called Create LOCAL player from Create Player and im just monster lost. As you can see im correctly looping and it even prints, but it doesnt care at all about the first iteration.

solar stirrup
#

I wonder if that marketplace movement component supports the GAS

thin stratus
solar stirrup
#

nope, doesn't

#

rip

thin stratus
#

Cause the node you are using is to create Local Players

#

And it always was for creating Local Players

plain nacelle
thin stratus
#

That is the CreatePlayer node

#

It always created Local Players

#

Someone just renamed it to better reflect what it does

#

This node was never capable of spawning Networked Players

plain nacelle
# thin stratus It always created Local Players

https://www.youtube.com/watch?v=98hu9MPm19c but in this video hes doing that exact thing.

This Video:
In this video, we flesh out our GameMode class and begin spawning in a player Input Receiver at each of the available Player Start points in the level.

0:00 Intro
00:19 Recap / Tidy
00:44 Get Player Start Points
01:24 About Player Start
04:50 Spawn Input Receivers

Multiplayer:
In this playlist, we'll look at anything and everythin...

▶ Play video
#

at minute 10:50

thin stratus
#

Again, do you want to play with 2 Players in 1 Game, aka Local Couch Coop (optional Splitscreen) or do you want 1 Player per Game, Connect via Network?

plain nacelle
#

Im fine with local couch

thin stratus
#

Then you don't need to start the Game with a Server

#

1 Player, Netmode: Play Standalone is enough

#

The node you posted will spawn the additional local players

plain nacelle
thin stratus
#

I'm not sure why you look like an idiot. You are learning. It's totally fine.

echo pasture
#

Cedric is wrong, it is the goal to actively shame people who are still trying to learn and call them idiots for not having the same knowledge base as a more experienced user

digital marten
#

@chrome bay it's really interesting to hear what you did for HLL, I've been wondering what other games do for stuff like shooting. Knowing this tells me that while not desirable sending multiple reliable packets a second is viable.

I have a question about your balistics. You said they're processed as 50Hz, I assume using fixed time step. How did you implement that in UE? Did you do something like this in the projectile actor:

void BeginPlay()
{
  SampleRate = 1.f / 50;
}

void Tick(float DeltaTime)
{
  SampleRateDelta += DeltaTime;
  while (SampleRateDelta > SampleRate)
  {
    SampleRateDelta -= SampleRate;
    RunBulletSim(SampleRate);
  }
}

I've been wondering how fixed timestep is done in UE, but I've not seen any answers. The above code has been my assumption for how it's done.

thin stratus
#

Yeah that could work I think

#

With fixed numbers, let's say TickRate is 20, so 1/20 is the DeltaTime. That's 0.05.
If you want 50 updates in the same time, then you need to perform 2.5 updates per Tick

#

1/50 is 0.02, so for the first frame you have:

  • Frame 1 | DeltaTime: 0.05 | SampleRateDelta: 0.05
  • SubStep 1 | SampleRateDelta: 0.03
  • SubStep 2 | SampleRateDelta: 0.01 -> Fails While on next iteration
  • Frame 2 | DeltaTime: 0.05 | SampleRateDelta: 0.06
  • SubStep 1 | SampleRateDelta: 0.04
  • SubStep 2 | SampleRateDelta: 0.02
  • SubStep 3| SampleRateDelta: 0.00 -> Fails While on next iteration
  • Frame 3 -> Same as Frame 1
#

Your While probably needs >= though or?

#

Unlikely of course that a floating point hits the sweet spot, but in theory it should

digital marten
digital marten
# thin stratus Yeah that could work I think

Does UE5 not have a preferred method of implementing fixed time step & ticks?

I thought it might since the game engine was used for multiplayer games, and quite a few of the GDC talks I've watched, everyone used fixed time step (though they didn't use UE). Overwatch did 60Hz, and Rocket League did 120Hz if I remember correctly.

thin stratus
#

RL was UE3 at the start and had a lot of custom shit in it

#

OW is of course not UE

#

UE has some sort of fixed timestamp, but not sure for substeps

stable grotto
#

Hey guys,
I want the server to spawn an actor only for the client that they only see and interact with
While using Spawn Actor From Class I just need to get the client reference and connect it to Owner and then tick Only Relevant to Owner right?

floral mauve
#

Is there a way to replicate an animation pose?

#

Like the actual raw data of it, and not just triggering an animation to run at the same time

#

This is how I'm trying to approach it in my AnimationBlueprint, unfortunately the client I think connects to the server but fails to load the level as it just stays black

#

Idea is to receive MoCap data on the host via LiveLink, save that data to a replicated SnapShot which the clients would use on their side as they would have no connection to the LiveLink

#

(Yes, in the screenshot the PoseSnapShot variable isn't replicated, I disabled that while testing for now)

thin stratus
twin pendant
stable grotto
thin stratus
#

Yeah then that's fine

stable grotto
#

Thank you guys

clear island
#

5.3 release notes ^

woven basin
clear island
#

I wonder if they're bringing it back

clear island
woven basin
#

thanks

clear island
#
Added additional Insights CPU scopes in Network Prediction plugin code.

Added a unit test program for the Network Prediction plugin that covers basic simulation ticking in forward prediction and interpolation modes.
#

yep

woven basin
#

sorry - saw you editted

clear island
#

😄

woven basin
#

but yeah - seems like its coming back

clear island
#

probably because of the physics prediction they introduced

woven basin
#

arh - yeah

ivory bear
#

Based on the pic, each turret is a spot where a player can possess and play (think multiplayer tower defense). how wouyld you connect a player to a turret?

thin stratus
woven basin
clear island
thin stratus
#

Easy enough to check if any other modules use it

clear island
#

yea I mean I'm just guessing, I dont actually dont for sure if they're using the NPP for it, release notes just say "Added Predictive Interpolation, a new type of physics replication."

quasi tide
#

Added documentation to Network Prediction plugin README file.
@thin stratus 5.3 patch notes

thin stratus
#

Yeah NewK already posted that

onyx citrus
#

Hallo, what is the best way to destroy replicated actors with lag hiding? I currently pick up some items, destroy them locally and destroy them as well on the server but sometimes some actors wont become destroyed. My guess is that it has something to do with latency but it is very random and I need to find a reliable way to do that. Does anyone have some tips for me?

solar stirrup
#

COND_Dynamic

#

And Iris having per-connection replication list for actors

#

Is it finally over

#

Are we finally getting rid of proxy actors to replicate to a handful of players

solar stirrup
onyx citrus
#

When I move close to the items I lerp them towards the player from 0 to 1 and if thats done I make the server call to destroy the actor, I do it on the client aswell because I dont want to wait for the server so there is no delay.

#

The Items are replicated but when I call destroy on the server they still, sometimes dont become destroyed.

#

I'am looking for a good way to destroy actors with lag hiding.

solar stirrup
#

They should Thonk

#

Just make them invisible on the client and destroy on the server mayhaps

#

There's lots of ways, some better for your game than others

onyx citrus
#

That is one good idea I could try.

#

I will try it with visibility but I'am still confused with multiplayer and why this does not work for me :D I need to learn a lot.

thin stratus
#

@onyx citrus I usually have an OnRep for bDestroyed and then set a Timer (or just the LifeSpan) to 3 seconds and destroy them then.

#

In the OnRep of bDestroyed I disabled and hide it as much as needed

#

That way the Client has all the time to show what they want to show

#

There is also something called TearOff, which cuts the Actors net connection

#

TornOff is the event on the Client for that

#

Then the Client would need to destroy it itself

#

Not sure if that is available in BPs though

solar stirrup
#

I think so

onyx citrus
#

Very very interesting. Thank you for all that information! If you disable the actor in the OnRep function you still have the server response time as lag dont you?

#

Nvm, now I understand what you meant with the timer.

pearl bear
#

In netstat my outrate is 6 and inrate is around 5.5 - 6. Ping is around 30-35 and still I have lag on my client. I am working on a racing game. Is these stats are normal or should I go with something like client side prediction to handle this lag issue.

woven bramble
#

I am trying to do Voice Chat using VOIP. It works in the Lobby where I join with OpenLevel but it's not working in the my Main Map where I log in with ServerTravel.
Has anyone encountered this before?

#

Since it never worked in PlayerController, I added it into Character BP (beginplay). This time, as I said, it only works in Lobby.

pearl bear
dark edge
#

Without prediction you should expect a 35ms + 1 or 2 frame delay between inputs and effects

dark edge
pearl bear
#

It's hard to express the full feeling, the game is played but it definitely doesn't feel comfortable

pearl bear
#

I am directly calling set throttle input method on client

dark edge
#

Chaos vehicles or your own system?

pearl bear
clear island
#

chaos vehicles dont have client prediction yet so this is expected

#

although your issue might be different

pearl bear
#

So I have to implement by myself ...

clear island
#

I think the throttle input should be called on the server

#

you calling it on client, makes the server correct it

pearl bear
clear island
#

which is probably the teleporting you're seeing

dark edge
#

You are basically applying your throttle in the future from the perspective of the vehicle. You are kind of doing your own half-assed hacky prediction.

#

What I would do is fire up the chaos vehicles example project, see if it works well in multiplayer, and see exactly how they have it set up.

pearl bear
#

thats probably why I had teleportation issue, I will try that, thanks a lot

clear island
# pearl bear Hmm, you are saying calling in both cause mismatch between server and client

basically, with client side prediction the way it works is:

  • 1 )you apply the input on client first
    1. then send it to the server and apply input there
    1. server sends a correction if it does not agree

however, chaos vehicles dont support client prediction yet, so in your case you are only doing 1) and you're constantly getting corrections from the server which causes that teleporting to happen

if you really want to stick with chaos vehicles you need to apply input on the server, not the client, but it will be bad for players with high ping, because you'll need to wait for the server to process your inputs before anything happens, so if you have situations where a vehicle is going at high speeds and the player is about to hit something, even if he dodges it in time, he will still fail to dodge and hit it because it will take time for the server to process that input

#

however, as of a few hours ago 5.3 was released which has an experimental physics prediction feature, if I were you I would try to explore that and see if it works for chaos vehicles

pearl bear
#

In worst case I can implement my own client side prediction, I guess its same as any fps game

clear island
#

yea this is also an option, if you're already familiar with it

twilit radish
#

@fathom aspen I'm expecting you to do a break down of the multiplayer plugin in the free Epic content this month 😛
#unreal-news message

#

Do they provide source code on the market place? I don't remember lol.

solar stirrup
#

Seems like it's blueprint only anyway

#

so you'd have access

fathom aspen
#

Well here's the proof to those cpp haters saying MP is not doable in BP only

twilit radish
#

I don't think anyone ever said it isn't 'doable' but it's absolutely not easier. Specifically optimizing blueprint only is kind of a pain because Unreal locks certain things behind C++ 😛

#

Although I guess I don't need to tell you that, but you get the point 😆

solar stirrup
#

good luck working with a team with only blueprints

twilit radish
#

That's the neat part. Who needs a team am I right! 😄

fathom aspen
#

BP only multiplayer works until it stops working XD

twilit radish
#

I was trying to make a quick prototype with just blueprints and I was already running into problems trying to connect.. The problem was that the net mode isn't exposed and my 'game' and 'lobby' map were the same so I couldn't easily tell if I was in standalone mode or connected to a server 😭

fathom aspen
#

Wasn't there IsStandalone?

#

There is already IsServer and IsDedicatedServer I guess

twilit radish
#

I don't want to talk to you again.

#

🤣

fathom aspen
#

See

#

Told you BP is insane

#

Yeah good luck poor me trying to use Iris and trying to fix such a bug xD

twilit radish
#

Did Iris even 'release' yet?

#

I think it's still just being worked on right?

fathom aspen
#

It's compiled by default now

#

But still not enabled

clear island
#

its a new bug 🙃

fathom aspen
#

Yeah should be actively worked on, but still no where close to touch it in production

twilit radish
#

Oh yeah for sure haha.

fathom aspen
#

current network solution?

#

You meant current replication system?

#

I don't think it ever had the honor to be named

#

Just regular old one

clear island
#

yea theres no fancy name like Iris

fathom aspen
#

Will be called poor soon™️

digital marten
clear island
#

I think Iris is supposed to be used on top of the current system

#

just like push model

#

probably not in the same way

#

but in way that does not disregard the base replication system already in place

#

standard property comparison

solar stirrup
#

although the engine itself is slowly being ported to push model

#

push model is just better both in code cleanliness and offers "some" performance benefits

#

the amount may vary, depends on your game heh