#multiplayer

1 messages ยท Page 650 of 1

vague fractal
#

Wdym by that ?

fading birch
#

you have your notify set in your montage correct?

#

or w/e anim asset you're using

#

just adjust it there

#

have it trigger when you want it to

vague fractal
#

I actually don't use montage atm.
It's all done with via the animationBP with his states

fading birch
#

you should use a montage for this kind of stuff

#

much more flexible imo

vague fractal
#

Every time i've tried to work with montage's it felt really wrong to me, but yeah. It's probably better, maybe i just need more time with it

fading birch
#

how has it felt wrong?

vague fractal
#

The Slot system inside of the AnimationBP and that i need a reference to the Montage in C++ code

fading birch
#

it's not so bad once you get used to it

#

you just need to set the slot in your anim bp before the final anim

true karma
#

Hi, I'm trying to replicate an event to all players, and I'm wondering how to go about it. Essentially it's treasure that appears in a random location in level that all players can see, and a HUD notification saying it appeared. Also, where would I place the code for it? Game mode? Player controller?

fading birch
#

Assuming the server is spawning it, then you can spawn it from your game mode, and then fire an event off on all player states, via the array of player states in the gamestate, to drive your HUD notification

true karma
#

@fading birch thanks. I'll dig into it.

dark edge
#

Is there some way to detect the current vs late replication in a RepNotify or do you have to do both RPC and RepNotify to do something akin to the explodey barrel?

dark edge
half jewel
#

theres actually an example of that problem in the learn tab of the ue4 launcher

#

where player joins late and an already opened chest plays its opening vfx

#

i think their solution was vfx and stuff on an rpc and stateful stuff on the rep notify

zinc garden
#

@half jewel You're right about that solution. I think they have that setup in the replication map on the Content Examples project

thin stratus
#

Everything that should happen in the moment of opening the chest should be an RPC. Everything that longterm defines the state should be an OnRep

#

I usually do this as a struct with info such as When was it opened. That way you can set the animation to the last frame if it's been a while since the chest opened

dark edge
thin stratus
#

I guess if you somehow keep track if when it was opened via a timestamp

#

So that longer ago opening doesn't trigger the rpc stuff

#

It's definitely sometimes better to use more than just a boolean to represent the state

twin juniper
#

is there a way if test a multiplayer game with a dedicated server , how it handles more clients , like 10 clients for example ,with out having people testing it ,?

thin stratus
#

I guess some unit tests or so but nothing build in

#

Usually you test with real players i guess

pure mango
#

Anyone noticing how slow Player State variables are updating/replicating on the client compared to the server instance for multiplayer?

prisma salmon
#

hey, could someone help me on how to make teams? I need to make a sort of a CTF game mode and i've been researching and found literally nothing on the internet for that sort of game mode, i knew about some stuff like "player state" and "game state" but have no idea on how to implement teams or the flag for the classes if i use them

plucky prairie
#

there an easy way to cast to player state from game instance? or the other way round can't find what links them

true stream
#

What is "to travel"?

#

In the guide I'm reading already starts talking about the different types, seamless and not seamless. Bit it never defines what it actually is.

prisma salmon
#

can anybody help?

dark edge
prisma salmon
#

anybody?

plucky prairie
prisma salmon
#

@plucky prairie i kind of just want to know how it works like how would i make teams? or how would i end the game when somebody pickups the flag?

dark edge
prisma salmon
#

Yeah i got that, but like where exactly would store the variable? @dark edge

dark edge
#

On PlayerState and also on the pawn. You could also use tags if you need projectiles and other things to have teams.

thin stratus
#

The more involved way of doing this is to make a new ChildClass of an Info Actor and call it TeamState.

#

Add all the info into that that you need, an array of Controllers and PlayerStates, etc.

#

And have a pointer on the PlayerState to the Team they are in

#

The less involved way is the Enum I guess

#

Then you would store a lot of data in the PlayerState and GameState

prisma salmon
#

i thought i should've had an array of controllers for the team

thin stratus
#

Yeah though both is better

#

Or maybe even only PlayerState

#

Cause if you want to list the Players of a Specific team to a clien,t they won't have any entries in the controller array, despite maybe their own

prisma salmon
#

how would i get the list of players for a specific team for a leaderboard for example @thin stratus

prisma salmon
thin stratus
#

Yeah if the enum variable is replicate

#

Last time I implemented teams I made that TeamState

#

And have all info in the TeamState

prisma salmon
#

i see im going to go the easy route with the enum thanks a lot

prisma salmon
#

thanks a lot i figured a lot of stuff out and i think i can make the teams now

tired sequoia
#

Heelo guys
i have some issue here in my game
the issue is the client not travel to the same map
how can i fix this

rocks random spawn

meager spade
#

your rocks are being created locally and not replciated

#

client made his own rocks compared to server

#

either spawn the rocks server only and mark them replicated

#

or use some determintstic random using a seed, so client generates the same rocks

warped fjord
#

anybody some tips or resources for standing on moving plattforms/ships/vehicles in multiplayer?

tired sequoia
#

thank you

native vector
#

i need some help
im taring to run montage on other player from player using trace and is working on server to client and is not working on client to server
using this events and exec target is other player

#

is not working idk what i need to do

#

is not working idk what i need to do

#

interact

#

ok i got some stupid idea and is working
someone can explain me why my approach was not working i confused ๐Ÿค”

heavy marlin
#

anyone know why it might be that when i start a client in the editor, and listen server is started for me - the listen server doesnt load config files (that im using for various required info)?

twin juniper
#

Hello everyone.I am using Default online subsystem.When my player creates a session he will go to thirdPersonExampleMap.When another person finds a session it is visible but when he joins that session he is also going to Third PersonExampleMap but there is no host in that map.He is the only one in that map.Plz help me.Thank you

wide portal
#

When calling ServerTravel, by default all player controllers are persisted, but what about any possessed pawns? Will they be unpossessed and destroyed by default, or should I tell all my controllers to unpossess first before any map transition?

fading birch
#

Player states, the game mode, the game state, and the game session are held when traveling. They are handed over to the new level upon arriving.

#

pawns are not.

#

player controllers are destroyed and a new one, matching the levels game mode player controller class, is created and the client is assigned that controller. Then the default pawn for the gamemode is spawned and possessed by the controller.

wide portal
#

๐Ÿ‘ That's what I was expecting. I think the issue I was experiencing came from testing in single-process PIE--I guess the clients got stuck and didn't reload the map, so it looked like they kept their possessed pawns. After switching to multiple processes, map transitions look like they're working fine, but loads of other things are broken ๐Ÿ˜† My fault for having the wrong configuration for testing up to now.

fading birch
#

it happens

#

when I first had to deal with it, it was a confusing mess

wide portal
#

Is it safe/practical to test anything in single-process PIE? The documentation says it may have "issues" but doesn't really give examples. Apart from server travel not working correctly, everything is much more stable in single-process mode, which makes me think it's just hiding a bunch of real issues.

thin stratus
#

You should always test actual builds.

#

Or at least Standalone.

#

it's also not true that GameStates survive the ServerTravel

#

@fading birch

fading birch
#

It's in the actor travel list.

thin stratus
#

But only one way

fading birch
#

Yeah.

#

I'm not sure what it does after tbh

thin stratus
#

Killing it

fading birch
#

Or why it's transfered.

thin stratus
#

You get a new Instance

#

It only survives from current to transitionlevel

fading birch
#

Ah

#

Thanks for the clarification

#

I thought it may transfer some attributes like the playerstate does

#

@thin stratus actually doesn't server travel work in PIE? I swear it does. Testing in standalone and packaged builds is a good idea too. But if you're testing travel stuff, pie should be fine providing server travel works in PIE

thin stratus
#

seamless doesnt

fading birch
#

Hrm that's odd

thin stratus
#

Yeah it's Epic :P

fading birch
#

I just swear I've used seamless travel in pie

#

I'll check tomorrow.

thin stratus
#

It'll give you a warning or error in your log even PE_PandaSippysip

vague fractal
#

I'm still kinda confused what kind of server will be run when i start with this settings.
Is that also just a listen server in the background or is that a dedicated server ?

#

"The editor will act as a Client. A server will be started for you behind the scenes to connect to." isn't very clear to me ๐Ÿ˜…

#

Alrighty

thin stratus
#

The Server code will react like a DedicatedServer though

vague fractal
#

react like a DedicatedServer
Does that basically just mean that there aren't any things which will render and similar ?

thin stratus
#

And some more, yes

vague fractal
#

Alrighty ^^

vague fractal
#

Does UE offer a way to run animations on dedicated server's ?
I've just read a post from siliex that Riot is doing that for valorant (for accurate hit detection) and i feel like it would make my life much easier :S

thin stratus
#

You should be able to play them on the Server just fine

vague fractal
#

Yeah, it does work just fine on the listen server, but with the case from above(Or when literally using a dedicated server) it wont be played

thin stratus
#

How is your MeshComponent set in terms of Visibility Tick?

vague fractal
#

Do you mean this setting here on my skeletal mesh ?

thin stratus
#

Yeah

#

Check if that shouldn't be Tick Pose and Bones

vague fractal
#

You sir just saved me from a lot of pain, thanks ๐Ÿ˜„

thin stratus
#

Does it help?

vague fractal
#

Yeah, now it runs with the case from above.
Can't really test it on an actual dedicated server though since i don't have a source build

thin stratus
#

Alright

split siren
#

Is replicating an existing actor without custom properties an expensive operation bandwidth/server side? My main concern is when actor start and stops replicating for specific connection frequently, so it spawns and despawns on client.

chrome bay
#

Starting and Stopping frequently is almost certainly not a good idea

#

Dormancy has the same problem just without the cost of actor spawning. But if you change between awake/dormant often, each time it's opening a new channel - which means sending all properties again, even ones marked as Cond_Initial

abstract pond
#

was wondering if i could get any help - im getting accessed none blueprint error for the player state ref that is here -

chrome bay
#

It's a replicated actor so you can't garauntee it exists when you try to use it

#

Should use a validated get

abstract pond
#

i've got this in the blueprint and on the event tick print string the server side its firing as true - its just the client player when they join the server is returning as false

#

so its just the client player player state not being set

chrome bay
#

yep, makes sense

#

actor takes time to reach the client

winged badger
#

PlayerState Actor needs to replicate separately from the reference to PlayerState

#

only after it does do you get a valid PS

#

replicating an Actor reference doesn't automatically replicate the Actor itself, its just the Actors NetGUID

abstract pond
#

ok i think i managed to fix it - the blueprint actor that is tracking all of this information itself wasnt set to replicated in its own class defaults

#

because i just set that to replicated and tested it again and they are both firing as true in the same server

chrome bay
#

just make sure you test frequently with packet loss and latency

#

Editor is rarely a good test environment for multiplayer stuff

