#multiplayer

1 messages · Page 731 of 1

fleet viper
#

and its only that project

#

ok so i found something

#

its only that character class

#

every new character class works fine

fathom aspen
#

See if it's this setting then:

#

For that problematic class

fleet viper
fathom aspen
#

Are you spawning your AI, or they are placed in the level?

fleet viper
#

placed in the level

fathom aspen
#

Hmm then there must be something else you messed with in that class

fleet viper
#

its probably because of something in cpp

#

prise the lord

#

i got it

#

had to remove getlifetimereplicatedprops function from the class altough it was not used

twin juniper
#

when I use the "event on post login" node it doesn't use the player controller I created for the players. Is there any way I can make use it?

quasi tide
#

Doesn't use the reference or the class?

twin juniper
#

I'm trying to spawn in the players and I'm using the "content examples" map from UE to spawn my players over a network. It uses the "event post login". I copied the entire thing but when I plug the possess node's player controller reference to the on post login's player controller reference. It uses the default player controller. I know it is because it ain't using the camera I set up using the player controller I created.

quasi tide
#

Did you set the right class in the game mode?

#

You're going to have to send code. I am unfamiliar with the example you are referring to. Sounds weird that you are manually calling post login.

twin juniper
#

this is what I used from the content examples

#

this is the camera that all the players are using. It uses the player controller array.

#

I tried another way to set up a spawning system but the issue I had was that the default player controller for local has an index but I need it for network

#

Hello, I´m following the blueprint multiplayer tut from epic. Do I need steam or such online services to host a game? or when I just host from the packaged app does someone find the game without anything?

quasi tide
#

@twin juniper What is the controller class you have for your gamemode?

twin juniper
#

it's the same I have for the world

#

all the gamemodes match

quasi tide
#

@twin juniper That doesn't tell me anything. Show me.

twin juniper
#

oh okay thats great thank you man.

quasi tide
#

You can do port forwarding and all that jazz, or have your own rely server.

twin juniper
#

I just took a screenshot of the whole gamemode

#

also, that is the other spawn system that only works for local

fathom aspen
#

Override HandleStartingNewPlayer as there the pawn gets spawned

#

Also override FindPlayerStart and don't do the PlayerStart logic in there

twin juniper
#

don't do the player start in the gamemode?

fathom aspen
#

It's already in GameMode

#

The function is called FindPlayerStart

#

Find it, override it

#

If you don't like the default behavior

#

Also OnPostLogin won't get called in case of a seamless travel

twin juniper
#

gotcha

#

so, I can find player start and just set the tags up like that, but I see the HandleStartingNewPlayer has the same issue as OnPostLogin. It has the player controller reference but it's not referencing the player controller I created

#

It works out fine and all I can control my pawns but the camera I set up for all the player controllers doesn't work

#

so, I'm assuming they aren't getting the right player controller reference

#

do you know why? I can control my pawns no problem but it doesn't assign them the camera.

fathom aspen
#

Print their names?

fathom aspen
fathom aspen
twin juniper
#

hmmmm, you could be right because I'm just using an educated guess with everything is here. So, I do apologize if I'm coming off like a jerk.

#

but this function is my camera in the gamestate

#

now, without that handingnewplayer and onpostlogin it works normally

fathom aspen
fathom aspen
#

I'm wondering too how someone can pass an array to SetViewTargetWithBlend?

#

Hello?

twin juniper
#

well, in netmode that's the only way it works

#

Idk why

#

but that's the only way I can setup a camera to be useable by everyone

#

sorry I was getting the screenshot for you

fathom aspen
# twin juniper

Ok too many issues here:

  1. GetAllActorsOfClass PlayerControllers I would not use for the simple reason that this array is already there. It's called PlayerArray. It's an array of PlayerStates. You GetOwner on each reference to get the PlayerController.
  2. Widgets are client side only. You created them without caring where they are created. You saved a replicated reference to them which is again incorrect as they are client side. Also they are created in the wrong place. GameState isn't a player specific class. Usually player classes are the one who spawn them, eg, PlayerController/PlayerState...
fathom aspen
#

Find the compendium in this channel pinned messages and read it a few times

twin juniper
#

gotcha boss

fathom aspen
#

And try to to use less GetAllActorsOfClass, as usually there are other ways to get the actors

twin juniper
#

what other ways are there?

fathom aspen
#

Also you don't need to cache all the references from the start

#

From PlayerArray I can get everything

#

Also using this way you are prone to issues where some actor hasn't yet loaded when GameState loaded

#

So it's not counted in

twin juniper
#

I thought the only way to communicate between two Blueprints is to use that

fathom aspen
#

PlayerArray gets auto managed for you

twin juniper
#

gotcha

#

thank you so much

#

I am very new to all this

twin juniper
#

really?

fathom aspen
#

I wouldn't have any of this logic in there

twin juniper
#

I know casting is another way to communicate but it's costly too right?

fathom aspen
#

Yes. Why would the GameState speak for the PlayerCharacter when the character is the one communicating with some actor on the map

fathom aspen
#

How much hard references you have and so

#

I would cast to the base engine classes when I can

#

And not cast to custom ones

#

And casting is usually fast

#

O(1)

twin juniper
#

ooooooh

fathom aspen
#

But it's costy on memory in case of too much hard references

#

Read the compendium and learn to use each class for it's job

#

Putting everything in the GameState is a sign of a bad code structure

twin juniper
#

gotcha boss

#

thank you

vague spruce
#

sup. i've got a light in the world that has a blueprint on it that calculates how it should move. i want to move it to server-side but i don't see anything about replication on the actor itself. my thoughts were to put the rotation on the gamestate and then replicate that gamestate to all clients every so often. is there a better way to do this?

#

i guess like, is it possible to replicate directional lights?

hollow eagle
#

just mark the actor as replicated, there's no reason to be using the game state for this

fathom aspen
hollow eagle
#

¯_(ツ)_/¯

#

you can just make your own actor that has a light component though

#

don't even need to replicate the light component, just the actor

fathom aspen
#

Yes correct. ez pz

#

RIP directional lights though 🪦

grim rain
#

Hello, im trying to get my visibility for a skeletal mesh thats part of the player mesh to be random. But unfortunately in game everyone sees the visibility differently. How to synchronize this in multiplayer? ( i call the function in my begin play in my player character)

grim rain
#

heyy thank you for that tutorial i tried following it using this method, but unfortunately does not work, the armor mesh is visible for one client and not visible for another client

grim rain
fathom aspen
fathom aspen
grim rain
#

the armormesh is just an additional mesh on my main player mesh which i used SetMasterPoseComponent in the construction script with .

fathom aspen
#

Not sure what you doing really as there is nothing special about it

grim rain
#

im not sure either what im doing wrong D:

#

i got it to work i think

#

turned it into this and it works now

limber gyro
#

Hey guys, i have some niagara particles in an animation notify, i play the animation for the first person mesh localy then do a multicast for the 3rd person mesh so that the other players can see, the issue is that my particles are playing twice localy, one in the 1st person mesh and another one in the third person and i was wondering if theres anything already built in UE that blocks that so that it only plays once?

limber gyro
#

I think that essentialy it would be like a multicast that runs on everyone except the client that sent it

lusty yarrow
#

Hey is there any way to specify with which map a server should start by default? I have a collection of maps and everytime I startup a server I'd like to be able to add a command line argument or something to have them startup from a specific map.

glossy plover
#

At the end of the game I'm doing unpossess on all controls (so that all characters stop moving and it says "Game over" etc...), but if the player is holding down a movement at the time of unpossess then the movement continues on clients (not server), so if you were holding forward the character just keeps moving forward despite being unpossess....is there something i should do before or after unpossess in order to kill all existing movement?

#

Doing this seems to work, does that look correct?

fervent gorge
#

Why can possibly Actor has NerDriver, but NetConnection is null? Maybe i should turn on/off something

#

or maybe not every Actor has NetConnection

hushed spoke
chrome bay
#

Well you're not guaranteed to receive every change to a replicated property so that's going to be a problem in the future if it isn't already

#

Recoil is usually calculated client-side, things happen too quickly for it to be networked

hushed spoke
chrome bay
#

You've got replicated properties there though

hushed spoke
#

Yes, I'm sending the coordinates to the server, setting it there

#

Or should I just make it locally and only send the final result to the server when I need to create the line trace?

