#multiplayer

1 messages Β· Page 182 of 1

odd hamlet
#

I did it this way

thin stratus
#

There is no reason why the mesh would not show up, unless you modify the mesh in code

odd hamlet
#

I just add it via add Instance

thin stratus
#

AddInstance?

#

You will have to share the full code at this point

odd hamlet
thin stratus
#

Add Instance is not replicated

#

If you add Instances you need to replicate that somehow

odd hamlet
#

hmm than how should I do it in order for the client to see?

#

I mean is there another way to spawn an instant mesh without add Instance

thin stratus
#

No, you will need to replicate the data via e.g. a RepNotify Array that has the Locations in it

odd hamlet
#

ah ok, I see

thin stratus
#

But there might be more needed depending on what you are doing with them

odd hamlet
#

no they are just the rooms of my game, they just need to be spawned πŸ™‚

thin stratus
#

Yeah then the Array would be enough. Does the Server decide on the rooms?

odd hamlet
#

and the rotating of the doros

#

it hhas to be done only by the server right?

odd hamlet
thin stratus
#

AddInstance and modifying them will all need to be replicated

odd hamlet
#

the doors are blueprints

odd hamlet
#

oh apparently with a delay of 0.5 seconds it spawns the instances for the client asweel

#

oh not always apparently

#

basically by being spawned on the Server Only they should be called from an Event that is on Run on Server

#

am I right?

thin stratus
#

Run On Server is meant to move from Client to Server. You can't say that spawning has to happen from a ServerRPC

#

That's not correct.

#

There are several events that call also on the Server and would also allow Spawning

#

Spawning has to happen on the Server if the Actor is replicated. That's all.

#

At least if you want the Actor to replicate to everyone.

odd hamlet
#

apparently If I set my doors from class default the replicate field to true, it fuckts all my projects and it generates 2 maps instead of one, without it, the world gets geenerateed perfectly

thin stratus
#

That usually points to your base setup and understanding of replication being wrong

#

I would suggest you take a smaller example and try to understand the spawning and replication part first via the Compendium

odd hamlet
#

I want to cry literally

rustic sable
#

that's been me the last couple of weeks

odd hamlet
#

yeah we been the same then brother

rustic sable
#

to be fair the explanations in the compendium make perfect sense but lacks a lot of detail when trying to apply things to an existing project

#

it all makes sense on paper πŸ˜…

odd hamlet
#

don`t say that, you are suppose to encourage me,

#

I am crying my eyes out here

#

I been on these doors for almost 2 weeks by now

#

I don`t know what to do anymore man

#

And I need this project done in a month

rustic sable
#

are you spawning stuff in begin play ?

odd hamlet
#

yep

rustic sable
#

yeah don't do that

odd hamlet
#

hmm why?

rustic sable
#

found this little tidbit somewhere which changed the way I look at things
"Event BeginPlay fires whenever a new controller is generated. In multiplayer server machine creates controller for every connected player. And there is a player controller created for each client as well (on the client side).
Since clients get one controller (their own), BeginPlay only triggers once for them. For server, however, since it has as many controllers as there are players, his BeginPlay for PlayerController will execute each time a new player joins."

odd hamlet
#

oh

#