winged badger
#

also, GameMode or GameState are supposed to track that stuff

#

not a separate Actor

#

one thing you really don't want is Actors that you really don't need replicating

abstract pond
#

before i was getting a bunch from the event tick but now only the one

winged badger
#

you still need to pull the is valid from PlayerStateRed

#

and return false if its not valid

#

it won't be every time either

abstract pond
#

so um - im debugging to see whats going on - added an is valid into that function and both are valid and firing through the branch

#

but theres something else thats being a problem

#

inside the function im comparing checkpoints passed versus the max checkpoints target - on the server the max checkpoints target is being set fine - but on the client side that x is returning 0

#

even though the total checkpoints debugs value is correct and the max laps debug value is correct the multiplication is returning 0 as the value and not setting the max checkpoints target correctly on the client player

thin stratus
#

Where are you checking the result?

abstract pond
#

what do you mean by checking the result?

thin stratus
#

You are saying the Client value is 0

abstract pond
#

yeah i just debugged went into the blueprint and just hovered my mouse over all the variables

#

and checked it in debug on the client and server versions - the server versions were all set correctly the client for some reason reading 0

thin stratus
#

Since you aren't using OnReps, can you just put a PrintString on Tick and print it there

abstract pond
#

yeah it still reads 0

meager spade
#

dont connect like that

#

grab the actual variable

#

not from the set node

abstract pond
#

same result with this

meager spade
#

not sure why controller is holding the checkpoints, that seems like player states job

abstract pond
#

the player state holds the checkpoints passed just the overall max checkpoints in the race that the controller holds

#

it works when both players are in their own lobbies but when they join the same lobby only the server is being set correctly

dark edge
abstract pond
#

replaced the max checkpoints target variable and put it in the player state - did this the values set were correct on both print strings but for some reason i got the accessed none on that player state ref

regal storm
#

Hey, looking to have my player walk to a location after interacting with the object before triggering an animation.

Tried using "Simple Move To Location/Actor", which does replicate, but is extremely jittery. It also doesn't really have much in the way of output (knowing when it's finished, for example).

Is there a 'best practice' for this sort of thing? Essentially, player mouses over an object (first person), hits "F", and I want them to automatically walk over to the object's 'Destination' transform variable. Interaction/Trigger is all there, I just need help on the approach to getting the player walking to the provided Destination transform

dark edge
regal storm
#

Ahh, yeah, setting up an AIController during movement seems to be the answer. Just have to handle the repossession after it's finished (and stop losing the view target on AIController possession)

granite nest
#

If i want to fire a gun in a multiplayer game, do i play the gunfire sound locally and run the actual raycasting and detection on the server (+checking if he is allowed to fire), and also ask the server to multicast the fire sound but exclude the one that fired? or is that not the correct way?

abstract pond
#

the checkpoints passed variable reads the same for both server and client even though they are not and in the array of the players checkpoints thats sorted for the leaderboard its correct?

twin juniper
#

Has anyone here had success getting sword trail particle effects to work well for clients with low framerate? Running into issues with fast melee animations where the trail looks funky because there arent enough frames to draw it properly

kindred widget
#

Why would networking handle your particle updates? Networking should play animations, animations should be played client side, particle should likely be attached to the weapon. So the only thing affected by network lag in everything is when the animation starts playing for the current state.

granite nest
#

When a player makes a sound that should be heard by everyone, do you just multicast playing the sound effect, or : play it locally , multicast it and ignore the multicast on the player that fired the gun, for less latency?

twin juniper
#

@kindred widget fair enough, I worded the question poorly I guess, removed the part about lag

kindred widget
#

Not sure if there are better ways, but UE4's default prototype uses an int variable to handle that. You just set a replicated variable on the server, and make it replicate to all except owner. On replication, play effects for that gun like muzzle flash or sound. Owner can play their same thing locally at the same time of the RPC to update server.

granite nest
#

oh okay so they do the low latency way

#

Is there a way to only to make a replicated variable only replicate to the owning client? So if server changes it, only 1 client gets that info. For example, i dont need other players to know how much ammo i have, so if it gets changed on the server, only i need that info

kindred widget
#

Scroll halfway down here.

#

This is more C++, but blueprint replication conditions should have most of these settings if you're using that.

granite nest
#

ty, i forgot about those conditions. im using c++

red salmon
#

Hi, everyone. So I got this little problem I recently started messing with multiplayer in unreal and managed to set up a direct IP input game and wanted to ship it to a few of my friends for testing but I have a problem if someone types something else other then an IP the game crashes any thoughts on how to restrict my editable text so it doesnt allow for the console to do "open (something else other then an IP)".

granite nest
#

You could make it 4 separate text fields that each accept only a number and later add dots between them

#

You cant specify that a text field should match a pattern

#

If you only want 1 input field, you could also validate the string before passing it to the console with a ipv4 parsing function

red salmon
#

I found an alternate way while I was messing with the blueprint and I think I found a pretty fool proof solution (might not be the best and maybe it will still crash the game but in my attempts at trying to crash it I failed at doing it.)

granite nest
#

i guess it will only crash at "0." for example

red salmon
#

nope it didnt

#

idk why but I tried that and didnt crash

granite nest
#

nice ๐Ÿ˜ฎ

bronze summit
#

I have an array of integers im replicating and this is quite heavy when initializing using init function on TArray as it calls OnRep n times. So I was looking at this pre-replication condition to change it to off during init. Does anyone know if when enabled it sends all the data? So basically after init to true and then send

tranquil yoke
#

for some reason, all of my rpc inside game state are not working anymore, there are like server events and client events, which used to work now they dont ? can some help me understand ?

dark edge
#

@granite nest Basically you only network "the gun just fired", not the effects that might make that event up. So on each machine you'd go
"THE GUN JUST FIRED" ->

  1. Play sound
  2. Play particle
  3. Play animation
granite nest
#

like this for a reload for example? Basically: the player character calls client reload. client reload calls server reload and plays some sounds/animations locally. Then the server actually changes the ammo and calls a multicast reload for all the other clients to play the sounds/animations

dark edge
#

That goes for many things.

"THAT DUDE JUST DIED" ok spew blood, play "ugh" sound, ragdoll

"THE SCORE JUST UPDATED"
ok play sound, update UI, etc

#

That's the basic gist of multicast events and RepNotifies

#

You should be networking the minimum state and events of the game so the experience can be constructed correctly on each machine

granite nest
#

okay i have a pretty good understanding now i think

#

So my implementation above should be correct

dark edge
granite nest
#

predicting when he is going to fire and then fire ๐Ÿ˜„

#

but thanks, now i know that i'm not being silly having 4 functions for each networked action

dark edge
#

Prediction in this context would be updating the local ammo count on reload before the server does it, and rectifying things if the server disagrees.

split siren
#

I still can't figure out an optimal way of replicating inventory. I started with fast tarray rep of structs (uint8 itemID, int32 quantity)
This works well, small footprint, but is not flexible at all. For example gun in inventory has some bullets in it, but this info doesn't have anywhere to go in the current struct. Any ideas/pointers how to replicate inventory of items that serialise to different structs?

bronze summit
# split siren I still can't figure out an optimal way of replicating inventory. I started with...

I currently am working on a inventory system too. I've found that using structs as a base definition of a item the best solution as I can link it against one or multiple datatables. Then I started creating the storage component to make it multiplayer compatible and I quickly found out that I was walking against the same issues as you do. In my struct I had for example a stacksize. But in datatables they are always 1 (stacksize) for me as it should be modular and expandable. So I decided to make a second struct which is what you are doing with the quantity and id basically but ID is for me a whole struct with a FGuid inside. As Im not working with ammo I cant really help with that. But what you could potentially do is if for example a mag is a inventory item itself you can potentially nest that inside. So you would get struct Item (Weapon) -> Slots (Scope, Mag, Stock (Array of Item structs or Map for fast lookup)) -> Magazine Slot (Index of struct) -> new Item Struct (Ammo Type) -> Stacksize 30 (integer) (full mag or something)

twin juniper
#

so i want my game to check if a server is full and then go to next server and so on, my idea is that i can have many dedicated server running on different ports and game check thru them and join the one who is not full. how to do this? or is this a bad way to go about it?

thin stratus
#

Do you have a list of those servers?

#

What if all are full?

#

This sounds a bit like something that a backend should solve and not the game. But that's not so straightforward

fading birch
#

I was actually curious about something similar too. What if I have 2 players and the server has only 1 slot open in the session. They try to join at the same time. What ends up happening?

#

I imagine they would both join and I just kick the last person to join.

thin stratus
#

They both join and the second one gets auto kicked

#

UT solves this with Beacons iirc

fading birch
#

Ah interesting.

twin juniper
#

is there a way to scan for what dedicated server are up running by default in ue4?

fading birch
#

Find sessions would handle that

#

Providing your using an OSS

thin stratus
#

If you have an OnlineSubsystem running that supports sessions

#

Damn it, too slow

fading birch
#

Kekw

#

And I'm on mobile lol

thin stratus
#

Dito. Just woke up

fading birch
#

Fair enough.

#

It's 11pm here.

thin stratus
#

8am

thin stratus
fading birch
#

Most of the time if you're not using a online subsystem, you'll need to create your own system for your backend. Or use an existing one like playfab or aws gamelift.

thin stratus
#

Yop which cost a lot

fading birch
#

Even a custom one would cost a bit. Cloud servers are stupidly expensive

#

Ehh

#

It's a bit inbetween imo

#

There isn't really a good channel for this kind of convo

thin stratus
#

Let's see what they answer

twin juniper
#

i found a plugin caller multiplayer server browser master server listing, it runs a program that the dedicated server send their info to, and client can the see a list of server and connect to them. I think this will solve it for me.

fading birch
#

that...sounds like a waste of money tbh

#

are you hosting on a specific platform/store?

#

ie Steam, Epic Games Store

twin juniper
#

well atm i just host myself, but goal later on is steam or epicstore

fading birch
#

I would use the Steam Online Subsystem then

#

and utilize find sessions

#

your servers can create a session upon starting up and Find Sessions will show you a list of servers that are up that match the query parameters

twin juniper
#

thanks . sounds great. I will look into it .

thin stratus
#

Hosting yourself is all fun and games but is a ton of more work once you realize that it doesn't stop with some simple server browser.

#

Steam takes a cut but also gives a lot in return. Or take the adventure of using eos which hands you this stuff sort of for free

granite nest
#

If a character is spawned on the server, visible for each client and the server, and the character spawns an actor locally in begin play. Every client and server will then have this actor. Now if i call a server function inside the actor class on a client, will the server be able to run that? Or does it not know which actor that is on the server

strong sail
chrome bay
#

Message Bus is something else

pastel marlin
kindred widget
#

@granite nest That actor spawned by the character has no networking capability. You cannot network anything that is not directly spawned by the server and replicated. The only way to affect that actor, is to route things through the Character and make each machine affect their own copy.

