#multiplayer

1 messages ยท Page 235 of 1

dark parcel
#

The widget should know whos the owner

#

Get Owner -> Get Current Health / Get Max Health

ornate moat
dark parcel
# ornate moat

you need to pass the reference at the time of the widget creation

ornate moat
#

iuh

dark parcel
#

Create a variable, call it Owner . The type is Actor

#

Make it instance editable and expose on spawn

#

On the create widget node, set the owner (The character that you spawn)

crisp shard
#

Would it be possible to create a data asset at runtime or a data table?

Not even sure if either of those would fit my needs but Iโ€™m thinking to create a system that would allow a player to make a very simple mini quest and have it exist for another player to do at a later time. I suppose I could do this outside the engine like storing the info somewhere else and then reimporting / loading that back to get in the game again but yea curious if there are any suggestions on this concept

#

I could make a BP loaded with variables that could be set (this sounds like a data asset lol) and then just have that BP saved as an actor but idk Iโ€™m just thinking through ideas rn

mighty yoke
#

With all the discussion about getplayercontroller above, I kind of got lost.
If you have a game that combines split screen with online multiplayer, for example 2 players splitscreen in a lobby with 2 other players (not splitscreen).
If you wanted an enemy that picked a random player to target with an attack, what is the best practice to get that list of players?
I've seen a half dozen different ways, including tracking it yourself by building it when players connect/disconnect, and using the various built in player lists, I can't tell which one is best to use.

tender olive
#

right, so I made a new project to get my head around this "get player controller" concept right,

  • made a custom game mode and custom player controller, player controller has a int variable to keep track of.
  • so in game mode, on handleStartingNewPlayer, I cast it to player controller, set a number to the variable and spawn the default third person character and posses it.
    then to simulate the scenario, just made a simple input action that spawn an actor bp_actor_on_client. I know some will say I should at this spawn point, set a reference to the player controller, but that is the thing right, we want to get it without having such hard reference, since pcg does not make any reference it just spawns.

So this actor will after some time call server and ask to be spawn, and the server will choose a color based on the owner player, branching on the int variable we set at the start.

So this works fine PIE when

  • stand alone
  • as listening server

and also works in stand alone multiplayer out of the editor.

In a split screen however, it always runs as player 1, spawining the redish ball instead another color, because of the fixed index in get player controller at 0.
But I don't think there is a way around this for split screen right? So if the actor does not have a reference to who owns it, there is not way to call the server with the correct info.

But at the same time, actor spawn in split screen is visible regardless of who spawns it, so we do not have the server/client problem.
Then the question would go to how to identify if it is a local split or client server, can call game mode directly from the actor, but still can't know who should owns it.

tender olive
mighty yoke
#

I guess to summarize is there a built in player list somewhere that accurately tracks all the players, ranging from all local, to all online, and any combination within, or does that need to be implemented by the dev

thin stratus
thin stratus
#

Only thing with that array is that the order is not guaranteed to be the same on server and clients. As it's filled locally. But it will contain each player's PlayerState. Even AIs if you mark them as bWantsPlayerState

tender olive
#

pcg in split screen duplicate everything, since is the "same instance".
so for split screen, one needs to handle it as stand alone I guess, only 1 can run pcg,

it is the same instance for both screen,

well in my initial setup, i have pcg populating most of the visual, trees and some buildings, but at those buildings, some of them I want to spawn an npc, so that is where the spawn from server comes in. For this scenario, I don't really care who spawns it, so its fine.

Converting this to a splitscreen, there is no need to control any of that, as it alls runs as a single instance.

But just out of curiosity, I think it is impossible to get a player controller from a loose actor in a splitscreen, it simple doesn't have any. But it is also not needed since any controller can direct call it

#

on the pcg side, I do think I already have a solution, I'm passing the "seed" variable, which is just a random number from the graph, at the pcg spawn actor node, the graph runs on the client, the client can pass a parameter to the graph, and then spawn the actor with this parameter, like the count variable, index or whatever. It won't be a hard reference to the player controller, but it will be enough to get one in case its needed.
Unfortunately there is just no solution for local split screen, impossible to know which character trigger the pcg

#

like this, in online, the only visible actor in server is the white ball, everything else is client. Everythng is pcg generated here, including the server balls
but local split screen, it runs both. Balls are spawn with "get player controller at 0" which call server spawn.
in split screen, the pcg is literally the same instance, so there is no way to know who triggered the pcg generation from walking, this is a grid based pcg, that loads around player. But shouldn't have any need to know either, everything is a single instance.
Well, anyways, thanks for all the effort in explaining it, that really help me get a better view of it

grand kestrel
#

@thin stratus can you think of any reason not to do a net predicted launch character stack?
Just prototyping the idea atm

#

In this case it came about because characters needed a boost during some of their air attacks but root motion sources acting like forces instead of impulse didn't cut it
But its still just a 'try it and see'

rough dock
#

if i have custom settings for a game ie. gravity multiplier, damage, multiplier, would it be better to store them in the game mode, gamestate, or it doesnt matter which one

nova wasp
#

if they were in the gamemode they would not be able to replicate to players

#

they may need to be in the game state here or some other actor replicated to all clients

quiet yarrow
#

Recommendations on how to replicate an elevator that an chaos vehicle can drive on?

#

I imagine there is a way to have the elevator be predictive?

nova wasp
#

My assumption would be having the elevator move on the fixed async physics update somehow

#

unsure if the default callbacks work in the sim, I would insights trace to see

thin stratus
open wave
#

so setting up a river where i can enter i can start swimming. the start swimming works fine but when i exit the water all players are stopping swimming not just the player that has exited the river

bright summit
#

and why are you sending RPC when you already separated server logic with hasAuthority branch. Overlap functions are executed on server and clients so rpc is not needed here I think

open wave
#

ahh okay i was trying to achive a way to automate the water volume so i am not having to place heaps of physics volumes as i dont believe i can do this in blueprint

#

ill have to go back to the drawing board for this

snow trail
#

hello, what's the correct way to replicate damage in a first person shooter?
(it's a PvE game to play with a party of friends, not competitively, so i'm fine with some client authority)

what i mean is, let's say i have a client firing 20 rounds per second, hitting the enemy with all of them

the absolute easiest way to replicate this that i can think of would be to call the damage event from the client to the server, for each bullet hit
however even with my little experience i can tell that it sounds like a bad idea, especially since every RPC would need to be reliable

a different solution could be to go with server authority which makes the replication problem nonexistent since i can just replicate the enemy's health variable, given all damage is called and applied directly by the server without having to be called by a client first

the problem this introduces, which is what i'm stuck on, is how do you replicate the firing from a client? just start/stop firing RPC events?
and then, wouldnt the positions be desynced between client and server leading to confusing misses or hits?

thin stratus
#

The position could indeed be different. As the thing the client is aiming at is already somewhere else on the server and even further gone once the RPC arrives on the server to start firing.

#

But that's only solvable by storing information about the targets and having a timestamp to send along to the server so it can do the hit tracing against an older position

#

Which all in all isn't easy and if you make a coop game is probably overkill

snow trail
thin stratus
#

You either send each shot as an RPC, or you send start and end.

snow trail
#

start and end as the total damage values?

thin stratus
#

Start and End as the StartFire EndFire

#

You should always only RPC what the Server can't know about

#

In this case the button press and release

#

The rest is all authority stuff

snow trail
#

i see

cinder orbit
#

why doesn't Execute Console Command with the command of viewmode unlit work for player 2 when testing in editor w/ listen server mode?
I tried both client & server authority calling it from player 2 character input

bright summit
grand kestrel
# thin stratus I mean, the pending stuff in the CMC might already be doing what you want or not...

I mean, the pending stuff in the CMC might already be doing what you want or not?
LaunchCharacter and pending forces typically desyncs, it's not in saved moves if that's what you mean, might be misunderstanding you tho

Not sure it needs to be a stack if they can't be offset with a delay anyway. Could just combine them into one vector.
Generally the stack wouldn't be used beyond a single count outside of edge cases, but it would represent different launches, so the vector would be unique to each one

Also, side note, that gameplay tag could be pretty expensive to replicate, so make sure to only send a bit if it's empty.
Yup

I'm mostly just making sure I'm not wasting time reinventing the wheel, but doesn't seem like I am if I can get a stable/accurate version of LaunchCharacter

#

@pallid mesa you got any insight? ^

subtle kernel
#

guys, I connect to my game server like:
ClientTravel("someurl:20001?character=MyChar&token=MySessionId", TRAVEL_Absolute);

How can I simulate it in PIE? Like In game instance do ClientTravel with these additional params right after start? Or maybe there's some project settings for it?

nova wasp
#

but I'm not sure how to make the client not auto join

#

My dumb temp solution would be to have the client disconnect after starting PIE to a local level and then call this after

subtle kernel
nova wasp
#

the startup arguments?

#

or do you mean the editor PIE settings?

#

It kind of depends ... GEditor can obtain some PIE arguments I guess but I'm not sure what you want to get exectly

subtle kernel
#

nono, I'm talking more about real world example. I basically login on my login map and get signed character Id I want to load once client travels to game map. So I have session Id and character Id in game instance, but how do I transfer it to server now, so the right character is loaded for given player controller?

woeful wagon
#

I click the button and it moves to the controller,Then the controller calls the event in the gamestate, The gamestate increments an interger then moves on to the final stage where its supposed to tell everyone who got the vote, The problem is the clients are not getting to this final part of the code and Iโ€™m not sure why any help would be great!

sinful tree
# woeful wagon I click the button and it moves to the controller,Then the controller calls the ...

You can't send RPCs on actors that aren't owned by a client. GameState isn't owned by clients so you cannot have them call an RPC on the GameState.
Your multicast will also not be guaranteed to be received when the replicated value is received on clients. Make that "Player Vote" variable a "Rep w/ Notify" and you'll get an OnRep function that will be called when a new value is received which you can then use to update whatever you want to update when the new value comes in.

tardy fossil
#

in that specific example you could override the login function and create the player controller by calling the super function, parse the options string and set the variables on the player controller before returning it

woeful wagon
sinful tree
#

If you want to adjust something for everyone to see, you need to be executing on the server, but in order to have a client tell the server to do something you need to RPC on an actor that is owned by the client, and then the server can do whatever it needs to.... So you could RPC on their player controller, playerstate, controlled pawn, or a replicated component owned by one of these actors, and then when executing on the server, go to the gamestate and increment your variable.

woeful wagon
sinful tree
#

GameMode only exists on the server, so any variables on there won't be replicated to anyone.

woeful wagon
sinful tree
#

So if you wanted a click of something on a client to increment a variable on the gamestate and for everyone to see a print when the value is received:

Clicked Button on Widget > RPC to server on PlayerController > Get GameState > Call "Vote Count" function on GameState.
Vote Count Function > Increments "Player Vote" OnRep variable +1
OnRepPlayerVote function > Print "PlayerVote" variable.

winter pollen
#

how are projectiles ( bullets ) supposed to be replicated? currently the template i use only seem to have the damage running on server and the muzzle flash in some other function. But not the projectile itself.

The projectile is spawned locally from my bp_rifle

meager heart
#

Anyone have an idea why my actor that I'm spawning in my GameInstanceSubsystem isn't being replicated to clients?