hushed spoke
#

Indeed, I checked the reliable check, and it worked as I want

#

What would happen on a high ping since I used reliable RPC?

hushed spoke
acoustic drum
chrome bay
#

Generally when you shoot a weapon and it's hit-scan all you do is send the origin and direction to the Server, that's enough for the server to do it's line-trace etc.

#

And usually it's reliable, you don't want player shots to be dropped since they're pretty critical to gameplay

#

Any RPC/property update will be affected by ping/packet loss etc.

#

But in the case above you have replicated properties, which to me implies the recoil parameters are being replicated by the Server - which is not going to work

hushed spoke
hushed spoke
acoustic drum
hushed spoke
acoustic drum
#

The gameplay ability system?

#

Or client side prediction

hushed spoke
#

Gameplay ability system and it's client side prediction

acoustic drum
#

There is nothing to learn about its client side prediction afaik it just does it for you

hushed spoke
#

ah kk, I guess I'll just search for a guide on youtube

acoustic drum
#

And if all you're hoping to do is make a lightweight game and implement recoil then GAS might be a bit overkill but ill link you some resources

hushed spoke
acoustic drum
hushed spoke
# acoustic drum Just for fun?

Yeah, I started it since my internship uses unreal engine, but I might actually change CS:GO trademark and assets with original stuff and publish it

#

F2P

acoustic drum
#

Fair enough

#

CSGO is f2p now did you know

hushed spoke
#

yeah I know, but it's riddled with cheaters lol

#

Anyways, this won't replace the true CS:GO

#

But it might be a casual game someone might pick up when they're bored of the original one

acoustic drum
#

Unfortunately cheating is nigh impossible to prevent in csgo

hushed spoke
#

Yeah of course

acoustic drum
#

Good luck with your game

hushed spoke
#

Thanks 🙂

ancient adder
#

I have a struct with ReplicatedUsing and COND_OwnerOnly but its executing the onrep function on client side not server in blueprints(didnt check in c++), the OnRep function is BlueprintNativeEvent, what am i doing wrong?

chrome bay
#

C++ OnReps never execute on the Server

#

BP on reps are a hack which is why they do, even though they shouldn't

#

If you want the Server to run the same code, just call the function manually when you change the variable.

ancient adder
hushed spoke
#

@chrome bay It worked! I set the coordinates client side and made a reliable RPC for the line trace only. Thank you 😄

fleet viper
#

Im basing all my animations on the ai state which is stored in an enum in the ai controller. Problem now is that the client side cant get the state of the ai since the controller only exists on the server. Does someone know a workaround for that?

#

this code is in the anim class event graph

winged badger
#

replicate the data in Pawn or replicate AIControllers

#

either way will work, only second one is not recommended as it adds replicated Actors

fleet viper
winged badger
#

yes

fleet viper
#

ok

ancient badge
#

Hello, how do i mirror an action in multiplayer? For example, two players are facing each other. Player 1 spawns a cube on his left side. Player 2 would see this cube on his right side normaly, but i want him to see the spawned cube for him on the left side too.

marble gazelle
# ancient badge Hello, how do i mirror an action in multiplayer? For example, two players are fa...

not sure why you would do that, but instead of replicating the cube actor you would spawn the actor only locally and would replicate the action. How ever this means that you either need to have a cache of cubes to be replicated in order to have the cube spawned on other peers if they join in later or you don't care.
But to be faire I'm not sure what you are trying to do, but if it involves gameplay I would replicate the actors position properly as it otherwise results in 2 different representations of a world.

ancient badge
marble gazelle
ancient badge
#

Thought about that too but couldn't find a way hot to work with that replicated data yet, maybe i was missing something.

marble gazelle
ancient badge
#

Yeah, lets say i spawn a cube. Thats the moment something changes. So i don't replicate the cube, just the data where he is.
How does the other player know that this cube was spawned on this location? I guess because of a RepNotify for the location part. But how do i tell the other player to start an "event" to create his own cube at that location for his view. Or do i understand something wrong right now^^

marble gazelle
# ancient badge Yeah, lets say i spawn a cube. Thats the moment something changes. So i don't re...

No, your system would do smth like Play Card, this would add an instance of CardData into an array for example. Now you have two ways.
PlayCard is a replicated function that will spawn smth according to the parameterrs.
The replication of the array will make you check that an new element was added and this PlayCard is a local function, that will spawn the actor on the one peer calling this function, and the replication will trigger the same logic based on the data given in that array

glossy plover
#

Is there an easy to replicate material parameters? On my characters I have a staticmesh cylinder below them with a material that has a color parameter, when I spawn the character it on the server I set the color on the material. But when clients join they don't see the color change...Even though I had set the replicate component on the staticmesh, i have set replicate on the variable that sets the color etc...

ancient badge
marble gazelle
# ancient badge If i understand you right, i spawn a card and that card i add to a replicated ar...

No the actor it self is not relevant. the actor is just the visual representation of your card and is not replicated in any way.

Let's say you have smth like this:

USTRUCT()
struct FGameCard
{
  UPROPERTY()
  UMyCardData* CardData; // Comes from a data asset for example
  UPROPERTY()
  ECardRotation Rotation; // Vertical / horizontal, facing up or backfacing
  
};

Then you have an array TArrray<FGameCard> PlayedCards which you can replicate. and depdending on the content of this array each peer can spawn actors. What needs to be spawnd comes from the data object that is loaded from disc

marble gazelle
glossy plover
#

I'm not following? How does a struct help with this? Note that the characters get spawn in by the server before the client has joined. So when the server spawns the character, it sets the color; when the client joins it doesn't see the color update. If I manually update the color on the client then it works; but it should just replicate the material from the start

marble gazelle
glossy plover
#

I still don't understand why a replicated struct would be any different from a replicated linear color? When the server spawns the character it generates a random color (say "Blue" for example) and then set a replicated "TheColor" variable on the character as that blue. It then updates the material paramater with that color from the variable.

dark edge
glossy plover
#

The client is not in the game yetat that point though

dark edge
marble gazelle
dark edge
#

Linear color is a struct

glossy plover
marble gazelle
#

no it will only call rep notify if it replicated smth. it's a notification that you received a change

#

and IIRC you can be sure that you have received the first values in the actors BeginPlay so if the color doesn't change you can just grab it there.

dark edge
#

That's what's so great about repnotify

glossy plover
#

Yup that did it thanks

dark edge
#

Same thing with entering relevency range

ancient badge
marble gazelle
# ancient badge Ok, i think i get what you mean. Lets say the first entry in this array has its ...

Let's assume we have smth like this

+-+-+-+
|2|1|0|
+-+-+-+
|0|1|2|
+-+-+-+

where the numbers are indices.
then you have two arrays

TArray<FCard> Player1Cards;
TArray<FCard> Player2Cards;

The cards them self don't know where they are, this doesn't matter. If the array has at some index a valid object you can spawn smth for it. If it doesn't you keep the slot empty.
where you place the stuff is then fully up to the peer. It will calculate it based on the position (index) in the array

ancient badge
marble gazelle
#

you also wouldn't have two arrays like this, you would have one array per player and the "local" player would put it's array always on the bottom for example and the other player would be put on top

ancient badge
marble gazelle
#

at somepoint you need to specify locations anyway, but this way you always have a context for your decision

ancient badge
#

So in text:" is this array local put it here if not put it there"

fallow shadow
#

sigh

#

i have delayed this for well over a month now

#

its time to get started on interpolation

#

anyone got a good guide/starting point?

dark edge
fallow shadow
#

movement

#

i get rubberbanding

dark edge
#

Are you using character movement component?

fallow shadow
#

yes

dark edge
#

Fix the rubberbanding first before messing with interpolation

#

WHen does it rubberband

fallow shadow
#

when you start and stop moving

#

like in the period between you starting moving and reaching the max speed

#

same goes for stopping

dark edge
#

Are you changing max speed at runtime?

fallow shadow
#

nope

dark edge
#

Are you doing anything weird or outside of
Input -> Add Movement Input
?

fallow shadow
#

nope

dark edge
#

Show a video clip with the capsule visible

fallow shadow
fallow shadow
dark edge
fallow shadow
#

cpp only

#

the only blueprints im doing are in the HUD

fallow shadow
dark edge
#

You should first check if a BP character deriving from the engine-provided class behaves the same.

#