that`s actually great info for me

#

thank you

rustic sable
#

I guess it depends on what kind of actor it is but in my case it was messing a bunch of stuff up

slim jay
#

Are these values high enough to cause lag/stuttering on the server?

odd hamlet
#

I need to build the map, on what else should i build it then if not begin play?

half iris
#

Question: When creating save games, do we want the server to be authoritative there as well? Or can we rely on the save game encryption that UE provides out of the box, to be enough against tampering by players?

mint light
#

If I'm trying to add movement to a Dodge roll animation (no root motion since it'll need to be replicated), is AddForce on a looping timer (or timeline to hone the curve / feel) the standard way? I feel like my friction settings are messing with AddForce in odd ways. I have high friction to have instant start / stop on char movement.

I've tried zeroing some of those settings before doing the animation and timer but still get weird results like: char does not move during animation, but afterwards, if I jump, the char will get slowly pushed backwards while midair. Seemingly because AddForce is still trying to act after I put the high friction settings back on once the anim completes.

I'm thinking at this point of just changing the character's walk speed for the duration and moving them using AddMovementInput to avoid these kinds of funky physics consequences. Is that kosher?

half iris
#

Another question: If I handle the save game logic only on the server, and after playing for a bit one of the clients quits from the server, do I just pass them the version of the save game that was stored on the server up until that time?

Then the next time they connect to this server, the server loads their save game and sets it as their current save game again? To avoid the results of potential tampering whilst they are not connected to any server?

dark edge
#

leave server -> continue the game from the same state in single player?

half iris
#

No, right now I am working off the assumption that players will only be able to continue playing in a server.

#

Specifically though, the context is about collecting customization collectibles throughout their playthroughs.

#

If they collect a certain emote or trail on server 1, quit, and then join server 2, I want them to still have that specific emote or trail that they collected on the other server.

dark edge
#

or something of the sort

#

unless you're totally ok with it being client authoritative as anyone can just modify a save game

thin stratus
#

@half iris If you want players to not cheat, use a database that you host and use DedicatedServers that you host.

#

Throw a lot of money at it of course.

#

If that's not doable, stop worrying about cheating.

half iris
#

That makes a lot of sense. I will just write the saved changes to the client and not worry about any of it. Especially seen as it regards customization collectibles, so it has nothing to do with actual gameplay anyway

#

Thanks for the help @dark edge and @thin stratus

slim jay
#

The issue with character movement in multiplayer is that any network lag causes the server and clients to fight over the characters position. Building custom character movement in multiplayer works fine in the editor until you play in a real world game with network lag and then the game becomes unplayable from stuttering movements. Can i fix this without c++ ?

dark edge
#

you trying to sprint or wall run or dash or anything ilke that?

slim jay
#

Im just running or walking in very large map

rustic sable
# odd hamlet Well but isn’t everything corelated on begin play?

afaik this only triggers multiple times on things that have controllers attached? I could be wrong but still learning all this. just looking at this seems the game state might be a good place for maps. might want to take a look at it's overrides / blueprint implementable events to see what it fires when. Again not sure when begin play is safe and when it isn't so I tend to look at the header of the class, it's pretty well documented as to when things fire.

dark edge
#

whats wrong with that

#

animation is a little jumpy but it ain't too bad

#

You can't blame it on the CMC unless you actually see corrections all over the place. Make the capsule visible and show corrections

slim jay
sinful tree
# slim jay The issue with character movement in multiplayer is that any network lag causes ...

There is no way for the clients and server to know where everyone is going to be at a certain time so the server must win out on this and basically whoever has the lowest latency will usually be the first one to arrive at a certain position.

The built-in character movement component does a fairly good job at compensating for lag and even packet loss preventing jittering and rubberbanding in most cases. If you start to add movements yourself outside of the CMC, namely, having the character move in ways that the CMC doesn't know about, then you'll end up with more issues with jitter and rubberbanding as you're working against what the CMC is trying to handle.

#

The problems can start to arise from something as simple as modifying the max walk speed during runtime - the moment you do that, things become unsynchronized.

slim jay
#

I found a few plugin about this maybe they will help

sinful tree
# slim jay You're saying even the slightest change in the CMC can easily cause this, if I'm...

Yes, because manipulating the CMC's values is what can cause things to become desynchronized as the server is expecting the client to move in a certain way based on the values set in the CMC. The moment you increase the movement speed on the CMC on the client, the server isn't going to agree with it. The moment you incrase the movement speed on the server before the client, again, the server will not agree with where the client should be based on their movement inputs.

#

If you set the values before hand in the editor, no problem, as both the client and server have the value.

lament flax
#

i got a sprinting flag working with the CMC to ease client prediction.

how should i correctly implement a stamina variable ?

slim jay
sinful tree
#

Even if you RPC the change, it doesn't matter - there is latency involved that the CMC can't compensate for as that RPC isn't likely to arrive at the same time as the movement data with the character moving at a different speed, so you will ultimately get some kind of jitter or rubberband. The only way to correct for max walk speed is by inserting a flag into the CMC to indicate the movement speed needs to be changed, and having the CMC insert that into its move data that it sends to the server so that when the server receives the flag, it can then appropriately move the character knowing the appropriate speed to move them at.

#

It can become synchronized using an RPC, but it usually involves something like....
Stand Stil, hold shift, wait a moment, start walking.

#

But, that's not realistic either. You can't know when a player is just going to tap shift randomly to get some more speed while they're already moving.

#

A different and sneaky kind of way is to have the max walk speed at your sprint speed already. You can then have the player's movement input scale reduced, thus making them have a walking speed, and then when you want them to sprint, you simply increase the scale of their movement to 1.0. You lose out though on being able to prevent players from sprinting all the time, like if you wanted to implement a stamina system you wouldn't technically be able to prevent the player from sending their full movement input all the time (through cheating in some way)

slim jay
ancient adder
#

What would cause the timer to be frame dependent on server?
a 10s timer takes over 30s on 15 FPS server side

#

Setting Server Fixed FPS back to 0 instead of 60 fixed the issue

reef bison
#

I have some abilities in my game that grants the player knockback immunity (like the roll in the attached video), but I am having a multiplayer issue on bad connections (100-200ms). basically if I try to dodge a moment before the hit happens, the client will have the immunity but this info didn't reach the server yet, so it causes a huge rollback because the client dodged the knockback but the server already registered it. I don't really see how I could fix it because of the latency between the ability activation and the hit registration on the server

I am building a coop game (not competitive) so I am considering enabling the Client Authoritative Position settings on the CMC component so the client has absolute control over this things, would this be a good approach or is there another solution? at the moment the knockback is all handled on the server so I would need to rewrite everything to be handled on the individual clients

hollow eagle
#

I would recommend watching this video (timestamped for the literal situation you describe).
https://youtu.be/h47zZrqjgLc?t=2110

Given that you're doing a coop game, going for what they did isn't entirely necessary and the "easy" route of letting it be somewhat client-authoritative would be fine, but the technique here may be useful regardless.

GDC

In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.

Register for GDC: http://ubm.io/2gk5KTU

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover a range of developmental topics including game des...

β–Ά Play video
radiant cypress
#

Hey ! Simple question : Why are RPC unreliable by default ? Aren't there more action types that we want to be sure that it's done, in general ?

lament flax
#

Did anyone here checked the Sprint GA of tranek ?
it looks good but i would like to know if its a good model to follow

dark parcel
#

Who cares if you missed one or two if that can ease the traffic

radiant cypress
#

Well the movement component already replicate everything

lament flax
#

when a server RPC thats is flagged as reliable is ignored and not executed for too long the client is kicked

dark parcel
#

K that's just example

radiant cypress
#

I dont have an example of Unreliable rpc possible

dark parcel
#

Afaik it doesn't replicate character rotation

#

If something needs to arrive and shouldn't be dropped, use reliable

#

Otherwise don't

radiant cypress
#

Well i have indeed done a non reliable rpc for replicating yaw, you are right !

#

But anything else ? ^^

lament flax
radiant cypress
#

Like, any action has to be reliable ?

#

throwing a bomb, anything

pale bronze
#

Does anyone know about replicating VOIPTalkers? for voice chat using advanced sessions

#

I have a problem that im stuck on and i cant find a solution at all

radiant cypress
#

I see

dark parcel
#

If something needs to arrive, set reliable. Otherwise don't..

lament flax
#

stuff like shooting ist reliable

dark parcel
#

I'm pretty sure movement's are unreliable

#

I would make shooting reliable

radiant cypress
lament flax
#

yes, because if the client lags, wells, stuff will be skipped by the server.
clients faults

dark parcel
#

Or throwing grenade

lament flax
radiant cypress
#

Yeah because is on all tick so i guess its ok

dark parcel
#

Wut

radiant cypress
#

But throwing grenade should be reliable, right

lament flax
#

shooting shouldnt be on tick

radiant cypress
#

no

#

no

#

movement

lament flax
#

oh

radiant cypress
#

I guess thats why movement shouldnt be reliable

dark parcel
#

In general something that you update every frame probably shouldn't be reliable. IMO

radiant cypress
#

but grenade should

lament flax
#

the CMC as a lot of weird stuff but has a very good replication & prediction process IMO

dark parcel
#

Because u will send the next packet on the next frame anyway

radiant cypress
#

yes

#

But when exactly is a "bad" client kicked ?

#

At how many paket loss ?

#

i mean, how many reliable rpc missed

radiant cypress
dark parcel
#

Don't know, but maybe those guys that does multiplayer might tell you to profile. Never done that my self

dark parcel
radiant cypress
#

Im not up to date on that regard

dark parcel
#

No, that's just a networking concept

radiant cypress
#

I have read the whole gabrielgambetta stuff

dark parcel
#

Also if you are making fast action game you do want to use cpp. Mainly for the features that is not available in blueprint

radiant cypress
#

But i guess on has to recreate it for every action

#

mhh

dark parcel
#

I will suggest Stephens multiplayer tutorial in udemy. It will teach you important concepts for multiplayer.

lament flax
#

you would want to fake the grande throw on client and have the server replicating to check if its all good

#

im not a expert so i cant tell you the exact process

radiant cypress
radiant cypress
#

But is it in cpp ?

#

Oh ofc

#

Its litterally in the title

dark parcel
#

Nah, I wouldn't make mp shooter in bp alone

dark edge
#

Maybe the closest I'd ever get to a MP shooter in BP alone would be something like DayZ where the shooting being full jank is ok

lament flax
radiant cypress
#

I understand

lament flax
#

thats why i moved to cpp

dark parcel
radiant cypress
#

Arent there some marketplace assets to uncover those (or part of those) features in bp ?

dark edge
#

Which features? If you're smart about it you certainly could get decent feeling shooting in BP

radiant cypress
#

Also yeah, I'm not into a competitive stuff, but I'm sure we can get a good "feeling"

dark parcel
#

Server rewind. Expanding cmc

dark edge
#

I doubt most people are doing server rewind anyway

radiant cypress
#

Yeah that's competitive +++

dark parcel
#

Maybe, I don't know better. But being a bp only user and seeing that it's impossible to make a mp game I want with it alone. Force me to learn it.

dark edge
#

You can get pretty far with clientside hit detection + a server check going "eh, close enough"

radiant cypress
#

I understand the feeling. Im just a bit afraid to start cpp from scratch

dark edge
#

if you're new to the engine you should not just jump into cpp

radiant cypress
#

Im not new to the engine, but im new to cpp

dark edge
#

once you're comfy with it then just start moving bits and pieces of your current code base to it

#

start with a file with your structs and enums and a bp function library in it

radiant cypress
#

mhh

#

Thank you all for your advices

#

πŸ™‚

reef bison
#

it is still a very interesting solution, I will keep it in mind for other types of abilities grubnote

#

moving things to be client-authoritative seems to be the best move in my situation

radiant cypress
split jasper
#

I'm trying to do the most basic stuff imaginable and it's driving me crazy.

I am literally just trying to spawn the top down character and have both clients see it
I am using play in new window PIE, net mode play as client. 2 clients.

If I start on the same level, it works fine. But I want to start in a startup level, and then if you enter the password, it loads the level the server is on. And then spawns you. So existing players see you spawn, and you see them.

Should be so easy but I'm not getting it, and ive tried seemingly everything to do this.

The problem seems to be when I start on the same level I get this:

Server: postlogin called for: BP_KingController_C_0
Server: postlogin called for: BP_KingController_C_1

While when I start in the startup level and then join the server level, both result in:

Server: postlogin called for: BP_KingController_C_0

Meaning when I start in a startup level and join the server, it seems to give them both the same player controller or something.

I literally just want two pawns to spawn and its making me feel so dumb. I just spend 4 hours trying to sort this out with AI and I think it made things way worse and put in the wrong path.

#

Sorry I kinda missed the key part:

If I join the server after switching maps and am given the same player controller, each client only sees itself. Client 1 wont see client 2 and vise versa. if I start on the same level it works fine. I tried all possible ways the mode can spawn stuff, default, override, every iteration.

lament flax
#

Does it change something for GAS (like prediction) if you bind IAs to GAs instead of calling them manually ?

storm zealot
#

Greetings!
When client's Capsule Collision Component hits Physics Actors they fly away into the outer space. With server everythings ok. What can I do?

That happens when I set Collision Response To Channel: Pawn - Block in blueprint

storm zealot
#

Thats how break any physic object for client

shell pendant
#

Think I had the same issue a while ago haha

#

And even set the physics for the actor if needed if you want him to die (ragdoll) but this ain’t for a character if I’m right?πŸ˜…

#

Still learning too and found it funny in the beginning πŸ˜‚

storm zealot
#

Gravity is enabled(

neon summit
storm zealot
neon summit
#

How are you spawning it

storm zealot
#

Just placed in the world

neon summit
#

What object type is it

storm zealot
#

Neremind, didn't notice that little node that sets mass of object to 0.2)))
I pretty dumb

dark edge
#

You using the GameMode functions?

dark parcel
#

Unreal doesn't support multi world for multiplayer. Once a player join a server, they will open the server map. From there on, only server can open new map and take all the clients using server travel

#

You can't have client A on X map and client B on Y map with Unreal Networking implementation.

quasi knoll
#

Hello smart people, I can enter a vehicle in multiplayer, but exiting doesn't allow me to possess my character again. What do I need to use instead of the basic key press?

neon summit
#

And get player controller shouldn't be used

#

And you need to pass the character in from the interact event

#

And store a reference to character and controller

quasi knoll
neon summit
#

i didnt ssee you have the input of player controller

#

show where you're printing

neon summit
#

has anyone used smoothsync?

odd hamlet
#

how do I make a certain thing to run only on server? Should I set on the event running on owning client? or with the has authority node?

fervent leaf
#

Does anyone know good documentation or video about level traveling on multiplayer? I'm creating a plugin that handles everything traveling related but I do not understand it currently. What i try to do now is a ClientTravel to a level. It seems the client travel sends the owning client to local instance of the level or something. If I ClientTravel with a different client, it also creates its own instance of the level? What if i would want to ClientTravel to same level with the another one (like another players house). Server travel seems to travel every single one of the controllers, so I assume ClientTravel would be the way. What if the player leaves the house and should return to the original level? Shouldn't that also be a ClientTravel to last level without creating its own instance of it? I never done anything like this so maybe i understood this completely wrong. Thanks for any tips

woven basin
woven basin
#

you cant have players on different levels

#

everyone must be in the same world

lost inlet
#

then I'm not sure you comprehended what it said then

fervent leaf
woven basin
#

a client can RPC to the server to ask the server to load a new map, which will travel everyone to that map

#

cant have client A remain connected on Map A while Server is on Map B

#

best option is teleport and level streaming, with "hidden" areas under the main map etc. That's how many games do it - i.e. ARK the boss fights are "under" the real world, with a fake skybox above the boss fight to make it look like its outside

fervent leaf
random verge
#

Is there a UPROPERTY meta for enforcing that MinX and MaxX also do not undermine each others values when set in the editor UI?

woven basin
woven basin
#

(I dont know answer, but it will be on that page or not at all)

odd hamlet
#

Why someetimes on the client side it skips that has authority or idk what it exactly does, and spawns the worlds?

neon summit
#

I don't think the level bp replicates

halcyon ore
#

How do I test 2 different standalones connecting to make a non-dedi server?
I see info for connecting to a dedi?
Is this not something you can do with the editor?

odd hamlet
neon summit
#

it may though idk

random verge
#

listen server?

silent valley
halcyon ore
odd hamlet
random verge
#

sorry that was for @odd hamlet

odd hamlet
#

yep

silent valley
odd hamlet
#

sometimes it works as it should

#

but sometimes randoomly I see another world spawning in

#

like wtf

neon summit
#

What are you spawning?

odd hamlet
#

a blueprint that spawns instance meshes and different other actors

neon summit
#

And you only want server to see or both?

odd hamlet
#

i want the server and the client to see the same, the one being spawned by the serevr

#

and also the client to see it to

#

sometimes it works as it should but sometimes it doesn`t

neon summit
#

I think you should try spawning in the game mode and make sure the replicates flag is checked

warm sparrow
#

In my multiplayer blackjack game, im trying to figure out how to set up physically spawning the player's cards on the table. I was thinking it would be an actor that is spawned by the playerstate since thats where the information about each players hands are, playerstate holds a reference to its own card spawner and communicates with it to tell it what cards the player has. is that a good way to go about doing this?

odd hamlet
#

Bro why are instanced static meshes so hard to replicate

fleet bear
fervent leaf
#

I Currently try to send only one of the clients to a different level with ClientTravel. I call a ServerRPC that broadcasts the owner controller and gameplaytag to a gamemode. When gamemode receives the event, it will validate the request and then call Controller->ClientTravel. I use seamless travel for this. Now when the seamlesstravel is finished, The player has moved to correct level but spawns in a weird position and it still sees the player's even though they are on different level. Is this how it should work or what am i missing? I don't want to move all the players at the same time so i can't use ServerTravel. I got explained earlier that it is because server is on a different level and that can't be. THE QUESTION: So is ServerTravel the only solution really if i want to move player's between levels and client travel should be only used traveling first time to a level?

#

I don't really understand when should I use ClientTravel now and what is the purpose, if ServerTravel is always needed to switch between levels that sends all of the clients anyway

twin tree
fleet bear
halcyon ore
#

I'm reposting this, because someone else was having an issue, and my post got a bit hidden.

How do I test 2 different standalones connecting to make a non-dedi server?
I see info for connecting to a dedi?
Is this not something you can do with the editor, or do I need to cook it?
(Trying to test match making, and I wanna have 2 standalones, 1 make a listen server, and the other connect, even if that is just an open 127.0.01:17999 or whatever command to connect)

thin stratus
halcyon ore
#

I need a 2nd person.
To test connecting, and travel levels once match making is ready.
To make sure it replicates correctly.

thin stratus
#

Yeah but why can't you do that in the Editor?

#

Is it a steam connection?

halcyon ore
#

IDK how to.
Thats why I ask.
I see info for 2 standalones connecting to a dedi.
But, not 2 standalones connecting to make a non-dedi/ listen server setup.

thin stratus
#

Just set it to 2 players and Play As Standalone (instead of As Server or As Client)