I'm making sure the game instance spawning the actor is on the server, and the actor is set to replicate. Is spawning an actor from this non-replicating subsystem an issue?

tacit furnace
#

Hello, I have a random puzzle system that stores answers in a map. Since the system randomly generates answers and spawns them, it works on the server without replication using the "Switch Has Authority" node. When I try to display the answers in a widget, only the integer part of the map is visible on the client, and the string part does not appear on the client.

fossil spoke
fossil spoke
#

Instead, create a Struct type that holds the 2 data types you need.

#

And replicate it with an Array.

meager heart
tacit furnace
fossil spoke
fossil spoke
meager heart
#

Also the fact that the game instance / it's subsystems are auto created on clients, I think replication might get a little weird (I at least ran into problems when trying, but maybe I was doing something wrong)

loud flax
#

Is there any costs involved with calling an RPC function in an offline game? Asking because I'm trying to make a plugin that needs to support both single player and multiplayer. Wondering if I should separate any RPC stuff in a different class to maximise the performance of the singleplayer code.

fossil spoke
fossil spoke
loud flax
#

Thanks

tacit furnace
fossil spoke
meager heart
fossil spoke
#

The best way to tell

#

Is to use the BeginPlay function

#

On the Actor itself

#

Because that will always be called for both Server and Clients

meager heart
fossil spoke
#

Since its usually very odd that an Actor thats set to Replicate and is spawned on the Server would not be replicated.

#

Typically its user error

meager heart
#

I just had some stupid code to make it easier to breakpoint and inspect the data

#

Yeah let me double check

tacit furnace
#

Should I use a struct like that or an index for every answer?

fossil spoke
loud flax
#

@meager heart Just my two cents but usually the workaround I have for these kinds of issues is that I usually have an actor that handles world-based stuff that reads from the subsystem. That way you don't need to drive world-based logic directly from the subsystem itself.

meager heart
meager heart
fossil spoke
#

So it doesnt matter from where you call the function

meager heart
#

This is the class declaration

#

Ah yeah that's true

fossil spoke
#

Are you actually running PIE with a Client attached? Lol

meager heart
#

Yeah definitely

#

I'm sure there's some user error somewhere but not sure where

fossil spoke
#

So a breakpoint on line 71 doesnt get hit?

meager heart
#

Unfortunately not, function only fires once, but I can verify the actor exists on the server

fossil spoke
#

It is odd then, have you restarted the Editor?

#

I hope you arent using HotReload or LiveCoding wrong

meager heart
#

It doesn't appear in the outliner, I think there's some uclass specifier I'm missing for that but can't remember rn

#

Yeah I have but I'll give it a try again. I use LiveCoding sparingly and will restart generally if I modify anything in a header

#

Yeah still not firing after a restart

fossil spoke
#

What happens if you delay the spawning for a bit?

#

I wonder if OnWorldInitialized is a bit to early

meager heart
#

True, let me try that out

fossil spoke
#

Thats just a wild guess

#

Since I have to go now lol

#

Sorry to ditch you

meager heart
#

No problem, still gonna try to figure it out the discord is just a good place to get quick answers when there's something basic I'm forgetting about but if it's something weird I can debug it

#

Thanks for the help ๐Ÿ‘

#

Same thing happens after a delay lol, very weird

little pumice
little pumice
meager heart
#

Great point, let me check

little pumice
#

at debugging (breakpoint) you can use watches with following value:
{,,UnrealEditor-Engine.dll} GPlayInEditorContextString

#

to distinguish Server/Client/Standalone etc

little pumice
meager heart
#

thanks lol just needed some arbitrary code and sometimes debugging on a log macro is weird

meager heart
little pumice
#

maybe it's about actor's owner

meager heart
#

Isn't the owner the world if I just spawn it?

#

I guess the owner is an actor so it's not...

little pumice
#

what net mode selected in PIE? "Client"? Can you see running character on the second screen?

#

or just two actors together in one frame

#

maybe you just spawned 2 standalone windows Jokerge

meager heart
#

Yeah I'm using a listen server and 1 client, the server is running in the viewport and the client is in another window

#

don't remember the exact nomenclature because I'm restarting rn

little pumice
#

Make fresh new Actor in BP, add Cube Mesh to it, mark Actor replicated. Spawn it in gamemode . Check if it replicates Pepechill

#

|| ah, GameMode do not exist no clients, so it's even simplier, no HasAuthority needed||

meager heart
#

Was able to spawn a replicated BP actor from gamemode, made my class blueprintable to see what happens if I reparent that new class to it

#

Yeah using that reparented BP made it hit ๐Ÿค”

#

Very weird, the child BP class doesn't override anything

Maybe it's the fact it has a component it actually registers with the world or something, idk

#

Gonna go to sleep for tonight, thanks for the help everyone smiley

meager heart
tacit furnace
#

Is possible get overlaping actor player controller in sphere collision?

dark parcel
#

as who?

#

Client will only ever know their own controller

#

as server, sure you can

tacit furnace
dark parcel
tacit furnace
dark parcel
#

Yeah if client the one calling it

#

since only an instance of local controller is available to them

#

but then what are you actually trying to do?

tacit furnace
#

Does the server know itself as Index 0?

dark parcel
#

might be doing it wrong

dark parcel
#

anyway you don't want the index

#

what will that server?

#

you already have the reference to the character

#

as server you can just get the controller of the charcter

little pumice
dark parcel
#

Overlap -> Switch has Authority -> Cast to Player Character -> Get Controller

tacit furnace
little pumice
#

e.g. when collision happens, then you have input params/context to deduce correct PC, or if Client had send RPC, then it will be handled in corresponding instance of PC of that client

dark parcel
#

Damage is server only

#

just make sure everything is run in server, client simply receive the result (the replicated health)

tacit furnace
dark parcel
meager heart
dark parcel
#

so it will not be aware of other player's health

#

use player state for such property

tacit furnace
dark parcel
#

death is also handled on the server

#

so client shouldn't die unless the server tell them to die

woeful wagon
sinful tree
woeful wagon
#

the repnotify

sinful tree
#

You're not supposed to be calling it yourself.

#

It gets called automatically when a replicated variable receives a new value on clients.

#

You define what happens in that function when that new value is received.

woeful wagon
#

oh i read call the function so i misinterpreted mb

woeful wagon
sinful tree
#

That should be correct. The print string in the OnRep should print on clients.

upbeat basin
#

I don't think ++ and -- nodes work correctly with onrep variables

sinful tree
#

Does in 5.5, at least for clients. The server doesn't seem to trigger the onrep unless it gets set.

upbeat basin
#

Oh I wasn't aware of that they fixed it. Just had the same issue on 5.3 last week though

woeful wagon
#

if thats the case

sinful tree
#

Yea so in that case, just set the Player Vote C1 to the output from the ++ node and it'll probably show up fine.

upbeat basin
#

Well I would try a regular assignment just to be safe

woeful wagon
upbeat basin
#

Yep, you might want to see that replicated variable bubble when you assign/set your variables to trigger OnRep fn

#

Arrays also had a similar problem iirc, requiring to set it to itself after element addition/removal to trigger the OnRep (for BP), not sure if it got fixed as well though

woeful wagon
#

ok so this works if i start with the "server client" first if i initiate with the player client it stays at one lol

woeful wagon
upbeat basin
#

Well I don't see any other problems with the setup either, so maybe something else is broken wrong/missing?

woeful wagon
#

going to check the output logs for a bit

fossil spoke
#

Not something thats usually considered, given that you just assume you have made one lol

bright summit
#

what would be the best approach to make breakable props, like chair, table, crates etc. Chaos destruction with replicated force fields? These props must:

  • be able to be spawned run-time or be placed inscene (so I need replicated actor).
  • I want to create and bind to them events like OnDamaged, OnBreaked etc.
  • and the most puzzling part: how to code that debirs of destructed prop make noise, impacts, scrape etc. (I have coded it on my static mesh physics objects but I wonder if it even would be possible to code it for debirs)
bright summit
#

I see that another problem would be with replicating it. I can replicate static mesh physics but geometry collection not

normal viper
#

Something that bugs me. Let's say before the game starts I give players choice to choose Starting Resources amount (50/50/50 or 25/100/25 for example). I can store this choice in the Game Instance and when Player Controller get's created just Get GameInstance from each player and take this Starting Resources variable and add to the Player State (where they store resources). Just out of curiosity I don't expect people to cheat because I don't plan ranked ladder, but it feels like it would actually be easy to ''hack''? And so because of that there is question. What is actually better place to do it? ''StartingManager'' that receives it, spawned by GameMode? Spawned for each PlayerController? The current flow is Game Instance calls to open level, Game Mode spawns Player Controller. So maybe GameMode would spawn Manager? but then it cannot access GameInstance, so how to ''feed'' data to GameMode for this exact player. What I'm missing? What can I create so gamemode or playercontroller can access it without user beeing able to ''hack''. Or do I just lock the choices, so in the worst case if player tries to hack it's gonna set starting resources as default or something like that? I'm missing some class where I could feed the data safely so the game can take it and use. What is that?

dark parcel
#

You are letting the player chose their own starting resource before they join the game?

normal viper
#

not the one that respawns around him, just the amounts like 50 wood 100 gold for example

dark parcel
#

I kinda lost the plot, do you want the player to chose starting resource before they join someone's game?

#

why do you need game instance

normal viper
dark parcel
#

then all the choice can be stored in the server

normal viper
#

okay so that would be after the session is made or something like that?

dark parcel
#

I think you are overthingking it

#

you simply need to ask the player what choice they made

#

you don't ask them, how many lumber did you chose

#

you ask them the choice ID

#

and you map the ID with the resource in the server

#

if Choice 1 -> Wood = 50, Gold = 5

#

if every choice is valid then doesn't matter if they "hack"

#

unless you impose restriction where some choice is not valid. Then you do handle this on the lobby and accept people request to selec tan id if it's valid

normal viper
#

okay, but more or less flow in the blueprints would look like how? I'm missing that ''bridge''. If I ask from server, then I ask to where? Player Controller?

#

so it means I should put that choice to be set in player controller?

dark parcel
#

Am I picturing instance where people join a server where they are presented with a Widget that have buttons where they can make choices on starting resources?

normal viper
#

Yes

#

like 3 buttons, if you click/highlight one, you set Choice 1

dark parcel
#

If other player needs to know or see what choices other people make

#

you do store that in game state

#

as that is replicated

#

Client joins

As Client -> Click button (Server RPC, hey I select option 1)

Server : Ok option one valid, set Player 1 choice to 1 (choice being a replicated variable)

normal viper
#

ohh, Game State... so game state opens already when we are in ''lobby'' and waiting for everyone to be ready? and then we can access it from GameMode and give choices to each player?

dark parcel
#

You are already in a running game

#

Game states, player states

#

use them as you will

normal viper
#

ok, that got me closer to what I wanted, but for singleplayer I guess Game Instance will be completly fine for ''missions'' and then for multiplayer I will just do different logic, or will abbadon the idea of resource selection ๐Ÿ˜„

dark parcel
#

I mean the idea of selecting starting resource is very simple

#

you can just prototype a button where if a player click, it will represents the player that clicks it

#

If you are going to make multiplayer then you do have to make it multiplayer ready

#

don't do a single player game and change your mind in the middle

#

the architecture is different

#

You don't even need to do different logic as Multiplayer logic will work just fine for single player