granite nest
#

Hmm i need some help with my ammo not replication

#

i have 2 ammo variables. The MaxAmmo is assigned via blueprint

#

inside the beginplay of the weapon, the ammo is initialized on the server

#

both variables are replicated

#

Lets say the MaxAmmo is 4, then the client says i have 0/4 ammo, while the server says 4/4

#

So the maxammo is replicated, but the other one is not

#

init ammo is defined like this

#

okay i changed the replication condition and now it works so the server is the owner

thin stratus
#

Yeah, multiple things you should reconsider @granite nest

#
  1. MaxAmmo is set via Blueprint, so it doesn't need to replicate.
  2. You are limiting the InitAmmo call already to Authority, not need for it to be a ServerRPC. This just allows clients to change it, which is bad.
  3. If COND_OwnerOnly fails to replicate for the Client, then the Client is not the Owner of the Weapon, which you should usually make sure of by setting the Owner param on the SpawnActor Paramaters.
granite nest
#

ooh thats how the owner works

#

thanks ๐Ÿ™‚

floral mauve
#

Purely theoretical, is it possible to replicate an actor of the same BP between two different levels?

#

Or will that probably require a workaround or twenty

thin stratus
#

A Server can theoretically only have one active Level

#

Not sure what your plans are yet

granite nest
#

Are first person cameras usually replicated? When i want to fire on the server i need the player camera directon, so i guess?

floral mauve
#

Though I guess you can have one main level and each client can load in a diferent sublevel

thin stratus
granite nest
#

Lets say i want to increase the maxwalkspeed of a movementcomponent. Should i a) just tick the replicates checkbox and then call the server to change the maxwalkspeed. b) tick the replicates checkbox, call server to change maxwalkspeed + locally instantly change the maxwalk speed (it will cause less delay before sprinting starts, but wont it result in jittering effect because the server will not allow the higher speed before it is received by the server?) or c) dont tick the replicates box and change a custom variable "walkspeed" on the server, which each client will then apply to the movemet comp OnRepNotifyWalkSpeed, or d) again the same as c but also change it locally

#

my intuition would be to do d because it does not replicate all the variables from the movement component and still (maybe?) leads to the same movement

chrome bay
#

Since the client has to predict the max walk speed, you should change it on the client and also ask the server to change it.

#

Ideally though, you would do that in lockstep with the movement simulation.

#

And of course Server needs to make sure the client isn't cheating by doing so

granite nest
#

And that will not result in jittering? (because the client changes it before it is received by the server and the server will not allow the higher speed)

chrome bay
#

It shouldn't do. The client isn't receiving movement from the server, the client is simulating then tells the Server what it did

#

And the server either agrees or disagrees. For it to agree, the movement speed has to be the same

#

Usually the speeds are fixed, and instead you send flags to denote which speed to use, i.e. whether you are sprinting or not etc.

#

Otherwise you could get RPC ordering issues where the two calls arrive at different times

dark edge
#

@granite nest To Correctlyโ„ข implement a multiplayer Sprint function, you have to go into C++

granite nest
#

i am using c++

dark edge
#

@granite nest I haven't implemented it in my project yet but I'm pretty certain you need to do something along the lines of this.
https://youtu.be/RtQRMcupJs0

Many of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidschannel
Discord: https://discord.gg/PdvudWx
You asked for it so here it is! This is my Networked Character Movement Tutorial complete with a full download to the pr...

โ–ถ Play video
blazing spruce
#

Hi, wondering if someone can help? Im doing a first person game where the player has to press E to interact with things which then draws a line trace.. the line trace is ran on the PlayerCharacterBP and is set to Run On Server in a custom event however its only doing it in a straight line and doesn't take into account if the player is looking up or down, does anyone know how to get around this? Its only started doing it since making it replicate, before that it worked where ever the player looked

thin stratus
#

You will have to show what nodes/variable you use for the trace

blazing spruce
#

Also it only doesn't work for the client, the server can look where ever and it works

thin stratus
#

Can you try using the BaseAimRotation for the direction instead?

blazing spruce
#

Ive never actually used that node before lol where would in go in place of?

thin stratus
#

The forward vector

blazing spruce
#

So i would put the BaseAimRotation into the Multiply node instead of the ForwardVector?

thin stratus
#

Yeah you need to turn the rotation into a vector first

#

Should also be called getforwardvector on the rotator

blazing spruce
#

Like this?

#

Although thats making the line trace just go off the left if im looking straight from when i spawn and if i turn it still goes to the same place regardless of where im facing

#

oh wait.. i never plugged it into end lol

#

Yeah thats working now thanks mate!

prisma salmon
#

please?

dry cipher
#

hello all
Maybe someone can help me:
I have a simple spectatormode with set view target with blend.
I used Paw Control Rotation for my Camera Spring arm (camera is not relevant for multiplayer in my case). My problem now is that the spectator has input controls disabled. Is there a simple way that the spectator can move the camera also localy?

#

if i understand correctly, viewtarget is only the image and possess the overwriting of the controller?

analog plinth
#

Has anyone had problems with a Reinstall breaking Session joining?

prisma salmon
#

No.

analog plinth
#

Keeps freezing server on my pc and kicking client after timeout

#

My partner has tried the project and it works fine

prisma salmon
#

that has to do with your network then

#

oh

analog plinth
#

has to do with the editor somehow

#

have reinstalled several times now, if anyone has had a similar problem and knows a fix, Id appreciate it

prisma salmon
#

how about getting a new pc and trying it?

#

on there?

dark edge
analog plinth
#

its standalone

prisma salmon
#

try the packaged

#

version

analog plinth
#

it had no issues before reinstall

#

and was playing in two standalone windows

dark edge
#

If standalone don't work that's pretty borked

analog plinth
#

yeah tell me about it

prisma salmon
#

did you try the packaged version?

#

or?

dark edge
#

What's the crash log?

analog plinth
#

I can.

prisma salmon
#

You can try the packaged version?

analog plinth
#

Something about a function thats clearly working and a reference that its clearly getting.

#

I will try the packaged version

#

as I said, partner has gotten zip today and it works fine, no errors

dark edge
#

You doing anything weird like hot reload?

analog plinth
#

Just creating and joining lobby and starting session

#

travel

dark edge
#

Try nuking the disposable folders like intermediate and saved

#

It's weird that it would behave differently on different computers

analog plinth
#

Seriously

prisma salmon
#

prob

#

something weird nobody understands

#

are you working on a bugged engine version?

analog plinth
#

4.26

prisma salmon
#

oh

#

i have no clue

analog plinth
#

4.26.2

#

Yup

#

exactly my life rn

#

trying int and saved kill

prisma salmon
#

unreal is a buggy mess not going to lie

analog plinth
#

sometimes it can be for sure

prisma salmon
#

epic should really fix alot of those bugs

kindred widget
#

It's not really that easy most times.

prisma salmon
#

true

#

but still

kindred widget
#

Change one thing, and suddenly half an industry can't update to the newest engine version. People hate you. Don't change things, let people solve them themselves, people hate you. Better just to leave it alone.

prisma salmon
#

btw does epic own unreal engine? or did epic make unreal engine?

analog plinth
#

Yup. still broken lol

#

unreal came first i believe

prisma salmon
#

bruh, there's no way it'd work on someone else's pc

analog plinth
#

it 1000% does

prisma salmon
#

I'm actually surprised it does

dark edge
prisma salmon
#

are you using a vpn by the way? or are your firewall settings broken/

analog plinth
#

nope

prisma salmon
#

ok that's suuuupperr weird

analog plinth
#

yup

dark edge
#

You need to start by confirming that you 1000% both have identical projects

prisma salmon
#

Also a quick question for anybody: is listen servers safe? will my ip get leaked or something like that?

#

i hope not

analog plinth
#

dude. I zipped it, he opened it, it worked. Theres not much more I can say

dark edge
thin stratus
#

Anything you can do in form of debugging?

analog plinth
#

after

thin stratus
#

Like, attach VS to it

#

And check where it hangs

analog plinth
#

Im fairly certain its the engine

#

if its not the project...

dark edge
thin stratus
#

You reinstalled the engine version?

analog plinth
#

So idk, maybe eradicate all trace of engine then reinstall

#

yeah

thin stratus
#

What are you testing, standalone?

analog plinth
#

thats when the problem started

#

yup

thin stratus
#

What if your partner packages

#

And you start the packaged version

#

Does that work?

analog plinth
#

Id rather not rely on packaging every time I want to test it, tbh

dark edge
#

@analog plinth On both boxes, open the uproject file in text editor and check that they're exactly the same

thin stratus
#

Welll

#

You kinda have to cause PIE/Standalone is different from Packaged

#

But of course only every day once or so

prisma salmon
thin stratus
#

But still, it's a test

#

It's not supposed to be the solution

analog plinth
#

Standalone ran the game fully replicating before reinstall

thin stratus
#

have you verified the instalation?

analog plinth
#

and still does on other pc

#

yup

dark edge
prisma salmon
analog plinth
#

advanced sessions is what you want

prisma salmon
#

that isn't lan

thin stratus
#

That has nothing to do with lan or not

prisma salmon
#

it doesn't have to be

analog plinth
#

no

thin stratus
#

AdvancedSessions exposes more C++ code

analog plinth
#

yes

thin stratus
#

You still need a Subsystem that can do online sessions

prisma salmon
#

like?

analog plinth
#

eos or steam subsystem

thin stratus
#

Steam

#

EOS

analog plinth
#

look it up in plugins

thin stratus
#

Or Platform depending

analog plinth
#

^

prisma salmon
#

Is there a tutorial on how you can implement steam subsystem

analog plinth
#

several

thin stratus
#

Probably

prisma salmon
#

if there is please send a link

thin stratus
#

Google is your friend

prisma salmon
#

okay

thin stratus
#

@analog plinth Did you reinstall the Engine and left your project on your PC?

analog plinth
#

yes

thin stratus
#

have you cleared the binaries, intermediate, saved folders?

analog plinth
#

have

thin stratus
#

regenerated project files too I assume

#

It compiles fine?

analog plinth
#

yup

#

just crashes on session travel

thin stratus
#

What does the crashlog say

analog plinth
#

something that doesnt ring true

thin stratus
#

Have a copy paste/Image?

analog plinth
#

its about a reference coming back null. which isnt possible. because it has the reference

#

Im reinstalling engine, dont have log in front of me

thin stratus
#

Did you attach VS when it crashes?

#

Would probably help

#

And make sure to use DebugGameEditor and not DevEditor

#

In case it still persist after the reinstall

dark edge
vague fractal
#

Uhm, say i have an Enemy class which has an variable marked as ReplicatedUsing.
The OnRep will not be called if the instance is already destroyed, or ?

analog plinth
#