#

Then let one host and the other find/connect

#

Or if you have no session setup, just use the console

#

open levelname?listen

#

For the server

#

open 127.0.0.1

#

For the client

halcyon ore
#

Ah, thats what I was missing.
That open levelname?listen
I saw some UE form post, but it tried to do it in a shortcut, with like .uprojectpath -listen -map=etc -game

thin stratus
#

That's actually standalone

#

The names are sadly the same

#

Standalone is the word for a net mode that is not a server, or client

#

But also the word for a specific play button in the Editor,

#

So if you select Play As Standalone it just means that the started players are not already made to be a server and client

#

But the standalone from the play button means that the process will be a standalone one, not inside the editor

#

That can of course be mixed and matched. The argument you have their results in the same

#

You can also rightclick the uproject file and hit Launch Game to open a standalone process

#

Still uses editor data fwiw so not the same as packaged

halcyon ore
#

Alright, cool.
Yeah, I just didn't know about that open level?listen
Thats got my expected results, for my testing.
Thanks

pale bronze
#

Does anyone know if theres a good way to test multiplayer while including the steam api? So far Ive been using two standalones and connecting using LAN but my problem is i can only focus one window and the other window becomes very laggy until i switch to it

Is there a way to make both run simultaneously?

pale bronze
odd hamlet
#

Yeah you could give one to a friend of yours

thin stratus
#

I mean, you have to do that to test Steam anyway

dense mason
#

hemlo everyone

#

can anyone please tell me how i can i sync server time and client time?

#

so that there's no delay between both

thin stratus
#

@dense mason

dense mason
#

omg not c++ pls

quasi tide
#

If I recall correctly - that article outlines why that isn't that good

kindred widget
#

It outlines why it's slightly inaccurate. It also doesn't matter for a lot of use cases.

dense mason
#

Hmm let me use this then

twin juniper
#

the delay will still be present lol, just that you use 1 value

thin stratus
bright summit
#