You might be screwing something up like client and server disagreeing on acceleration or whatever

#

just whip up a BP character and give it the same speed and acceleration stats and see what happens

fallow shadow
#

this is

#

weird

#

the rubberbanding suddenly isnt happening anymore

#

wait lemme check one more time

ancient badge
dark edge
#

Specifically what are you trying to do?

toxic lion
#

Thought this may be a better place to ask

Subsystems can't replicate with any real world use right?
For a "manager" or singleton, am I better off just using an actor?
Or chucking everything into something like GameState?
Or is there a better alternative?

dark edge
toxic lion
#

rooThink1 ah interesting

ancient badge
# dark edge Specifically what are you trying to do?

All i want that the cards from each player are shows at the bottom and the cards from the other player on the top. Waht i understand is that i need to replicated my data for the cards and let each player place the cards for himself. What i don't get is how i access the replicated variables fromthe other player.

dark edge
#

For now, just let then know the cards, so make a few replicated variables on their PlayerState or Pawn like
DeckCardArray
HandCardArray

ancient badge
dark edge
#

I'm talking in a cheating context. But that's for later

ancient badge
#

In that context would only when he plays the cards know what it is.

dark edge
#

So for now your goal should be to sync each players card arrays and have each local machine show local players cards in one spot and other player's in the other

ancient badge
#

Yeah but where do i get the Variables from the other players? For my local no problem. But how do i use an array that when i make my blueprints don't know about because the other player sands me them when the game is running? How do i access that array from the other player so i can that his cards to that location?

dark edge
#

Playerstate
-HandCardArray(repnotify)

ancient badge
#

So i make for each player a handcardarray and when the round starts i call that repnotify?

dark edge
#

idk what a handicap is

#

repnotify will fire whenever the array changes

#

that's when you'd move cards, etc

ancient badge
#

Sorry my smartphone doesn't know what englisch is and is changing some words

ancient badge
dark edge
#

just hook into the repnotify and it'll work

#

RepNotify fires every time the variable is updated, even the first time (right when you join)

ancient badge
#

Thx i will try that

humble bane
#

Is the server a player when Doing listening servers?

dawn ledge
#

Im trying to make world transitions that wont cause client disconnects in an online session. I started learning about level streaming and I've just discovered the AGameModeBase::bUseSeamlessTravel. It seems like they both do the same thing, except level streaming uses sublevels. How should I choose which one to use?

dawn ledge
toxic lion
#

Does anyone have a simple breakdown as to how you would have an actor handle the replication on a subsystem?

dawn ledge
#

I dont think a subsystem can replicate any properties, but it could feed data into a replicated actor

dark edge
#

does a subystsem even have a netmode?

thin stratus
#

They are UObjects iirc

#

Cause I think all of their respective parents are also UObjects

#

GameInstance, World

#

LocalPlayer

#

So usually they don't replicate anything. If you need something to exist on both ends you can just use it's BeginPlay to register in the Subsystem

#

And EndPlay then to unregister

#

Aka, add and remove to and from array

dark edge
#

Does a subsystem seem like a good fit for something like a global projectile system or would that maybe work better as a component on GameState?

thin stratus
#

I hope we are talking about Gameplay Subsystem

#

Honestly, Subsystems usually hold the same type of code that their parent would usually hold

#

Just encapsuled

#

If you wouldn't put it into a UGameInstance, you wouldn't put it into a UGameInstanceSubsystem

#

UWorldSubsystem gives you something more generic in the scope of the World

dark edge
#

If you were to make a global projectile system with projectiles as just raw data, where would you put it?

thin stratus
#

So you could make that a Projectile Pool or so if you want

dark edge
#

Just
Tick -> foreach ProjectileStruct -> update

thin stratus
#

You could, there is just not replication in it

toxic lion
thin stratus
#

If you need replication it's probably better on a replicated actor of sorts

toxic lion
#

didn't mean to reply there. more of a general question

dark edge
toxic lion
dawn ledge
#

Yeah, I have also made a gamestate component that acts like a subsystem but has replicated properties

dark edge
toxic lion
#

yeah, so maybe a GameState component to act as a singleton is a better pattern?

dark edge
#

I think it's up in the air really, do whatever floats the boat

#

Literally in my case, got a BuoyancySubsystem lol

#

Or rather, FluidDynamicsSubsystem, it does global buoyancy and drag for water and air.

toxic lion
#

arlighty. thanks for the input. let me play around with it a bit and see what happens

dawn ledge
#

Can anyone explain the differences between level streaming and seamless travel?

bitter oriole
#

Level streaming = load/unload part of the current level

#

Seamless travel = once connected to a remote server to play online, change level on the client without a giant blocking loading screen

dawn ledge
#

okay, that makes sense. I was adding other worlds into the persistent level as sublevels, so it seemed like just another system to transition between worlds.

#

So it seems like I could use both to accomplish the same thing

#

Why would I choose one over the other?

dark edge
static sable
#

hi, in an experimental RTS I use behavior tree to move my units. As long as I send move command to server everything works, but the unit movement is not smooth. Controller doesn't exist for my unit (actor) on client, neither does behavior tree. So how to calculate movement on the client and get movement done smoothly?

bitter oriole
#

Level streaming is more commonly used for bringing up and down parts of a large single player level

dawn ledge
pallid mesa
#

btw for those interested today I posted a new article about how to implement a better synced clock in a non destructive manner

#

can find it in pinned comments in this channel

static sable
#

let me put it the other way... how to sync client with server, when there is no controller on client's actor present to do the behavior tree logic?

quasi tide
#

The behavior tree logic is done on the server and that gets replicated

static sable
dark edge
humble bane
#

GoodJob

am having an issue where I spawn a moving rock , on hit its supposed to cast to third person character, but the casting always fails, the casting actually works with an AI but not multiplayer, any help is appreciated

dark edge
humble bane
graceful flame
stiff nebula
#

i've a replication issue with my client character where he shoot on the Y axis / play sounds through some function, server hears the sound and also is able to shoot on the Y axis, any help here?

graceful flame
#

Can you share a screenshot of the blueprint?

stiff nebula
#

ignore the comment, a bit outdated on what the bp is supposed t odo

#

so basically i can get linetrace working on any axis when i'm on the server, but for some reason the client cannot access the Y axis and just shoots on the x axis. the other issue i've got is that the sound does not play clientside either, but plays on server and i'm not sure why. for reference, this is being called through an event dispatch that looks like this

#

'on use item' is the event dispatcher

#

then it's used here after the sphere collides with the player and it attaches the gun to a socket

stiff nebula
dark edge
stiff nebula
#

yeah...

dark edge
#

OK so you're trying to do NON predicted guns?

#

Is this a gun or what is thi

stiff nebula
#

a gun

#

what's predicted gun supposed to be, sorry im new

dark edge
#

First off if you're new you sure picked a hard thing to get right

#

but it's doable

stiff nebula
#

i've attempted this a couple times before and gave up, this is my third attempt haha

dark edge
#

so basically right now, your setup will do nothing on the clients computer until ping ms later

#

Do your projectiles do anything fancy like bounce or curve or are they just bullets?

stiff nebula
#

no projectiles, just hitscan

dark edge
#

ok so I'd do it like this. You can do it all in the weapon if you set the owner of the weapon to the pawn that equips it.
Pawn
Input -> Get Weapon -> Call Fire

Weapon
Fire -> Hitscan -> Run on Server Event
Run on Server Event -> double check hitscan if you want but ignore this for now -> Do replicated stuff (apply dmg, etc).

#

That's basically clientside hit detection

#

OR if it's super slow paced and some lag isn't the end of the world

#

Pawn
Input -> Get Weapon -> Call Fire

Weapon
Fire -> Run on Server Event
Run on Server Event -> Multicast Event
Multicast Event -> Hitscan -> Do Cosmetics -> Switch has authority -> Do replicated stuff (apply dmg, etc).

stiff nebula
#

not sure how setting owner works, is that about all i've got to do in that regard

stiff nebula
dark edge
#

You aren't gonna make a competitive shooter with BP only

#

At least, not one that can't be cheated at trivially

stiff nebula
#

well, just trying to get to the mvp stage

dark edge
#

But if that's not an issue, do the clientside hit registration if it must be snappy

#

Basically it goes like
Hey Mr. Server, I hit that guy
OK Mr. Client, I'll let evryone know.