if the actor is destroyed, I do not believe the variable exists

#

I could be wrong

vague fractal
#

Alright, also wondering if it would or would not get called if the Enemy instances is marked as PendingKill

thin stratus
#

You usually want to add some extra time before destroying

#

You "deactivate" the actor, hide it, turn off collision, and destroy it 5 sec later

analog plinth
#

can make it go invisible

thin stratus
#

Or you can have a look at "TearOff"

analog plinth
#

then destroy it

thin stratus
#

But that needs some c++

vague fractal
thin stratus
#

Yeah then have a look at TearOff

#

Should call TornOff on the Client

#

Will cut off replication and allow the client to handle life time afterwards

#

@vague fractal

vague fractal
#

Alrighty

granite nest
#

i have this animation sequence that plays on another player's weapon when he fires. Everything works except for the sound cue, which is not being played. Is there a reason for that?

#

Also are those always played in 2D? because then it would already not make sense to play it like that when another player fires

#

Oh i can specify a bone name lemme try that

#

nope still not doing anything

#

The player that shoots sees the animation, the particle effect and the sound

#

but other people only see the animation and particle effect

granite nest
#

also changing the sound for a different cue or montage is not working

dark edge
#

@granite nest show the event that is triggering the sound

granite nest
#

This is called when someone fires

#

from the multicast reload that the server sends

#

PlayAnimation plays the reload animation

#

which includes the play sound notify

#

as shown in my first screenshot

#

Maybe i should change the play sound notify to a custom notify that calls a multicast which plays the sound.

#

but then it gets complicated

dark edge
#

@granite nest are particles triggered by a notify?

granite nest
#

yes they work

dark edge
#

So the problem is in the notify. Is the parameter for what sound to play replicating fine?

granite nest
#

The sound to play is just set inside the animation sequence

#

if that is what you mean

#

im not really telling to play a specific sound, just to play a specific animation

thin stratus
#

Do you hear the sound when previewing the animation?

#

Do you hear it when just placing the animation looped into the scene?

#

You can also try to make your own AnimNotifyBp

#

And play the sound in there

#

To try and see if that works

granite nest
#

a) yes, it is also heard by the player shooting, just not by others. b) yes then it works perfectly !

granite nest
granite nest
#

lol i added a play fire sound notify event

#

implemented it

#

and it does not even get fired (not printing hello nor playing sound)

stray oxide
#

I am using advanced sessions plugin and whenever a client joins a listen server, it can't move or do any actions that require input. The pawn is just standing there playing the idle animation. Anybody know why this could be??

compact adder
#

Im getting this crash when trying to join a session anyone know why

steel agate
#

I've had an issue with components on an actor. I expected the child scene components to move when I update their relative location on the server and that would be visible on the client, however that doesn't happen.

I can solve this by manually updating on tick or something like that but I'd rather make sure this expected behavior. The components are set to replicate.

#

Nvm it's not actually running on the server and it's an issue of my own replication of server client

steel agate
#

So okay, then here's my confusion. I call the function on the server to adjust the position of the users weapon depending on their controller type/settings. This gives them better offset for aiming.

Now the server calls an event set to run on owning client, that checks what settings the client has, then calls a run on server event. The run on server event gets dropped....since i see the event triggered on the owning client, print statement shows it hit, however the run on server event it calls gets dropped

#

I'm guessing ownership isn't inherited? Pawn owns the gun, controller own the pawn, controller does not inherit ownership of the gun?

#

I set the weapons owner from the pawn to the pawns owner, everything works, but I don't feel that's right.

vivid prawn
#

a quick question, How does an event dispatcher works when it's replication set to RepNotify?

#

I understand RepNotify trigger on variable changes, but in event dispatcher i'm not changing anything, i'm calling an event

severe widget
#

Uh

#

I wouldn't expect a dispatcher to replicate at all

#

Maybe BP will call the event if you bind/unbind from it, though, and that'd be sorta neat

vivid prawn
#

i see... yeah, but I can't make it work, just thought maybe i didn't understand it well.

#

and it only calling it on server not clients

severe widget
#

BP notifies are a little different - they'll fire when the value changes regardless of where it is but then also when a new value replicates over the network

#

Effectively calling your OnRep on the server

winged badger
#

and on client if it sets the value locally ๐Ÿ˜„

vivid prawn
#

i see... I'm trying it on Game State, I believe everyone have GameState on their side, so i'm not sure what i'm missing

winged badger
#

way to "replicate" an event dispatcher call

#

is basically, put a byte variable with RepNotify

#

from OnRep, call the dispatcher

#

and just increment it on server when you want it called

#

it doesn't matter what the value in it is, just that it changed

vivid prawn
#

oh... so it should have a variable in order to trigger, ok, let me try that

#

yeah, it works, I set event dispatch replication to none and rely on variable RepNotify

#

which means setting event dispatcher to RepNotify doesn't make sense, is there any purpose for event dispatcher to have replication?

severe widget
#

nah just a fluke and it doesn't seem to do much of anything

vivid prawn
#

yeah, thanks guys for the help ๐Ÿ™๐Ÿฝ

tacit pine
#

hello.How can i get quantity players in blurprint?

thin stratus
#

GameState->PlayerArray->Length

thin stratus
#

So, I assume if a Client locally changes a repolicated Array and the Array doesn't further change on the Server, the Client would keep their local change, right?

chrome bay
#

yeah for sure

granite nest
#

If you have multiple client windows open, and shoot in one window, do you guys hear the shooting also in the other client's windows? or do you only hear the sound from windows that you are focused on

fossil veldt
#

Ay ppls how do you use DOREPLIFETIME_CONDITION with a custom condition? I'm tryina set my property to only rep if another variable is set to a certain value OnRep like so but I can't figure out how you're supposed to use SetCustomIsActive and there's not a whole lot of usage in the engine to look at:

void ACItemBase::OnRep_ItemState()
{
  if(ItemState == ItemStates::Carried)
  {
    SetCustomIsActiveOverride(Bla bla bla);
  }
}
kindred widget
#

@vivid prawn That's just an oversight on Epic's part. They likely just don't check in the UI what the Property is. Dispatchers are a property just like a boolean or integer and can be marked Replicated, etc. But Dispatchers don't have anything to do with networking. They won't actually do anything outside of the local machine.

#

@fossil veldtNot sure I understand? If you want the client itself to override onreps, just take in the old value, and if the other property == something, set the value back locally. Otherwise you usually mark it as a replication condition on the server.

fossil veldt
vivid prawn
kindred widget
#

@fossil veldt Can't you just specify that in the DOREPLIFETIME_ACTIVE_OVERRIDE ?

#

DOREPLIFETIME_ACTIVE_OVERRIDE(AMyClass, ReplicatedVar, ReplicatedVar = EMyReplicatedVarType::ValueName);

#

Er. No, that won't work. Sec.

fossil veldt
kindred widget
#

Wouldn't you want to call that on the server though?

fossil veldt
#

yeah, i'l probs do a switch on authority

#

1>C:\UE\Projects\Hydroneer\Source\Hydroneer\Core\Items\CItemBase.cpp(77): error C2065: 'ChangedPropertyTracker': undeclared identifier Getting this but I think i'm probs missing an include

vague fractal
#

DOREPLIFETIME_ACTIVE_OVERRIDE Damn. And it thought there is only
DOREPLIFETIME and DOREPLIFETIME_CONDITION :blobsweat:

fossil veldt
#

ah I seeeeeeee

#

Is it possible to grab the property tracker from somewhere?

#

It's available in void ACItemBase::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)

#

yeah wait I don't even need to do this OnRep, I can just do it on PreRep anyway

red salmon
#

Hey guys is there a tutorial or something that can help me how you can send data to a session from lets say a main menu? ( what I mean is that I want to require players to set a username in the main menu before joining a server and when the player joins a server it will have that username variable with his name in game)

pearl fog
#

hey! I'm using the default VOIP system in Unreal and for some reasons when I server travel using seamless travel the engine just crashes, I checked the crash report and it seems it fails when FScene is being destoyed or the Audio Thread crashes. Is there a way to fix it ?

fading birch
#

@red salmon beacons would help solve that. But that's more of a #online-subsystems question

golden girder
#

how to do physics and collision with console multiplayer sending sockets

#

?

granite nest
#

Is it true that you need to make a custom character movement component for multiplayer?

pearl fog
#

well the default one works in multiplayer but it might not be suited for you

dark edge
granite nest
#

Lets say you just want your sprint to work correctly

dark edge
granite nest
#

this guy in this video: https://www.youtube.com/watch?v=RtQRMcupJs0&t=404s, says that you really need a custom movement component

Many of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidschannel
Discord: https://discord.gg/PdvudWx
You asked for it so here it is! This is my Networked Character Movement Tutorial complete with a full download to the pr...

โ–ถ Play video
pearl fog
#

why use a custom one for something as simple as sprint ?

#

you just need to change your movement speed on server and inform the clients so interpolation/extrapolation don't do strange teleport things

granite nest
#

he shows that this is the bad way to do it, which causes bugs when your ping is a bit higher than zero

#

which just sets the movement speed locally and tells the server to change it

pearl fog
#

I never got any issues with the character movement component ๐Ÿคทโ€โ™‚๏ธ

#

but yeah this code is not safe

granite nest
#

Can you quickly explain why not?

pearl fog
#

because the client is sending the speed it wants to the server, you can change it in Cheat Engine or other cheating programs and hack your speed

#

a better way would simply tell the server to start sprinting and you manage the speed server-side

granite nest
#

But you would also change the speed locally for less lag right

pearl fog
#

yeah

#

you can use RepNotifies or Multicasts to inform the clients that the speed of a player has changed so they can update theirs locally

granite nest
#

But lets say you have 500 ping. You start sprinting, the server does not know you started to sprint for 500 ms and you will teleport all over the place because the server does not agree

pearl fog
#

if you change directly your local speed yes, but if you only do it once the server processed your message and sended a message to every client it will not (but you will still have some sync issues with that much ping tho, like extreme input lags)

granite nest
#

uhu, So apparantly, the guy in the video added some things to a custom character movement component and then you will not have the bugs from my previous message

#

i'll rewatch it to fully understand

thin stratus
#

The main reason why you should implement Sprinting into the CMC directly is because otherwise you get corrections at start/end of your Sprint

#

Which feels shite for players with higher pings

granite nest
#

But i dont understand why you dont get that correction if you implement it into the CMC

thin stratus
#

Also the suggestion to use an OnRep OR a Multicast is bad.

#

Multicast is pretty wrong here

#

The CMC works like this:
The Client tells the Server that it wants to move. It sends a Timestamp with that request, as well as some additional info, like it's movement inputs, if it wants to jump, crouch, etc.
It also sends the Server the final Location after the Move.

The Server will then perform the same movement. If the location is different it will correct the Client.

#