I added ```cpp
void ABaseSpectator::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);

GameState = GetWorld()->GetGameState<ABaseGameState>();

SetReplicates(true);
SetOwner(NewController);
SetRole(GetLocalRole());

}

bright summit
#

ok it seems the spectator pawn is only spawned for local player...

#

and that is the reason

#

so I need to move my code to playercontroller ugh..

lost inlet
#

Used it in a previous project, it looks like Epic later also bumped the update rate by default

frigid fox
#

ClientSetHUD function does not work on server properly what should I do?

#

I can't cast to my custom hud on server but I can on client after setting of hud

lost inlet
#

well

#

though I've never had to rely on this for creating a HUD, usually you just have that created once

lost inlet
#

not using that node

#

since on the server, that'll always be the first connected player

#

or in the case of a listen server, the host player

frigid fox
#

okay I got it

#

then what's the way to get the current player's

lost inlet
#

well you've given no information about what BP I'm even looking at

frigid fox
#

that's the third person player blueprint

lost inlet
#

then why don't you use the node that gives you the pawn's player controller rather than using that one?

frigid fox
#

after respawning of the player I try to reset the hud

lost inlet
#

and you do know there's a delegate you can subscribe to on the player controller that tells you when posession changes right

#

works on client too

lost inlet
#

OnPossessedPawnChanged

frigid fox
#

okay let me try now thank you

hot scroll
#

I desire thoughts on an approach to multiplayer plugin behavior.
It'd be for other developers. The Server would handle REST calls to external data APIs.
3 Modules: Core Module with shared data types. Client Module & Server Module each depend on Core.

Client wants certain info, it has IDs for that info.
Client has a component on the PlayerController.
ClientComponent calls a [Server] RPC.
The Server takes the IDs from that.
Server makes REST call to get the desired Data. Server would probably cache results to reduce calling overall (not really worried about that part yet)
When Server has the data, it calls a [OwnedActor] RPC sending the data back to requesting Client.

For returning the retrieved info to the Client, I'm deciding between:

  • Server calling an [OwnedActor] RPC to send it back to the Client
  • filling out a Replicated variable on the PlayerController Component.

Are there any pros and cons of these individual approaches?
Is either broadly preferred? Does it sound like there's any distinct gaps in my understanding on this?

pale bronze
#

Am i wrong but if a server calls a server RPC which calls a multicast the clients should ALWAYS get what gets called in a multicast right?

On beginplay I have has authority node and it calls a server RPC which calls a multicast rpc which just prints string and for some reason clients never get that print string?? i thought the point of multicast was it replicates to all clients, Do clients also have to call their own multicast RPC ?

hot scroll
pale bronze
#

im doing it on the player character

#

on begin play

#

im not sure how it works but i believe clients activate their own begin play?

frigid fox
pale bronze
#

even when the host activates the multicast RPC the clients dont get any print strings set in it

#

so im assuming clients also need to call the server RPC which calls the multicast

lost inlet
#

well where is the multicast

pale bronze
#

above

#

im trying to setup VOIP which i got working for the host but the clients can still hear the host no matter the location

neon summit
#

You can use the bp debugger and see where it goes wrong for the client

lost inlet
#

breakpoints are a useful tool

pale bronze
#

what play mode does the bp debugger work in

neon summit
#

Wym what play mode it work in

neon summit
#

It only works in pie if that's wym

outer sphinx
#

Hi guys, I'm capturing a render to show the character in the widget when opening the inventory but it always takes client 1, is there a way to take the owner because from the other clients 2,3,4 it always renders what the client sees 1

ashen plume
#

is this a bug? component replication to clients isnt respecting their order of being destroyed then added

#

evident by printing during the previous component end play event, and next component begin play event, the begin play always fires first

solar stirrup
#

Replication order isn't guaranteed no

#

So you'll have to handle that yourself

#

@ashen plume

ashen plume
plucky prawn
round bobcat
#

Why is my client not replicating to the server, but the server is replicating to the client? I'm updating a replicated variable with this code and calling the server function. This code is in the playerstate.

void AMainMenuPlayerState::CreatePartyID() {
    AllPartyID.Add(UKismetMathLibrary::RandomIntegerInRange(1000000, 9999999));

    PartyID = AllPartyID.Last();
}

void AMainMenuPlayerState::ServerCreatePartyID_Implementation() {
    MultiCreatePartyID();
}

void AMainMenuPlayerState::MultiCreatePartyID_Implementation() {
    CreatePartyID();
}
worthy oak
round bobcat
worthy oak
#

Correct

#

The replicated variable once changed on the server, will replicate to the clients

round bobcat
worthy oak
#

You likely will still want a function to tell the clients HUD β€œhey update your screen” not sure how your handling it

#

Right yes you either need to make an event telling the widget to update

#

Or you could do a rep notify

#

That executes something widget related when the value is changed

round bobcat
# worthy oak You likely will still want a function to tell the clients HUD β€œhey update your s...

Here is the new code with some updates, the widget now shows on the client again, but is still not replicating to the server.

playerstate

void AMainMenuPlayerState::CreatePartyID() {
    AllPartyID.Add(UKismetMathLibrary::RandomIntegerInRange(1000000, 9999999));

    PartyID = AllPartyID.Last();
    ServerCreatePartyID();
}

void AMainMenuPlayerState::ServerCreatePartyID_Implementation() {
    AllPartyID.Add(UKismetMathLibrary::RandomIntegerInRange(1000000, 9999999));

    PartyID = AllPartyID.Last();
}

and the class I'm actually implementing this code

void UPartyInfoComponent::PollMenu() {
    if (Menu == nullptr) {
        TArray<UUserWidget*> WidgetsFound;
        UWidgetBlueprintLibrary::GetAllWidgetsOfClass(GetWorld(), WidgetsFound, MenuClass);

        if (WidgetsFound.Num() > 0) {
            Menu = Cast<UMenu>(WidgetsFound[0]);
            if (Menu) {
                Menu->PartyCreated.AddDynamic(this, &UPartyInfoComponent::OnPartyCreated);
                Menu->PartyCommitted.AddDynamic(this, &UPartyInfoComponent::OnPartyCommitted);
            }
        }
    }
}

void UPartyInfoComponent::OnPartyCreated() {
    if (MainMenuPlayerState) {
        MainMenuPlayerState->CreatePartyID();

        if (Menu) {
            FText PartyIDText = FText::FromString("PartyID: " + FString::FromInt(MainMenuPlayerState->GetPartyID()));

            Menu->PartyIDText->SetText(PartyIDText);
        }
    }
}

the delegate is from my widget class

worthy oak
#

To then handle create

round bobcat
worthy oak
#

For something like that the server should be in charge of creating the ID

#

and the client β€œlearns” what the ID is

round bobcat
worthy oak
#

And that’s what you want updated?

round bobcat
# worthy oak Your widget is just showing the party ID?

The widget is not updating the variable, just showing what the variable currently is. I want the variable itself to be updated across the client and server, the widget doesn't matter to me because I only need to show it to whoever updated the variable.

worthy oak
#

Your variable is probably updating, but you aren’t seeing it visually because you haven’t told your UI to make use of the new value

round bobcat
worthy oak
#

If the variable is in your player state, that might be a good candidate for where the rest of the code should live

#

As for your rep notify function

round bobcat
worthy oak
round bobcat
#

Alright, I'll try it, but I have to leave rn, so hopefully it works. Thanks!

worthy oak
#

Of course, best of luck!

hot scroll
devout sonnet
#

This doesn't work, but can someone tell me why?

halcyon ore
#

So, I have setup sessions on my game.
It seems to work mostly on PIE.
But, no luck on steam?

I have the steam subsystems.
I have the SDK, all the INI edits, and steam overlay pops up, with my correct steam account.

No sessions popup.

Is this an issue with 2 of the same steam accounts on different PCs.
and, if so is there any easy way to test?

#

(I'm using advanced sessions)

neon summit
#

I don't think you can use the same account

dark parcel
neon summit
dark parcel
#

Though I find it a bit strange to do it that way since the client should know its own name

dark edge
torpid lantern
#

I could use some advice, or maybe just a duck on this one:

So I was/am in collision hell. My dead units are for some reason acting as dynamic obstacles and messing up the pathing on my AI movement. I spent the past two days tinkering with various collision boxes, profiles, - heck, I even tried teleporting the dead unit under the map. Anyway, for whatever reason as long as that actor was in play, it would act as a capsule and my units would try to path around it.

I abandoned my debugging attempts and I am exploring this idea of destroying the actor on death and replacing it with a dummy dead body (without collision). I think there might be a bonus here that I no longer need to replicate or monitor that dead actor's attributes, but I am unclear on how much compute each actor consumes. But now I am discovering that a sudden destruction of that actor is breaking my game all over the place and this will be a much larger project than I expected.

So question:

Should I revert and go back to debugging the original collision issue; is there a significant networking benefit/drawback to destroying (and replacing) a logic-heavy actor that would otherwise linger on the server for 5-15 minutes?

dark edge
#

Are you saying that moving a unit out of the way leaves it still blocking the way?

torpid lantern
#

That's what I observed

dark edge
#

What does being "dead" imply? What state changes?

torpid lantern
#

state is an enum on the character

dark edge
#

What happens if you just move a living unit out of the way

#

teleport them into the sky

#

also what's doing the moving for them usually? Are they Characters?

torpid lantern
#

They are characters and all of their movement is driven by AI move to

dark edge
#

Your teleport is somehow not updating navigation. I'd start there

#

might be that navigation is only updated when the thing moves, but teleporting doesn't count as a "move"

#

either way, the best results would be to basically say "Don't consider me for navigation, also, don't let my collision stop Pawn"

torpid lantern
#

Do you think I should rip out this stuff about replacing the dead actor with a dummy? I feel like this is a huge headache.

dark edge
#

no

#

er

#

yes

#

There 100% has to be a way to just make the thing stop walking, stop being in the way of navigation, and stop blocking collisions

#

do that

torpid lantern
#

I think I needed to hear that, thank you. Goodbye 8 hours of work..

torpid lantern
#

If I teleport the actor +1000, it just falls back down, if I dump them under the map then the actor falls until cull. I just notice that even after cull; the pathing remains broken. In PIE, I do not see any collision objects in that area that the AI tries to path around.

#

This is how I am moving my actors:

#

All "units" are replicated and manage by the server, movement is via RPC and behavior tree.

halcyon ore
#

What if you enable the nav mesh debugging, or put some debug draw on this enemy?
You said being dead is a state.
Does that mean you don't destroy actor after a bit?

Also, does this only involve issues with replication, or does running in standalone cause the issue, as that'd be more direct to debug.

torpid lantern
#

I'm not so familiar with nav mesh debugging or what a debug draw is.

Yeah, I destroy actor manually after n minutes.

By standalone, do you mean outside of PIE, net mode, or both?

halcyon ore
#

Nav mesh debugging, to just be 100% thats a gap or lack of nav mesh, could also test if it follows your enemy around, or just has a gap at inital spawn.

Debug draw, not sure what else to say here, its a debug draw.

Also, n minutes, do that mean like 1 minutes, 5 minutes? In which case, why not just either.

  1. basically insta destroy (looks like your enemy visually died super fast)
  2. Just disable all actor collision.

and, I mean the standalone net mode.

torpid lantern
#

Sorry, I am a debugging noob. Are these configurations on the actor or a tool in PIE?

I haven't decided on the exact duration just yet, let's say 5 minutes but maybe more.

My enemy has a death animation and I want its corpse to persist. The video shows that I teleported the actor under the world at the advice of Adriel. What is interesting is that even after the actor falls down far enough to be culled, the moving actor still thinks it is there. And I did not see any collision capsules in PIE debugger.

I have disabled all collision and it falls through the world. I have also set the actor to use a collision profile (P_BlockStaticOnly) that blocks only 'world static' and ignores everything else. I have also triple-checked that nothing on my moving actor is blocked by by the object type configured on P_BlockStaticOnly.

Will try standalone net now and this also happens in my prod/packaged environment.

halcyon ore
#

If your in standalone, or the server.
You can show Navigation to show the nav mesh.

On your enemy, you can put it on tick for testing or something, and just like draw debug sphere, and use actor location.

See where the sphere goes, and if it truly follows the actor or not.

torpid lantern
#

Maybe I misunderstood you, but show navigation does not change anything for me. I am running net mode standalone in the selected viewport. Connecting to my local dedicated server running in another process.

Will try the sphere thing now.

halcyon ore
#

Weird.
If you have a nav mesh, it'll turn the floor green

torpid lantern
#

oh, like pushing 'p' in PIE?

halcyon ore
#

Yeah

torpid lantern
#

Oh there sphere trick is handy, but yeah - it falls underground with the actor. I've never been able to get the nav mesh to show green at runtime, but that would be super useful.

halcyon ore
#

Run the game as just standalone, don't connect to a server.
Cut out the potential of server issues.

simplify it basically.
That'll also let show Navigation work.

Make sure the code works, before involving networking.

torpid lantern
#

Well, the server controls all unit's movement - so in standalone my game is completely busted.

halcyon ore
#

standalone is also a server, so it should work fine?
Idk if I'd be worried that your game doesn't work at all in standalone, even if its not designed for it

#

If thats not an option.
Then, what if you just insta destroy actor, does the nav mesh issue get corrected, or still occurs?

torpid lantern
#

Yeah, insta destroy clears the path. That's what my original question was about.

I would still need a body - so I'd need to create a placeholder actor and transfer the meshes over. I did this and it solves my pathing problem, but deleting the actor resulted in a bunch of downstream errors.

halcyon ore
#

Could try to explicity disable collision on the components blocking the nav mesh, rather then disable the collision on the actor as a whole.
(Its what I do, and it clears up the nav mesh)

torpid lantern
#

Will give it a shot, thank you.

#

No luck. The unit falls through the floor but the pathing is not updated.

halcyon ore
#

While it says underneath.
Do you have that like fill underneath nav mesh enabled on the components that block the nav?

torpid lantern
#

Fill Collision Underneath for Navmesh is false

I am using Detour Crowd AIController as my base, so I wonder if there is maybe something in there that is messing with the pathing.

#

Oh yeah, looks like it's detour. Crap.

devout sonnet
#

Multiplayer will be the death of me.

torpid lantern
#

For any future searchers: I got it! My solution was setting up avoidance groups. I had to make my moving actor ignore the avoidance group mask of the dead actor.

vital furnace
#

Hi, can someone help me? Actually, I am creating a multiplayer network game. I followed a tutorial that showed how to create the menu to spawn the server, then the menu to join the server, but the videos stop there. I followed another tutorial to create the lobby, but now I'm a bit stuck because the tutorials come from two different people. I would like that when the lobby launches, a widget appears and allows the player to choose their team. Then, depending on the team they choose, they are placed on one of the platforms dedicated to their team. Once everyone is ready, the server (the host) starts the game, and the players are transported to the game MAP where a countdown occurs, then the match starts and ends after 5 minutes, and the players are taken back to the lobby. Can someone help me with resources (tutorials, Blueprints, PDFs...) to solve my above issues?

queen escarp
#

hey question, my game will have "waves spawned levels kinda" where would i best implment the game mode features ? make a sepereate Bp or in the game mode or where do u normaly controll that stuff ?

#

will contain basicly "spawn- when all dead do blabla"'

shrewd ginkgo
#

In the footprint system I made, I want everyone to leave a footprint, but I want only a special role to see it, for example, I want to assign a bool such as ishunter? and I want them to be able to see it depending on it. how do I do this?

dark parcel
#

You can check the role of the character before doing any of the foot print logic

shrewd ginkgo
#

but if I do that, won't that cancel out the footprints left on the ground by actors other than the role I want?

#

I just don't want them to see the footprint.

dark edge
#

How long do footprints last?

#

And when does someone's Hunter status change?

shrewd ginkgo
#

10 seconds for now, but I want them to be erased as new footprints come in.

#

and the hunter will be chosen at the beginning of each round, when the map opens.

dark edge
#

Quick and dirty would be to have the footprints be replicated actors and just make them relevant for the hunter player.

shrewd ginkgo
#

the sentence was heavy on the translate app. i didn't understand anything :/

normal valley
#

im running into issues redeploying gamelift servers.

#

the deletion process has been ongoing know for close to 4hrs

dark edge
#

How many teams?

#

And how performant do you need the query to be? How often are you asking for every actor that belongs to a specific team?

latent heart
#

You could have a team list on your game state and have objects register themselves to said list on beginplay.

waxen apex
#

whats the best method towards storing player data for multiplayer?

#

Like if I were to store stuff like weapans, unlocked abilities, items, etc for a mmo, or heroes and skins for a moba.

#

I know I would be using a database to store the stuff, but should I be using stuff like EOS and Steam or do I have to create my own stuff?

latent heart
#

Do steam or eos even provide that kind of thing?

waxen apex
#

probably?

#

I am kinda going out on a limb here

#

Also, where and how should I structure the data i'm storing before I actually store it?

latent heart
#

I don't think they do, but I may be wrong.

old knot
#

hey guys, I made a struct and added it to the player controller to save some data, but when I try to read struct data from the game mode in HandleStartingNewPlayer event, all values return null. why is that ?

glossy kettle
#

u might have to review ur control flow

#

and/or ensure it is networked appropriately

maiden flame
# waxen apex whats the best method towards storing player data for multiplayer?

I don't know about best, but I can give you some general pointers. Just take it with a grain of salt, as besides from implementation, I lack the experience to know how well it holds up.

You definitely should use a backend service like EOS or Steam for its secure account authentication if nothing else. This allows you to tie your database's entries to a specific player ID, regardless of where you get your database service from. Which ties into the structure part: There's not really one way and it depends on the database language (relational, non-relational), but like I mentioned, you need to associate the data with a player ID (e.g. Steam ID) either way.

As for where to store it before you send/retrieve the data from the database, assuming you care about security and the integrity of the data, you should handle any database interaction purely on an official dedicated server, server-side (Game Mode for example). Otherwise you risk community hosts or clients sending false data, even if you somehow manage to hide all the credentials that access the DB (which is another security concern).
You must sanetize and validate data that can be indirectly manipulated by clients through inputs, but this is more of a general security thing, and you can always manage this on a case by case basis.

waxen apex
# maiden flame I don't know about best, but I can give you some general pointers. Just take it ...

Thank you very much, this is what I've been looking for. Although, let me just confirm a few things with you in case that somehow changes the answer.

  1. So EOS and Steam stuff for the actual accounts.
  2. Use some code to connect the Accounts and the Database together
  3. Because I do care about integrity of the data, the code for storing of data should be on the Gamemode.

Question: What do you mean by relational and non-relational, like same/different code language?

maiden flame
#

Yeah, it relates to the database code and its structure.

waxen apex
#

Also, by structuring of the data, I mean how should the information be formatted before the send/retrieval?

For example, player inventory. Do I just have the gamemode record/get/whatever-the-getting-method-is the inventory and just store it in a SaveGame-thing before it sends it to the databased?

#

Or like, it creates a file of some kind and then sends that over to the database?

maiden flame
#

Any format the database accepts that takes minimal space to store and bandwidth to transfer, which you can later retrieve and restructure in your game's code.

#

Some databases might accept any format, but it doesn't mean it's a good idea to use it.

waxen apex
#

So I could use the SaveGame thing and it would work, assuming that it would accept any format.

maiden flame
#

Sure, but I would rather create my own save logic I think. So you only update necessary information when it changes dynamically, rather than sending the entire save game every time. Unless you intend to update things only at specific points, but then you risk data loss if a client suddenly disconnects.

#

You could basically keep track of everything as integers, but in the actual database you have names for the rows and columns to identify what they represent.

#

Same for your game logic, but you just send/retrieve the bare minimum data.

waxen apex
#

How, or what would I use to create that custom save? Do you mean through a custom class that the gamemode will store in, then save it, basically all in one go? Or a custom function which grabs the necessary data from the necessary places and stores that directly to the databased?

maiden flame
#

Eh, that logic is up to you.

waxen apex
maiden flame
#

Np!

maiden flame
waxen apex
#

Oh yeah, I don't plan on letting databases be on clients

maiden flame
#

But can you trust the server is my point.

waxen apex
#

I guess I need to figure out how to do something like Helldivers and have a server database whilst still being a listen server thing

#

Unless I'm wrong about helldivers being listen servers, and I'll just default to dedicated servers

maiden flame
#

Yeah, I think it is possible.

sacred kraken
#

Say I want to make a multiplayer game where the world persists. So you do something, close the game, come back and everything you did has persisted. What's the "go to" way of doing this? My amateur brain provides these options:

  1. Always retrieve data from the (Dedicated) server when loading in
  2. Use a database to store everything (probably safer in case of server crashes, although option 1 could use save files I suppose)

In both cases I wonder how to save all the state in the world if it's a big world. Could I use partitioning to group stored data per partition?

#

what stops this server player from changing his health
Oh I think I know this one. The answer is nothing. Server is server.

rustic sable
#

a listen server acts as both a client and server so you can use HasAuthority() to only run logic on the server

#

use validates?

sacred kraken
#

Unless the server is dedicated somewhere outside of the parties involved, there's no real way of preventing it. All you can do is make it harder.

maiden flame
# waxen apex I guess I need to figure out how to do something like Helldivers and have a serv...

I believe that even if the servers are player hosted (P2P or listen), when you do something that requires an update in their database, it goes through an intermediary server without updating the database directly from the host. First of all to access the database securely without exposing DB credentials, but possibly to validate the action itself as well.

As long as no DB credentials are leaked, hacking the game itself to update player data only associated with the hacker isn't a big deal. This is mainly the responsibility of secure coding practices, anti-cheat, and database management. It's when someone gets access to other player's data that things get serious.

maiden flame
#

AFAIK server-side hacks for a client are very difficult, but the real vulnerability lies in how you validate the data on the server, as clients have some authority through inputs.
Health hacking is generally easy to mitigate, but you see client-side hacks in triple A games all the time.

#

Of course, if you have direct access to the server (being a host), it becomes a lot easier to do anything with the game.

sacred kraken
dark edge
#

how many actors total per team you think?

#

Like 10, 100, 1000?

sacred kraken
#

Same way. AI would also be a controller running on the server.

dark edge
#

what

#

do you want AI in place of players?

#

like there's some human players, and some AI players?

#

is this still a multiplayer situation or just single player 1v1 vs ai?

#

But it's the same game right?

#

1v1 vs human or 1v1 vs bot

#

A properly formulated multiplayer game should work as dedicated + clients, listen + clients, or single player

sacred kraken
#

Then you are the server (single player)

sacred kraken
#

They wouldn't have to join if it's all local. You just spawn them in.

#

Joining is only a thing through matchmaking. So even if you fill up missing players with AI, they would run on the server and be spawned in when the game starts without them being actual players joining

#

At which point it's your own logic that spawns them in

dark edge
#

If you want them to pretty much work exactly the same as players except not be players, you'll probably have to do a little bit of tweaking in your GameMode I'd guess. Giving them PlayerStates would be a start though.

#

yes

sacred kraken
dark edge
#

Used to require C++, dunno about nowadays

sacred kraken
#

Since AIController is also a controller.

dark edge
#

what do you do on post login?

sacred kraken
#

Why would you need post login for that if you know it's an ai

#

Yes but then you said local

#

Put your new player logic in a place that takes a controller and go from there

#

But it's not online, that's now how games work unless you create instances that actually join as if they were real players

#

Meaning you'll need to create those AI controllers on the server

#

And thus just deal with the controller, not the player, and separate the two. That way you have support for both ai and player controllers

graceful flame
#

there's a checkbox to allow bots to also have playerstate, I think its on the ai controller

maiden flame
#

That is a broad question, and it depends on your game I think, but you are on the right track for getting and setting health only via the server.
Just understand that beyond the intended logic/rules of your game, you can't prevent an untrusted host from cheating if they know how.
If your game is not hyper competitive, spending too much time on this stuff is pointless. Accept that you'll never be able to prevent all cheats, and that preventing them is an ongoing process as people discover vulnerabilities in your game's code.
Also take everything I say with a grain of salt, it's a really broad and complicated topic.

As for preventing client-side cheats, it's a rabbit hole, but there are some best practices/principles to mitigate the more obvious stuff. Like we already established, only changing health on the server is a good practice. You've probably read "never trust the client".
Now we should ask, what actions in the games can influence the health? If your hitboxes are client-side only, the client could possibly hit everything on the map, or maybe the attack reload time for the player is only checked locally, allowing them to rapidly deal damage. Both cases make server-validated health useless. You need mechanisms on the server to validate what should have been possible at that moment.
You can trace a lot back to the client's inputs, where gameplay critical events emanate from. The logic for validating inputs and events/actions really depends on your game's mechanics, but that's the general principle (again, validate server-side if something should have been possible, without trusting the information the client gives you).

As for preventing clients from knowing stuff like other player's coordinates, I have absolutely no clue. This is lower level stuff, and I'm not sure what information clients are able to retrieve from the engine.
This is possibly anti-cheat territory, where you might step outside of the game application.

honest rain
#

Hey everyone 😁 I am trying to do something that automatically crashes the client ( 2 players, 1 server 1 client ) and I am trying to understand why :
My client picks up an object that adds a component to the thirdPersonCharacter, this component has a function running on owning client and works fine, but whenever I am trying to call a function with 'run on server' inside this component, it crashes, but not when calling a 'run on server' function outside the component.
From what I understand it is impossible to run a 'run on server' function on the component because the component does not exists server side, is that correct ?
Thanks πŸ™‚

graceful flame
honest rain
#

the run on server function isn't on reliable though

dark edge
#

ok so add an event between post login and the rest of your code

#

call that when you add a bot

#

Post login -> ??? -> Fire up a new player
Add Bot -> ??? -> Fire up a new player
Fire up a new player -> ??? -> possess

#

however you want

#

Add Bot button

#

Begin Play if CurrentPlayers < MaxPlayers

#

oh idk bout that

#

probably not

#

just have an event layer in between like I showed

#

that will still work

#

Post Login -> Player stuff -> Common Setup
Add Bot -> Bot stuff -> Common Setup
Common Setup -> spawn pawn -> possess

#

might be num player states

queen mortar
#

Hey so I have an actor with mesh and when player interacts with it it should dissapear, but for some reason client cant make it dissapear for server but only for itself. Listen server works fine. Any suggestions?

queen mortar
sacred kraken
#

For instance

queen mortar
#

Well now client cant interact with it

thin stratus
#

The RPC can't be in the actor

#

It's not owned by the client

#

And visibility is a state

#

You gotta RPC in the character and the set a rep notify property in the actor

#

And in the OnRep use it to determine visibility

sacred kraken
#

The one time I know the answer and you’re faster than me lol

thin stratus
#

There is also a high chance that the follow camera isn't replicated in rotation. Try GetBaseAimRotation for the Rotation instead

queen mortar
plush gust
#

I have a collection of UStruct that I'm replicating via a UProperty on an actor component and each of those structs have a ObjectPtr pointing to a UObject. Those UObject are replicated via subobject replication on the actor component. When those ustructs replicate are the replicated subobject UObjects guarenteed to replicated at the same time too? If not, how do I make sure nobody tries to use the struct before the UObject has been replicated?

thin stratus
#

And then only trace on the server of course. The multicast is wrong and replaced by the onrep

queen mortar
#

Yeah mb I know now

rustic sable
#

I'm getting Replicated parameters cannot be passed by non-const reference on a server call but what if you need to pass an inventory container

hollow eagle
#

...use a const ref

rustic sable
#

const ref is read only mate

sinful tree
thin stratus
#

It's kinda intentional that the Param of an RPC is const&

#

It's not supposed to be writeable

rustic sable
#

TArray<FItemSlot>& _container could be a backpack, could be a chest, depends on the context

#

yeah I see why they do it, just not sure how to handle this now

thin stratus
#

By sending a const TArray<FItemSlot>& Container

#

If your idea was to modify the Container on the other side, then I would love to know why :D

#

It's not like you would modify the original one a different PC sent to you

sinful tree
rustic sable
#

no, that's not the way it worked. The way I had it in single player is the inventory manager worked is it links up a container and the incoming item.

rustic sable
#

the item itself can be const& that gets destroyed on pickup anyway

queen mortar
queen mortar
thin stratus
#

Input -> ServerRPC -> LineTrace -> Cast HitActor to your Stove -> Set bIsStoveVisible to true
OnRep_IsStoveVisible -> Set StaticMesh Visibility to bIsStoveVisible

#

bIsStoveVisible is a RepNotify variable in the BP_Stove

#

Ultimately, you may want to consider putting an Interface in between the LineTrace and the Actor, cause you kinda don't want to cast to every possible Actor you could interact with.
But that's not relevant to the Multiplayer part.

queen mortar
thin stratus
#

The BP_Stove must be replicated of course

queen mortar
#

Yeah Im aware of that

queen mortar
thin stratus
#

The OnRep should be inside the Actor that you want to adjust the state of

queen mortar
#

Alright that cleared out things

hot scroll
#

Question: When a dedicated server is running, it's headless right?
I think there's an option for displaying log of events taking place (like session started, player joined, gameplay event occured like score or kills), is that correct?

And when handling many players in many sessions, is it running multiple instances of a headless server handling interaction of many clients?
Or is a single console representing details that happen across multiple sessions?

Like I don't fully understand how it scales when deployed. Been reading through various docs but could use a point in the right direction towards this subject

twin juniper
#

for learning about networking stuff, is Lyra or Shooter Game better?

odd hamlet
#

Ok so basically my second character cant see a text that initially is hidden on the user widget, and after with some fucntions I try to get to the second player hud and to make it visible but I cant do that, any ideea why?

dark parcel
#

Hud is local to each player

#

Wdym by trying to get to the second player hud

odd hamlet
#

oh but it asks for the player coontroller to put input

#

Don`t I also need to usee the get player controller and choose between '0' and '1'