With optionally, the server double checking to make sure you're not talking out your ass.

stiff nebula
#

sounds good, here's my current order -

#

this is my fire, not much to set up

quasi tide
#

If you're doing a competitive shooter, it definitely isn't "optional" to have the server verify the shot was even possible.

dark edge
stiff nebula
# stiff nebula

then i go to here with the fire and then it's the hitscan after that

dark edge
quasi tide
#

All of my games are co-op, so I just do client hit detection 😅

stiff nebula
#

cool, will keep that in mind

stiff nebula
#

because it gets replicated right?

#

i think i need to do that though because it goes from the character BP to the gun BP, doesn't replicate without that for some reason

dark edge
stiff nebula
#

or atleast, i don't know how to replicate the shot without it haha

dark edge
graceful flame
#

How do you do that last part "server tells everyone but you to do cosmetics".

stiff nebula
dark edge
#

I think there's a multicast skip owner, or you can just check if owning client on the recieving end of that multicast and bail out

graceful flame
#

ahh okay

dark edge
#

Welcome to the toughest part of making a game, making the damn thing work in MP without lag all over the place.

#

Making it work without visible lag and with server authority is even harder

stiff nebula
#

since i started trying to do game development, i've come to appreciate what other developers do in regards to multiplayer replication, i am absolutely lost in this part haha

dark edge
#

Then maybe don't start with a competitive shooter unless grinding away for years is your style.

pallid mesa
#

it's a way to learn

stiff nebula
#

well, prior to this i've done some single player stuff

dark edge
#

I've done this stuff for like 8 years and I wouldn't want to try a competitive shooter. Although I am trying to do multiplayer vehicular combat with projectiles so I'm a glutton for punishment too I guess.

stiff nebula
#

just a singleplayer fps where u shoot bots running at u

dark edge
#

I'm lucky in that I don't need prediction as my vehicles are fairly slow responding.

pallid mesa
dark edge
#

ya

#

well some condensed form of it.

quasi tide
#

Only let people get in a vehicle if their ping is < 10ms. Problem solved. Easy.

pallid mesa
#

my vehicles are client authorative with some server validations lol

stiff nebula
#

it started working lol

dark edge
pallid mesa
#

specially when you have multiple players with vehicles

stiff nebula
pallid mesa
#

yeah the whole input thing

dark edge
#

As far as neworking goes I just replicate control variable state and physics and it just works.

#

Sure you wait 30ms to turn but it's a bigass tank, you're gonna wait 30ms to turn anyway

pallid mesa
#

ye

dark edge
#

Although stuff like this is possible so who knows if lag will be a huge issue
Very old video but I found it when trying to track down my dedicated server testing videos.

#

15,000 hp awd bike with a propeller shoving it into the ground makes for some broken necks

pallid mesa
#

that looks fun as hell

fallow shadow
#

Why would i ever want to set a variable as UPROPERTY(Replicated) when i can just change it on server through a RPC?

dark edge
#

What if you joined a game late

graceful flame
dark edge
#

You missed the RPC, what is your variables value?

fallow shadow
#

Ah

#

That makes a lot more sense

#

much appreciated

dark edge
#

Honestly if you can do it with RepNotify, do it

#

It's so good

graceful flame
#

There's other reasons too, like an RPC can just simply get dropped due to packet loss. But a replicated variable should update (eventually).

#

But then its not perfect either, the custom event that runs on the server to set the replicated light switch bool to True might get dropped due to packet loss and so it never changes in the first place.

graceful flame
#

You can use reliable, but then I've heard that also has the potential to overflow and cause clients to disconnect

dark edge
#

Well yeah if you send tick input reliable

#

SendAimDirection should not be reliable. Interact() should be.

graceful flame
#

So maybe only use reliable for things that have to absolutely work no matter what, such as ending the round in a cs go match or something.

dark edge
graceful flame
#

Sure, bad example.

#

What would be a good use case for reliable then?

dark edge
#

Anything transient and important

graceful flame
#

Something that happens not often but MUST happen for the gameplay logic to even work.

dark edge
#

Interaction, Jump, Shoot

#

Stuff you do a few times a second, not hundreds

graceful flame
#

So if Jump is reliable and there's 10 players all jumping up and down isn't that enough to cause an overflow?

#

I guess it depends and is worth testing.

dark edge
#

10 x 1 x 5/sec is like 50 bytes a second

#

I mean there's overhead but its not like sending 10 vectors every frame

#

Fortnite burns about 15 kB/sec so 50/15,000 is like 0.3% of your bandwidth

#

So like nothing

graceful flame
#

good to know

dark edge
#

While sending just 1 vector a frame is like 700 byte/sec

humble bane
#

am having an issue where I spawn a moving rock , on hit its supposed to cast to third person character, but the casting always fails, the casting actually works with an AI but not multiplayer, any help is appreciated

dark edge
#

You destroy self before doing stuff

#

do that last

#

Not saying that is your problem but thats A problem

humble bane
dark edge
#

That's your problem

#

What are you trying to do here?

#

why are you doing clientside hit detection for this

humble bane
humble bane
dark edge
#

if you want clientside hit detection

#

OR only do it on the server

#

either/or

#

you either need to gate by LocallyControlled or Authority after Event Hit. If you do serverside hit detection you don't need any RPC .

humble bane
humble bane
graceful flame
#

9 times out of 10 there's a way to avoid casting

dark edge
#

make sure it's actually hitting what you think it's hitting

humble bane
humble bane
dark edge
#

lol

graceful flame
#

Maybe you can use an interface, an event dispatcher or you can use tags.

#

I like to use tags because its already built into the default Actor class. I just tag my actors as needed, "Enemy, Destructible" for example. Then during an overlap event or hit result, I can use the actorHasTag node to check for any tag(s) I want and do stuff to the actor after knowing that its the right one without having to cast. Ex: Projectile hits something, break hit result, get hit actor from hit result, if actor has tag "Destructible" then run custom event that does stuff without having to cast.

humble bane
graceful flame
#

or you could use an interface and do it that way, also works well

dark edge
#

is the rock a character?

humble bane
#

no

dark edge
#

Dude your naming convention is mega confusing. WHy is all this called RockSpawn, when you don't spawn a rock

humble bane
dark edge
#

How many do you spawn?

humble bane
#

@dark edge it looks like my rock has an hit event even when it doesnt hit anything, am thinking the server rock is colliding with the local rock, is that possible (even tho the server rock is invisible from local side)? if so that would explain why the name of the actor printed was my rock

humble bane
dark edge
#

why are you spawning 2 rocks

#

Show how you're spawning it

humble bane
#

also strange because my other rock projectile doesnt have collision problems

dark edge
#

What the spaghet is going on here

#

lol

#

This is gonna take a minute

#

Why are you doing all this local/server stuff, you're not gonna have prediction anyway

#

why not just input -> server -> do replicated stuff

humble bane
dark edge
#

Do you have a base ability or is every ability a big pile of wires like this?

fallow shadow
#

btw how would i execute some code on the server without invoking an RPC

dark edge
#

Is this hard coded into Character?

dark edge
#

The only way info goes from client to server is with RPCs

humble bane
dark edge
#

So are you spawning 2 rocks or 1 replicated rock?

humble bane
humble bane
dark edge
humble bane
dark edge
#

How many abilities are you planning?

humble bane
fallow shadow
#

something like changing a map completely after a certain amount of time regardless of what the client(s) do

#

would a HasAuthority() check in the gamemode code suffice?

dark edge
#

HasAuthority means you're the boss, either server or standalone or clientside authority stuff (i think)

fallow shadow
#

epic

twilit radish
#

There’s no reason to use HasAuthority for the GameMode because it only exists on the server 😄

dark edge
#

Say you had a replicated actor, which would be most things in your game except HUD/UI or GameMode. You'd gate stuff by HasAuthority if you want it to only do something on the server, and it could possible happen on any machine. Like hit detection.

graceful flame
#

So you’d pretty much want to always use hasAuthority when doing onBeginOverlap?

#

Say the character steps onto a floor switch that opens up a trap door.

twilit radish
#

Depends on if you want local prediction or not I suppose.

graceful flame
#

It would be something like TrapDoor->onBeginOverlap->hasAuthority->overlappingActor is character…

#

That would work because the TrapDoor and it’s switch are level actors and not possessed by a real player. Right?

dark edge
#