If you change the WalkSpeed of the CMC on the Client and then via ServerRPC also on the Server, then there are a few frames where the Client moves with the new WalkSpeed, tells the Server what location it reached and the Server, not having the WalkSpeed variable changed yet, will perform the move and end up on a different location, resulting in a correction for the Client

#

Because the ServerRPC for the WalkSpeed change will not happen at the same time as the ServerMove RPC.

#

And that goes for all sorts of Input Driven movement

#

E.g. Rolling, Dashing, and what not

#

And on top of that comes the moves that the Client actually saves. When the Server corrects the client, the Client might already be a lot further with its actual movement. The Client keeps track of its last few moves, discards verything older than the correction and then replays the ones that are newer, so you aren't literally teleported back.
And these also need to know that you were infact sprinting, so that also has to be setup correctly.

#

Networked Movement is not easy, and while it looks working on 0 ping or low ping situations, if you have a higher standard multiplayer game with fast movement etc, then you have to use the CMC.

round star
#

Why is it that I cant just spawn instanced foliage meshes on the server and they not show up for clients like a regular actor..tf

granite nest
#

So you are saying there is a delay when you change the movement speed directly and send that info to the server to change the speed, but isn't there the same delay when you tell the CMC that you want to move?

#

wait i think i understand

thin stratus
granite nest
#

ooo so its purely because the speed update and movement location update are not sent in the same network packet

thin stratus
#

Yes, or rather in the same RPC

#

In your own CMC you can basically pass over additional flags

#

One being "IWantToSprint"

#

And then the server will perform sprinting the same way the clietn will and they stay in sync

granite nest
#

yes thanks a lot for this information i really needed this

#

everytime i think i understand networking, there is so much more to it

blazing spruce
#

Hi, ive got a problem which im hoping someone can help with.. at the moment i have 1 PlayerCharacterBP, eventually im gonna have to have a few of them to have 5 or so players in the game, when i incorporate those BP's ive got a feature where you have to find keys to unlock certain doors, at the moment i have a 'HasKey' bool on the PlayerCharacterBP, now for the Key's BP i do a check once interacted with to see if the player has the key or not, if so display a HUD, if not pickup the key however the way im doing it is via a Character Ref in begin play which at the moment is the same BP for every character in the game.. Whats the best way to do this kind of check when there is multiple characters? this will also lead on to my next issue with HUDs lol

near gull
#

Anyone have any suggestions on replicating skeletal mesh movement? I have the location replicating perfectly, however the limbs of the character are not correct.

#

What I want:

#

What I get:

thin stratus
#

Are these simulating physics?

near gull
#

Yes, but no gravity

thin stratus
#

Well, doesn't matter if gravity or not

#

They use Physics to determine their location and that's not easy to sync

#

You can try only simulating on the server an replicating a struct or so with bone locations to then update the bones on the clients

#

+- some inter and extrapolation

near gull
#

I see, do you know of any good documentation or videos for that?

#

Sorry, I am brand new to UE4

thin stratus
thin stratus
#

This is usually visible fluff that you don't sync

near gull
#

I figured as much, necessary for my application unfortunately. Thanks for the help.

blazing spruce
thin stratus
#

Yop

near gull
#

@thin stratus Last question, do you think what I am trying to do work without simulating physics? When I disable physics before it seems like it disables the whole skeletal mesh and is set to the reference pose.

blazing spruce
#

Nice one and then if i make the PlayerCharcterBP i have now the parent and make child copies of it for each player that should still work right?

thin stratus
#

That's what inheritance is for, yes

blazing spruce
#

Thanks mate!

thin stratus
near gull
#

Gotcha, thanks

blazing spruce
#

So same kinda thing, when the player picks up a key they can pick it up by interacting with it or if its been dropped (by a player dying for example) then ive made it so you can pick it up by walking over it, atm ive got it so again it checks the OtherActor and casts to the PlayerCharacterBP, is there a way around this as well so it makes sure its that specific player?

thin stratus
#

You might want to limit actually aquiring the key to Server only and make the boolean for having the key and OnRep to drive visuals and general state

#

You don't need to RPC there, neither can you usually

boreal geyser
#

Hey ya'll so I have a multiplayer game that uses the advanced sessions plugin. However, for some reason, when two players try to play from different machines, the session the host creates cannot be found(Even if they're on different or the same network). The session can only be found if the host starts up another instance of the game on their machine. What could be some causes for this?

warped violet
#

Hello

#

How can I set a player name so it will persist ?

#

I am using PlayerController::SetName(const FString& S)

#

but it gets reset every map change...

foggy rain
#

Is it possible to replicate respawn timers? If I just call an RPC, I have a latency on the client.

kindred widget
#

@foggy rainYou'll have an easier time just replicating a single time value to the client. Player dies, respawn timer is set on server as ServerTime + 10.0f seconds as a float. It replicates to client. Client can use that by getting the replicated server time and doing RespawnTime-ServerTime=WhatToDisplay.

foggy rain
kindred widget
#

Servertime is already replicated. You just need to replicate or rpc the respawn time.

#

GetGameState -> GetServerWorldTimeInSeconds will get you the server time for any machine.

foggy rain
kindred widget
#

The time the RPC went through shouldn't matter. The only thing the client needs to know is the server time that the server intends to respawn at. The time at which the RPC was sent won't help anything.

foggy rain
kindred widget
#

GameState has a value that is constantly ticked. 1.0f value per second of game time. That's ServerTime. If you kill a character, and then set RespawnTime as CurrentServerTime + TimeItTakestoRespawn. Then RespawnTime is all the client needs to display the timer.

Player dies at 537.53f ServerTime.
TimeItTakesToRespawn = 10.0f
Server sets RespawnTime for that player at 537.53+10.0 = 547.53. It RPCs or replicates this, either way works. Replication is probably better.

Client gets this value maybe a tenth of a second later after the replication. Client knows that it'll respawn at 547.53-Servertime. Now you get the time to display by doing RepawnTime-Servertime. So the client received the 547.53 value 4 seconds ago. It ticks, does it's 547.53-Servertime. Since that was four seconds ago, client will display approximately 547.53- 541.63 = 5.9 seconds to respawn.

foggy rain
#

Wow, now I get it! Thank you a lot!

I have another question. AGameStateBase contains a function called GetPlayerRespawnDelay. Should I override it to display respawn time? Is it returns seconds left or the whole respawn time?

#

I just thought that the respawn time is better to locate in PlayerState.

kindred widget
#

@foggy rain That looks like a call used to get the value that can be set to set a minimum respawn time. It won't work for anything but server code though. It's located on the GameMode. Any other call to that looks like it will just return 1.0, like on Clients.

#

Personally, I'd agree with you on the PlayerState. I'd want other players to see a player's respawn time and such and since it's associated with a player, it'd be best to put it there.

pure mango
#

Here's the scenario:

On Client 1:

  1. Player touches coin
  2. Player's PlayerState.CoinCount +1 in PlayerController, "Executes On Server" event
  3. Update Client UI coin amount text box

On the Server side, that PlayerState.CoinCount is 1. Then the updated PlayerState will be replicated back to Client 1.

However, I am seeing that there is a replication delay between steps 2 and 3. The UI will actually update first before the PlayerState replication happens.
On the Client, UI shows "Coins: 0" when it should actually be "Coins: 1" after replication.

Using print statements, I can confirm the PlayerState will eventually get replicated over. But since the update Client UI is called already (step 3), the UI is outdated and the code does not know to update the UI again.

Is there a solution to this? Am I thinking this right?

kindred widget
#

Honestly. Prediction is a downright nightmare with UI. It starts out all nice and simple, but in reality, as a developer, you're really better off just taking the network delay on clients and always displaying the real value replicated from Server.

pure mango
#

I'm okay with clients getting delays on UI updates because of replications
But the UI is incorrect because the replication is slow, because I call the UI update event after sending the PlayerState update (Execute On Server)
Was wondering if that's a good practice to do

kindred widget
#

You shouldn't rely on RPCs much with UI either unless the RPC is just meant to display something once, like a server wide message or something. OnRep functions with bindings, or ticks/timers will be your friend for keeping UI correct.

pure mango
#

Here's an example:
On Client:
Picking up a Coin (in BP_Coin) will call the UpdateCrystalCount (in PlayerController)
Then it will update the PlayerState on the Server (which will eventually replicate it back to the Client), and update the HUD

Problem is PlayerState.CoinCount is still 0 for the Client when HUD is updated because PlayerState hasn't been replicated from the Server back to the Client yet

#

And after Client Update HUD is called, it won't be called again
So the UI is outdated when the replication from the Server back to the Client finally happens

kindred widget
#

Your value is on the playerstate?

pure mango
#

Yeah, I wanted to keep all player values in PlayerState, I think it makes sense
Unless it isn't?

kindred widget
#

Create a delegate in the PlayerState like OnCoinCountUpdated. When UI or HUD is instantiated, get the local player's playerstate and bind an event to that delegate, the OnCoinCountUpdated. In the Playerstate, make that value Rep with Notify. In the OnRep function, call the delegate OnCoinCountUpdated. Now the UI knows to run that event after the value has been replicated to the playerstate.

#

Now your only networking related to updating that value on clients should be the server replicating the value.

pure mango
#

Hm, I'll have to analyze what you just said some more but I think I kind of understand
Let me try it out
Thanks

foggy rain
#

It's weird that this function is located in AGameStateBase and not managed by game mode

twin juniper
#

what function is called when a pawn is possessed by a client? It's an APawn, not a ACharacter

brittle beacon
#

any tips on what sort of character polycount to aim for with multiplayer games in mind? maximum 8-10 players at a time, arenaโ€™ish, 12-15 ai also present per map. thanks.

hollow eagle
#

That question is too situation specific, there is no general answer.

astral crater
#

When replicating a component, do both the component and the owning actor need to override GetLifetimeReplicatedProps, or just the component itself?

dark edge
#

Depends on the spec you're targeting, but polygons are cheap. Don't overdo it with 5 million poly models but anything sane will be fine

brittle beacon
dark edge
brittle beacon
#

yeh i have so far only reduced using lod in cc3..

kindred widget
#

It's also not really a multiplayer issue. Your networking won't care how many polygons your meshes have.

brittle beacon
#

multiplayer is not only networking but feel free to defend your point whilst i go off and do something useful.

kindred widget
#

Only really true if you're planning on a local coop game.

fossil spoke
#

Assuming you meant that your attempting to create a Property on the Component that is Replicated.

astral crater
#

I'm trying to replicate the instance of the component

#

Which I believe is not what you're saying

fossil spoke
#

Ok well in that case why would the Component itself need to implement GetLifetimeReplicatedProps? That is the function that allows the Replication of Properties on the object itself.

#

So with that in mind.

#