trim onyx
# odd hamlet Don`t I also need to usee the get player controller and choose between '0' and '...

Hi you should read this
https://cedric-neukirchen.net/docs/multiplayer-compendium/common-classes/playercontroller
In a matter of fact going through whole compedium should help you in a long run.

The class APlayerController might be the most interesting and complicated class that we come across. It's also the center for a lot of client logic since this is the first class that the client actually 'owns'.

dark parcel
#

Wizard mp tips and tricks tells you what not to do (get player controller with index)

#

Also you seem to not aware what objects are replicated

#

HUD is local to each client. A machine can't reach other machine HUD

candid tinsel
#

what is better for multiplayer, gas or just using server/client events?

short arrow
#

There's also a ton of optimization settings they have that you can change at your leisure

candid tinsel
#

ive heard that gas is better for games with multiple abilities like rpg games, but is it worth implementing for just a couple abilities

fossil spoke
#

Why not try and learn GAS first on a simple side project and then make your own judgment about its usefulness?

#

Asking people here is just going to result in different opinions.

#

Especially when we have no idea how you think you might want to use it or not.

candid tinsel
#

i might give it a shot but i dont know if i would use it because it would take a long time to figure out the gas system

#

for example the game im making the abilities are pretty simple like ragdoll and interacting

fossil spoke
#

Nothing ventured, nothing gained.

#

You will likely regret not knowing it in the future.

candid tinsel
#

so for lag and latency its better?

reef bison
fossil spoke
#

You need to do research

candid tinsel
#