#

but not vice versa

normal viper
#

im scared of multiplayer because of how much things take longer to debug and do things but yeah just trying to conceptualize how things would be if

dark parcel
#

well ngl, sometime I don't know how much I can push multiplayer

#

it's just by some miracle at the verge of giving up, I got the solution on what I thought is impossible to do with my current skill

normal viper
#

must feel good and scary at the same time ๐Ÿ˜„

#

my plan is to make basic prototype so you can play, and then give it a bit of time to try and make it multiplayer, but systems are quite simple, if its not gonna work then its gonna be a good lesson but at least game in single will work

now after thinking a bit, since we are in lobby, there is already player state and player controller, so player clicking on the button it would just Set Resources Amount to Player State of that player... holy shit that was simple? each button would Set different amount... correct?

#

now I just need to fill my knowledge about sessions, lobbys and ''starting game'' .. step by step well get there

#

thanks for help ColdSummer

upbeat basin
#

I was gonna comment on hacking stuff but now I have a question, is it possible to fake/send RPCs with hacky ways?

#

Not like mingling with the data being sent with it but like triggering it

chrome bay
#

Anybody know if the FArchive passed to Struct::NetSerialize's size is only the size of serialization data of that particular struct? Reason I ask is I'd like to pack an optional value and use the size of the FArchive to determine whether it's serialized or not, instead of an extra bit

upbeat basin
#

How is that possible though, is there a different tech behind RPCs than using the open sockets between my pc and server?

#

If it would be a http request, I can understand that you can just duplicate the payload and send another request from outside, but shouldn't RPCs use the connection that we already have with server?

#

If they do use it, is it some kind of copying instructions to execute the RPC call again or something like that?

chrome bay
#

That's partly why the ownership system exists. If a client machine does manage to send an RPC for an actor they don't own, the server would reject it

#

So even if a client manages to push one through, nout will happen server side

#

The ownership test is done at both ends

upbeat basin
#

Yeah I was going to give an example of an RPC that would increment a resource for the above question. So since we're owner of our PlayerState, if we don't put checks it could be incremented infinitely, is that correct?

chrome bay
#

yeah for sure

#

A client machine could basically call any function they want at anytime outside of normal code execution

#

So whatever the server is receiving should be validated and checked

upbeat basin
#

Is there any recommended resource on hacking or hack prevention to learn more about this kind of stuff? I always felt myself missing on this side

dark parcel
#

Like client say ,. Hey I want to open this door.

Server gonna check if the client have the key or not in it's machine

#

so doesn't matter what the client say they have

chrome bay
dark parcel
#

if client by some chance allowed to say, I have this much resource,
Then they can just do memory manipulation and change their resource.

You can design the game like, client values is but mere illusions. Their resource in their tab is just a representation what could be true.
But the real value is always on the server

tardy fossil
#

basically: client requests to do things, server does things

upbeat basin
#

Yeah I was going to give an example of just storing the variables in server itself is not enough to prevent hacks. Server side logic should cover abusive or edge cases to prevent anything go out of order as well.

Like having presets and saying to server "Hey I want this index" is probably the best way as ColdSummer recommended. Although it still requires index check in server too.

But if it would be "Okay you have X amount of points, each point is 50 resource, now select which resource you want", and the widget button click would say "Hey server add point to this resource" that would require the server to check if any client's total spent points are exceeding the limit or not.

Just wanted to add my bit, since the initial question kind of included that

chrome bay
#

A simple example would be firing a weapon or something. You can make an RPC called FireWeapon(Orign, Direction) - and do a simple check to make sure the client is near that origin, roughly facing that direction etc.

BUT, the client machine could spam that RPC to the Server as often as it likes. It's up to you to implement a heuristic to check the rate of fire they client is expecting, the number of shots fired etc.. That's a little more complicated to do.

dark parcel
#

I am on the verge to think that I shouldn't care about hack too much

#

for someone to hack my game, my game need player base first

#

if I am not working for a company, then meh

#

simple checks will do

upbeat basin
#

Well that's a valid concern as well. Me trying my best with listen server games here.. (with the hope of it growing and requiring dedicated servers some day)

chrome bay
#

Pretty much. Like it helps to maintain good practices either way because then it becomes natural, but hackers are only going to hack a game that people widely care about

dark parcel
#

and if we are doing listen server, that's doomed already too

chrome bay
#

Ideally players who host servers and DO want to play normally shouldn't be penalised for that though. It's also a good reason to support both listen + dedicated. It's not super hard to do outside of a few edge areas, and if you're writing cheat-resistant code for one you get it for the other too.

little pumice
#

Listen server is not self sufficient as many might think. It still requires NAT Jokerge

tardy fossil
#

not with steam lobbies ๐Ÿ˜‰

upbeat basin
#

Being bound to a subsystem is still better than paying for a server that hosts less than 10 players monthly I believe ๐Ÿฅฒ

dark parcel
#

Using AWS fleet, you can create an instance on demand

#

they can be terminated when there's no more player too

normal viper
#