On the Owning Actor, you need to mark the Property thats holding the Component as Replicated and then add an entry to the Owning Actors GetLifetimeReplicatedProps function to cause it to be considered for Replication.

astral crater
#

Oh so I misread the component replication page

#

But now that you say it that way it makes sense

fossil spoke
#

A Component is a UObject, it gets replicated like any other property.

twin juniper
#

when the player connects to the server, there's a brief moment the player has no pawn, is there a way to control what location/rotation/view-target the player sees at this moment when it has no pawn?

fossil spoke
abstract pond
#

hey was wondering if anyone could help - i was wondering how i can stop the movement of each player after they have completed the race - i already have the full set up for completing the race just not disabling their movement after the game is done

#

i still want them to be able to press buttons so they can use the menus etc but i want their movement to be stopped until the rest of the players finish the race and then stopping the movement of any players who have finished

fossil spoke
#

Are you using the CMC?

#

For movement?

#

It has a DisableMovement function.

abstract pond
#

there is no enable movement function however so how would i re enable the movement?

fossil spoke
#

SetMovementMode

#

DisabledMovement just calls this with a MOVE_None input

#

So you can call it yourself to set movement to MOVE_Walking or something

abstract pond
#

getting accessed none with this - im doing this blueprint in the gamestate as thats where the race completion stuff is all being done

severe widget
#

Well the owner of a game state is never going to be your character

#

So the cast will never actually give you a valid value

#

You say this is at the end of a race? Wouldn't it be that you have a list of participating players?

open quail
#

the owner is probably the player controllaer

#

what you maybe want is getcontrolled pawn or sth

hollow eagle
#

no, the owner of the game state will never be the player controller either

open quail
#

oh its the game state

#

yeah

pure mango
#

Anyone know how to get the corresponding PlayerController in PlayerState?
Get Instigator Controller is null, I have to input an Actor

thin stratus
#

GetOwner

pure mango
#

Oh, that's strange
In PlayerState:
Get Owner takes in Actor and returns Actor
But the returned Actor (self) is actually a PlayerController, not an Actor
But I guess PlayerController is an Actor
So the owner of PlayerState is PlayerController, good to know
Looks like it works, thanks

thin stratus
#

The Type that is returned by a function doesn't mean the thing that the Pointer is Pointing to is of that Type. It can also be a ChildClass

#

That's what casting is for :P

steep terrace
#

Thx @thin stratus

tight granite
#

hi all.I am new to ue4. i am trying an mutiplayer game where users can push each other. the player is applied a knock back using LaunchCharacter node on componentHit.
on listen server the collision looks perfectly fine with with 300 ms ping,but when the game is run using Hamachi vpn and there is a jitter on knock back. i am not sure why this is happening.
any help would be appreciated
the following is the approach

  1. create a custom event set to run on server which is calling launchCharacter, and run it locally
chrome bay
#

It'll be near-impossible to make it smooth. Only the Server should detect the hit events and call launch character. Ideally the locally controlled character would "predict" the launch too, but it can't really do that when the source is other players

#

Characters interacting with each other in multiplayer is always going to have jitter/collision issues

round roost
#

Is there a way to replicate an actor only to a certain player, that isn't the owner? For example a Character that is possessed by an AI, but only a certain player should see it

#

When i spawned the character I set the owner to the player and tried "OnlyRelevantToOwner", however as the AI possesses it the owner is changed to the AIController

chrome bay
#

You can override AActor::IsNetRelevantFor so long as you're not using replication graph

round roost
#

Thanks, I'll do that :)

thin stratus
#

Can someone refresh my memory a bit: If I want to determine if a Character is the ListenServer's or some other client's via Roles, what Role setup do I expect?

I assume being on the Server side would be LocalRole == ROLE_Authority.
And for the owning Client, locally it would be LocalRole == ROLE_AutonomousProxy.
And for other Clients, locally it would be LocalRole == ROLE_SimulatedProxy.
Now if I'm on the Server side, so LocalRole == ROLE_Authority, how do I diff between my own Character and someone elses?

The RemoteRole must either be ROLE_SimulatedProxy or ROLE_AutonomousProxy.

#

I assume the it will always be LocalRole == ROLE_Authority and RemoteRole == ROLE_AutonomousProxy, or?

chrome bay
#

IsLocallyControlled() :D?

thin stratus
#

But... I want ROLES

#

:D

chrome bay
#

Unless you have to use roles ๐Ÿ˜„

thin stratus
#

No I don't.

#

James go home!

#

Thanks :D

chrome bay
#

Yeah I guess it would be ROLE_Authority on Server... and RemoteRole == None?

thin stratus
#

None :O

chrome bay
#

Maybe...

#

I'm not sure

#

๐Ÿ˜„

thin stratus
#

Yeah right, at least I'm not alone with those roles

#

Ah well, will just try with LocallyControlled then

#

Wanted to be as fancy as the CMC

chrome bay
#

I think on Server a remote player is local == authority and remote == autonomous

thin stratus
#

Blรคh, still doesn't do what I want it to do.
I just need the Current Timestamp in my CMC.

chrome bay
#

I think Remote for the Servers' own pawn though.. not sure

thin stratus
#

And I have Server and Client prediction data. Just can't figure out the one i need to use per character

#

Client apparently is also for ListenServers, locally at least.

chrome bay
#

I don't think Server has any prediction data for it's locally controlled char does it?

thin stratus
#

Hm idk. I could just use the World TimeSeconds I guess

#

Just for the Client I would need it to be in sync, which I think it is

tight granite
chrome bay
#

The best you can probably do is have only the server respond to hit events and launch the character

#

Integrating it with Client-Prediction is somewhat impossible to achieve here because other players will be lagging behind too much for it to be in sync anyway.

round roost
#

So somehow my "OnlyRelevantToOwner" actor does not get replicated to the owner at all. The owner is not the controller, but the controlled pawn of the player btw. Maybe that's the issue?

thin stratus
#

Not sure how that exactly works, but maybe it's only checked once if it should send the package to spawn the actor on the client and at that point your Character/Pawn is not possessed yet?

#

I would try passing the Controller or making sure the Actor gets spawned when the Character is possessed

granite nest
#

About prediction: Lets say i want to reload and i already change the ammo counter (replicated integer) locally , and then i send a server request to reload. The server checks if(allowed to reload) and sees that the player is not allowed to. The local counter should be restored to the server version, but the local variable does not get updated bc replicated variables are only updated if they change on the server and the server one does not change in this case. Should i do this with a Client RPC? i know it'll work but maybe there is a more logical/simpler/built in way

#

Normally i would add a local check to see if the user is allowed to reload, then restore the ammo counter and then call the server reload. So the prediction would only be incorrect if the user bypasses the Allowed to reload check, which leads to the player not seeing the correct counter and nothing else

#

So maybe i should just not care

blazing spruce
pure mango
#

So this is weird. I have this in my BP_Checkpoint:
Top image: Player Array has two elements but the output for both of them are empty for the print statements
Bottom image: But by just adding a Player Array Temp and using that, it somehow works just fine as expected

I wonder why is that?

granite nest
#

Can a cheater change your code/variable values?

#

Then cant he just remove the 'is authority' check and execute code that should only run on the server

dark edge
#

@granite nest sure he could, but it wouldn't matter. If it didn't happen on the server, it didn't officially happen.

granite nest
#

So i have noticed in multiplayer shooters, when i have 300 ping i can instantly aim and my fov will instantly change, so it is only done on the client. So as a cheater, i could make it that all my weapons zoom in x10 and noone would ever notice right

bitter oriole
#

Probably

granite nest
#

And i could also zoom in while jumping because i could remove that check to see if aiming is allowed

bitter oriole
#

Sure

thin stratus
#

The thing with the Authority is that uuuusuuaaly, if you use C++, you can mark the code to be stripped from the Client package

#

Not a thing in BPs though I think

granite nest
#

Ait

#

i guess game developers have to make a trade off between security and performance

bitter oriole
#

More a trade off between security and how deep in your player's rear your are going

#

PC security is not a thing, you just need your kernel level anticheat to be good at finding out

frigid ledge
#

straight, how do i call a variable from the server from the client?

chrome bay
#

You don't, but I'm not sure I follow. what are you trying to do?

bitter oriole
#

Need more context

frigid ledge
#

trying to call an array containing all P Controllers that have joined the session, I need those for the Playerlist TAB to be updated etc, tried using All actors of class but not seem to work

dark edge
bitter oriole
frigid ledge
#

that also includes having a variable that holds all the Controllers?

bitter oriole
#

Such a variable can never replicate correctly

#

It should be an array of player states instead

#

Which already exist in game state

frigid ledge
#

okay thanks

vague fractal
#

Hey uhm, i'm currently trying to use the Network Profiler.
But it seems like the GUI is kinda bugged in my case.
Like i can't even see what's above Details (PER SECOND)

#

Also doesn't seem like i can scroll up or similar

rugged token
#

Idiotic question, but I'm not finding an answer. I have turn-based game module which I want to convert to multiplayer. If I use steam subsystem, does Steam provide a server to run my game, or that's on me and I have to manage the server myself?

thin stratus
#

It's nearly always on you

#

Steam does not provide hosting your Server

#

@rugged token

#