i did a little research but its alot of different stuff about multiplayer and im not an expert so im just wondering what might be the best way to handle simple things for multiplayer

fossil spoke
#

Ok, well then learn the basics first, dont use GAS.

#

If you are that new.

#

Read the Network Compendium in the Pinned messages.

#

Read it 3 times over.

candid tinsel
#

so everything on the client side must be predicted? and also for the gas abilities does the ai behavior replication must be included in it

fossil spoke
#

No, everything on the client does not have to be predicted.

#

Forget about prediction.

#

You are clearly very new to multiplayer

#

Learn the basics like the back of your hand first.

#

Then move on to advanced topics.

candid tinsel
#

yea its my first project and ive been working on it for about a month now so its my first time doing a multiplayer game and on the internet it says alotta different things and people always mention prediction and gas and there isnt alot of information i found for the basics understanding

twin juniper
candid tinsel
uneven lion
#

Hello, this is a new error I didn't receive until upgrading to UE5.4
Network checksum mismatch. FullNetGUIDPath: [126]BP_PlayerState_C_2147481901.[134]AbilitySystemComponent
I've rebuilt/cooked everything so idk why there is a mismatch... any ideas?

devout sonnet
#

I'm thinking I need to take a break from my project and start a new one to better understand RPC and multiplayer. Any suggestions on what a good project is for that?

woven basin
# devout sonnet I'm thinking I need to take a break from my project and start a new one to bette...

So - I personally highly rate the c++ course from Stephen Ulibarri. I know some people on here dont rate courses etc - but for me and my style of learning - it was awesome. Its one of the few courses that actually gives relatively good habits, and will take you from nothing to been pretty good. He has discounts on his discord all the time - so its only like 10 or 20 bucks or something.

Another option is the c++ course by Tom Looman. I've also done that one. Its also good, but costs alot more.

You wouldnt go wrong with either of those.

The alternative is if that isnt what you want/prefer - then just start trying to do some basic things like get a chat going or throw a ball or something between 2x chars.

devout sonnet
woven basin
#

even if you dont want a "shooter" MP game - its the concepts that matter

#

anyway - something for you to check out. As mentioned - if you check out his discord- there is always discounts there. Or Udemy has loads of discounts all the time. You should be able to grab the course for like $20 or something. Dont pay the "fake" Udemy charge of like $150

devout sonnet
dark parcel
past flicker
#

I'm using a Reliable Run on owning Client RPC in BP. It is executed on Server, the RPC event runs also on server, but the RPC event never runs on the client. This takes place in a GAS ability. Any ideas how to diagnose?

thin stratus
#

What actor is the RPC in?

past flicker
#

That's probably the issue. GameplayAbility is a UObject and does some magic to replicate via some other mechanism. Maybe I can reroute through the GA's avatar actor?

thin stratus
#

Hm. Yeah in no GAS project did we ever use replicated GAs

#

Depending on what the RPC is for, yeah send it through the avatar

past flicker
#

My problem is detailed in the GAS channel if you might have a better way to achieve what I'm trying to do.

I'm trying to create a grapple system. One client activates a grapple ability, and the target activates a corresponding victim ability. I need the victim to get data from the attacker, and waiting on an event seemed the best fit. but in practice only the server is receiving an event from Wait Gameplay Event, hence the RPC attempt.

chrome bay
#

Your issue might be that ability instances are only replicated to the player who owns them, players don't know what abilities other players have

#

You can send RPC's through an instanced ability no problem though

#

But it does need to be replicated from the Server IIRC

#

Not generally a common thing

past flicker
#

The RPC is on an ability owned by the actor. Or at least, it is to the best of my knowledge. The attacker's interaction is sending an effect that grants the ability, which activates itself on Client 2. The ASC owned by Client 2 calls the RPC on server, but it never gets to Client 2 and I'm not sure why.

#

Okay I know why. I set Replication Policy to Replicate and the RPC is called now. I never considered that as an option because tranek's docs say "Don't use this option.". So now I'm wondering... is using that bad? Is tranek's wrong here?

sinful tree
#

Generally speaking abilities shouldn't need to be marked as replicated. Making them replicated fights against what they were made to do, namely help with prediction and synchronizing the abilities, and using replication kind of messes up some of the tools you have available in an ability to handle such prediction.

#

If you are trying to activate an ability on a client, but it relies on data from another client to execute, then there can't really be any prediction anyway.

past flicker
#

That is true in my case. I only need to predict the attack grapple attempt animation. The actual grapple and victim abilities are not supposed to be predicted.

#

Maybe using GAS was a mistake?

chrome bay
#

But you always end up circling back when you realise how difficult it is to make your own

sinful tree
#

The problem isn't so much GAS. It's the order of operations that you need to perofrm in order to get the result you're looking for.

chrome bay
#

Can you not just use Activate Ability With Event on the victim and pass the data along? Not entirely sure what you need the RPC for

past flicker
#

Changing data on avatars before activating my abilities has worked pretty well. Every time I try to use the events, context, payloads, it feels like hitting a wall.

chrome bay
#

Maybe I'm not seeing the whole issue here, but in my mind the attackers ability just calling Activate Ability With Event on the victims ASC (server side, ofc) and passing the data along is the "gas-way"

sinful tree
#

inb4 issues with movement/corrections.

chrome bay
#

If you're sending two independent requests that are reliant on order then it's probably a fluke that it's worked so far

#

Well if you're trying to mix GAS and Movement prediction, you're wasting your time

#

Epic themselves don't have a solution for that

#

Try making a simple stamina system with GAS attributes and CMC, experience eternal pain

past flicker
#

Using Activate Ability With Event had a lot of baggage. Last time I tried to use it. I felt like triggering abilities by tag was too rigid and that doesn't solve if I need multiple events over the course of the ability.

chrome bay
#

You don't have to use the tag method to activate them, you can call it manually and just pass arbitrary event data along

#

If you need multiple events though, then yeah, not much you can do. It's not really designed for that

past flicker
#

Not using triggers sounds interesting, but if Wait Gameplay Event payloads aren't networked it seems odd Activate would be since they're the same object. And if they are networked properly why can't that be leveraged for the task?

#

Also I do have a stamina system coming... that's going to be a problem?

chrome bay
#

All I will say is, expect misspredictions

#

CMC and GAS operate in their own space and don't talk to each other, so when one affects the other, they conflict

#

It "works", but it isn't perfect

#

This isn't really GAS or CMC's fault either tbh, the issue is there's rarely a way to trivially rollback and resimulate entire systems like that

#

The more systems you couple together, the more expensive prediction and resim becomes

#

Beyond a certain point you may as well suffer the misspredictions instead

#

NPP was supposed to help this, but Epic is yet to attempt to base GAS on NPP and after attempting similar things myself, I fail to see how it solves that problem

past flicker
#

I feel like my prediction needs are pretty basic. Play the animation instantly, wait for server on everything else.

chrome bay
#

It's more an issue when you want to stamina to be a GAS-based attribute, and modify that through GE's etc.

past flicker
#

I noticed that was a thing on some custom CMC github. I haven't had to face it yet though.

chrome bay
#

RE Wait Gameplay Event, I thought they were networked tbh. Seems pointless to have that feature otherwise

#

Presumably that does require listening via tagged events though

past flicker
#

After turning replication on my Client RPC is firing. Wait Gameplay Event Payload is correct on server and empty on client.

#

As far as listening for tagged events, I thought that would be better since there is likely only one victim ability active per client at any given time. Can't really be suplexed while you're being suplexed.

lament flax
sinful tree
#

Unless you're passing in a replicated object as the payload, then that payload object won't exist on the other side.

lament flax
chrome bay
#

Similarly, what happens if the Server changes stamina - well any predicted moves the client makes in the interim may now be incorrect, so the client would get a correction everytime.

past flicker
# sinful tree Unless you're passing in a replicated object as the payload, then that payload o...

I think you just blew my mind. Right now I'm constructing an object and attaching it to the optional object before sending the event. You're saying if I instead make that a replicated var it will exist on other client? That makes a lot of sense, but that means it's no better than just setting replicated data on the avatar, which is what I was trying to avoid because there is no guarantee it would be replicated in time.

chrome bay
#

Yeah, an object you create via NewObject or whatever won't replicate

lament flax
chrome bay
#

But the client can't sprint if there stamina is zero

#

So if stamina predictively reaches zero, can sprint is false. if the client misspredicts this, the server will fail to sprint them

#

Similarly you have to decrement your stamina in lockstep with CMC movement ticks, otherwise it will be out of sync

lament flax
#

As soon as i get back home ill screenshot the stamina part

sinful tree
nimble condor
#

Is PostInitializeComponents() called before repnotifies?

past flicker
#

That works if I invert my logic. Instead of passing direction and location I can derive that on the victim's side from the attacker's location.

chrome bay
nocturne quail
#

what that unknown range of players?
I play with two clients as dedicated server and if driver vehicle go out from this range circle and comes back in range the vehicle starts zig zag, while zig zag, if if the driver go out from range it comes in normal state and stops zig zag.
this only happen for other Clients not for the driver

fossil spoke
#

The Vehicle is being unloaded because its no longer network relevant to those Clients

#

Then it gets recreated when it comes back into relevancy range

nocturne quail
#

now i need it to auto re-invoke physics

fossil spoke
#

I cant answer why its broken

#

Other than its likely because its not being correctly reinitialized when coming into relevancy again.

#

BeginPlay is called again when coming into relevancy.

nocturne quail
nocturne quail
#

or i need to call both, disable/enable ?

nocturne quail
#

character is attached to the vehicle, on network relavency it has a conflict to reinitialized vehicle physics and character physics and in result the vehicle reinit failed?

#

this is what i can guess from this work around!

lament flax
nocturne quail
nocturne quail
#

@fossil spoke
I fixed the issue somehow, once the character possess with vehicle, i call these two line.

GetMesh()->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);

and then

GetMesh()->SetSimulatePhysics(true);
#

seems like this is a bug in UE5.3

#

since in UE4 i don't need to do it

#

seems like in 5.3 on which i am testing, have a bug where the irrelevant characters capsules is adding random zig zag physics forces to the vehicle

#

adding ECC_Pawn to ECR_Ignore or ECR_Overlap, fixes the issue

#
void AMasterVehicle::OnRep_AttachedToVehicle()
{
    if (bPlayerDriverAttachedValidOwner))
    {
        VehicleInteractionComponent->SetActive(false);
        GetMesh()->SetRenderCustomDepth(false);
        GetMesh()->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
        GetMesh()->SetSimulatePhysics(true);

        if (IsValid(GetController()))
        {
            GetController()->SetControlRotation(GetActorRotation());
        }
    }
    else
    {
        VehicleInteractionComponent->Activate(true);
        GetMesh()->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block);
        GetMesh()->SetSimulatePhysics(false);
    }
}

this is the temporary fix 😌

twin juniper
#

Why using a RepNotify over a normal Replicated variable? I don't get it

dark parcel
#

RepNotify have a function that gets called when the variable is updated (replicated from server to client).
Very useful when you want to do X when Y variable is updated.

quick plaza
#

Does anyone know why Mover Components velocity and Intent Input is always 0 in Client? Server side they are getting populated with proper values but client side always returns 0

queen mortar
#