@dark parcel I realized what part of puzzle I was missing. In my ''Level Selection'' because after clicking Start Game I was opening new level, everything would get resetedso I setting anything in Player State didn't make sense for me. The missing puzzle is that I need to travel to the next level without reseting PlayerState for example. I don't know how yet(i'm watching tutorials and reading), but I think this is it. That way player can click things in mission selection and set them, and then travel to level with these settings. Game Instance would be fine for the singleplayer in 100% but I guess it's better to it with this way.

dark parcel
#

The same selection should be stored on server game instance or any presistence object.

#

So it can be carried over to the next level and any data gets replicated to client if needed ( you don't in this case)

#

As client you request the server what choice you make.

Server check the request and set the choice if request valid.

Client On rep choice -> update widget.

When game is ready to move to the next level with server travel.

Server store all the data it needs from the lobby (e.g player choice).

Once all the players travelled to the next map.

Server read player choices it stored in persistent object and grant resources to players based on their choice.

#

You should make a custom player state for your lobby

#

As choice doesn't mean anything outside your "character screen"

subtle kernel
#
FString ServerAddressWithToken = FString::Printf(
    TEXT("127.0.0.1:20002?character=%s&token=%s"),
    *CharacterSheet,
    *SessionId
);

ClientTravel(ServerAddressWithToken, TRAVEL_Absolute, false);

guys, how do I properly pass parameters to server?

When I pass like that I have some strange things in InitNewPlayer Options parameter, it has something like:

?character=taiko&token=QUE1N0NERDJGQzUxNTZBQzRCMDg4QTRBMDRFQkI4QjJFOTQ2NDFEMQ==?Name=computername?SplitscreenCount=1 taiko&token=QUE1N0NERDJGQzUxNTZBQzRCMDg4QTRBMDRFQkI4QjJFOTQ2NDFEMQ== RDNERDU0MDI2OUZDMjQxNThCRkEzNjFEOTJFODA1MjYxMzI5QzJFMg==

why it's so ruined? ๐Ÿ™‚

lost inlet
#

well it should be a question mark each time

#

not &

subtle kernel
#

yea, but something makes it a mess. it's not me ๐Ÿ™‚

#

or what do you mean?

lost inlet
#
FString ServerAddressWithToken = FString::Printf(
    TEXT("127.0.0.1:20002?character=%s?token=%s"),
    *CharacterSheet,
    *SessionId
);
subtle kernel
#

oh, so it's not like http url thingy! okay ๐Ÿ™‚

lost inlet
#

also if you override something like ULocalPlayer::GetGameLoginOptions then they'll also get added

subtle kernel
#

not yet ๐Ÿ™‚

winter pollen
#

can someone help me understand what is going on with my projcetile in terms of replication? The damage is replicated correctly but the projectile itself is only visible on the shooting client

#

1st pic

#

2nd pic

#

3rd pic

#

4th pic

chrome bay
#

Well, you're supposed to spawn the actor server-side, not spawn it client side then ask the server to deal damage

upbeat basin
#

Oh wait, if it's spawned only on the client, how would server RPC work?

chrome bay
#

RPC belongs to the weapon it looks like

upbeat basin
#

Ah right, okay then it makes sense

chrome bay
#

But yea, the setup is backwards

upbeat basin
#

Also, not related with the problem or wouldn't result any different but ApplyDamage interface should already include all the parameters you're passing with your BPI, there shouldn't be need for it ๐Ÿค”

winter pollen
#

i think this setup is this way to prevent latency that would come with spawning it on server no?

#

wouldnt i need to just spawn a fake bullet to other clients

#

and have the actual bullet only visible to the shooting client

upbeat basin
#

I'm not so much experienced with this stuff but I feel like the local client should have the fake bullet while others have the replicated one (and maybe even correct your fake after the actual replicated one spawns in local player as well). And have your actual bullet on your server

#

At least the damage logic should be on the server, that I can say I guess Well that kind of depends actually

winter pollen
winter pollen
upbeat basin
#

Currently you're giving the authority of saying "Hey I hit something" entirely to the client, which can work but not safe regarding to cheats and consistency.

And preventing latency should be like faking to your local player by saying "Yes good boi, you pressed the input and now you're doing this" as soon as input comes and waiting for server approval to continue or revoke the action if needed I believe

winter pollen
upbeat basin
#

That's why you create a fake bullet to make it responsive, without waiting for anything and correct/destroy it whenever you get info back from server to make it consistent

winter pollen
#

yeah i guess that makes sense, would i need to rework that damage event or can i keep that?

chrome bay
#

You shouldn't have an RPC a client can call which just applies damage either way

#

Nothing stopping them calling that whenever they want

winter pollen
#

you mean i could make the projectile spawn on the server then just connect that to the existing damage event as now only the server could call it?

chrome bay
#

To keep things simple, for now yeah, do the damage server side

#

Projectile prediction is no joke to implement generally

winter pollen
#

the class itself would essentially be the same as before, which would call the damage event

loud stratus
#

I have a question about Delta Replication in regards to replicated structs: when changing the struct, if I use a local FMyStruct variable as a placeholder and fill it with the global replicated FMyStruct fields, then apply all requested changes to the local FMyStruct variable, then finally overwrite the global replicated FMyStruct variable with the local FMyStruct - this is where delta replication comes in to save my butt, correct? It shouldnโ€™t send the entire struct over the network since some of the fields may/likely will be the same?

#

And to piggy back off of that, letโ€™s say one of the fields is an array and some elements are added/removed. Does the entire array get replicated or only the delta between the original and new array?

normal viper
#

Do you guys know what is the exact command to type in the Open Level to use ServerTravel? I'm using Advanced Session Plugin so I can get ServerTravel node, but I read somewhere that because of that plugin I can use Options in the Open Level node, just cannot find exact command there, since I already have Level from Object Reference, is ServerTravel enough?

thin stratus
#

The Options String is usually appended to the URL anyway.

#

SomeMapName?Key1=Value1?Key2=Value2

#

The top node you have can just use an AppendString node to add the KeyValue pairs

#

The only other way to get a server travel going is by using ExecuteConsoleCommand, and there you'd also append the string together for the same

normal viper
#

The first ServerTravel node works, but I wish I could use OpenLevel (byObjectReference) and add to it ServerTravel.

thin stratus
#

E.g. ServerTravel SomeMapName?Key1=Value1?Key2=Value2

thin stratus
#

That's not possible fwiw

#

ServerTravel != OpenLevel

normal viper
#

even with the Avanced Session Plugin?

thin stratus
#

Don't know what that would have to do with it

#

Internally in C++ OpenLevel is != ServerTravel

#

You do either or

normal viper
#

Ok, I just read comment somewhere that said it's possible that is why I'm confused or I understand it wrong

thin stratus
#

Not to my knowledge

#

I would need to check for that

#

Can be that it is indeed possible, but I know the code paths are different

normal viper
#

If that could be possible it would be sso good

thin stratus
#

Why though

#

Because of the reference part?

normal viper
#

I'm creating buttons to ''Enter Level'' and I have Level Reference so It would be so much usefull connecting this than taking name of the level converting to string etc.

thin stratus
#

You can just code your own if that's what you want though

normal viper
#

so like 50 buttons, each would pass different Level Reference

#

hehe maybe not 50 but yeah

thin stratus
#

Doesn't seem like it's possible

#

OpenLevel call SetClientTravel

#

And that handles just a Client Traveling

#

You'd need to code your own node

#

Or you load the level and grab the name from it

normal viper
#

yeah I mean it's not big deal, just was confused and looking whole internet for it because this comment said it's possible haha

#

thanks for help โค๏ธ

thin stratus
#

idk what the soft ref of the level can all give you

#

But you might be lucky and it can offer you the path/name of the level asset

#

So you can just use that with the ServerTravel node

#

Then you don't need to change the StartGame node

normal viper
#

So I have Data Asset for each '"Level/Episode" as I call it. I have there Level Name and Level(Object Reference). I will just change to take Level_name instead of Level(Object Reference) so it's not big deal I guess.

thin stratus
#

Honestly. change it to the Asset

#

That makes it easier for you in the future to change it without changing the callsite

normal viper
#

so pass whole asset and take name from it inside GameMode for the opening of the level?

thin stratus
#

Yeah, then in the future if you want to you just have to change what StartGame does and take the reference of the level instead of the name if you want to change it

#

You might also want to pass options in the future, so might make sense to just handle "Level" as the DataAsset

normal viper
#

makes sense, thanks for feedback!

woeful wagon
#

@upbeat basin @sinful tree almost forgot but thanks for the help its still a little goofy but it could boil down to im not doing it in standalone mode nonetheless I appreciate the help!

grand kestrel
#

@thin stratus
Doing LaunchCharacter from a GA isn't de-syncing, I'm guessing that's because its fired from a predicted ability and the velocity itself is predicted by CMC, that probably suffices
So yeah I probably don't need to do anything custom there

#

I did notice though, it doesn't get applied while a root motion montage is active, even if its additive, the root motion overrides it
So for my own purpose I probably need to have a separate predicted velocity that is added onto root motion, for launches during root motion
Using a custom root motion source that mimics this would be the same, without reinventing the wheel

winter pollen
sinful tree
# winter pollen does this count as spawning the projectile on the server? trying to figure out h...

What this would be doing is allowing a client to spawn basically any actor at any time at any location_ and since you're multicasting it, it's spawning that actor individually on all clients that have this actor relevant at the time of the multicast (so they'd all have local copies of the actor), while also spawning it on the server. You want to limit what information you allow clients to tell the server. If you want to spawn something on the server, then spawn it when "Executing on Server" and if you want others to also see it, make sure it's a replicated actor.

I've never done local prediction of projectiles myself but understand what would be required, and it's somewhat complicated to get it to look right since you effectively would have a projectile that you spawned locally on the client that moves slower than what your projectile normally would and another projectile that you spawn on the server that is replicated out to everyone and moves at full speed, and you end up having to make them link up by using an ID that you create on the client and tell the server to use. When the replicated projectile comes to the client that originally spawned the predicted projectile, you'd have to have the replicated projectile be invisible for that client and since it moves faster, it would "catch up" to the predicted version, at which point you can make the replicated version visible and then destroy the client predicted vesion, and in the case that the server rejects the client shooting, have a means of destroying the client predicted actor (likely via a Client RPC) by sending that ID number back and the client finding the local projoectile and destroying it.

winter pollen
#

crying What.

exotic wasp
#

your client is telling the server to spawn an actor of the clients choosing. this means they can spawn literally anything

sinful tree
# winter pollen <:crying:1316599219188011038> What.

Here's basically what needs to happen:

You need to have two projectiles spawned, one locally on the client when they press the button and another on the server when they receive the RPC from the client requesting to shoot, after the server accepts that the client can shoot.
The client predicted shot needs to be moving slower than the server projectile.
You need some way of being able to link the client predicted projectile and the replicated projectile which is where the ID comes in.
If the server rejects the player shooting, it needs to tell the client to destroy their locally predicted projectile.
If the server allows the shot, then the server needs to spawn a replicated version of the projectile that will then exist on all clients.
The client that predicted the shot should not see the replicated version until it has "caught up" to the local predicted version (the replicated version will be moving faster than the predicted version) at which point the locally predicted version should be destroyed.
The logic of the replicated projectile would be handled by the server, so what it hits or where it continues to travel would all be based on how the server sees the world.

This also doesn't account for things like if the player is close to a wall or some other actor in which case there may not even be enough time to handle all of this in which case you'd need to handle the logic a bit differently.

There is an example of how to do predicted projectiles in Unreal Tournament's source code as well.

chrome bay
#

Anybody know why FPredictionKeyDelegates::BroadcastRejectedDelegate and BroadcastCaughtUpDelegate don't clear/Move the delegate list? They make copies, but surely once the events are broadcast they are no longer needed?

fluid prawn
#

Quick question if I run in the editor client mode with two clients I will create 3 world representations

#

I assume all these world exist on separate threads or no?

flint epoch
#

One question, on my LyraCharacterComponent, I have Safe_bWantsToSprint and this works with the CMC streucture.
But after setting up my GE_Sprint and GA_Sprint. Nothing happens. I know the input is working because of print nodes.
The only logical reason, is that Safe_bWantsToSprint is never true. Because the variable is not linked to the input (so set true when pressed, set false when released.

Before using Lyra, I used to just set the input in the character.
But now I want to work with GE so any idea how can I linked this behavior?

nova wasp
#

So they copy to avoid changing during iteration

dark parcel
#

Also tranek gas github implement sprint. You can look how it's done.

flint epoch
dark parcel
flint epoch
dark parcel
#

But anyway tranek implement a sprinting on his gas documentation.

#

Also multiplayer ready, it toggle the bits in FSavedMove, you should be able to get what you need.

subtle kernel
#

guys, what is the best way to never miss to log any dedicated server crash? ๐Ÿ™‚

nova wasp
#

use a crash reporter?

thin stratus
subtle kernel
# thin stratus "best" I wouldn't want to comment on, but you can try setting up "Sentry".

wise Cedric, can I ask you to point me in right direction? I already finished my prototype, but still can't solve issue with syncronizing of character rotation. I tried to control it by adding yawn on client and server, it works in editor, but in shipping package it's not synced at all and makes character simulated proxies rotate randomly.

I need to programatically rotate character, like for example when ability is used I need to face the opponent(SetActorRotation(LookAtTheOpponentVector) e.g.). CMC is ruining all fun here along with PlayerController.

What is the proper way to do it? How to rotate in sync? ๐Ÿ™‚

#

I now use a component like:

// Fill out your copyright notice in the Description page of Project Settings.


#include "Components/COR_ControllerRotationComponent.h"

#include "Kismet/KismetMathLibrary.h"

UCOR_ControllerRotationComponent::UCOR_ControllerRotationComponent()
{
    PrimaryComponentTick.bCanEverTick = true;
    SetIsReplicatedByDefault(true);
    bIsRotating = false;
}

void UCOR_ControllerRotationComponent::BeginPlay()
{
    Super::BeginPlay();
}

void UCOR_ControllerRotationComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    if (bIsRotating)
    {
        RotateToFaceCoordinate(DeltaTime);
    }
}

void UCOR_ControllerRotationComponent::StartRotatingToFaceCoordinateInternal(const FVector& InTargetLocation,
    bool bIsRecursiveCall)
{
    APlayerController* PlayerController = Cast<APlayerController>(GetOwner()); 
    APawn* ControlledPawn = PlayerController->GetPawn();
    ControlledPawn->bUseControllerRotationYaw = true;
    TargetLocation = InTargetLocation;
    bIsRotating = true;

    if(!bIsRecursiveCall)
    {
        if(!GetOwner()->HasAuthority())
        {
            StartRotatingToFaceCoordinate_Server(InTargetLocation);    
        }
        else
        {
            StartRotatingToFaceCoordinate_Client(InTargetLocation);
        }    
    }
}

void UCOR_ControllerRotationComponent::StartRotatingToFaceCoordinate(const FVector& InTargetLocation)
{
    StartRotatingToFaceCoordinateInternal(InTargetLocation, false);
}

void UCOR_ControllerRotationComponent::StartRotatingToFaceCoordinate_Client_Implementation(
    const FVector& InTargetLocation)
{
    StartRotatingToFaceCoordinateInternal(InTargetLocation, true);
}

void UCOR_ControllerRotationComponent::StartRotatingToFaceCoordinate_Server_Implementation(
    const FVector& InTargetLocation)
{
    StartRotatingToFaceCoordinateInternal(InTargetLocation, true);
}

void UCOR_ControllerRotationComponent::RotateToFaceCoordinate(float DeltaSeconds)
{
    APlayerController* PlayerController = Cast<APlayerController>(GetOwner()); 
    APawn* ControlledPawn = PlayerController->GetPawn();

    FVector MyLocation = ControlledPawn->GetActorLocation();
    FVector DirectionToTarget = (TargetLocation - MyLocation).GetSafeNormal();

    FRotator CurrentRotation = ControlledPawn->GetActorRotation();
    FRotator TargetRotation = DirectionToTarget.Rotation();
    float DesiredYaw = TargetRotation.Yaw;
    float CurrentYaw = CurrentRotation.Yaw;
    float YawDifference = DesiredYaw - CurrentYaw;

    YawDifference = FMath::Wrap(YawDifference, -180.0f, 180.0f);
    ControlledPawn->AddControllerYawInput(YawDifference * DeltaSeconds * 10);

    if (FMath::Abs(YawDifference) < 1.0f)
    {
        bIsRotating = false;
        ControlledPawn->bUseControllerRotationYaw = false;
    }
}
thin stratus
#

HOLY MOTHER OF WALL OF TEXT

#

Vertical screen doesn't help that message.

subtle kernel
#

well, it's just to keep it short. That's how it doesn't work right now xD

chrome bay
# nova wasp It might be if the array changes from a delegate

Yeah that part I understand, but what I don't get is why they don't actually move the current list out of the static map, since presumably once broadcast you don't need em anymore and they should clear. Prediction Key stuff went through a lot of changes in 5.5 so is quite interesting

thin stratus
#

The CMC is already sending the ControlRotation to the Server. @subtle kernel
There isn't really a need to go beyond that.

subtle kernel
#

When I rotate with player input it's all good and fine. But as soon as I try to do it programatically, nothing I tried works so far

thin stratus
#

Right, so you have to understand a bit how the CMC and prediction likes to work.
If it's a Character that is actively controlled by the Client and you have the Yaw of the Character use the Control Yaw (checkbox), then rotating the Character to face something might get overridden by the CMC. Or rather by the ControlRotation the player sends.

#

Which means if you rotate the Character, you also need to rotate the ControlRotation to the same direction.

#

At least in a naive first approach.

subtle kernel
#

How do you control the ControlRotation? Currently I do rotation like:

ControlledPawn->AddControllerYawInput(YawDifference * DeltaSeconds * 10);
thin stratus
#

You can just set it

#

If there is no setter on the APawn class, then there should be one on the AController class.

subtle kernel
#

So I don't need to manually replicate rotation, like I do it now? I just need to do it either on server or client changing yaw along with ControlRotation in sync?

thin stratus
#

GAS exposed them to GameplayAbilities, but you can use them without GAS too.

subtle kernel
#

I'm neck deep in GAS

thin stratus
#

Then you'd usually just use RootMotionSources in the GAS Ability.

#

There should be some that can also Rotate. If not you can make your own.

#

They are just structs that ultimately provide the CMC with a "fake" RootMotionTransform.

#

But those are usually for fixed movements.

#

If you need a dynamic, constant rotation to a target, then you might want to handle this differently.

subtle kernel
#

nah, I don't want dynamic

#
RootMotionParams.SetRotationalAcceleration(CurrentRotation - StartRotation);

gpt says something like that

thin stratus
#

GAS has nodes for it

#

You use them in your Predicted GAs

#

Check RootMotionSource.h

#

There is a huge comment in it explaining them

subtle kernel
#

okay

thin stratus
#

I don't think there is one that does just rotation

#

These are the default ones that exist

#

You can inherit from FRootMotionSource and make your own, following how they are done.

#

It's not really rocket science.

#

You can check the first one, the ConstantForce one for an example.

#

Most of the function are boilerplate code

#

::PrepareRootMotion is the one that ultimately does the heavy lifting

#

At the end it calls RootMotionParams.Set(NewTransform) where the existing ones almost all just pass a vector in, but you can do some rotation stuff

subtle kernel
#

okay, I will look into it. doesn't sound too complicated

#

Thank you so much

thin stratus
#

No worries

pale hazel
#

I tried it out and it works now, thank you very much for the help

chrome bay
#

Anyway to access the FProperty chain being serialized within an Iris net Serializer anybody know?

nova wasp
#

the member descriptor should be accessible from the offset

chrome bay
#

Basically I've got an item that's inside a fast array, and I want to change what the item serializes based on settings of the fast array container property

#

So I've declared a net serializer for the item type, but can't see anyway to get the outer fast array from inside it

#

either from within Serialize or Quantize etc.

little pumice
#

though it will not work if object was added to multiple arrays Pepechill

#

you may use wrapper struct for items Pepega

chrome bay
#

The other option sadly is duplicate information into all those items, which I don't wanna do. Upsets the alignment etc.

nova wasp
#

ugh the property descriptors can sometimes contain an fproperty

#

the owner is in the instance descriptors too

chrome bay
#

Hell I don't even know how to get them crying

#

Looking now at FGameplayAbilityTargetingLocationInfoNetSerializer which seems to do some shenanigans with descriptors but reading through this code is giving me PTSD

nocturne quail
#

setting something's visibility to hidden breaks/disable replications for the hidden object?

#

like if i am in ADS mode and want to hide the head without propagating to childrens for local controller, and the head is the root of the modular body

#

after doing this baseaimrotation and controllrotation stops working

chrome bay
#

Yep, if it's hidden and has no collision then by default the Server marks it not relevant for anybody

#

You can override IsNetRelevantFor to change it

nocturne quail
nocturne quail
#

not sure if it will effect optimizations but it works

chrome bay
#

That doesn't have any effect on relevancy

#

Just means you'll be running animations on the server and when it's not actually rendered

split siren
#

Does ChaosVehicle have good integration with replication? According to the docs, Modular Vehicles should have decent implementation, but I can't get that one up and running.

grand kestrel
#

@thin stratus I've noticed the client is receiving incorrect stamina value, i.e. not what the server sends
I've set breakpoint there without condition and its always 100.f
The breakpoint in that screenshot is never hit, so its sending the correct value
I'm making a merged branch for PredictedMovement (for sake of BP users primarily) so maybe I managed to miss/break something but I can't see what

twin vessel
grand kestrel
#

I assume that is what you're referring to

twin vessel
#

Yup

grand kestrel
#

If you notice anything else like that feel free to ping me here or create issue on git

#

I'm working on v2 now, its very close, I accidentally updated main a little early lol so its temporarily in a non-ideal state

#

But the main feature in v2 are modifiers

dark edge
#

If you were making something not QUITE RTS but close, with maybe a few dozen characters running around with no direct control, would you use CMC?

grand kestrel
#

That's kind of on the threshold of yes/no
Sounds unnecessary tho, in fact Mover might be able to handle those simpler characters very well

#

We used Mover for Critters because we needed lightweight pawns

#

Its not ready for player-controlled characters but it worked well for that

dark edge
#

What's the TL:DR on Mover nowadays? Not quite ready for prime time but worth messing with?

grand kestrel
#

We're about to release a game into EA with those critters and they're fine
Mind you at this point they mostly just sit there due to time constraints, but they do work
If you need root motion anim/sources then abort abort abort (ask Cedric how much work that takes)
But specifically because yours aren't going to be directly controlled, I suspect it is an option worth investigating for you

dark edge
#

Is it as much boilerplate and tightly coupled as CMC or more of a generic movement system?

white sand
#

Hey I'm wondering if people are using Iris in their projects, or if it's something to avoid

#

I'm looking to start a new multiplayer project in 5.5.2 and I heard it's better than the default system. But it's still marked as experimental as far as i know so I'm not sure if it's just not feature complete or if there are actual issues

grand kestrel
hot scroll
#

How does PlayerState.PlayerId UniqueID work?
Is it fine to rely on that and match up certain data stored longer term for that?

Like if a player disconnects and joins a server a week later, will it be their same PlayerId UniqueID?
Or should I assign my own UUIDs based on login instead?

I'm trying to find a better resource to learn about the PlayerState.PlayerIdUniqueID. I went back through cedric's multiplayer compendium (which I'm surprised didnt mention it)

fossil spoke
#

PlayerId is just an identifier for that Session.

#

UniqueID is a globally unique identifier for that Player on the running platform.

hot scroll
fossil spoke
#

If you are using Steam, it will be your SteamID for example.

hot scroll
#

Ahhh okay, that is excellent to hear

#

Thank you very much Matt

fossil spoke
#

No problem.

subtle kernel
#

guys, what do you use for logging in dedicated server shipping builds?

grand kestrel
#

Might need more context there
But... the log ๐Ÿ˜„ You just have to enable it in shipping
Also, Sentry

subtle kernel
subtle kernel
#

oh, okay, thanks

#

I'm all alone here, yea xD

#

btw, it shouldn't be possible to connect from shipping client to dev dedicated server?

grand kestrel
#

Why not? They are separate programs, so long as you don't gate the connection yourself

subtle kernel
#

oh, okay, that's nice

#

now I have a problem with shipping client won't show anything at all after loading screen ๐Ÿ™‚ I wonder how to debug it xD

silent valley
subtle kernel
#

is it this one?

#

seems like it will rebuild everything from scratch cryign

agile meadow
#

i have these three things, and these 3 server functions. for some reason the transform doesnt update in multiplayer, while the 2 bool properties do when im on clients.
anyone know why that might be?

upbeat basin
agile meadow
#

i did that for testing. the Replicated doesnt matter, as im not even doing a DOREPNOTIFY for them

upbeat basin
#

Isn't your question why your variables don't update on clients? It sounds like replication matter

agile meadow
#

it is, but both of the bools replicate

#

only the transform doesnt

#

right now the way my code works is that the client is doing some work, and is sending updates to the server

#

not back and forth

upbeat basin
#

So in the actual code they are all marked as replicated and have DOREPNOTIFY?

agile meadow
#

and then the server updates the world

agile meadow
upbeat basin
#

Okay and what do you expect to happen that doesn't afterwards?

agile meadow
#

im doing a builder system. so the client has a phantom object mesh, and has a soft class reference to an actual object. on the clients screen, they can move the mesh around. that works fine. the checks also happen on the client for if they can place or not (these are updated by the server in a different location). these all work

now, im trying to send the mesh's position to the server, so that the server can spawn an object into the world at that location

#

it is instead spawning at 0,0,0

#

so everything is working except this transform for some reason

#

and i tested this before trying to implement replication, and it does spawn in the proper position in that case

#

i could try to do the dorepnotify thing and do this more properly, but im too lazy right now and i thought this would work, especially considering part of it does work

#

and i think in theory it should work just fine

subtle kernel
#

Do you see that Transform variable in this server rpc when you debug? it's not 0,0,0?

upbeat basin
#

Is it possible your issue is with the spawn logic or the spawned actor maybe? Have you debugged your functions?

agile meadow
#

ive done much printing in various places. im not positive i read the logs correctly actually. its hard to see what the server is doing when so many logs go through. as far as i can tell the server never gets updated.
ill just try an RPC tomorrow

#

and yes that does say relative transform but it doesnt work either way. i forgot to change that from my testing

upbeat basin
#

Oh

#

Wait you aren't supposed to call the xxx_Implementation

agile meadow
#

FUCK

#

my brain

#

youre right

#

cause these ones i dont

#

omfg

subtle kernel
#

go get some sleep xD

agile meadow
#

Rider auto completed the implementation lol

#

and i didnt check that

subtle kernel
#

Rider is so bad at it, yea

upbeat basin
#

Yeah thats ue shit + rider, it does suggest _Implementations for autocomplete

agile meadow
#

implementation calls work on native functions too...bit inconsistent

upbeat basin
#

It might be possible that you call them as a regular function, so just running locally without nothing to do with RPC

agile meadow
#

possibly. changing that hasnt yet fixed it. i may need to do it tomorrow anyway. good catch though, thank you

graceful steeple
#

Hi all,
Iโ€™ve a dedicated server and a client game (UE5) and I want to change the tick rates on them.
For client:
I am able to go in project settings and under frame rate click to smooth or fixed and set it to a value under frame rate.
For server:
I tried updating script .ini files and add values such as t.MAXFPS or NetServerMaxTickRate and set it to a value

But then I launch the server with the -log parameter
I get one line which says:
bringing world up for play .. (max tick rate 30)
Even though I clearly set this up to be a different value

Any ideas what am doing wrong ?

snow knot
#

any tutorials on how to create an auction house

subtle kernel
snow knot
#

well i never done anything associated with multiplayer , i need some resources

subtle kernel
#

well, there're many resources regarding general multiplayer ๐Ÿ™‚

#

And 0 about making auction houses on UE ๐Ÿ™‚ i'm almost 100% certain

snow knot
#

im want to build an idle game where only multiplayer features would be a global chat and an auction house

subtle kernel
#

you can begin here probably:

lost inlet
#

you're probably not going to find a piecemeal tutorial on that, learn the concepts

subtle kernel
#

it's all down to RPCs and replication in your case

lost inlet
#

and that above link is a good place to start

snow knot
#

thnx

fierce grove
#

IF the client triggers an event and sends at that moment GetWorld()->GetGameState->GetWorldTimeInSeconds() and when the server receive the server compares the delta ...do I get the 1/2 RTT ?

upbeat basin
#

Your world and server world seconds are not the same. RTT should be calculated by sending a timestamp, waiting for response with the same timestamp (which should be the "R" in RTT) where you obtained it and calculating the delta from that timestamp again where you obtained it, as far as I know

fierce grove
#

well use a standard ping and divide by 2. There is no way for the server to know exactly how far back the client sent the instruction

dark parcel
#

Round trip time is just the time it takes for the client to send data to server and back

#

you can use RPC to send the data

#

As client -> Send Server RPC (Client Time Stamp)

#

Server send data back to client

fierce grove
#

I know that , but when firing an ability such as a projectile I can't have fun by passing multiple timestamp back & forth

dark parcel
chrome bay
#

The ServerWorldTimeSeconds feature in AGameState is very rough

#

Not really meant for accurate prediction etc.

dark parcel
#

if you need sync clock, then just implement network clock

#

or get the one in player state, I heard it's good enough

#

just up the update value

upbeat basin
#

ServerTime wasn't even in the consideration there, it was client world time comparison with server world time

chrome bay
#

Yeah, they are unrelated

#

But the ServerWorldTimeSeconds in AGameState gives you a very, very rough approximation of the current server world time

#

Good enough for some things

fierce grove
#

ServerDeltaTime = GetWorld()->GetGameState()->GetServerWorldTimeSeconds() - ExecutionTime;

#

that's what I'm doing

#

when writing the question I just use the standard time

upbeat basin
#

Oh I thought it was different worlds' time comparison since it was GetWorld()->GetGameState->GetWorldTimeInSeconds() there

fierce grove
#

So the GetPingInMilliseconds from playerstate is better

chrome bay
#

Not neccesarily

#

Depends what you're doing

fierce grove
#

I just want to spawn a projectile server side that catches up to the client position

chrome bay
#

Take the ping from the player state and halve it, that's your starting delta time

#

Although why server would fast-forward I'm not sure

upbeat basin
fierce grove
#

that was my question, because I'm having a hard time figuring my print ๐Ÿ˜‰

chrome bay
lost inlet
#

they really jacked up the default update frequency in AGameState

chrome bay
#

Yeah, its a bit insane

#

very spammy

lost inlet
#

it used to be pretty bad for clock drift

#

so they compensated that way

chrome bay
#

I just ping-pong RPCs back and forth via player controller, that works good enough for me

#

(unreliable and infrequently)

#

pretty sure I nicked it from UT actually

upbeat basin
#

UT uses that method but the engine doesn't have it? ๐Ÿค”

chrome bay
#

Well UT is pretty specialized twitchy shooter I guess, and targeted very high tick rate servers (like 120hz IIRC)

#

They also really didn't care about making the game "modular" or abstract, they specifically had the goal of making UT - so separation of concerns etc wasn't really a big deal

#

hence weapons and characters being extremely tightly coupled

#

worked well though.. must be nice to have highly specific goals lurkin

fierce grove
#

https://forums.unrealengine.com/t/severe-lag-ping-in-an-empty-ue5-project-in-local-standalone-any-net-mode/1787863 might experience this based on my measurement.. ping says 300 but serverdeltatime says "300" also...

Epic Developer Community Forums

Steps: create a new project from FPS template. print ping from player state in character BP. launch as Standalone with 2 players in Client net mode (with a dedicated server) this happens with a listen server too. basically any mode which makes the server run outside of the editor. ping will be 120-200ms with noticable lag. Other notes: turn...

karmic venture
#

any reason why repnotify replicates after aprox. 10 sec?

upbeat basin
#

Could be a whole lot of stuff

#

First thing that comes to my mind is, assuming you're in editor without any network emulation and 10 secs is exaggration, if that's a variable in PlayerState, it has a low net update frequency

#

Well, actually checking the PlayerState, it does seem like it's similar to Character now

#

Is this changed at any time? I feel like I remember I was dealing with why clients were receiving updates on player state a bit late and default frequency was way too low

#

I was comparing MinNetUpdateFrequency, Character is still 100x more frequent than PlayerState

#

Anyways, to come back to the question, it could be a whole lot of things like from having high ping to forgetting a timer to set the replicated variable or something, so it might need some debugging or more context to answer it

karmic venture
#

its gamestate, net update is frequency is 10. i tried to add force net update, no changes

upbeat basin
#

Well I don't have any specific idea about that sorry

#

Not sure if makes a difference but seems like a lot of replicated variables though

#

Is it just these variables that replicate late or any other side effects you can see during quest changes?

karmic venture
#

these are only that need and are replicated in GS

#

custom ones ofc

#

no, they only are set and replicated on quest start and end

#

and client side just triggers event dispatchers for UI elements and level blueprint to load proper dungeon

upbeat basin
#

I want to ask if it's possible that your quest struct is too big but I don't think that alone could result that much delay

karmic venture
#

it never had any problems, also it started recently, i'm checking 1 thing that I changed recently and see if it hels

#

yes, i got the culprit... network saturation for sure but now I need to adjust it somehow

#

dungeon was generating (asside of meshes) actor that's interactable and replicated. That caused saturation, I need to rework the actor or spawn logic

dusky junco
#

Hey folks!
We are experiencing some roadblocks with getting two clients to interact with a shared entity and doing the prediction etc required for that.
Imagine having two players steering the same vehicle, one controlling the wheel and the other taking care of throttle.

Looking to chat, and maybe pay a bit for some consultancy ๐Ÿ™‚

sturdy sand
#

Ok I've been stuck at this problem for a week. Since this only happens when I test in multiplayer, I'll ask here. For some reason the object nullifies inside a struct that I assign to an array. I first create a new object, add it to the replication list, also ensure that's it's supported for replication and then assign it to the struct before adding that struct to an array (multiple times on different indexes). All this happens in a server RPC. After I do all that, when I debug it, it shows that the object still exists in the structs, but when I check in the editor they are not there. Why is this happening? Here's the code: https://paste.ofcode.org/AuFGCg3TtCrgmTmgPazpe5
Also an error that I get when it calls that is in the log file.

#

Might know why actually

lost inlet
#

the ensure message is practically telling you what to do

sturdy sand
#

yep

lost inlet
#

also it's a great help to have engine symbols installed for debugging

sturdy sand
#

I looked at the error message many times but I didn't really know what that meant

lost inlet
#

no, it's just debug symbols

#

you install them from the epic launcher as an option

#

and if you launch via the IDE (with a debugger) it'll actually allow you to interact with the callstack

#

which will help see the issue better

sturdy sand
#

interesting. I'll see

#

Also that was the issue

#

I just had to enable it and that's all

#

Crazy how I spent almost a week trying to debug this

#

and it's just a boolean I forgot to enable

lost inlet
#

well if you do those things, the next time shouldn't be a week

sturdy sand
#

hopefully

#

I usually don't look at the output log errors that often since I always thought that they don't tell anything useful but it seems I was wrong

#

is it this?

#

oh yeah right

#

srry

normal viper
#

Sorry for interrupting. Is there any way (if yes I'll look myself) to test Multiplayer for 2 people but using Standalone Mode?
How do people test Level Travel (from ''Session/Lobby'' Level to the Target Level if so far I cannot join the session when I use Standalone mode. The thing I want to test is passing the data that I saved on Player State, and ''passing'' it to the ''new'' Player State (CopyProperties) works only when tested in Standalone Mode.

dark edge
upbeat basin
teal frost
#

Hmm. Just out of passerby curiosity... do you think it would be possible to do what he wants or similar, at least on a small scale, utilizing beacons?

subtle kernel
#

guys, I'm seeing strange, I run my client like:
CubesOfRealityProtoClient.exe 127.0.0.1:20001 -log

Here's shipping package logs:

[2025.01.29-16.10.34:457][  0]LogInit: Display: Game Engine Initialized.
[2025.01.29-16.10.34:459][  0]LogInit: Display: Starting Game.
[2025.01.29-16.10.34:459][  0]LogGlobalStatus: UEngine::Browse Started Browse: "/Game/TopDown/Maps/Login?Name=Player"
[2025.01.29-16.10.34:459][  0]LogNet: Browse: /Game/TopDown/Maps/Login?Name=Player

Here's dev package logs:

[2025.01.29-16.07.46:614][  0]LogInit: Display: Game Engine Initialized.
[2025.01.29-16.07.46:616][  0]LogInit: Display: Starting Game.
[2025.01.29-16.07.46:616][  0]LogGlobalStatus: UEngine::Browse Started Browse: "127.0.0.1:20001/Game/TopDown/Maps/Login?Name=Player"
[2025.01.29-16.07.46:616][  0]LogNet: Browse: 127.0.0.1:20001/Game/TopDown/Maps/Login?Name=Player

It seems that shipping trying to open local map for some reason, when dev travels to server.

Why it happen that way? What can be fixed?

hollow raven
#

I want to make a game whith procedurally generated maps. I want to make it like a 3d cube grid. The parts are almost always the same size, some are bigger, but it always aligns with the grid. Now I want to know:
What is the smartest and most multiplayer-viable method to do this?

subtle kernel
hollow raven
#

Or is there a special class for this?

dark edge
#

but what I'm saying is you don't replicate the actors, you replicate the seed that placed them there

#

When you play Minecraft, the server isn't sending you all the blocks, that's way too much data

#

you just have the same seed, and the server sends you the diff vs the generated level from that seed. On a fresh level, the server has to send you pretty much nothing

hollow raven
dark edge
#

it has nothing to do with it

#

your options are:
Server runs the procgen, replicates the results
or
Server and clients run the procgen, getting the same result

#

for something with as much data as you're talking about, you want the first approach

hollow raven
#

As far as I know

dark edge
#

how the hell would that work

hollow raven
dark edge
hollow raven
#

They are already rooms

dark edge
#

you can maybe have baked lighting within each room but that has nothing to do with what we're talking about anyway

#

how many cubes are you talking about?

hollow raven
dark edge
#

I load in, how many rooms are there

#

10, 100, 1000000?

hollow raven
#

I will use seeds

#

I just wasn't sure about how to handle rooms.

#

I thought doing them as normal actors could be bad for Performance

#

Considering there are also actors within these rooms

dark edge
#

how many rooms?

hollow raven
#

That trigger certain events

hollow raven
#

Like 15ร—7ร—5

#

5 in height

#

So less than 525 rooms, because some rooms can be as big as 25

#

Then one room has the scale 5x5x5

#

For the beta, I will go down to 7x3x3

dark edge
#

Have you successfully spawned a room at runtime yet?

dark edge
#

What is a room then, an actor BP with childactorcomponents?

dark edge
#

or is it a level instance

hollow raven
#

They are actor BPs

cloud lake
#

random sanity check q, maybe someone can answer.
player has a 'sheath', basically just an overlap component.
in multiplayer, the player makes a server RPC call which directly calls AttachActorToComponent.

the pickup actor is replicated, the sheath is replicated.

does the attachment automatically replicate, or do you need to multicast from the server RPC? i feel like i have only gotten this to work multicasting, but my understanding is attachment is replicated by the server automatically provided the actors involved are replicated.

lavish mortar
#

Hey guys I have an actor that is replicated, I am trying to use RPC run on server and run on owner only however these aren't firing, I've set each ones owner to the player controller however still not working, anyone know the right way of doing this?

tacit furnace
#

Hello, how can I use level streaming in multiplayer so that load and unload events only affect the event owner?

grand kestrel
twin vessel
grand kestrel
#

@twin vessel sorry I just realized -- we're not checking stamina in CanCombineWith
We're only checking bStaminaDrained

#

@twin vessel sanity check this for me

twin vessel
# grand kestrel <@700826458582679553> sanity check this for me

I would skip the check for stamina value difference in CanDelaySendingMove and PostUpdate for the reason explained before. Other then that seems right.

Probably (but i am not sure) putting the check also in CanDelaySendingMove is redundant since you are forcing no combine in PostUpdate

grand kestrel
#

Engine puts them in both
But yeah

#

Where do you actually utilize EndStamina then

twin vessel
#

It is the value you send to server in network move

grand kestrel
#

Could you show me your implementation?

twin vessel
#

Look at XMUFoundationMovement

#

My reasoning is that since ServerCheckClientError is run at the end of the server's move, we need to check the current stamina value with the stamina value at the end of client's move

grand kestrel
#

I do notice you don't have Start/Saved stamina drained state, was that not a consideration , or a reason for that?

#

I do think that should delay sending moves and disable combining

#

Hmm yeah I have borked something here
@twin vessel have you tested using p.netshowcorrections 1
I'm getting intermittent corrections at similar intervals so I've set something up wrong

twin vessel
grand kestrel
#

I'll test further then

#

Just gonna stash and figure out where I borked it ๐Ÿ˜„

twin vessel
wet crypt
#

Hello, how can I use level streaming in multiplayer so that load and unload events only affect the event owner?

somber juniper
#

Noob here,I'm trying to replicate my dialogue tree.But it isnt work properly.

somber juniper
#

Widget displays but the task dont works

sinful tree
#

It might display, but any of the RPCs and replicated properties you're using are not replicated.

somber juniper
#

So how to fix that

sinful tree
#

Anything that happens in a behavior tree also do not replicate, they usually only happen on the server where the AI Controller associated to the behavior tree resides.

Widgets are local only meaning they can only be used to display data that the client has already. That means you need to use some other replicated actor or component that the client has relevant at the time to handle what information needs to be sent or received from the client.

#

Like you might want a "Dialog Component" that is attached to say your PlayerController.... This component you can then use to send RPCs through, and have specific dialog windows pop up with whatever information you want for that paritcular player. If the player needs to send some kind of choice to the server, then you'd put the RPC in there as well.

somber juniper
#

Thanks for the response.I'll check and give an update @sinful tree

tired current
#

Can anyone tell me why unreal makes u write _implementation at the end of RPCโ€™s definitions in cpp

nova wasp
#

because you don't call the _Implementation to make the RPC replicate

#

you call the ufunction which is defined in the generated header which actually queues up the RPC

#

so they are two distinct functions

#

you can call _Implementation and Onreps etc directly if you need to or even override them from parents if they are virtual

tired current
#

Interesting thank you for the explanation

nova wasp
#

notably this is similar in BlueprintNativeEvents

#

where the regular non-implementation function is optionally sending the call to the blueprint if one overrides the function

little pumice
# tired current Interesting thank you for the explanation

you can call _Implementation and On_Reps etc directly if you need to
it's an edge case though.

There is extra step in calling RPC or BlueprintNativeEvents due to straight forward nature of C++ language:

  • When you call a function, it literally executes it's body, while
  • For RPC you want that code to be executed on a different machine.
  • The idea ofBlueprintNativeEvents is to give Blueprints a chance to handle(consume) call instead of C++.

So in both cases you can't just call original function, an indirection is required.

nova wasp
#

but you CAN and there are many cases where you need to call an onrep directly on the server to do work intended for responding to changing data... It's rarely needed unless something is a bit spaghetti but I'm trying to convey that they are not magic

#

it's definitely not the common case I guess

little pumice
dark edge
nova wasp
#

Afaik it's in the generated header

#

You can follow the actual calls in a debugger

dark parcel
#

any tips on using motion warping in multiplayer settings?

#

I let client calculate the final position and have server use that data for the warp location.

#

it's still correcting however

#

might be because there is a collision and what the server sees not the same? but then how do I go around this

fair oyster
dark parcel
#

Unreal

#

I am at the edge of turning off correction during the attacks....

fair oyster
#

sever-side?

dark parcel
#

Would really appreciate 2 cents here ๐Ÿ˜ญ

dark parcel
#

idc much about cheating for this game

fair oyster
#

did you disable server correction?

#

bIgnoreClientMovement.... = true

#

and what is value of "NetUpdateFrequency"?

#

default is 30

dark parcel
#

enabled after the ability end

#

NetUpdateFrequency is 100 for character

fair oyster
#

I think there are some unnecessary interpolations.

mild creek
#

Hey, I'm just trying to replicate an INT. What am I missing here? I just want the INT to change on both systems when one player clicks.

dark parcel
#

@mild creek you already set it for one of the character

#

Append string and print object and you will know what im talking about

#

you have 2 characters in the world

#

As client you RPC from character_1 , server set the int to 2 then it replicate back to the client's character_1

#

so now server's character_1 and client's character_1 int is 2

#

where character_2 remain 0 since you never trigger the RPC on character_2

mild creek
#

ahh okay, thank you very much!

wild ivy
#

hi there am kinda stuck. am using a cable component and i want to replicate it but i can seem to get it to work right

dark parcel
#

So to translate that print string

Server: Character_1 int is 2
Client: Character_1 int is 2
Server: Character_0 int is 0
CLient: Character_0 int is 0

normal viper
#

Okay I think I don't understand something. I'm spawning actors after actors which is probably the problem it self (one actor gets spawned, then the one that spawned spawns again other 2, but i don't think it matters).

Player Controller spawns Faction Manager (as Owner I plug Self so as Player Controller)
Faction Manager spawns Hero (as Owner I first Get Owner (of Faction Manager) then I cast to Player Controller, and I past that Player Controller as Owner of Hero.

Inside Hero I again need Player Controller reference, so I take Get Owner of the Hero, cast to Player Controller, but it turns out it's a AIC_Unit ?

Yes, Hero set to AI Controller Class, but I don't get (like I read so many articles I never saw that AI Controller can steal my ownership?)

Now I'm kinda confused what the I need because i cannot test if my logic will work.
Basically the context is i'm trying to let the Hero reveal fog of map for THE ''client''/''player controller'' (i'm lost in naming these things because) that owns it. and yes I use AI mostly to move units so far? but i'm going to scrap this logic and put it inside units blueprint.

#

and from Faction Manager as I spawn hero, sorry for mishmash but I'm trying things before i clean them up nicely

normal viper
#

yes, it's child of BP_Unit and these are pawns that can be moved by player (top down rts like controlls)

upbeat basin
#

Can you check the Auto posses AI of the caravan BP

#

If you don't possess a pawn and auto possession settings are set, they can get automatically possessed by a player or AI controller, which eventually changes to owner as well

normal viper
upbeat basin
#

Yup, you might want to disable it

#

Or set to placed in world in case you want any pawn in scene to become an AI

#

Or just possess the caravan with your controller after spawn and let the settings be as it is

normal viper
#

I manually put Player Controller variable on spawn from the Faction Manager(for now) and I can use it inside caravan so for now it's fine, just was confused that Get Owner suddenly changes when there is AI Controller involved. I have some logic on AIC_Unit for moving but I'll check if I can disable itetc.

upbeat basin
#

It's not an AI specific behavior. Possess function calls Pawn->SetOwner(this)

#

I don't know where Spawn exposed variables are set but probably order is like Spawn -> Set exposed variables -> Check for auto possession -> Possess -> SetOwner so your parameter is overridden

#

What does bAllowJoinViaPresence in FOnlineSessionSettings actually means? Presences for me is status kind of a thing like "listening to spotify" in discord or "playing x for y minutes" in steam, is it something different for online subsystem context? What else can it use and what difference is there to use it or not?

For example, I'm testing with null subsystem and if I don't set it to true, I can't find the session from another player. Why is this required and are there any other stuff that could be used to make the session discoverable?

vapid gazelle
#

Is it possible to have a client join a running listen-server session in the UE editor at a later time, not when I start playing the level in PIE? I would love to be able to test scenarios where another player joins the game later into the session. Is that easily achievable?

normal viper
#

yes, but I think you would need to open the windowd for it before, just not join him straight away

#

and usually people make lobbys like levels where you can click to host session and then join session

#

you should be able to join match that is already ''live'' when players already went trough lobby to the match level

prisma merlin
#

How do I stop the server from replicating rotation to clients?

#

When I call "Set Actor Rotation", just on the server side, this is arbitrarily replicated to all players clientes

#

This did not happen in Unreal Engine version 4.27.2, this was put into the code in version 5.

#

These events are also replicating even though I'm calling them outside of an RPC

loud umbra
#

Hey there!
I just want to drop something out of my inventory, so basically replicating "Spawn Actor". As you can see I juse RPCs as usual, but it doesnt work? Am I being dump?

dark edge
# mild creek

Playercontrollers are only on server and owning players machines

#

so if you have 1 client and 1 listen server, both playercontrollers exist on listen server but only clients exists on their machine

normal viper
#

Anyone has idea what setting Auto Poses AI does extra that my logic that w as working just stops? and i have no idea how it's even related. When I set it to Disable, players spawn, they got their units, they only see their own ''fog of war'' and when I set this to Posses suddenly 1 player doesn't see anything. The thing is if I don't possess I cannot move with AI MoveTo? Can I use something else?

loud umbra
normal viper
thin stratus
#

Is there an easy way to find the nasty RPC that something calls on tick and is marked as reliable?

#

I found one, but I wouldn't be surprised if there are more (client's project)

quasi tide
#

I feel like I saw somewhere that would show you all objects that are ticking. Like a cmdlet thing you would run. As for detecting the RPC - idk

#

dump ticks

thin stratus
#

It might be enough to breakpoint where a reliable rpc is progressed

#

Ticking Actors might not give me much

#

Thing could run on a timer

quasi tide
#

Only other thing that I can think of is profiling and seeing which area is filling up fast.

#

ยฏ_(ใƒ„)_/ยฏ

thin stratus
#

NetDriver.cpp:2671 (UE5.4) has a Bunch.bReliable = 1; line I can breakpoint

loud umbra
#

Hey there!
are there any tutorials or courses that cover replication for dedicated servers and NOT listen servers.

quasi tide
#

It will be the same

subtle kernel
#

guys, I tried to implement my own FRootMotionSource_ConstantRotation for synced rotation in multiplayer, it works okay when call it on client, but when I call it on server it gives me:

checkf(false, TEXT("Serializing RootMotionSource without NetSerializeNative - not supported!"));

not sure what it is. there's no such method as NetSerializeNative in FRootMotionSource

quasi tide
#

Only thing to keep in mind is visual stuff doesn't happen on dedicated servers

loud umbra
#

Thats weird, because I made some multiplayer abilities that are working on listen server, but not on dedicated server (when i click on play as clients)

dark parcel
#

You have to elaborate more than that

#

And that sounds like the issue is not about dedicated server

#

More like clients can't get the ability to work

#

So playing with 2 players as listen server mode ( 1 server and 1 client ) as client might produce the same result.

subtle kernel
# thin stratus In theory, yes. For something like your Ability I would probably look into RootM...

Hey, Cedric, I tried to implement custom root motion source and it seems to be working okay. But it's not getting replicated at all :/ I'm using it like:

TSharedPtr<FCOR_RootMotionSource_ConstantRotation> RotationSource = MakeShared<
            FCOR_RootMotionSource_ConstantRotation>();

        RotationSource->InstanceName = FName("RotateToFaceCoordinate");
        RotationSource->AccumulateMode = ERootMotionAccumulateMode::Override;
        RotationSource->Priority = 900;
        RotationSource->TargetDirection = DirectionToTarget;
        RotationSource->RotationSpeed = RotationSpeed;
        RotationSource->Duration = RotationDuration;
        RotationSource->SpeedOverTime = SpeedOverTimeCurve;

        CharacterMovement->ApplyRootMotionSource(RotationSource);

So I either run in on server or client and I think it should be replicated automatically from both sides, right? :/

subtle kernel
pine sage
#

And there was something associated with the accumulate mode ...
All in all, it was a bit of a mess like "What if we didn't care about rotation?"

#

Plus, make sure your structure has ALL the correct override for serialization, and check the one used by default in the engine. Some are missing for rotation IIRC

#

(FUN)

thin stratus
#

Well Server can add it alone ,but then you get a correction i assume

tacit furnace
#

Hello, how can I use level streaming in multiplayer so that load and unload events only affect the event owner?

pine sage
#

Corrections are very minimal, almost inexistent with an acceptable ping.

mellow kindle
#

quick sanity check question: is it normal that calling ClientTravel after joining a server for the first time causes unreal to first load the default map before loading the map that the server is actually hosting?
everything is otherwise working fine ๐Ÿ˜…

normal viper
normal viper
#

Are Structs not properly replicated? Do I have to mark somewhere in C++ to be replicatable? im trying to figure out why my system is not updating the health bars for clients meanwhile for server it works. If it's not only because of structs I can post more data so many someone can help.

fossil spoke
#

@normal viper The only reason a Struct wont replicate its values, is if they are not marked as UPROPs.

#

Or, the Actor itself is not Replicated.

normal viper
#

Hmm,

  1. I have component on unit with Health Bar
  2. Icreate Health Widget inside Damageable Component, then I take it and assign in the unit (i tried delay to see if maybe here is fault, but that is not the case).
  3. In Damageable I initialize widget, for testing purposes I put ne Health and Max Health and they replicate.
  4. Inside W_Health I bind to Damageable On Health Update event ..

with the numbers everything works because I can see printing good amounts after I take all actors and damage them by server in the player controller, just widgets are not updating on the client, theyare always 100/100 (default value od Widget).
I even was about to do something on repNotify but im not sure if that is the problem.

fossil spoke
#

Is the Component set to Replicate as well?

normal viper
#

Client: 100/100
Server 156/234

Damage: (these are numbers actually from Damageable Struct as I didnt change it in the Take Damage function

#

and also replicated as it's added on the unit

#

maybe when I'm initializing component and i take Data Asset it's not replicated?

dark parcel
#

That's kinda a flaw imo

normal viper
#

Hmm, so 1 more thing maybe it will help. I removed W_health from the Widget Component that is on Unit. but i'm setting it here, and so it actually still works but only for the server. So I guess the problem is with how I initialize it?

#

this is the start of this ''flow''

dark parcel
#

What is w health? Widget health?

#

You are trying to replicate a widget? Well you cant

normal viper
dark parcel
#

I would rework a lot of this tbh. Decouple your widget and your attribute

normal viper
#

which one? i think you are misunderstanding, there is Widget Component put on unit, and then there is another WHealth that was created on AC DAmageable

#

widget doesn't hold health variables

#

just receives them with bind from the damageable component

dark parcel
#

Why is WHealth replicated?

#

Your health shouldn't be a widget component

normal viper
#

i guess i have to change the flow and just create widget on units from player component on each client ?

dark parcel
#

Make an actor component that hold your attribute at the very least if you don't want to use GAS

dark parcel
#

And your widget in turn just read those variable

vapid gazelle
#

Do I correctly understand that calling a multicast function on the client actually runs the function locally? And that generally you want to gate it to the server unless you really want that multicast call to run on the client?

dark parcel
#

And fyi structs is deffinitly replicated, I used it all the time

dark parcel
#

Mc only meaningful if called by server

#

Server will then tell the client to run the functions on everyone's copy of the actor

normal viper
dark parcel
#

OnRep Hp -> broadcast ValueChanged

#

Widget on construct get my character attribute component-> bind value changed

normal viper
#

so in case of 30 units I have to basically create these widgets not on them, but maybe on them but trough the client for the client? ๐Ÿ˜„

dark parcel
#

Why do you even think about networking when it comes to widget

normal viper
dark parcel
#

The widget only read the internal variable

#

It gets updated when it gets updated

#

Take for example an hp bar

#

It just read the character hp

normal viper
#

i dont know because it feels weird when i have unit on the ground and in my mind it should have 1 health over himself and everyone just read it, meanwhile it turns out i have to create 4 widgets for him for 4 players so each of them has own health bar of this unit

dark parcel
#

RTS game?

normal viper
#

yes

normal viper
dark parcel
#

Multiplayer is about communication

normal viper
#

there was confusion maybe with wrong numbers on bar and on printing, it's jsut that 2nd player doesn't see this widget of the unit

verbal ice
#

@chrome bay Hey! I read back up on HLL's projectile implementation, using the manager to "simulate" them just as data. I have a question, since clients are a little behind, how do you handle long-distance projectiles with travel time & bullet drop? If a player is walking perpendicular from you, wouldn't you never hit it because you're seeing in the past?
Or do clients also tell the server when a "long distance" projectile hit a player?

dark parcel
#

Begin play -> get health widget component -> get my attribute component-> bind value changed

#

Widget on construct -> get owner -> set text to owner hp

#

So you get the initial hp variable to display on your widget and update whenever your value changed is called

#

Ofc doing it on begin play mean there is an instance where variable may not be replicated yet

#

So you can see 0 for a few frame for example

#

But you can work it out from there

normal viper
#

get my attribute component is what in this context?

dark parcel
#

Your hit point or what ever variable you want the widget to represent

normal viper
#

also just taking widget component that is added as component, it does nothing to it

dark parcel
#

Not sure what you mean

normal viper
#

like this component itself doesnt have any variables yet

#

or i cannot bind to it, i first have to create widget somewhere and then set it as it? ithhink at least its like that

dark parcel
#

Is that not widget component?

#

You can add a widget to widget component

#

An instance will be created

#

Look into the detail tab

#

Gtg for now

normal viper
#

you can only put class, is this it..?

dark parcel
#

How does the damage take place? How does it happend?

#

Going b to work now but I can write sample code to demonstrate showing hp and taking damage after work

normal viper
#

I have problem with showing up widget to the 2nd client, not really with taking damage (it works more or less) ๐Ÿ˜„ , and this is usually called by interface first on BP_Unit which then calls to component on himself

#

so i modified the starting thing a bit, and now its shows actually proper starting values on server and client,

#

rn it just doesn't update the client

#

and widget itself:

dark parcel
#

So what do you think happend with call on health update? Do you think the client magically knows?

#

That delegate will only be called on the machine that execute it. In this case the server.

#

I can show you an example code later but the solution was given above if you want to try it your self.

#

Basically take damage should just deal damage

#

Don't call widget to do anything. You can broadcast but bear in mind that's only get called on the machine that execute it.

#

Take damage (server) -> set hp = hp - damage

#

OnRep_hp -> call value change

#

Make sense? On rep gets called on client ( and server if using blueprint )

So since you are using bp, move the on call value changed on the OnRep function.

On rep is literary a function that fire when the variable updates ( e.g when server update the client value )

#

OnRep damageable data -> call value changed

. Get rid of the call value changed inside the execute on server block

vapid gazelle
#

Ok so I found a response from @thin stratus from a while back about how to manually create and join sessions, and it works ok with a packaged build, but I'm still hoping there's a way to do this from the editor itself. Any clever creative solutions y'all might have tried in the past?

https://forums.unrealengine.com/t/how-do-i-launch-a-server/310995/2

The point of this exercise it to test clients joining later in the game

thin stratus
vapid gazelle
thin stratus
#

Yeah it should create a button at the top next to the normal play buttons once you started playing iirc

bright summit
#

for now only way to do it was "open mapname?listen" and then on client "open 127.0.0.1" ๐Ÿ™ƒ

thin stratus
#

Yus, I also only learned about it from a Client's Project

split siren
#

What is the recommended way to create a simple plane with client-side prediction? I think FN had those like 7 years ago.

I tried

  • Vanilla Chaos Vehicle Replication
  • Chaos Vehicle Replication with Physics Prediction (experimental)
  • Chaos Modular Vehicle (experimental)
    I have not tried this but is a backup
  • Code flying physics in a cmc and pretend the plane is a sphere shaped capsule

All the chaos replication really didn't perform well in my testing.

tardy fossil
#

Modular vehicles is the best IMO but it still has lots of bugs

#

Like bad jittering

#

Also if you hit something too fast you will crash lol

#

Like the whole game.. not crash the vehicle lol

#

Although once they fix the jitter and crashes it will be superior to the old vehicle movement system

split siren
#

I will try again the modular vehicles, thanks for the direction.

tardy fossil
#

physics prediction and async physics needs to be on for it to work

#

even offline mode it needs physics prediction enabled for some reason

nova wasp
#

probably uses callbacks for both cases

tardy fossil
#

yea i assumed it has something to do with that

nova wasp
#

kind of seems silly as there's surely no real reason it can't be active in direct variable tickrate physics but I guess most of the reason for the existence of that plugin is predicted physics

normal viper
# dark parcel OnRep damageable data -> call value changed . Get rid of the call value changed...
  1. I deleted the call from inside Server Take Damage.
  2. I moved the call logic to the Rep Notify
  3. Right now it updates only for the client and not for the server.

Is this because that what you said, this broad cast call is only called on machine that execute it? so that is why it's on client 1?
So either I have to bind or just inside widget create custom event Update Health and pass these variables from rep notify?

split siren
dark parcel
tardy fossil
split siren
normal viper
# dark parcel OnRep is called on server too in Blueprint

so in BP_Unit when I call on Begin Play to update it updates for everyone.. then when (probably here is mistake) I take all actors of class and damage them f rom Player Controller (i call TakeDamage Server on the component) it only updates for the clients at the moment, and not for the server.

I also changed to call just event and not binded call. What I'm missing out?

dark parcel
#

@normal viper got friends atm but maybe we can go on a 5 min call later. As far as I can see your begin play seems fine to me

normal viper
#

What I'm doing wrong that it doesn't update for server now... hmm the worst part it's just guessing game until it clicks you know... like i wish I knew what I was doing haha xd

dark parcel
#

The on rep looks fine too

dark parcel
#

Just remember that changing a value on client will only change for it self

normal viper
#

In one tutorial I saw someone just Bind from inside Widget

#

to the value from the component/actor

dark parcel
#

Yeah that sounds fine

#

You can bind whenever you want. In most cases just do it on widget construct

normal viper
#

they used binding here will test it right now

#

uhh, it works

#

isn't this on tick though or something?

#

im gonna try 1 more thing because I think it may be problem how I initialized widget from the unit, it should just be on construct

dark parcel
#

So when you set the damageable struct on server

#

The server will then replicate the data to client on the next net update