Yeah you might move the gate so cosmetics happen locally but yeah

#

Every replicated actor exists in multiple worlds at a time (servers and other ppls)

graceful flame
#

Yea

dark edge
#

Like maybe you show the trap slamming shut and play sound and spawn particles on overlap, but gate by HasAuthority before applying damage. Or don't, if you have some damage prediction setup. Depends.

#

If you gated right after overlap, you'd have to replicate the state of the trap or some event to do the cosmetics

blissful saffron
#

Anyone know where Lyra's EOS handling is located? Trying to find and emulate how they handle hosting and joining.

blissful saffron
#

Looks like it's in CommonUser instead of OnlineSubsystemEOS 😄

grave lynx
#

Hello, guys, I'm trying to spawn multiple players with spawn actor node. I don't have any issue with the location, but the rotation is working only for the server. I'm using the gamemode for spawn them

gilded merlin
#

Hi guys, any idea why when i'm doing rpc call from client to server with scene component variable, scene component variable is okay on client, but on server it seems to be null (display name is blank)

#

Other variables seems to replicate just fine

#

IS valid node on server returns false

winged badger
#

its not part of the Actor CDO and not replicated?

#

or its a component on a non-replicated Actor that has been spawned in runtime

#

either way, Component doesn't need to be replicated to be net addressable

#

it requires that A - its owner Actor is net addressable and B - Component is either stably named (so a Component not added in runtime) or that Component is replicated

#

for Actor to be net addressable it needs to be either loaded from level, replicated, or deterministically named on all machines with IsFullNameStableForNetworking returning true

#

(third condition is how actors loaded from level are net addressable by default - their names are serialized with the Level and IsFullNameStableForNetworking returns true if Actor has RF_WasLoaded flag)

gilded merlin
#

@winged badger Thanks a lot for very detailed answer.
The variable that doesn't get replicated is in fact static mesh, spawned in component via actor's construction script.
Actor is replicated.
Even tho I have added set is replicated node in construction script, it didn't help, but I'll have to debug it a little bit more 🙂
Appreciate your help dude, thx.

winged badger
gilded merlin
#

Is it doable via blueprints? How do I do that then? Even tho, I'd like to resolve the problem that I have first, just to understand what's going on here.

winged badger
#

instead of sending ValveComponent you send ManualSteer reference and then you do ManualSteer->ValveComponent on the other side

#

this wouldn't work if you had an array of Components and didn't know which of the Actor's Components you need, but in your case it will work just fine

gilded merlin
#

That's a way to workaround this, but unfortunately in my case, I send scene component, because I can push there static meshes from many places, and I need to know specific static mesh. If I had there manual steer, I wouldn't know which specific mesh did I send

ancient badge
#

is a listen server automatically replicating actors?

gilded merlin
winged badger
winged badger
#

you can deterministically name them when you spawn them

#

and use SetNetAddressable(true)

gilded merlin
#

I guess that have to be done in c++?

winged badger
#

by name them i don't mean variable name, but what you'd normally see in outliner name

#

blueprints can SetNetAddressable(true), but don't know off the top of my head how you'd name the component as you spawn it

gilded merlin
#

That's for all the leads Zlo, I will try to dig into it a little bit deeper

#

I'll let you know when I resolve that, thx mate, appreciate your help a lot

ancient badge
gilded merlin
woeful ferry
#

If you want to spawn an actor locally, just dont set it to replicate

ancient badge
#

you mean "Componentn Replicates" under the "Details" Tab from the actor right?

gilded merlin
# ancient badge you mean "Componentn Replicates" under the "Details" Tab from the actor right?

@ancient badge I suggest you to watch those yt series, it's short and really well explaining multiplayer basics https://www.youtube.com/watch?v=TEojA3VBXG8

BRY