Hey there. On my journey with multiplayer I encountered another problem that seems like I cannot fix it. This time player is interacting with an actor with line trace. If the line trace hits the actor, its components visibility is turned off and when he does again, visibility is set to true. Now client is having problem with interacting again. When client or server interacts for the second time, server sees the components visibility turn on but client doesn't. I sent the whole code but I think that just the variable 'IsVisible' is causing the problem. I'm open to any suggestions

neon summit
queen mortar
neon summit
#

every time you set it true

#

so when you interact again. it wont fire the notify

#

you can get the bool and use a not boolean and plugin

queen mortar
chrome bay
#

Where do you reset it to false?

queen mortar
#

Well I dont now

neon summit
#

on the trace event

chrome bay
#

If you set it to true and it's already true, then nothing is changing

neon summit
#

if you dont set it false then

chrome bay
#

So there's nothing to replicate

queen mortar
#

But doesnt it call the onRep even when I set it to false on the trace event?

chrome bay
#

OnRep will fire when it goes false again yeah, so long as it was previously true

neon summit
#

only fires when the valuie changes

chrome bay
#

But if you set it to true then false in the same frame, again nothing will replicate

queen mortar
#

Alright I used a delay and now it works perfectly

#

Thanks guys

chrome bay
#

Delay is probably just hiding the issue. Use a counter if you want a more reliable method

#

Remember that property updates are lossy by design, you aren't garaunteed to receive every change, only eventual state

#

If you want a reliable notify that fires each time the stove is ignited, even if it isn't still lit, use an incrementing byte. If the byte is even, the stove is unlit, if it's odd, the stove is lit

#

You can change it's state 256 times before potentially losing updates

#

Or to be honest, in this instance, an RPC probably makes more sense

#

Seems as though you're treating it as an event

queen mortar
chrome bay
#

Essentially you can treat it like a bool that actually counts changes too, so even if state is the same, you can at least tell that it changed

#

But genuinelly in this case, unreliable multicast sounds applicable

#

But the counting bool approach would avoid dropping

queen mortar
#

And what happens after the bytes value is 256?

chrome bay
#

it just wraps to 0

#

(at 255)

neon summit
#

I've never used a byte before for anything in my project so thanks for giving me ideas how to use it lol

chrome bay
#

int is same just wasteful for a type that large πŸ˜„

odd pivot
#

Anyone have thoughts on what is the best practice for multiple team members to work on Project files when using source build of the engine for client/dedicated server type of games ?

chrome bay
#

Usually distribute prebuilt binaries via a CI system, like Horde

honest rain
#

Hello πŸ™‚
I would like to add a component to my character, and the component will have a timer that deals damage each x seconds.
In order for this to work, I need to 'add component' to the character server side AND client side right ?

ancient adder
#

I'd say add it on server and let the replication handle adding it on client side

honest rain
#

makes sense I am going to try it, thanks πŸ™‚

woven basin
#

You would only have the component dealing damage on the server. The server will replicate the 'damage dealt' event to the client, and with the amount of damage etc. Using this, the client can fire a damage effect locally when the replication on_rep occurs

honest rain
honest rain
lament flax
#

how can i make the cheatmanager valid on clients ?

woven basin
woven basin
lament flax
#

its not about packaged game

#

im talking about in editor

woven basin
#

did you initialise it in the Player Controller? I dont remember having to do anything else

wispy veldt
#

I have a question about server-sided replication (player state, for example). If a client sends a 'run on server' event to the server on a player state, and the server event sets a variable (not set to repnotify), does it also automatically at that time replicate the value, or do I still need to call a multicast to all clients?

lament flax
#

the higher the lag, the bigger the delay

#

same with RPCs

wispy veldt
#

I was asking specifically if you still had to multicast, since playerstate is indicated as replicated already, so I wasn't sure if they meant anything within playerstate is automatically synced on all clients when it changes.

woven basin
ancient adder
#

Yea the playerstate it self is replicated, But you still need to set your properties in playerstate to replicate if you want them to, so yea you don't need to multicast

wispy veldt
#

Thank you

nocturne quail
#

What's wrong with this declaration?

UFUNCTION(Server, Reliable, WithValidation) void Server_DealDamage
(
UPrimitiveComponent* OverlappedComponent, 
AActor* OtherActor, 
UPrimitiveComponent* OtherComp, 
int32 OtherBodyIndex, 
bool bFromSweep, 
const FHitResult& SweepResult
);
latent heart
#

The formatting is horrible

#

Try removing the const &

nocturne quail
# latent heart Try removing the const &

this is why i am getting this error right?

declaration is incompatible with "void AMasterVehicle::Server_DealDamage_Implementation(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)"
#

const & will fix it?

latent heart
#

I made a typo.

#

I meant removing it.

nocturne quail
#

ah, so i don't need it const right?

latent heart
#

And the &

#

It's only a guess.

nocturne quail
#

yeah after removing const, now new error: Replicated parameters cannot be passed by non-const reference

lost inlet
#

It should be const ref

#

but this is an over-redacted error

nocturne quail
#

with const ref the first error

#

or it is actually complaining about WithValidation ?

thin stratus
#

ServerRPC to deal damage? Guess you don't care about cheater.

lament flax
nocturne quail
thin stratus
#

:P It's a ServerRPC to deal damage, that's what the name and signature says

#

This has nothing to do with Auth. it's quite the opposite actually.

nocturne quail
thin stratus
#

Then why is it an RPC

nocturne quail
#

updating health value on friends screen

thin stratus
#

That's not related to there being a "SERVER RPC" for Dealing Damage.

#

Why are you calling a ServerRPC to Deal Damage?

#

Especially if it's located after a HasAuthority check, which means it's on the Server already?

lament flax
#

Does it costs something to call server rpc on server ?

nocturne quail
# thin stratus Especially if it's located after a HasAuthority check, which means it's on the S...
void AMasterVehicle::ApplyDamage(AActor* HitActor, float DamageAmount, const FHitResult& HitResult)
{
    if (HitActor)
    {
        UDamageType* DefaultDamageType = UDamageType::StaticClass()->GetDefaultObject<UDamageType>();

        FPointDamageEvent PointDmg;
        PointDmg.DamageTypeClass = DefaultDamageType->GetClass();
        PointDmg.HitInfo = HitResult;
        PointDmg.ShotDirection = GetMesh()->GetForwardVector();
        PointDmg.Damage = DamageAmount;

        float ActualDamage = HitActor->TakeDamage(PointDmg.Damage, PointDmg, GetOwner()->GetInstigatorController(), this);

        if (ActualDamage > 0.0f)
        {
            // Play damage effect or any other visual feedback
            // ...
        }
    }
}

void AMasterVehicle::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    if (!HasAuthority())
    {
        Server_DealDamage(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
        return;
    }

    ApplyDamage(SweepResult.GetActor(), 100.0f, SweepResult);
}

bool AMasterVehicle::Server_DealDamage_Validate()
{
    return true;
}

void AMasterVehicle::Server_DealDamage_Implementation(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    ApplyDamage(SweepResult.GetActor(), 100.0f, SweepResult);
}

this is how i did it

soft peak
#

It costs a little, sure, because you're invoking the handler that decides where to send the function.

nocturne quail
#

TakeDamage() is auth controlled in character class @thin stratus

thin stratus
#

Your Overlap should not call a ServerRPC

nocturne quail
#

then what should call it, since its a vehicle

thin stratus
#

On top you can always make your own Interface for damage instead of using the build in one

thin stratus
# nocturne quail then what should call it, since its a vehicle
void AMasterVehicle::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    if (HasAuthority())
    {
        ApplyDamage(SweepResult.GetActor(), 100.0f, SweepResult);
    }
}
nocturne quail
thin stratus
#

What RPC and why?

#

Overlap already happens on basically everyone. Limiting it to HasAuthority already ensures it's on the Server.

#

ServerRPC is absolutely redundant here

nocturne quail
#

Server_DealDamage_Implementation

which calls float ActualDamage = HitActor->TakeDamage(PointDmg.Damage, PointDmg, GetOwner()->GetInstigatorController(), this);

thin stratus
#

No, just get rid of the ServerRPC

#

It's not needed

nocturne quail
#

TakeDamage should always be called on server, TakeDamage is my custom damage system

thin stratus
#

Missty

#

OnOverlapBegin is called on the Server and Clients

#

if (HasAuthority()) limits it to the Server

#

The event is already on the Server.

#

The RPC is redundant

#

aka not needed

nocturne quail
#

yes i don't want to call it on clients

soft peak
#

If you want to broadcast the damage out to everyone (for instance, to put damage numbers over their head), ApplyDamage would call some UFUNCTION(Client) Client_OnApplyDamage(/* stuff */);. If you wanted to broadcast the message to everyone so everyone can see the numbers over their head, that'd be UFUNCTION(NetMulticast).

thin stratus
#

That's what the HasAuthority is for

thin stratus
soft peak
#

Whoops, you're right.

#

UFUNCTION(Client).
Edit: Have fixed the previous comment.

thin stratus
#
void AMasterVehicle::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    /// Called on Everyone

    if (HasAuthority())
    {
        /// Server Only
    }
    else
    {
        /// Clients Only
    }

    /// Called on Everyone
}
nocturne quail
# thin stratus That's what the HasAuthority is for

so here i am calling it two times on server right?

void AMasterVehicle::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    if (!HasAuthority())
    {
        Server_DealDamage(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
        return;
    }

    ApplyDamage(SweepResult.GetActor(), 100.0f, SweepResult);
}

πŸ˜‚

#

got it got it

thin stratus
#

In theory yes, you call it on Everyone at the bottom and you let the Client send an RPC to the Server

nocturne quail
#

Thanks for correcting me

thin stratus
#

And then if you want to display damage numbers on Players, you can always send a CLIENT RPC to the Clients with some limited information about what happened AFTER you applied damage.

#

Like Indigo suggested

nocturne quail
#

yeah for that i have a onrep_stateupdate to do it

thin stratus
#

Or that, yeah

soft peak
#

Yeah, if the health values are replicated already and you don't need contextual information about damage type, an onrep function would be the way to go.

#

Has anyone here run into problems with a dedicated server not detecting collisions between Chaos vehicles and static objects in UE 5.4? For some reason, I'm seeing collisions in PIE and on clients, but the dedicated server doesn't even enter FPhysScene_Chaos::HandleCollisionEvents, to say nothing of firing collision events. I'm trying to figure out why that might be happening. I thought UE simulated vehicle physics on the server, and it does seem to override our client's simulation if I force a breakpoint to halt the server for a bit.

sour dragon
#

Hello, short question. How can i join the game delayed with one client? I want to test out if my variables replicate properly if i join with client 1 (both play as client), do some stuff in inside the PIE Session, and then after a delay join with the 2nd Client to see if it syncs up.

soft peak
#

I don't know how to do that in PIE. I would suggest making a packaged build for the second client. Maybe someone else will know a better way.

sour dragon
#

Not even google nor chatgpt does know :D, thats why im asking. I saw someone did it in a youtube video somehow, but i mean there must be a built in way to test this right? This is fundamental

dark edge
hollow eagle
#

You can have clients start in standalone and connect them manually to a server (or start a listen server with one), or there's an option in editor prefs somewhere to allow creating new PIE clients while a game is already running.