If you can't afford the huge server costs that come with trying to host Dedicated Servers for a community (which might never exist if your game doesn't go off), you might just fall back to ListenServers (cheating can't be prevented) and stop caring.

rugged token
#

@thin stratusthanks, clear as day - this just ended my endeavor with making multiplayer. I just can't handle all of that by myself w/o any programming/network experience.

thin stratus
#

Well, UE4 gives you the Server

vague fractal
thin stratus
#

But you will have to host it somewhere

thin stratus
chrome bay
#

tbh if you're making a game that needs dedicated servers you better hope you've already got a community to play it.

#

Just make s m o l games that don't need em

thin stratus
#

Ah we are all repeating ourselves every 2 weeks.

chrome bay
#

๐Ÿ˜„

thin stratus
#

Can we just make a website?

rugged token
#

Ok, hosting a server is way beyond my ability. I don't even really know what a server is. So i'll just stick to single player and make another game that doesn't beg for multiplayer ๐Ÿ˜•

thin stratus
#

Allar, are you here for some Website thingy that tells people to stop making non-playerhosted Dedicated Server based games?

#

Sticking with Singleplayer saves you 10 years of your life, just by not having to learn it

chrome bay
#

MP is overrated ๐Ÿ˜„

thin stratus
#

So yeah, good call

#

Take it from someone who is looking at replicated movement for the past 4 hours, trying to figure out why the replaying of moves on client side just DOESN'T WANT TO DO WHAT I WANT TO

rugged token
#

@twin juniperI have no knowledge of neworking, so aside from converting my single-player game to multiplayer, which might prove quite the trip on its own, I need to also dig into how networking and setting up a server works. Aaaanyway, i'll better make another singleplayer game from scratch, at least that's something I can definitely do w/o problems ๐Ÿ˜

#

then, i'm not ๐Ÿ˜‚ not alone anyway

silent sinew
#

I'm running into this "Failed to open descriptor file"when the game launches on the phone. I've searched through the comments here and I see many people have this issue but only one seems to have mentioned any fix - but it's ambiguous. They ( @dry tulip ) said "i might have figured out a work around, using the absolute path to the uproject file seems to be working". I haven't figured out what is causing this issue but this seems to indicate it's a path issue. Where is this path stored or changed at?

rugged token
#

I'm not a programmer, I learned UE+blueprints in the last 3 years, I'm decent at it, learning mp now is something I can't afford.

#

so, i either find someone to work with, or drop it, stick to what I know I can do - u know...

#

anyway, thanks for the info everyone! ๐Ÿ˜„

round roost
floral crow
#

When I try to launch a client from a packaged build it launches as Standalone instead of Client. What is causing this? I don't even know which other context I should provide you guys with.

Here's the command line arguments I'm using: MyGameClientPackage.exe /Game/MyGame/MapsFolder/Map -ServerIP 127.0.0.1 -ServerPort 7777 -game -log -ResX=1280 -ResY=720 -WINDOWED

round roost
#

Still not replicating... oof

vague fractal
#

Does it make sense to mark a property as Replicated and ReplicatedUsing ?
Or is it enough to only use the ReplictedUsing if you are in need of a call back method ?

granite nest
#

using alone is fine

vague fractal
#

Might should ask it a bit differently, does ReplicatedUsing also imply that it's Replicated

granite nest
#

yes ๐Ÿ™‚

vague fractal
#

Alrighty

granite nest
#

For a first person game, how do you guys implement the 2 different character models (one that the player sees and one that others see) ? my idea is just to add 2 skeletalmesh components to the fps template and set one to owner only see, and the other to owner no see, and then apply animations etc to the active one. Is this good or bad? I'm wondering if things wont look weird because in the fps character, the mesh is attached to the camera

vague fractal
#

Just using "True first person" is an option, but the problem with that way is that your animations have to be made for true first person which is why i gave up on first person ๐Ÿ˜ฆ

fading birch
vague fractal
normal violet
#

Is there someone with a good understanding of server / client movement? I'm having some problems with my character where the default movement is working just fine (charactermovement), but rotating a static mesh (a turret in this case) of that character is jittery on the client while it's smooth on the listen server. A force net update helps a bit, but it's still a bit jittery for the client. Does anybody know how to correctly implement this?

vivid prawn
#

How do you save PlayerController when traveling to another map? e.g. a player select a character in the lobby and i want to spawn that character when map is loaded for that specific character.

#

currently what i'm doing is, taking the Unique Net ID and save it in GameInstance and upon loading new map in the new GameMode OnPostLogin I compare the Controller Unique Net ID with the one I saved in the GameInstance.

#

it's working fine, I'm just curious if there is some built in feature or better way of doing it.

old knot
#

how can i setMovementMode for other clients. i set it as usual but it only works for localplayer ๐Ÿ˜ฆ

pearl fog
vague fractal
pearl fog
#

yeah it's sill experimental :/ but I found it sooo more readable that I didn't bother learning the old one x)

vague fractal
#

Yeah, the old one also looks really old xD

pearl fog
#

yup xD

#

maybe someone here have used both and can tell you if one is better than the other

vague fractal
#

It says it shouldn't be shipped, but i guess Unreal Insights should anyways not be a part of the shipped build, or ?

pearl fog
#

yup ๐Ÿค”

vivid seal
#

@chrome bay sorry for tagging you directly but I was reading your blog post on burst counters again. in my situation i am using multicasts (need to pass parameters with each event rather than just the shot number, and not firing fast enough to cause issues hopefully!). do you think this will still have that "staccato" effect you talked about where things will come in bursts rather than at intervals, or is that just a quirk of variable replication that multicasting wont encounter?

boreal geyser
#

Hey guys so this problem has been bugging me for a day now but essentially I am having a problem with session making. Using UE4's advanced session plugin, I am able to host and join a game fine from the same computer(by starting different instances of the game on the same computer), but when I try to host a game and try to join it from 2 different machines, the session cannot be found. Do you guys think its because I am using the wrong plugin version? I am using 4.25.4 and the closest one available is 4.25.3.

#

I tried moving all my matchmaking blueprint code onto a new project and I still get this same error

#

FindSessionsAdvanced essentially returns 0 servers

dusty grotto
#

Potentially silly questions ahead: As someone with only a couple hundred hours of UE under my belt with no fully finished projects; would approaching a small, 5v5 multiplayer game be unrealistic? Just starting to dig into it, but handling hosting etc seems potentially prohibitive for a small indie game. Are there workarounds with things like Steam and Epic Online Services to mimick Peer to Peer connections or are dedicated services mandatory?

red salmon
#

I ran into a weird problem so basically I made it so if you are the host of a game to display a Server host text using a widget that is placed in the viewport only if you are the host by using the HasAuthority node. It worked fine but when I redone the project using advanced sessions plugin and the clients all now recive the Serve Host text and the editor tells me that all the clients are authority. any way to fix this?

dusty grotto
fading birch
dusty grotto
fading birch
# dusty grotto Potentially silly questions ahead: As someone with only a couple hundred hours o...

that's not quite how it works. For something like you're trying to accomplish, dedicated servers are essentially mandatory for a fair game. By using listen servers, you ensure that one of your players is the host, outside of no latency, they are the authority, which means they could easily cheat. Dedicated servers helps alleviate this, but not entirely. You should look into PlayFab or Gamelift, both of which have free tiers you can use during your development period and then once your game (hopefully) starts making money, you'll be able to offset the costs.

dusty grotto
fading birch
#

I will say, gamelift can get stupidly expensive fast. As can playfab.

#

the absolutely cheapest solution that's still cloud based is a custom scaling solution using AWS EC2 instances, which is what fortnite uses. However, that requires a lot of technical knowledge, planning, and maintenance

dark edge
#

And go with a game design that has legs in single player mode. Don't rely on having the critical mass of players around.

#

Or if you must got multiplayer, think more like GarrysMod (self/community hosted) instead of a Live Service.

dusty grotto
dusty grotto
summer tide
#

So I have a replicated bool IsAlive set in my char which I get in AnimInstance. I use that in my AnimBP to play death animation.

#

In 2 clients multiplayer, the anim won't play.

dark edge
summer tide
dark edge
summer tide
dark edge
summer tide
dark edge
#

That should replicate, you gotta figure out where it's failing