❗ DISCLAIMER: Re-uploaded due to the original video being somehow magically deleted (I didn't do it..) 😭

👋 Welcome to the Replication Series! This series covers how Unreal Engine handles Replication from the ground up starting with what replication is and how Unreal's Client-Server model works and then moves on into more advanced topics.

📹 ...

▶ Play video
ancient badge
gilded merlin
winged badger
#

huh, remembered it wrong

#

you just need a single c++ function here

woeful ferry
#

Is this how you link up components?

#

client/server

winged badger
#

to create a component of type, name it as it creates it, attaches it, registers it and sets it net addressable, then returns a pointer to that component

woeful ferry
#

For components created in runtime?

winged badger
#

that was for Mleko

woeful ferry
#

Ah, i'm just curious

winged badger
#

but yes, blueprint does a terrible job at adding components

woeful ferry
#

Been thinking how you replicate components you have created dynamically

winged badger
#

SetIsReplicated(true)

#

that one is straightforward

#

making them net addressable without replicating them is better for performance, but also a little bit more complicated

woeful ferry
#

But the creation of the components need to be multicasted/onrep? Or is it handled if I create one on the server

winged badger
#

if replicated, only the server needs to make one

#

and if clients did it as well they would end up with a pair of them

woeful ferry
#

Ah, thank you! 😄 Not a thing I

#

I'm using right now, just curious

hushed spoke
#

Hello everyone, I have the client run this blueprint, but it doesn't reach the run on server event

gilded merlin
#

Is client owner of this blueprint?

hushed spoke
#

no

gilded merlin
#

I guess that's why it isn't called on the server

hushed spoke
#

alright, thank you

#

worked like a charm 🙂

gilded merlin
#

You welcome 🙂

harsh lintel
#

if I don't have a default pawn on the game mode, is there a "correct" way to spawn a pawn and possess it so there aren't any network errors? or is this good enough?

dark edge
harsh lintel
#

I'm trying to find how to override HandleStartingNewPlayer

#

All I do is to spawn the pawn but I don't know if I'm supposed to possess it there too

dark edge
#

I think that event is a one stop shop, you're basically skipping all the find start spot, choose pawn, etc stuff.

harsh lintel
#

hmmm

dark edge
#

You're basically saying "I'll do it"

#

so ya you'll want to possess

harsh lintel
#

I also overrode "FindPlayerStart"

gilded merlin
winged badger
#

few notes

#

you can do USceneComponent::StaticClass()

#

you can also do Component->IsA<USceneComponent>() to see if its a scene or derived from it

twilit radish
#

NULL intensifies

winged badger
#

SetNetAddressable() is redundant alongside SetIsReplicated()

#
const FString ComponentName = "MyScneComponent" + FString::FromInt(Counter);
USceneComponent* NewComponent = NewObject<USceneComponent>(Owner, SceneComponentClass, FName(*ComponentName));
// attach and register
NewComponent->SetNetAddressable():
Counter++;
#

is how you would do it without making it replicated

#

not that it hugely matters, just fyi, Counter is a member int32 variable

fathom aspen
rocky kestrel
#

This is from multiplayer replicated turret. I shoots ray and should check id from player. It always returns null.

#

This is from controller and it calls beginplay input of that id.

#

This is from player character

dark edge
#

Why do you have all these delays

#

just expose PersonalID on spawn and set it when you spawn the char.
Load -> Spawn -> Possess

rocky kestrel
fathom aspen
#

The turret is not client owned, so you can't call server RPCs from it

dark edge
worn wagon
#

Is the vanilla sessions interface good? I have heard there are some plugins like advanced sessions that improve upon it

dark edge
#

Yes and yes

worn wagon
#

Phrased another way then, what do these plugins offer over the vanilla implementation?

dark edge
#

More stuff with friends etc, more stuff exposed to BP

worn wagon
#

Can I say, display a server name, current and max player count, ping, current map, and gamemode with vanilla?

dark edge
#

Not sure, have you tried?

worn wagon
#

Oh BP stuff

#

No I was just about to get into it

dark edge
#

You can at least get player counts etc

worn wagon
#

Hmm alright

rocky kestrel
#

Made things little bit more clear. This is from player controller.

#

that second from third person character BP and it prints correct

#

This is debug replicated actor only prints players ids and it print only null

#

so problem is that server doesn't know players ids? only locally players know their?

#

if I make that "Output Get" replicated in player controller. Then J print doesn't print anything and server neither.

fathom aspen
#

Honestly this is all a bad code structure

#

Having same property in two different classes, GettingAllActorsOfClass, Running BeginPlay without guarding with authority(you prolly don't need it here), Too many delays

#

PlayerID is a string too

#

You got a property already in PlayerState called PlayerId

rocky kestrel
#

But PlayerID in this case is username+password because later on database login

fathom aspen
#

And there's where such property should be

rocky kestrel
#

Okay!

fathom aspen
#

Still it should be in PlayerState. No reason for it to be all over the place

rocky kestrel
#

Okay I try that

safe vortex
#

How the hell do you even properly replicate Pawn Rotation without a Character Movement

#

thing just doesn't work

sinful tree
#

You need to do a "Run On Server" event to tell the server that you want the rotation changed.

safe vortex
#

lol I've done that but alright I'll check

#

Nope

#

locks in place, doesn't rotate

#

Multi-cast makes it so only local sees it, rotation on other client is still locked forward

#

Actor is replicated as well

dark edge
# safe vortex

To start with, are you sure your float is getting to the server fine?

#

also WTF is that math, why are you getting base aim twice and all that. WHat are you trying to do?

safe vortex
dark edge
#

Is actor replicated, has movement replication checked, is component replicated?

#

wait a second

safe vortex
#

I can't have movement replication checked because I'm doing a focused heavy physics game

#

and movement replication causes jitters when hitting into other physics

dark edge
#

OK please explain in plain English what you're trying to do here

dark edge
safe vortex
#

I'm creating a physics type game. I am not using the normal Character Movement system. There was a way to make physics run better on the server by using fixes by Rama's techniques

#
#

Something similar to this

dark edge
#

I have a multiplayer physics game too. What are you trying to do here? Gameplay wise, you're making some star move around?

safe vortex
#

It's a space game where the player moves in space. Acceleration from boosts, interacting with meteors and what not.

dark edge
#

That's exaclty how replicated physics works

#

but you're not using physics, you're directly updating the rotation.

safe vortex
#

That's not the problem.

#

Normal Character Movement with Replicated Movement causes massive jitters with physics interactions (player gliding into a meteor)

#

and even players going through it

dark edge
#

So are you using physics only or physics + CMC or what?

safe vortex
dark edge
#

That's not what Rama's approach does

safe vortex
#

plus unchecking replicated movement, fixes the problem

#

but then character rotation no longer works

#

Well his method is of course C++

dark edge
#

His method does no direct sets. It's all forces and torques.

#

You're adding forces then setting transforms all over the place.

safe vortex
#

And I do such that with my own Ability SYstem, the movement isn't an issue

#

and fixes

dark edge
#

Read over his approach.

  1. Client runs physics on their end, sends data to server(transform and velocities)
  2. Server replicates that data out to everyone but that client.
  3. Other clients add forces to proxies to get them to smoothly match the state from server.
safe vortex
#

I set ONLY the transfroms in hopes to fix the rotation issue

#

Which I've been unable to do

#

Physics replicates fine, matches correctly

#

I just cannot replicate player rotations

dark edge
#

Sure you can, people do it all the time.

#

For one, ControlRotation isn't gonna be a thing on other clients

#

I'd back up and start with a super simple proof of concept. Get a cube to fly around and rotate and sync those up.

safe vortex
#

Add Controller Yaw Input didn't work. Grabbing actor rotation and putting it into a replicated variable didn't work. Replicating Controller Yaw on server/multi-cast didn't work. Setting rotation from said replicated yaw variable didn't work

dark edge
#

Sending a transform over certainly would work. You need to send a transform and 2 vectors per frame (your transform, velocity, angular velocity)

#

Then you replicate those out

#

then on clients, you smoothly add forces and torques to the physics for all characters but your own

safe vortex
#

Sending the transform works yeah

#

as I did show

#

that's me rotating left

#

but the actor itself never moves

dark edge
#

So for a character
Tick -> LocallyControlled? -> True -> Do Physics -> Send PhysicsState(Run on Server, unreliable)
-> False -> Do Physics Smoothing using PhysicsStateReplicated

SendPhysicsState(Run on Server) -> Set PhysicsStateReplicated(replicated)

#

Rama's is basically the same setup as the default physcis replication but client-authoritative.

#

Dig into how the normal physics replication works, there's some heavy math in the smoothing

pseudo merlin
#

hi all, I have replicated actors in my game that are weapon pickups. I'd like to rotate them for a visual effect on each client independently, but even with replicate movment off they copy the servers rotation. Is there a way to override this behavior?

#

im tempted to rotate them on GPU, but wondering if theres something im missing here

dark edge
safe vortex
dark edge
#

physics includes rotation

safe vortex
#

The rotation of pawns is the issue

pseudo merlin
#

ah i think i solved, the root component was set to replicate

#

it was a mesh which maybe has some logic to auto replicate location or something

safe vortex
#

lol so Add Controller Yaw Input never replicates

#

and doing repnotify with input works with setting a transformation

dark edge
vivid sparrow
#

basically I have a credits system in my player state but it's always reading null whenever I get the player state off the owning player

bitter oriole
#

Probably that widget doesn't have an owning player - widgets should never be replicated

vivid sparrow
#

it adds successfully but it doesn't get the player state off the client, only the server

bitter oriole
vivid sparrow
#

does player state even replicate? i thought it was just specific to each player

#

that i add

worn wagon
bitter oriole
#

Eventually

#

Of course you can't rely on PS being replicated at any specific point in time

#

Might be 2s after level load, 5s...

dark edge
vivid sparrow
#

weird, I added a delay of 2 seconds, and it worked, but it read the saved amount of credits from the individual Player State, upon the level loading it's always reading from the initial player's saved amount (being 10 credits)

vivid sparrow
#

unless i shouldn't store credits in the player state since the initial amount it would load in would be replicated across all clients anyways

worn wagon
#

I'm getting a crash error and I really have no idea where to start. The error is:
Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LazyObjectPtr.cpp] [Line: 22]
It happens after I try and host a listen server via a main menu level and load another. The level loads and the character spawns, but then it instantly freezes and crashes with that error. The map plays fine on its own, is there some extra setup I need to do? This is the code I'm using inside of a button click function to swap maps.

GetWorld()->ServerTravel(URL);```
dark edge
split siren
#

If I wanted to avoid using default replication for character movement and put all movement data needed for replication into a custom struct, what data would I need to put there?
I have FRepMovement, but the character movement is not as smooth as with normal replication.
I skipped RepRootMotion because I am not using any advanced animations with root motion. Is ReplicatedBasedMovement important? It was always 0s and false from casual debugging.

vivid sparrow
#

unless that's up for me to improve that lol

dark edge
vivid sparrow
#

mm alright

dark edge
#

You just don't have other ppls PlayerController

#

And may or may not have their pawn depending on relevancy

vivid sparrow
#

the players do have their own individual player states when I add the delay of 1 or 2 seconds, I don't get a null player state since I assume it just has enough time to set the player state in, on event construct it's called immediately before clients are assigned a player state, at least I assume

#

adding the delay of 1 or 2 seconds solved it for me

bitter oriole
#

Or 20s

vivid sparrow
#

yeah, my prof doesn't use a delay at all which is weird lol, which made me think I was doing something wrong

#

i'm calling it at the exact same time too

bitter oriole
#

You can not assume any timing in MP

#

Instead, build your code to not need any

vivid sparrow
#

yeah since magic numbers are bad lol

dark edge
#

Does anyone have a flow chart of what is guaranteed to exist before what else? That would be very handy

vivid sparrow
#

that would indeed be very helpful lol

quasi tide
bitter oriole
#

Assume nothing, build everything to withstand null pointers

fathom aspen
# worn wagon I'm getting a crash error and I really have no idea where to start. The error is...
dark edge
#

I mean there's certain things. I'm pretty sure HUD implies player controller

worn wagon
#

I don't have any landscapes added though

bitter oriole
#

HUD is purely local

#

For actually replicated classes on client? There's not much that's a sure thing

vivid sparrow
#

from what I understand it's Constructor -> PostInitializeComponents -> NativeConstruct but I don't think that helps in this case lol

#

NativeConstruct is like the BeginPlay of widgets idk

worn wagon
dark edge
#

Nah. I mean how many?

bitter oriole
#

Probably not

#

In any case, do it, test it, and when your game goes closer to release, anything can be optimized

dark edge
#

That's nothing. They're not checking on tick right?

#

Even if they were checking on ticket probably wouldn't even be a big deal

glad escarp
#

Hey guys. Asked in UMG already but I wanted to also try here since replication might not be something that the UMG experts would be versed in. I'm trying to replicate changes to a world space widget. I have a simple computer terminal system working pretty well but I want other players to be able to see what the interacting players are typing on the screen. Any ideas about where start looking?

fathom aspen
glad escarp
#

If I'm adding a child to a scrollbox will that work the same way or am I gonna have to figure out a way to route a server replicated event through the using player to add said child widget

fathom aspen
#

ScrollBox is part of the UMG widget so it's client only. Every connection would have to do that on his own. So you have to do it OnRep too when that said replicated "action" happens

#

For example. On "Enter" key is hit you add a scroll box. So you would call a server RPC that sets bHasPressedEnterKey to true and in the OnRep you add the scrollbox to the widget

glad escarp
#

ok. Yeah right now the way the terminal works is when you hit enter, it commits a string to a new widget which gets added as a child of a scrollbox. Simple chat type stuff. I just didn't think you could do a server RPC from an actor that isn't directly owned by the player, aka a pawn.

#

This terminal is a separate actor that takes input from the player after the PlayerCharacter BP has input and movement disabled

fathom aspen
#

It's owned by the controller which is owned by the client(player in your terminology). Ownership is checked until you get to the outer most owner

glad escarp
#

ok. Thanks. I'll work with this. Thanks for pointing me in the right direction

ripe basin
#

Any tips on working with Steam API? I have to run a build and then share it out to another machine and separate Steam Account every time I want to test something. Is this as good as it gets? lol

dark edge
ripe basin
#

Yeah, Standalone works fine for 1 Player - But anything past that I have to build and test on multiple machines.

dark edge
#

Get multiple machiens

#

or some friends

ripe basin
#

So in this instance, I'm trying to troubleshoot lobby / leaderboards.

#

I know, I was specifically asking if there was another way instead of having to run a build and share it out. lol

#

So I'm guessing no

dark edge
#

You can just launch the uproject

#

if you have engine installed on the machine

#

That's what I do, it's like 5 seconds from submit to source control to server launching new "build"

#

server being a shitty laptop

ripe basin
#

It's mostly the second Steam Account thing, not the actual launching.

#

Like if I run a dedi + client, it still only uses 1 steam account on the machine, so it kicks the client out of the session.

#

I'm wondering if I can maybe force the initial server launch to be some kinda universal account, then the client uses my normal steam account.

dark edge
#

I'd just make another account, you'll want it for the company/appid anyway

#

I'm not sure a dedicated server needs an account but IDK for sure

ripe basin
#

Alright, was trying to see if there's a better way than what I'm doing - Guess there isn't. lol

#

"Get some friends" 🤣

worn wagon
#

Okay i'm not much closer to figuring out this error, I'd really appreciate your guys' help

#

What I have been able to figure out is it only crashes when I have more than 1 game instance open

#

it provides me with this error Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LazyObjectPtr.cpp] [Line: 22]

#

For this code const FString URL = "/Game/Maps/MixtapeMansion?Listen"; GetWorld()->ServerTravel(URL);

#

So this assert triggers when the PIEInstanceID of the second client is not equal to 0, which it wouldn't be

#

So is it just not possible to test local networking in the editor? I can't imagine this is the case

#

Something is messing up somewhere, or this is a bug with the engine

#

Okay also running it standalone works fine, but both clients get connected, I'm guessing i'm misunderstanding something about how this all works xD

worn wagon
#

Got it working properly now but it still crashes on the client join if I run the instances in viewport instead of standalone

#

🤷

#

I FIGURED IT OUT FUCKERS

#

Okay so anyone having the same issue, go into advanced settings here

#

Then go down here and make sure "Run Under One Process" is OFF. It is enabled by default.

#

Idk why I couldn't find anything on this

echo geode
#

It's not a really a question, i just want to explain my thoughts about I just want to get the best idea for the make multiplayer implementation of that:, I have an range(oven) actor with the burner and the dial component. So i want to create a timer that when dial is changed and vfx effects to multicast(or onrep(repnotify)) on the time ends up, i'll call multicast function from the server to tell everyone that the time is up on the timer callback.

#

and while the burner heats, i'll imply the tick functions for heating on the actor's tick method(called on server) so it will evulate and call multicast RPC from the actor

dark edge
#

float TimeRemaining and bElementIsOn?

#

or float TimeRemainging and float BurnerTemperature

echo geode
#

Clients should care about,
Burner's heat
Dial's degree value
Time that expire,
Overheating,
Burner's VFX

dark edge
#

Overheating and VFX can be derived from Heat right?

#

Heat drives Overheating which drives VFX

echo geode
#

Should I use rep notify ot multicast when the timer is ends up on the server?

acoustic drum
#

How can I get the network insights tab? I'm not really sure where I'm supposed to put the command -NetTrace=1 -tracehost=localhost -trace=net

tacit bough
#

hi,
probably simple to solve: I've got a basic HUD with the player's points. The points are part of each player's PlayerState, the variable is set to be replicated.

The HUD works fine on the server, but the not on the client.

The point it fails at is when I try to get the other player's playerstate via a function I've put into a general blueprint function library.

What's missing to make it work on the client side too?

tacit bough
#

kind of solved it. I don't know why yet but setting the own player controller reference on the OnConstruct event does not work reliably.

fathom aspen
fathom aspen
# tacit bough

Also this won't work for the simple reason that clients are not aware of other client PlayerControllers

#

PlayerController is only replicated to owning client

#

That's why you got PlayerStates. The container that has all PlayerStates is called PlayerArray(it's in GameState)

tacit bough
#

Meaning, I should never try to get the player state via the controller or vice versa on any client, and instead should just get everything done with the player state directly.

fathom aspen
fathom aspen
tacit bough
#

wowie, that of course changes a lot of things, glad I got to know this early on in this project!

fathom aspen
#

Getting other people PlayerStates is valid though

tacit bough
#

I've read the bible at least 5x but I fail to reference it for specific things like these / forget the details while developing. Great link nonetheless though

#

my thinking was just wrong. I thought: hey, although I can't get the PCs directly, I can get them via their PSs right? nope of course not.

fathom aspen
#

Yeah I always keep it by my side when I'm not sure about things xD

tacit bough
#

the PCs don't just start existing on clients just because I attempt to get to them via the state

#

that's what I thought was happening lmao

fathom aspen
#

Yeah ofc not

tacit bough
#

yeye...

#

it's thoughts like these that the Bible doesn't touch on, it's the kind of wishful thinking you get into when nothing works for too long haha

fathom aspen
#

Yeah the bible is by no means a 100% complete source of info, as it would be 1000 pages in that case xD

#

But yeah it's good that this server exists and that people can ask

tacit bough
#

great, got it all working now :) fantastic

#

Only thing that's bothering me right now is that the update of the playerstate is pretty slow even on local machine testing, but that's a whole other story I guess...

#

alright, got that fixed in splitseconds just by changing the replication settings lol

fathom aspen
#

That's the easy fix yes. Their NetUpdateFrequency is potentially higher than other actors.

#

In cpp I would use an OnRep_PlayerState.

#

In BP I would delay until it's valid, or send a signal from the PlayerState class client-side on BeginPlay for example

humble bane
#

am having a strange issue where my animation replicates the first time but not the second time (client doesnt replicate)

animation replicates in other parts of my game every single time, so idk, strange, any help will be grateful

humble bane
#

I think I just found a work around, no worries

#

(for now jumpscare )

vague spruce
#

what's the difference between #UE_BUILD_SERVER and #WITH_SERVER_CODE?

glad escarp
#

So, I have an actor that spawns several child actors at BeginPlay and passes a randomized string into each child. The first string is saved and used as a password to log into the parent terminal actor. I print the password so I can see it and display the passwords on the child actors. Problem is, the actual password isn't showing up on any of the children for some reason. Should I be spawning the actors via Server RPC to make sure they are the same for everyone? Does the string randomization have to happen on a server RPC? I'm just trying to figure out why the print string password works but it never shows up on the child actors like its supposed to.

hollow eagle
vague spruce
#

good to know, ty

#

i need to send some custom options on connect to my server. do i just provide them like a query string?

            PC->ConsoleCommand("open 127.0.0.1");
sonic dock
#

Hello everyone, I am stuck in an issue where the client is able to connect to remote server hosted on windows server. But when I package for the linux build, the is not able to join. I ssh into the server instance and here are the logs.

#

The connection request is received by the server successfully but I am unable to join. It keeps sending RestartHandshakeRequest. Can anyone help with it?

scarlet fjord
#

Does anyone know if its possible to move AI pawns on clients? As in calling "AI Move To"

How can I achieve this?

rocky kestrel
#

Function in "player state"

#

in player controller when beginplay to set that id in player state

#

It works with dedicated server but when someone else joins game then it set first person id who joined to null

#

Goal is to have system that players know their unique "MyID = username+password" and server knows everybodys id

rocky kestrel
#

server log (I have replicated bp to print all players id from player states)

fathom aspen
#

Yes that's normal

#

You are using GetPlayerState(0)

high ibex
#

instead of index 0, try just getting player state and cast to your player state

fathom aspen
#

Which should be eradicated

high ibex
#

each player will have their controllers .. so rest of code should work fine

fathom aspen
#

You got a replicated PlayerState variable ready for use in PlayerController class. Learn to use it

#

Also if you are doing authority stuff in BeginPlay, do them after you do a SwitchHasAuthority and then you don't have to call a server RPC, just a normal event

fathom aspen
#

Read the compendium(in pinned messages) to know what GetPlayerXXX(0) returns when called from different configurations @rocky kestrel

rocky kestrel
#

Okay Thank you!

fathom aspen
glad escarp
fathom aspen
glad escarp
fathom aspen
#

You got a SpawnTransform when you spawn something, make sure it's what it's meant to be, i.e debug

glad escarp
#

They are just spawned by another actor. So they are independent actors.

fathom aspen
#

Ah ok, great then

glad escarp
#

ok. Yeah I've been trying to debug the actor spawn transform. I think it might have something to do with the way I'm randomly selecting a location. I'll work on it some more. Thanks

#

It's just confusing because the random spawn transform was working when I was just doing it all locally. It just started giving me problems when I started running it through a server RPC

distant turret
#

Hi, do you need a savegame blueprint if you are planning to use DynamoDB

hasty blade
#

[noob question] Why does the message only seem to reach the server?
If I put a breakpoint on BeginPlay, it stops on the server & on both clients.
If I put a breakpoint on the sending and receiving end of "Test Event" (image), it stops on both breakpoints on the server, but not on any of the clients on the receiving end.
What have I forgotten(/misunderstood)?

twilit radish
hasty blade
twilit radish
#

Is your (I assume?) Actor relevant to all clients?

#

Also are you sure the actor already exists by that point on all clients when you're calling this?

hasty blade
#

The actor is placed in the map, and not created on the fly, and there is a 10 sec delay before triggering the event... so it should exist on all clients.
But since it doesn't work, I'm doing something wrong 😆
What do you mean by "relevant to all clients"?

twilit radish
#

Actors can be relevant or irrelevant based on certain conditions, such as distance or manually messing with things. If they are irrelevant to a certain client they normally don't exist for that client until the actor is relevant again.

hasty blade
twilit radish
#

If an actor is not marked as "replicated" or whatever blueprint exactly calls it again it's not networked. If you want something to have a network connection (or not) you need to toggle that yeah.

hasty blade
#

So it's the "Master switch". 😆
Ok. Then I have a chance to get somewhere with this.
Thanks a million! @twilit radish ❤️

twilit radish
#

Essentially a master switch yeah 🙂

#

Np! Good luck 😄

dark edge
#

but that's a wacky ass way to do IDs

split siren
#

Just a sanity check, I want to NetSerialize a boolean (and possibly couple more in the future). Is this the correct way to do it?

uint8 Flags = (bProxyIsJumpForceApplied << 0);    
Ar.SerializeBits(&Flags, 1);
bProxyIsJumpForceApplied = (Flags & (1 << 0)) ? 1 : 0;
ebon cloud
#

Hey guys! I'm running into an issue executing server event on a client.
as the listening server everything works just as intended:

#

but on the client

#

I have replication enabled on the actor as well

blissful saffron
#

server functions don't execute on the client..

ebon cloud
#

@blissful saffron is there a way I can get the client to turn on the lights for the other clients, or is this only possible with the listening server?

blissful saffron
#

Well, you'll need to have your light actor replicate its on/off status to the clients

dawn ledge
ebon cloud
blissful saffron
#

So you could either have a replicated prop that tells whether the light is on or off (the way I'd probably handle it) or you could send a netmulticast rpc from the server once it receives the update

#

so if your actor replicates, that doesn't mean that every property on the actor is replicated

#

so maybe set an 'on' variable on your light that is replicated

#

then when the clients send the server function to turn it on, it sets that variable and that'll replicate back to clients

dark edge
#

Boolean bIsOn(replicated, repnotify)

#

Client
Input -> Run on server event

Server
Run on Server Event -> Set bIsOn

Everywhere
OnRep_bIsOn -> update stuff (light output, etc, play sound, etc)

blissful saffron
#

^^

dark edge
ebon cloud
#

thank you guys for the responses but again sorry for being dumb

blissful saffron
#

Sorry, I can't really see that. What's the issue?

dark edge
#

That function

#

that's where you do light stuff

#

Inside that function, get LightOn, and select or branch on it

#

Since it's an overlap and you can do it all with no client input, do this

Server:
Overlap -> HasAuthority? -> Event if you want -> Set w/ notify LightOn

Everyone:
Onrep -> do light stuff by branching or selecting using LightOn

Done.

#

no RPC events

#

It's that simple

ebon cloud
#

set rep is set to true

#

but still no lights on client

dark edge
#

In your Onrep, that's where you actually modify the lights

#

That's the end of the chain

#

This will be like a 3 parter, sec

#

Make sure the actor is replicated. The light component doesn't have to be.

ebon cloud
#

@dark edge so if I put has authority only the listening server can turn on all the lights

#

and they replicate down

#

but if the client touches the button

#

it doesnt do anything

dark edge
#

The overlap will happen on both machines

#

just the one on the client does nothing

#

This is all triggered by an overlap correct?

ebon cloud
#

yeah its an overlap

dark edge
#

K it should happen on server too

ebon cloud
#

@dark edge what was the point of has authority in the beginning?

#

if the client interacts with it wouldnt nothing happen?

dark edge
#

It's good practice to gate it

coral wing
#

GetWorld() doesn't work in multiplayer?

dark edge
ebon cloud
#

@dark edge still nothing on clients :( listening server works fine and all the clients see the lights turn on, but if I'm playing as the client and hit 3 only the clients lights turn on :(

dark edge
#

To make it go off of client input you'll need to
Hit 3 -> Run on Server Event
Run On Server Event -> Carry on as normal

#

Before you were using an overlap, which would happen on the server.
Hitting 3 doesn't happen on the server, so you need to RPC that like how I just diagrammed.

ebon cloud
#

@dark edge interesting so it actually works now

#

if I call it from 3

#

but not when I hit the overlap

vagrant grail
#

Simple question : Is this code Secured ? Like I'm having a debate with someone and I keep saying that he shouldn't add inputs to server events as those events are RPC so client can call it and send his own arguments through that so it creates a security issue but he keeps telling me that as long as he doesn't call that RPC from the client it's all good and he's doing that to pass arguments between 2 events on the server. So my question is 1 - Is it secured ? 2 - Can a client call that event (so is it an RPC) through a cheat even if in his blueprint there's no node calling the server from the client ? 🤔

#

Please ping me if any answer 🙂

ebon cloud
#

@dark edge it works now, I just casted to the character and called an even from there

#

thank you so much

twin juniper
#

Hi, dumb question but imagine i pass a Struct in an Server RPC (so from client to server), this struct contains a pointer to an replicated AActor, does the server receive the struct with the AActor client instance or it converts it to the server instance as if i would have passed an AActor* in the rpc instead of the struct

dark edge
#

Have you checked that yet?

dark edge
#

Or rather SRV Attack, I can call that whenever

#

Even when dead

#

Because you only do your Not Is Dead check on client

vagrant grail
#

So do we agree when we create a server Events it's an RPC ? And we should never put inputs going from client to server ?

blissful saffron
#

Yes, they're RPCs

graceful flame
#

Do Server_Attack > Is Not Dead? > continue ....

ebon cloud
blissful saffron
#

You can put inputs in them

graceful flame
#

and on client side as you have it

blissful saffron
#

You need to validate actions the server takes that are initiated by the client