#

Search for "allow late joining" in editor prefs. It'll let you click the play button after already in PIE to create additional clients.

sour dragon
bright summit
#

I am setting in PlayerController class variable in server RPC like:


void ABasePlayerController::Server_SpectateNext_Implementation()
{
    ABaseSpectator* BaseSpectatorPawn = GetBaseSpectator();

    if(BaseSpectatorPawn && !bIsSpectatingFreeRoam)
    {
        GEngine->AddOnScreenDebugMessage(-1, 5, FColor::White, TEXT("We are spectating, we can SpecateNext()"));

        CurrentSpectatedPlayerState = GetNextViewablePlayer(+1);

        if(CurrentSpectatedPlayerState)
        {
            CurrentSpectatedPlayer = CurrentSpectatedPlayerState->GetPawn();
            BaseSpectatorPawn->SetSpectatedPlayer(CurrentSpectatedPlayer);

            GEngine->AddOnScreenDebugMessage(-1, 5, FColor::White, TEXT("We are spectating: ") + CurrentSpectatedPlayerState->GetPlayerName());
        }
    }
}```


Have DOREPLIFETIME added in GetLifetimeProps, but it is not getting replicated to client, why? OnRep is not being called.

Am I missing something? Tried setting SetReplicates(true)
bAlwaysRelevant = true;

Ofc in server everythings works well
thin stratus
bright summit
#

It is flagged as replicated in header file and marked with doreplifetime macro

thin stratus
#

And the BaseSpectator is replicated? Wasn't specatating mostly local?

wispy veldt
# lament flax the higher the lag, the bigger the delay

I see what you mean about the lag/delay. What's the correct way to know when the RPC call comes in? As a workaround I added a little bit of a delay on the server side before calling the client event and that seems to work but I'm sure network latency would make it less reliable.

bright tiger
#

What happens if I create a ActorComponent with a replicated property but later I decide to not replicate the component in the AActor I chose to attach to?

Does the component property still being sent through the network even though the component itself it’s not replicated?

sour dragon
#

When i want to make sure a player that joins late can see the Fire FX, how do i do that properly with a Repnotify without breaking the existing Code?

#

I just need a simple example for this to understand how i would do it in such a case, i can figure out the rest myself

#

So to be precise, what variable do i store in the repnotify (the On Bool?) for it to be propagated to players that joined late or does it NEED to be the whole function? And where to put that repnotify?

wispy veldt
#

Maybe set 'fire on?' to be repnotified, and on the repnotify_fireon event, call 'showfirefx'

#

the event will be created automatically once you mark fire on? to be repnotified

sour dragon
#

Thanks, it works if i do it like this, the on off toggle works

#

Im just not sure if its the proper way to use a replicated variable for the new visibility?

#

I mean doesnt this mean the CURRENT clients get notified twice this way? One time by the multicast and one time by the repnotify?

bright summit
sour dragon
#

Or does Net Cull Distance handle all this?

rustic sable
#

Since you can't have a return type on a replicated function, how would you handle a function that previously returned a bool to check if something worked?

lost inlet
bright summit
# thin stratus And the BaseSpectator is replicated? Wasn't specatating mostly local?

yes, that was the reason, don't know why I was checking for spectatorpawn on the server. Spectator do not exists on the server and that's the reason I moved my code from SpectatorPawn to Controller xd everything works now as excepted but the main problme is a lag when switching players to spectate but it is innocent(?) don't know is it right word

twin juniper
#

--
what will happen when I put some code in the Server RPC?

Me: Run on the server and ??? replicate to all clients?

#

stuff there will be replicated to all clients automatically?

vapid gazelle
#

Does the engine typically not bother doing property replication, even when running a game in the editor as a Listen Server, when the number of players = 1? I noticed that my OnRep_ functions only trigger when I bump the number of players to 2, so I'm guessing it's optimizing away doing replication when it knows that server==client?

hollow eagle
#

there's no "optimization" going on, OnReps are only fired on clients.

#

And there is no client with a single player and a listen server.

vapid gazelle
#

Ah I see, thank you. I assumed there would be a client when I use Listen Server mode.

twin juniper
sinful tree
# sour dragon

This doesn't need to multicast. All that is required is the repnotify variable being changed on the server. The repnotify then can directly change the visibility or call any other functions that will be called locally on all machines when the value is received.

dark edge
odd hamlet
#

in my multiplayer in the blueprint of the map I have the code as in the picture, how is it possible tthat it spawns that blueprint twice? even with an has authority and an custom eventt with run on server?

soft peak
#

Maybe I could start somewhere simpler with my question: Assuming all objects involved have the "Simulation Generates Hit Events" checked, is there any reason OnActorHit() wouldn't fire on a dedicated when a Chaos vehicle runs into a static object, when the client sees the OnActorHit() event?

odd hamlet
#

yep

dark edge
#

don't

#

I'm not sure but I doubt level BPs replicate, so both sides would pass HasAuthority I'm pretty sure.

#

Just don't use level BP until you know when and where it's appropriate

twin juniper
dark edge
#

maybe for level specific stuff like if you had some level where some unique thing should happen

twin juniper
#

thyat's what I was thinking, it seems to be the place for putting random stuff when you are starting, it just helps to get you started

#

1 more thing, do you use Validation with RPCs?

lost inlet
#

It Depends

odd hamlet
dark edge
#

a map isn't a thing that's spawned

twin juniper
#

it's loaded

odd hamlet
#

I have a blueprint that represents the map for the players ( procedural random spawn of rooms)

#

sorry for confusing you

dark edge
#

just put it in the level

#

let it do the room spawning on begin play

twin juniper
#

Is this correct: "so that wouldbe a Multicast, for the visual to be on all clients, but not on the server (using if(!HasAuthority)) "

twin juniper
# dark edge wat

ex: a client shoot a bullet, then there's another client close to him, the server would handle the collision check and the damage and these stuff, for the visual part, would that be done with a multicast to add some kind of particule effect for all clients

dark edge
#

Sure, if you wanted to

#

there's other ways to do it too

twin juniper
#

I'm curious

dark edge
#

If the bullet existed on all machines it can just play particle effect locally whenever it hits anything locally

hot scroll
#

Unreal has a built in PacketHandler and Encryption support for it that uses OpenSSL.
Is it any good? Complex to set up?
Do folks use it for their client-server setups?
I'm assuming so. I found the Alex K article about it and figuring out when I'll fit that into my project.

twin juniper
#

so make that bullet be replicated

dark edge
#

fully depends on your design really

twin juniper
whole iron
#

Sorry to bug you months later! Did you end up getting it to work? Also any advice or tips or resources for someone trying to implement proximity VC (going to be using steam subsystem) and or any effects and such for proximity?

unique garden
#

Howdy Guys
I'm an expert 3d characters and 2d artist expert in rigging, sculpting, rigging, modeling, game assets, props for movies, games, and animations. I make use of blender, Maya, and Zbrush. I can model anything based on the references provided.

sweet sage
#

"Does Iris support push-model replication?
Yes, Iris supports push-model replication. While it is possible to fall back on a polling-based approach, the plan for Iris is to treat push-model as the default approach, allowing for further optimization than the current implementation allows."

How do i use push model with Iris?

#

The properties are replicating even if not marked as dirty

#
    FDoRepLifetimeParams Params;
    Params.bIsPushBased = true;

    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedMainHand, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedOffHand, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedHeadArmor, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedChestArmor, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedLegsArmor, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedFeetArmor, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedHandsArmor, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedMount, Params);

    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedHair, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedEye, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedBeard, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedBrow, Params);




    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, ExpectedRace, Params);
    DOREPLIFETIME_WITH_PARAMS_FAST(AMmorpgPlayerCharacter, Name, Params);
#

DefaultEngine.ini

[SystemSettings]
net.SubObjects.DefaultUseSubObjectReplicationList=1
net.IsPushModelEnabled=1
net.Iris.UseIrisReplication=1
#

Do anyone has this problem?

woven basin
#

Does anyone here ever actually run their multiplayer testing under one process? I just seem to keep running into issues that I need to have it always off.

For example - I just discovered on a blank new project that when running as one process, console command output run on the server console is random ending up on one of the clients as output

So my question is -is there ever a "safe" way to use one process in MP testing, or should 100% of testing be done with seperate processes, slowing down the client boot times and just put up with it?

hollow eagle
#

yes, it is the primary way you are intended to be testing multiplayer in the editor

#

having to run a separate process while iterating on something requiring multiple clients would slow down workflows considerably

fossil veldt
#

ye not using single process mode is a cope, usually problems come when you're using things that are shared like static delegates

hollow eagle
#

just about everything works fine as long as you're following best practices. Like not using global variables or shared static ^

fossil veldt
#

aka pretty much - don't ever use FWorldDelegates for anything

#

or anything that works similarly

woven basin
hollow eagle
#

some functionality in the editor is shared by all worlds

woven basin
#

but ok - good to know if I follow good practice - I'll keep it in mind

hollow eagle
#

showing an error on one screen doesn't indicate anything major is broken

fossil veldt
#

also don't use GWorld ever :)

#

unless you really have to

#

and rly just respect the context of game instances

woven basin
fossil veldt
#

and you will be fine

woven basin
#

hence my confusion

hollow eagle
woven basin
#

all good - at least I kinda understand now - so thanks for that

nova wasp
#

FAutoConsoleCommandWithWorld is useful to have a command that has what world it was triggered from

fossil veldt
#

I was about to mention this ^

#

aslong as you have the world context ur good

woven basin
#

yeah - more just need to see which part of the default console Epic has using the global?

#

I've changed the source build slightly (not on the screenshot project, I checked it was standard) - where I can enable console in shipping, but it whitelists and strips all the commands to just what I want through the console. So was going to use it for some required commands we want in shipping.

woven basin
nova wasp
#

(cheat commands with UFUNCTION(Exec) should work too)

#

but they of course have limitations as to where you can put them

fossil veldt
#

you can use ECVF_Cheat aswell on FAutoConsoleVariableRef

#

if u need a CVar

woven basin
#

thanks all - maybe its my fault - i might have still had the project on the wrong source build - so I'll go double check.

Either way - some good knowledge above I can use - appreciate it.

dark edge
#

dafuq would I know bout that

woven basin
hollow eagle
#

no, not even remotely

woven basin
#

thought so - just double checking. thanks

hollow eagle
#

if there's a single instance of a thing for the whole process then it's shared by all worlds

#

a singleton - a true singleton, where there is one and only one - would be shared by all PIE instances.

#

Which is not safe (unless you're trying to marshal data around to the editor for non-gameplay reasons like for a custom debugger, that'd be another story)

#

and "safe" here isn't about crashing so much as data being incorrectly shared between separate PIE instances

woven basin
#

so then never use singletons for multiplayer? cause otherwise you'd also be tripping up with PIE testing if they get shared?

hollow eagle
#

not "never" - don't use them if you aren't intending to share data across the entire process.

#

If you want something per PIE instance you can use a game instance subsystem.

#

you shouldn't use singletons even if you're doing singleplayer either - unless your intent is to share data across separate runs of PIE.

woven basin
#

maybe this article is confusing me

#

I thought a subsystem was a singleton

hollow eagle
#

They aren't true singletons.