summer tide
#
    bool IsAlive = true;```
dark edge
summer tide
#
LogTemp: Warning: ---------------------------0 FALSE
LogTemp: Warning: ---------------------------1 FALSE
LogTemp: Warning: ---------------------------0 TRUE
LogTemp: Warning: ---------------------------1 TRUE
#

Got it fixed. Instead of getting the variable directly I used a function to get it. Thanks

old knot
#

how can i set movement mode in multiplayer?

thin stratus
#

Set locally and in addition RPC to Server?

old knot
chrome bay
normal violet
thin stratus
#

But despite that you are missing the Prediction part

#

Your client is not setting the rotation locally too, so it has to wait for the server to tell it to move

normal violet
#

Yea was my gut feeling as well, but what would be the correct solution to make it smooth then? Figure out the prediction part?

woeful pebble
# boreal geyser I tried moving all my matchmaking blueprint code onto a new project and I still ...

Hey so late response but you NEED an online subsystem, if you downloaded advanced sessions you should have the steam version there is a tutorial for that here: https://www.youtube.com/watch?v=EDNF2DNLhPc&t=2406s it uses steam that's in built in ue4 and the advanced session plugin and steam advanced session plugin.

Check out my Unreal Engine 4 courses:

โ–บSouls-Like Action RPG with Multiplayer: https://devaddict.teachable.com/p/souls-like-action-rpg-game-with-multiplayer
โ–บMultiplayer First Person Shooter with Dedicated Servers: https://devaddict.teachable.com/p/multiplayer-fps-inspired-by-cs-go
โ–บMultiplayer Top-Down Dungeon...

โ–ถ Play video
peak star
#

I overrode Gamemode:PreLogin to prevent players from joining a listen server when it is currently in a gameplay level (only allow joining lobby level). It throws an error (just not the one I told it to) if they try.

How do I:

  1. Get it to throw MY error that tells them why their join was rejected?
  2. Even better, indicate on the Found sessions whether a game is in progress or not (currently in a gameplay level or a lobby level)?
#

I am using OnlineSubsystemNULL currently, not steam.

minor atlas
#

hi is it possible to play on dedicated server between two levels
like in minecraft between three worlds

graceful flame
#

Does anyone have a link for a good reference guide on how to design a well balanced multiplayer pvp game without getting the technicals, I'm looking for a high level overview of what makes for good balanced gameplay.

warped fjord
#

Does pkglag still work?

kindred widget
#

@graceful flame No real links, but my general thought process on that is the common triangle. In PvP things either need to be perfectly balanced, as in every player has access to the same thing as everyone else at all times. Like a common shooter. For more in depth games, the triangle is very common. Class A counters Class B, Class B counters Class C, and Class C counters class A.

This also goes well with the PvE balancing if you have different class types. Of course the Healer/Tank/DPS is the most common version of this. One class does their job a lot better with the help of another class, and that class does their job better with the help of a third class, etc. Tanks tank better with healers, Healers heal better with DPS killing things quicker, and DPS do their job better with tanks, often because of hit interrupts or backstab style effects.

Old paper RPG stuff is much the same. Warrior types often shred rouge types, rouge types will tear through casters, casters often control enough or have armor negating abilites to bring down warrior types. You just need some form of circle of life for your meta.

graceful flame
#

Thanks @kindred widget I'm glad to know that I'm designing my game with that triangle concept in mind. Different roles counter each other, but I think what I'm after here is more along the lines of when should a restriction be placed that limits the choice a player can make. How many limitations should there be? How many counters to your chosen role should there be? Too many counters and the game becomes far too complex, too few counters and it becomes predictable and repetitive fast.

dull lance
#

This isn't really a #multiplayer topic, but generally speaking your player & game research will help you decide what elements do you want to be predictable/complex

kindred widget
#

Side bonus to handling that after game release. People love patch notes and gameplay changes.

dull lance
#

also a reason why Q&A/alphas/betas are bae

dull lance
graceful flame
#

I suppose if I'm aiming for a MVP it should be kept simple. Right now its 5vs5 with 3 unique roles to choose per team. Eventually I want to make it 5vs5 with 6 roles to choose per team which would effectively double the pvp complexity, but I wonder what is "too much" when it comes to counter vs counter. I know moba games go really deep into complexity and players love it for that, but newbies hate it because it creates a steep learning curve. But on the other hand if its far too simple players will get bored. Trying to balance pvp balance is tough lol.

dull lance
#

3 roles vs 6 roles != 2x complexity. It's usually way more than that, depending on the design of each role

dull lance
#

Quick question: If I have two replicated variables, and I update both of them in the same Function, can I assume that they'll both eventually reach the clients at the same time?

viscid monolith
#

You should, because packages are being sent after tick

#

So first engine runs function, and only then, when you changed your variables, it will build a network package and send it through some nerdy protocols

peak sentinel
#

How to create subsystems only on client/server using ShouldCreateSubsystem? (How can I check authority/server to return true?)

dull lance
#

Which type of subsystem is it? World?

peak sentinel
#

Yep

dull lance
#

And you're wanting to create it only on server I assume?

peak sentinel
#

Both, I have two systems, I need one on authority and other one on clients only

dull lance
#

Try this cpp const bool bIsClientOnly = GIsClient && !GIsServer;

#

or via (From UKismetSystemLibrary::IsServer) cpp return World ? (World->GetNetMode() != NM_Client) : false;

peak sentinel
#

Ah, checking Netmode looks like a very solid idea, thanks (other works well too though)

hollow eagle
#

don't use the GIsX, it won't work correctly in the editor with multiple PIE sessions

muted perch
#

Trying to replicate rotation on an actor but I dont want to use multicast.

#

How would I do it?

#

I don't know what other information to provide, if you need any more I can provide.

peak star
#

@minor atlas i think the server that is executing and has the players joined to it can only run one level at a time.

But that one level can load other levels in or out during play. I dont know how to do that during multiplayer properly though.

#

Also You can send players to other servers when they go through a portal etc.

scenic ginkgo
#

The equivalent would be something like Accelbyte which you can use with Gamelift as they are an Aws partner

foggy rain
#

Is HasAuthority is the same is GetNetMode() <= NM_ListenServer?

kindred widget
#

@foggy rain Not exactly. Net mode does not equal authority. NetMode is the world netmode of the machine. So if there is a server, every other machine will be a client. If a machine is alone, it can be a standalone, and then there is also different server types.

Authority is the local role. In short it will return true if that machine has spawned that actor. For instance, if a client spawns an actor on it's own machine, it will return HasAuthority = true. A replicated actor on a client will be false since it's role will be simulated or autonomous proxy. While on the server it would be true for those same actors because it's the one that spawned them initially.

foggy rain
peak star
#

I asked earlier.nut it might have been drowned out by other conversations: I am using OnlineSubsystemNull over LAN, and overrode gamemode perlogin to reject players from.joining the server if the server is not in a Lobby level.

But i need 2 more things to happen and dont know how:

  1. The rejection error message is not the specific one I set in the override and it should be.
  2. I need the FoundSessions returned from Find Sessions BP node to contain info about whether the server is in lobby or not, so player can filter out servers that are busy playing and only show sessions that are available to join.
foggy rain
kindred widget
#

Server should handle possession calls entirely. It all gets replicated.

foggy rain
# kindred widget Server should handle possession calls entirely. It all gets replicated.

Hm... I have an issue then :D
I calling APlayerController::ServerRestartPlayer but it works only for a listen server controller. If I trying to call the same function on a client's controller - it not works. I looked in the source code and it stops on IsInState(NAME_Inactive) || (IsInState(NAME_Spectating), because it false on the client's controller.
What am I doing wrong?

kindred widget
#

Well. Where you call that from won't matter. It's a Server RPC so regardless of whether it's ran on the server or the client it'll end up on the server.

#

Glancing through general code calls. I'd assume that your player is in state Playing. You might try calling

ChangeState(NAME_Inactive);
ServerRestartPlayer();

But saying that, I assume there may be a better way to get to that if that's the case. I normally just go straight to the unpossess call.

foggy rain
foggy rain
vivid seal
#

how does GetLifetimeReplicatedProps work with inheritance? Is there a way to stop replicating a variable in a child class that the parent class is replicating, or change the replication condition of a variable in a child class that a parent class is replicating?

#

my use case is that I have a struct variable that I am replicating in the parent class, but the child class supports client side prediction of this struct, and I'm managing the state of it via RPCs and want to do a COND_SkipOwner in GetLifetimeReplicatedProps specifically in the child class.

meager spade
#

@vivid seal not sure you can change the condition in child classes

#

we ran into a similar issue

#

and just skirted around the problem

vivid seal
#

its a fixable issue but it drives me nuts that I have to specifically code the parent class in a way that makes the child class work lol

#

either that or have the child class create a duplicate struct value and override every getter function for the original struct's info to instead get the child struct's info, and then just use the new struct as the "predicted" version and ignore the old struct.

#

that feels hacky tho

eternal canyon
#

Is it possible to have a RepNotify with a parameter of the old value in blueprints or only c++?

thin stratus
#

You should be able to override the DOREPLIFETIME stuff

#

Only C++

eternal canyon
#

๐Ÿ‘

thin stratus
#

Check the UnrealNetwork.h file

#

There are some useful functions and macros in there

#

Specially starting line 360, which is reset macros

#

Use these to change the replication settings of an inherited property

vivid seal
#

so in the child class I'd use RESET_REPLIFETIME_CONDITION and that will work on a variable that is being replicated with no condition in the parent class, and change it to whatever condition (in this case, skipowner)?

#

and this would be done inside GetLifetimeReplicatedProps?

outer ocean
#

Hey, im working on a rolling/marble game and want it to work online,have some experience with replication, but somehow i dont get the movement to replicate.
The code breaks from client to server, and i Cantmove at all anymore at this point

foggy rain
# kindred widget Glancing through general code calls. I'd assume that your player is in state Pla...

Hm... I looked at the source code and the player only changes it's state on a local player's controller. It's super illogical, but here's a comment from the APlayerController::PlayerTick:

/* PlayerTick is only called if the PlayerController has a PlayerInput object.  Therefore, it will not be called on servers for non-locally controlled playercontrollers. */

This is where it changes it's state on my listen server (e.g. this is.why it works on it).

But it will change it's state if the pawn will be destroyed.

kindred widget
#

Well, the ServerRestartPlayer is most likely the case of UI input. Something you'd call from a button or input key when the player is ready to restart. I'm not very familiar with it myself. Like I said I just call Unpossess and Possess myself through my own functions.

foggy rain
#

Oh, I looked deeper and there is no need to call UnPossess at all. Controller->ChangeState(NAME_Inactive); is enough, the pawn will be automatically detached.

gaunt umbra
#

So, about Saving Persistent Data for a Multiplayer Game..
I know GameInstance would be possible but is it Safe Enough?
Is External Database with untrusted api access best practice?
Any production ready service you could recommend?

fading birch
#

DynamoDB is about as production ready as you can get

#

Playfab also has player data storage options, as does EOS

summer tide
#

What does it mean? Warning: Property NPC_Character::IsAlive (SourceClass: NPC_Character) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.

graceful flame
#

Input actions are normally handled in a PlayerController blueprint or a Pawn blueprint?

fading birch
fading birch
summer tide
fading birch
#

in GetLifetimeReplicatedProps

#

?

summer tide
#

How do you do that

fading birch
#

show your declaration

#

also you can just use windows key + shift + s for snip screenshots.

#

just puts it on your clipborad

summer tide
#
    UPROPERTY(BlueprintReadWrite, Replicated, Category = "AI | Config")
    bool IsAlive = true;
fading birch
#

that should be fine then

#

weird it's giving you that warning

summer tide
#

Do you know why i get this error: ANS_DealDamage.cpp(8): error C2027: use of undefined type 'USkeletalMeshComponent'

#

It happens when I'm packaging plugin

fading birch
#

you're missing an include

summer tide
#

this? Components/SkeletalMeshComponent.h

fading birch
#

should be it yeah

summer tide
#

Even though I should ask in plugin, but the project builds fine but during plugin package I get bunch of errors

peak sentinel
#

Do we need to put something to Build.cs in order to use PushModel?

gaunt cliff
#

I have an issue with ragdolls in multiplayer, when using the code without being networked it works flawlessly
however when I set replications "properly" and trigger ragdoll, pawns start to fly until I trigger "unragdoll" again
anyone knows about this issue ?

thin stratus
gaunt cliff
#
void ASCharacter::CalculateMeshLocation_Implementation(float DeltaTime)
{
    FHitResult OutHit;
    const FVector LineTraceStart = GetMesh()->GetSocketLocation(BoneSocketName);
    UE_LOG(LogTemp, Display, TEXT("BoneSocketName: %s - TraceStart: %s"), *BoneSocketName.ToString(), *LineTraceStart.ToString());
    FVector LineTraceEnd = FVector(0.0f, 0.0f, -1.0f) * 100.0f + LineTraceStart;
    FCollisionQueryParams CollisionParams;

    if(GetWorld()->LineTraceSingleByChannel(OutHit, LineTraceStart, LineTraceEnd, ECC_Visibility, CollisionParams))
    {
        CapsuleLocation = OutHit.Location + FVector(0.0f, 0.0f, 90.0f);
    }
    else
    {
        CapsuleLocation = LineTraceStart + FVector(0.0f, 0.0f, 90.0f);
    }

    MeshLocation = FMath::VInterpTo(MeshLocation, CapsuleLocation, GetWorld()->DeltaTimeSeconds, 50.0f);
}
#

There is a bug somewhere in this code when it is used in multiplayer

#

what this code does is calculate the distance to the mesh, set it on the replicated MeshLocation variable
Then, this code is called on Tick which is Multicast Reliable, after the calculation is done the location of the capsule component of the player is set to MeshLocation

#

when testing it on standalone it works perfectly

#

however when testing in a multiplayer settings the Z values keeps increasing endlessly

#

ok I narrowed it down, I increased the linetrace length to 200, now it appears that the X and Y are constantly changing and moving forward for some reason

#

which means GetMesh()->GetSocketLocation(BoneSocketName) keeps changing in value for some reason, even though the ragdoll has completely stopped movement

#

this only happens on multiplayer so I don't know what exactly is the cause, framerate? lag compensation?

#

Solved it by enabling always tick and refresh bones on skeletal mesh component

thin stratus
#

That's the worst thing you can do haha

gaunt cliff
#

so I set it to not reliable ?

thin stratus
#

Yes

#

You are sending it every frame. It's not needed to be reliable

#

You will just fill the reliable buffer and other things will stop replicating properly

gaunt cliff
#

hummmm

#

I need to read your necronomicon of networking once again

#

thanks for the heads up

#

are there specific use cases where I should use Reliable ?

#

I think I've set most of the things here as reliable >.>

thin stratus
#

One time events that have to reach the other side

#

Which is usually not a lot

#

Everything fx for example should not be reliable

stuck marsh
#

Hey, can someone help me with a silly issue I don't know how to solve?

#

So I want to store a variable from player 0 and player 1 to compare them