#multiplayer

1 messages ยท Page 717 of 1

gritty flume
#

Thanks a lot for helping me overcome that blocker! much appreciated<3

coarse mirage
#

Anyone knows what plugin i need to use for UE5, when trying to make multiplayer? Do i need the Online Subsystem Steam or the Steam Advanced Sessions Plugin ??

fathom aspen
jovial dawn
#

Hi all, I've created a small multiplayer game but I'm a bit confused on how to save my player to an external database and create a login menu and load my character. I have a website with a mysql database so I guess that should be enough to store the player information. From what I've read, I need to create some sort of lobby/login but I don't know where to start? Are there any tutorials on this subject? or examples. maybe so I would like to find the right security way to not get hacked from the beginning lol. I was thinking of creating a login page on my website and with a confirmation via email a code will be sent and the player will have to enter this code when he starts the game. I know that some games already use this method... but what bugs me is how to save and load the data.

glacial talon
#

Does anyone have Network Prediction working in 5.0.1?

latent heart
#

Does it actually work? I thought it was vaporware by this point.

glacial talon
#

Was "working" in EA, now it's an instant crash when used with a client

latent heart
#

And the crash is?

glacial talon
#

something about the rewind data not having any frame history, I can't make much sense of it

#

set your default pawn to NetworkPredictionExtras_ControllablePhysicsBall with >1 players and try to PIE boom crash

hoary spear
#

I always thought one had to layer it once more due to some ownershiprules and whatnot (not my area tbh), but cool to know that it can be called directly like that!

kindred gazelle
#

You can try a rep-notify bool called something like "IsOpen". Rep-notifies will create a function which is executed whenever the variable is changed. You could then put the timeline on a separate custom event which is called in the notify function. Whether the timeline plays or reverses would then be based on the value of "IsOpen". And after "Event Interact", you could get "IsOpen" and set it as the opposite of what it currently is.

pallid mesa
#

wouldn't put the timeline in the onrep. On the OnRep I'd simply pop-open the door

#

let the fvx and sfx and smooth movement be processed by your non stateful code

kindred gazelle
pallid mesa
#

onrep shouldn't call an event that calls the timeline, that's what I am saying ๐Ÿ˜„

#

but timelines are okay for this use case, you can make your door open in a nice way with some awesome curve

#

why this

#

because if people join the match/game or if someone enters the relevanvy sphere of the door

#

they will get to see the doors making noises and smoothly opening/closing

#

which is not needed

hoary spear
#

And probably not desired

kindred gazelle
#

True, but on the other hand its now client-side so any lag won't affect the animation

pallid mesa
#

noo

#

its not client side

#

overlaps run separately sv and client and on authority you can pop open it after the fact... take a look at UT doors code

#

their impl isn't perfect but the concept is there

kindred gazelle
pallid mesa
#

no, no rpc's needed

#

remember that overlaps get called in the server and client

#

you can check for authority and swap an onrep whenever you want

#

ie: exec timeline -> on finish -> authority -> onrep to true/false

kindred gazelle
#

Yes. Try doing the same thing in the door blueprint, but also once you've done that send a screenshot of your blueprint here since it sounds like something isn't quite right

pallid mesa
#

if this isn't an overlap then you'd need to bring this behaviour to the server somehow... by means of a server RPC

#

but interaction needs to pass by the controller

pallid mesa
#

noo, you did very good looking into interaction interfaces

#

buut your character shouldn't know he's interacting with a door

#

basically all the character should do is to handle the replication bit

#

and the door is going to be your interactor

#

so these events you have there in the character

#

should be moved to the door

#

so now the task is

#

you need to find a way to bring this server/cli interaction calls to the door BP

#

and the door bp is going to do the rest

#

and by doing it that way, you'll be able to provide a more generic and encapsulated view of how to interact with things

#

now give it a try ๐Ÿ˜„

#

ye

#

but remember your door needs to get the server and client call for your interact event

#

so you will have to handle the replication bit in the pawn

marble fox
#

Why can i not set bReplicateMovement = false? It just says Member is inaccessible. I Have incluced the actor.h and ye

winged badger
#

is it private?

#

if so there will be a SetReplicateMovement function instead

marble fox
#

Yeah i just tried that

bitter oriole
#

Show the code, show the output log.

real ridge
#

can someone tell me how are lobbies created does anyone have experience with it ?

#

like lobby with team a and team b and 5 and 5 players and they have readinness status

#

ready or unready

#

i have eos i dont know if lobbies are included there

marble fox
pallid mesa
#

that looks much better! @feral narwhal

#

There are ofc things to improve but the key ideas are there

#

now... remember that we might be interested in letting the door have the client call aswell.. listen servers don't require to server rpc as they are authority already

#

so in listen servers the server is a player, thus you won't need to do any RPC in such case

#

so something convenient is two check authority and only issue the rpc if you are on a remote connection

#
  • giving the door the client handle opens room to prediction
#

so its convenient to have ๐Ÿ˜„

finite goblet
#

Can you have beacons between two standalone clients?

frosty remnant
#

Pawns are listed in the intersection, but that depends entirely on how/where you spawn them, correct?

#

If you spawn a pawn in server-only code, that pawn only exists serverside. Likewise for client-only code. I've got that correct, right?

pallid mesa
#

Yes, only if the pawn isn't replicated

#

if the pawn is replicated when you spawn it on the server, the pawn will replicate to the clients

#

So what this diagram means is that replicated pawns are in the server and in the clients (without making distinction on local client or not)

young kestrel
#

So I'm doing what the docs says to do but I can't seem to be able to override certain functions.
The "serialize" when overriding returns a Linker Tool error (LNK2019).

Another Issue I found when following the instructions is that my game freezes completely. I seem to be able to join but nothing works, even the editor completely hangs up.

It would have been great if Epic actually would have done a real guide to that instead of a very small side note that even has errors in it (like the FCharacterMoveResponseData doesn't exist, only the Container does).

I guess I'll be stuck on that issue for a while until I know how to fix that LinkerTool issue.

marble fox
#

Hey so just a question, If i set something as replicated and do if (HasAuthority() Destroy(), Shouldnt it destroy on the server and then replicate for every client?

#

Im still learning this so yeah

solar stirrup
#

Yep, it'll destroy it on clients as well

marble fox
#

yeah but i did a fast if statement and i dont have authority which i wonder why, And in a tutorial im looking at he just uses SetReplicates(true) and nothing more then he jsut does a if statement and destroys it

#

Heres like how i kinda did it, Im still very new to this so dont judge ๐Ÿ˜„

solar stirrup
#

You need to call Interact on the server

marble fox
#

So like this?

#

ahh i see

dusty radish
#

hey, I may be missing something here but I'm calling to the player controller to create a widget in a session and the host creates the widget no problem but when the client creates the widget it's added to the host's screen. any help would be amazing. here's some screenshots of the setup. I'm using UE 5.0.1

fathom dust
#

If I want to represent a state machine on the server via a replicated enum property in the GameState, with the guarantees that 1) every client sees every change (none are skipped) and 2) the changes happen in the same order, what approach should I use?

#

I've found that regular replicated variables will skip intermediate state changes if they happen quickly.

fathom dust
dusty radish
#

hmmmm that appears to be an issue, the server is responding to both the host and client joing the session

fathom dust
#

If not, you can make the CreatePlayerCounter a Client RPC

#

Client + Reliable

dusty radish
#

So I created the using the event begin play instead and that seems to work really well

#

ah it makes the widget on the client but also make another one on the host

fathom dust
#

yeah

dusty radish
fathom dust
#

I think you should use the New Controller pin from the Possessed event

dusty radish
fathom dust
#

Click on the red CreatePlayerCounter event node in the player controller

#

And you should be able to change it in the details panel. I am on a phone and don't recall exactly where it appears in the UI

#

There's a really good PDF that Cedric Neukirchen wrote

dusty radish
#

That's great! I've got them created not I just need to replicate the variable, thank you for the help and I'll give that a read

marble fox
# solar stirrup You need to call Interact on the server

But i still quite dont really understand, Does everything that should replicate be connected to a rpc? Well i guess yes now since this worked but OnRep etc i understand what it does, When the replicated variable changes the onrep gets called but when should i use OnRep and just HasAuthority? Its a bit unclear in my head still

#

And doesnt RPC's need to be bound to the character also?

solar stirrup
#

You'll need to call it on an actor you own, so PlayerController most of the time

#

You want to execute most things on the server since in the end, it has authority over the game

marble fox
#

So for this example i have a delegate that my pickup binds too in the constructor and via that the character gets called, And since that is called the main func will also work like that, So doesnt that mean everything almost has to be called on the playecontroller / pawn+

marble fox
solar stirrup
#

Unless you own an actor, you can't call a Server RPC on it as a client, so yeah you might have to route things through the PC/Pawn sometimes

marble fox
#

If thats the case i got no idea how this works XD, Since the videos im following he just made the weapon system and its an Actor class by it self it isnt childed or anything just a brand new Actor c++ class with a bunch of code and it has a bunch of rpcs

compact talon
#

does seamless travel using the server travel node (advanced sessions with steam subsystem) not work in the UE5 editor?

#

I have play as listen server with 4 clients and using ServerTravel does nothing but return "true"

latent heart
#

Oooh

#

I thought that green leaf thing was some new trend.

#

It's just a new person indicator. ๐Ÿ˜ฆ

lime ledge
marble fox
#

I still dotn get how this works, Clients can see whats happening even tho it isnt going through an rpc?

young kestrel
marble fox
#

Can someone tell me why this will work with HasAuthority() even tho i havent made a Server function for this?

lime ledge
lime ledge
marble fox
#

Im doing all of this using a dedicated server

young kestrel
lime ledge
lime ledge
marble fox
young kestrel
# lime ledge Hmm, sorry it is a bit hard to say what your problem might be. Maybe you can pos...

The original was on German, so this is a translation

LNK2019 Reference to unresolved external symbol ""__declspec(dllimport) bool __cdecl UE::Net::WriteQuantizedVector(int,struct UE::Math::TVector<double> const &,class FArchive &)" (__imp_?WriteQuantizedVector@Net @UE@@YA_NHAEBU?$TVector@N@Math@2@AEAVFArchive@@@Z)" in function ""bool __cdecl UE::Net::SerializeQuantizedVector<10>(struct UE::Math::TVector<double> &,class FArchive &)" (??$SerializeQuantizedVector@$09@Net@UE@@YA_NAEAU?$TVector@N@Math@1@AEAVFArchive@@@Z)". StylzMainProject F:\Projects\UE5\Stylz\StylzMainProject\Intermediate\ProjectFiles\StylzCharacterMovementComponent.cpp.obj 1

Never saw an error like this before, so it's pretty cryptic to me.

#

The error appears twice. The same one.

lime ledge
lime ledge
# marble fox Yeah, But i got no idea how that works since the EquipWeapon function is only on...

Right yeah I think you need to get your head around the general multiplayer concepts a bit further ๐Ÿ™‚ But any function you create can be called on either the client or the server (but not called on the server from a client, or vice versa unless it is an RPC). In your case the client can call that function locally (no communication with the server), but it won't do anything due to the check for authority. Hopefully that makes some sense ๐Ÿ˜›

young kestrel
marble fox
#

Cause im getting a bit confused rn, I only have a few RPCS inside the character and none of them connects to this function

young kestrel
#

Okay that fixes the issue with the compiling. Now I need to find out why the whole game + editor freezes when joining the server.

[2022.05.21-18.08.19:813][520]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 0.70, Realtime: 21.00. IpNetDriver_1
[2022.05.21-18.08.19:813][520]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 0.70, Realtime: 21.00. IpNetDriver_2
[2022.05.21-18.08.19:824][521]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 21.00, Realtime: 21.01. IpNetDriver_0
#

Okay I found the issue

#

Thanks for helping me ๐Ÿ™‚

lime ledge
marble fox
#

Like this Inside my weapon is a function called OnEquip that just calls the attachmeshtopawn, And that func looks like this

#

But there is not a single rpc that calls these functions so how can the other player see that it is in the hand

#

So how can the other players see it i dont understand

#

This is the character function btw

dusty radish
#

I'm calling this function when the host quits the game so that the client will be disconnected properly and then will be allowed to connect to another session but the session isn't destroyed on the client side. can anyone see something I missed?

marble fox
latent heart
lime ledge
# marble fox Yes ik it has OnRep_EquippedItems() but should that really make a diffrence so a...

Depends what you do in there ๐Ÿ˜› It's very hard to say what is going on for you, but I'll throw out some random suggestions.

  • Could be a replicated property
  • Could be one of your RPCs telling them to equip
  • Could be your MeshComponent is replicated
  • Could be all your clients are actually equipping locally (say when you run over a pick up, for example)
  • Could be something else ๐Ÿ˜›
pallid mesa
#

depends โ„ข๏ธ

marble fox
#

And all that happens inside the OnRep_EquippedItems is that it calls OnEquip

pallid mesa
#

if you are setting that replicated variable in the server, there you have it

#

this is the typical ShooterGame style weapon equipping code

marble fox
#

So if i do like in GetLifetimeReplicatedprops, DOREPLIFETIME(ASurvivalCharacter EquippedWeapons) will that automatically be on the server?

#

Like this

pallid mesa
#

nope

#

like.. from a client you can get to the server through a RPC

marble fox
#

yeah i understadn that

pallid mesa
#

onreps triger behaviour when the variable value changes

marble fox
#

yeah

pallid mesa
#

so you can put a breakpoint and use the debugger to find out the role

#

callstack will provide the execution flow

#

so you can figure out where this server execution comes from

#

it's a bit - advanced... but the sooner you grab the debugger the better

marble fox
#

So wait wait, ah idk how i should say'

#

It isnt getting called from any rpcs thats all i know

pallid mesa
#

well the server flow should come from somewhere you know

marble fox
#

yeah ik but i cant trace it down

#

Inside Weapon.cpp it isnt any rpcs there either

pallid mesa
#

debugger is the solution in these cases where dry reading the code is complicated

#

but yeah dry reading the code can be a bit complex as you are seeing here

#

probably the character handles parts of that

#

ie: switching weapons ect.

marble fox
#

yeah

pallid mesa
#

my suggestion is for you to explore what happens when you press the switch weapon button in your character

#

maybe that's insightful

marble fox
#

yeah it happens when i pickup the weapon / equip the weapon

pallid mesa
#

mhm then track the switch weapon behaviour starting in the character

#

because when you press a key in your KB from a client, that's client code that needs to be brough to the server

marble fox
#

yeah

#

The interact function is not going through a rpc but it gets called inside a function that goes through a rpc so i understand how that works

#

ahh i found it im pretty sure

pallid mesa
#

oh!! Good job!!

marble fox
#

Its just it is such a dynamic system so it was hard to find

pallid mesa
#

yep!

#

multiplayer code can get complicated to read ๐Ÿ˜„

#

glad you got it!

marble fox
#

Since it has an inventory etc, It has its own UObject then its own Actor that is actually spawning etc, And the uobject is based of another class that has everything inside it im pretty sure

#

or no wait what

pallid mesa
#

Some multiplayer articles I wrote:

marble fox
latent heart
#

Implicit = it is not said, but is still true.

#

Explicit = You are told

marble fox
#

So it is like this void functionName() { OnRep_OnRepNameHere() }
will this call on the server too? I just realized im not so good at english after all

pallid mesa
#

haha in this case it means that server onreps won't get called in C++

#

unless you call the function

#

yes correct eggo

latent heart
#

No it won't..

pallid mesa
#

but usually you'd do a wrapper

marble fox
#

2 answer now my brain is twisted

pallid mesa
#

if you call the onrep function explicitly from the server

#

it will execute the code of inside the onrep function

#

what @latent heart says is that this doesn't imply any RPC

#

or any... client->server

latent heart
#

But just running that function from anywhere won't call it on the server. It will call it locally.

pallid mesa
#

correct!

latent heart
#

You need to call it from the server to run it on the server.

pallid mesa
#

yes

marble fox
pallid mesa
#

no

marble fox
#

It was thist part i got a bit confused at what you meant

pallid mesa
#

only if you call it from the server

#

so setting a variable != calling a function

latent heart
#

That is there because, in BP, OnRep functions are called on the server automatically when you change things on the server.

#

In c++, you have to call them yourself on the server.

pallid mesa
#

yes, but he's right

#

it's not very well written per se

#

let me try to write it better

marble fox
#

ah alr, Now my brain got even more confused cause im trying to search for where this get's called on the server

latent heart
#

Basically you have some sort of code pattern like this

marble fox
#

It has to be inside EquippableItem or something since that is literally where all the equip items are a child of

latent heart
#
{
  MyValue = NewValue;
  if (Server)
  {
    OnRep_MyValue();
  }
}```
pallid mesa
#

correct

#

actually... sometimes

#
SetMyValue(int NewValue)
{
  MyValue = NewValue;
  if (Server)
  {
    MyWrapper();
  }
}

OnRep_MyValue(){
  MyWrapper();
}
#

I've seen that also lots of times

#

which is also valid

latent heart
#

Yeah.

marble fox
#

yeah i asked inside the discord server where the tutorial / tutorial dude is at rn

#

I asked him about this how does this HasAuthority() go through

pallid mesa
#

I mean without context, clueless

#

anyways I gotta do a revision based on your feedback eggo

#

trust me, it was great!

marble fox
#

alright :D, No worries i guess

#

Alright im just gonna ask some more questions

#

So this whole function is actually coming through an rpc from the character, And the rpc does the useitem on the Item.h which this equippable item is a child of so i guess that would make this use also through the server

#

And does that make every other function inside this one also go through a rpc? So like Setequipped also gets through the server?

#

cause then everything i understand how it goes through, Cause then the bEquipped that is replicated gets set to a new value and if that is also on the server then everything makes sense

compact talon
#

seamless server travel seems to persist the player controller through levels, which is behaviour I wasn't expecting.

Is this reliable? Can I store information such as player cosmetics on the player controller and have it apply to the character on spawn?

I was originally going to save that information on the host and on level change I would deliver that information to each player controller manually as I didnt expect it to persist

pallid mesa
#

@marble fox @latent heart A bit more verbose, but does it now read better?

pallid mesa
#

the RPC gets you to the server

#

it's like taking a ramp

marble fox
pallid mesa
#

"to the server I go"

#

yes everything after the server RPC that follows the execution flow will be on the server

marble fox
#

ahh then it all makes sense

pallid mesa
#

๐Ÿ‘

marble fox
#

Its calling so many functions tho so in the end after tracking i got to the equip function which pretty much does everything

#

As you can see here

#

and all this comes from the use function

#

So its like idk how many functions it goes through

obsidian cargo
pallid mesa
marble fox
#

alr let me read 1 sec

pallid mesa
#

that's the pattern I follow the most

#

see here

obsidian cargo
#

Where is this written?

obsidian cargo
#

Keeping things descriptive and concise is so difficult with programming

pallid mesa
#

@obsidian cargo Pinned

#

probably provide also code with the example?

#

๐Ÿ˜„

compact talon
pallid mesa
#

TBH @compact talon haven't dug much into the benefits of seamless travel, so I cannot give you a proper answer

compact talon
#

I see, I am very new and I dislike behaviour that I don't expect. What I was expecting is on map change everything to reset and then I would manually transfer over the information I want into the new level.

I am having issues with seamless as it keeps the player controller persisted so information I don't want passed is getting passed etc

#

I should probably just change my game so it works better with seamless travel, but it is very intimidating

pallid mesa
#

"...to call the contents of the onrep..."

#

eeeeh not too sure

#

๐Ÿ˜ธ

#

writing this down so its super duper clear is hard haha

obsidian cargo
#

Gah, handling the OnRep / RPC order of 3 interrelated things is a pain.

#

I'm basically following the the pattern (pseudocode) OnRep_ThingA() if (!ThingB || !ThingC) QueueForLater()

#

It kills me that I know I'm going to do a lot of Queueing when the data IS THERE, but the RPC / OnRep fired in the wrong order.

pallid mesa
#

yeah those are implementation details

obsidian cargo
#

I'm fairly new with network programming. Is this a common situation to resolve?

#

I know you can wrap it all in a structure to force arrival at the same time

#

But that's not really a solution in this case

#

I fear it would make packets too large.

pallid mesa
#

you gotta netserialize to ensure atomicity

#

otherwise you cannot ensure order

obsidian cargo
#

In my case ThingA is an event (RPC, reliable) that affects a few dozen things (replicated as index + eventID pairs in a FastArray). And ThingC only happens very rarely.

#

A Reliable RPC with an array of potentially hundreds of ints sounded like a problem.

pallid mesa
#

I mean, depends โ„ข๏ธ on what you do with it

#

but we've spoken a lot about arrays/fast arrays in here...

#

it's quite a topic x'D

still mulch
#

Hey all,has anyone tried replicating advanced arpg
Currently giving it a go as it a needed for my game but Iโ€™m having the worst luck

Any help would be greatly appreciated

obsidian cargo
#

Yeah. I like the simplicity FastArrays offer in regards to diffing.

pallid mesa
#

but at the same time TArray replication can be more benefitial

#

that's the big depends โ„ข๏ธ clause

obsidian cargo
#

I'm gradually mutating my code to be more similar to how GAS GameEffects are replicated

#

But GAS replication is very complicated

pallid mesa
#

it is, yeah.

obsidian cargo
#

They have really clever usage the NetSerialize UPackageMap to allow server to filter data sent to specific clients

obsidian cargo
pallid mesa
#

I want to take a look aswell

obsidian cargo
#

It is one of those things that is genius in the simplicity

#

Though I was wondering if it was a problem to keep a long term reference to UPackageMap

#

Given GAS is used so heavily everywhere it is apparently not an issue

pallid mesa
#

that's deprecated in 5.0 @obsidian cargo

obsidian cargo
#

Guess I should see what they do in UE5

#

I need similar behavior in one of my inhouse plugins, but don't want to add GAS to it.

pallid mesa
#
UPTRINT PredictiveConnectionKey = 0;
#

what is this ๐Ÿ˜„

#

ah an unsigned int pointer

#

so it's equivalent but now its using an unsigned int pointer to avoid holding a direct reference

#

๐Ÿง 

#

@obsidian cargo

obsidian cargo
pallid mesa
#

it's holding the pointer

#

but not using the type

obsidian cargo
#

Oh I see, they only care about the address

pallid mesa
#

basically this is simply to avoid hard referencing the UPackageMap

obsidian cargo
#

I noticed UPackageMap could cast to UClientPackageMap (?) which has a connectionId

pallid mesa
#

my first reaction was: what's "up trint"?

obsidian cargo
#

But that is a lot of extra processing if the UPackageMap address isn't volatile for a connection

pallid mesa
#

probably the tradeoff is worth it

#

otherwise they wouldn't have done it

obsidian cargo
#

More generic to use UPackageMap directly (avoiding the cast), but I'm not sure how many times you would have a non-client connect to the server.

#

Or if the concern is from the client connection's perspective

still mulch
#

As they determine montages and stuff

#

At first it was working with no replication of variables needed but for some unknown reason it just stopped,my guess is I have to replicate it

glad escarp
#

So, I'm experimenting with the way I want to do shooting in my FPS. I would like to have actual projectiles because it's a sci-fi game with blasters and plasma cannons etc. My ADS function moves my weapon to a slot at the center of the camera view which misalignes the weapon location vs where it exists on the 3rd person display mesh. Should I move my camera to the weapon instead? Maybe I just answered my own question.

amber yew
#

Is there any decent macro for minimizing whole declaration of multicast delegates?

compact talon
#

Is there no way to get seamless server travel working with PIE?

winged badger
glad escarp
#

Ohhhhh. Ok that makes alot of sense. And then just do a blend to view

winged badger
#

you just SetViewTargetWithBlend while aiming

#

yes

glad escarp
winged badger
#

but out of the box, no

compact talon
#

fair

winged badger
#

source engine editing, maybe

compact talon
#

also does this event run when loading a new level with seamless travel? As they don't reconnect, they are taken with the server

#

so I would assume not

winged badger
#

it doesn't use HandleStartingNewPlayer instead

#

works for login and for seamless

#

as its called from both PostLogin and HandleSeamlessTravelPlayer

#

its blueprint native, default _Implementation calls RestartPlayer() which spawns the Pawn in default operating mode

#

so if you want that behavior, you need to call Parent function from BP

compact talon
#

if I want to use exclusively for seamless I assume I would want HandleSeamlessTravelPlayer then, is that even a BP event?

winged badger
#

don't think thats exposed

compact talon
#

ouch

#

I want players logging in to be auto kicked (game started), and players already in to have stuff happen

winged badger
#

but you would generally use a different gamemode on lobby and game levels

compact talon
#

I can just loop through existing players though as I store it in an array

#

yeah I have a lobby gamemode and base gamemode for all my minigames

winged badger
#

if you want to autokick anyone joining in late, you should really refuse login

#

via GameSession class

#

at least they get a proper network failure reason from the engine then

compact talon
#

I see, I am not sure how to implement that. I did want to refuse login but it didn't seem possible

winged badger
#

best way is to override AGameSession::ApproveLogin

#

c++ required tho

compact talon
#

Yeah, this is my first game and I am trying to avoid C++ where possible. For future games I do want to get very involved with it tho

plain spade
#

Hey y'all, I'm trying to access the keys from a map (its on the game state) on a local UI, but the keys come up as null when I try to access them. How can I get around this?

compact talon
#

It's rare for players to join post game anyways as I don't list it in the server browser, so they would need to load the browser then the host starts before they login.

winged badger
#

overriding a function or two in c++ is hardly rocket science

#

it doesn't involve you designing your own code structure

compact talon
#

I think I had to override a few for GAS

winged badger
#

which is kinda the hardest part

#

you'd probably be just fine to have it return TEXT("Insert your custom failure string here");

compact talon
#

would exposing the seamless travel player event in C++ be complex or is that also relatively simple?

winged badger
#

do note that when HandleStartingNewPlayrer is called

compact talon
#

so I can use it in BP

winged badger
#

the controller parameter will have a valid PlayerState already

#

and that PlayerState will have called CopyProperties before that

compact talon
#

hrm, yeah I have seen people mention PlayerState. Currently I just use the default and haven't made my own

winged badger
#

so any data you transferred via PlayerStates from lobby to game via CopyProperties is available at that point

#

which is very, very convenient

#

i carry over my character setups/loadouts via PlayerStates from lobby to game

#

and much more, but this seems like a reasonable first step

compact talon
#

I see, my game is extremely simple so all I need to carry from lobby and throughout the game is player skin + score (which is stored server only)

winged badger
#

PlayerStates can keep scores and you can show the leaderboard ingame that way on clients

#

as long as the scores are set only on Server, its fine

compact talon
#

Interesting. My score only updates at the end of each level so I didn't consider using player states for it

winged badger
#

PlayerStates persist through seamless travel

compact talon
#

Should I be using a separate player controller for lobby and game? I currently do but that breaks the seamless travel as it changes player controller

winged badger
#

it doesn't break it

#

only if you're doign something weird

#

๐Ÿ˜„

compact talon
#

weird, what happens then?

winged badger
#

depends what you do

#

but if controller class changes it will just instantiate new one

#

prior to calling HandleStartingNewPlayer

compact talon
#

So information stored on the Lobby player controller would transfer to the Active player controller?

#

like cosmetics

winged badger
#

no

#

but

#

if you do it via PlayerStates

compact talon
#

So I should have a custom player state and use the same state for lobby + game

winged badger
#

and transfer it via CopyProperties function (it has access to both old and new PS when called)

compact talon
#

ah

winged badger
#

it still works just fine

compact talon
#

yeah I really need to try and wrap my head around player states

#

I wasn't going to use them but they seem like they would make my game a lot simpler than it already is

winged badger
#

its designed to work with them, the multiplayer framework

#

so its generally easier to just use them

compact talon
#

Can clients mess with player state? I was going to exclusively store player scores on the gamemode and hosts game instance because I didnt want clients to be able to manipulate scores with cheats/hacks

#

assuming only the gamemode sets the score

winged badger
#

they can with their own instance

#

but that won't help them

magic yoke
#

anything clients do is always local, to do anything non-local, they have to make an RPC

#

so you can do something along the lines of Player State -> sends stuff to client, and Player Controller -> sends stuff to server

#

since the server can use state to RPC to the client since it owns the player state

winged badger
#

it doesn't matter if the PC or PS send a RPC

#

security is exactly the same

#

and client can use Server RPCs on PS

magic yoke
#

So long as the original call is made inside something the client owns right?

winged badger
#

PlayerState's owner is PlayerController

#

so its owned

magic yoke
#

I thought PS was owned server side not client side

#

weird

winged badger
#

there is no serve or client side to ownership

compact talon
#

Would there be an issue with having the same PS used in lobby and game? That way I don't need to transfer information over to new PS

magic yoke
#

sorry, I meant owned by the server*

winged badger
magic yoke
#

replicate: doesn't buffer, repnotify: sends the new value if it's changed from default when player enters relevancy range. Player doesn't receive the history of the changes.

Is my understanding

winged badger
#

and CopyProperties implemented on it, even if you need different PS classes

compact talon
#

I dont need the copy properties event do I with seamless travel as the PS persists?

#

assuming I use the same PS

winged badger
#
void AController::InitPlayerState()
{
    if ( GetNetMode() != NM_Client )
    {
        UWorld* const World = GetWorld();
        const AGameModeBase* GameMode = World ? World->GetAuthGameMode() : NULL;

        // If the GameMode is null, this might be a network client that's trying to
        // record a replay. Try to use the default game mode in this case so that
        // we can still spawn a PlayerState.
        if (GameMode == NULL)
        {
            const AGameStateBase* const GameState = World ? World->GetGameState() : NULL;
            GameMode = GameState ? GameState->GetDefaultGameMode() : NULL;
        }

        if (GameMode != NULL)
        {
            FActorSpawnParameters SpawnInfo;
            SpawnInfo.Owner = this;                      <<< note this line here
            SpawnInfo.Instigator = GetInstigator();
            SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
            SpawnInfo.ObjectFlags |= RF_Transient;    // We never want player states to save into a map

            TSubclassOf<APlayerState> PlayerStateClassToSpawn = GameMode->PlayerStateClass;
            if (PlayerStateClassToSpawn.Get() == nullptr)
            {
                UE_LOG(LogPlayerController, Log, TEXT("AController::InitPlayerState: the PlayerStateClass of game mode %s is null, falling back to APlayerState."), *GameMode->GetName());
                PlayerStateClassToSpawn = APlayerState::StaticClass();
            }

            PlayerState = World->SpawnActor<APlayerState>(PlayerStateClassToSpawn, SpawnInfo);
    
            // force a default player name if necessary
            if (PlayerState && PlayerState->GetPlayerName().IsEmpty())
            {
                // don't call SetPlayerName() as that will broadcast entry messages but the GameMode hasn't had a chance
                // to potentially apply a player/bot name yet
                
                PlayerState->SetPlayerNameInternal(GameMode->DefaultPlayerName.ToString());
            }
        }
    }
}``` @magic yoke
magic yoke
#

fascinating, help material online proven wrong again

#

thank you

winged badger
compact talon
#

I see

winged badger
#

but you can use same PS class, just implement CopyProperties

dusty radish
magic yoke
#

anything you need a player to know when they enter relevancy range should be repnotify. Anything that's one time/temporary can be just normal replicated

#

do note: that means anything that won't be default

compact talon
#

so for handling stuff like players loading cosmetics I would save the information to the player state in the lobby, and whenever the player state begins play it gets the mesh and modifies it with the cosmetics?

magic yoke
#

like a player changing colours

#

if you leave relevancy and come back, they will be default colour again

winged badger
#

@tulip ferry non relevant Actors don't replicate to clients if they are static (loaded from level), if they are Dynamic (spawned at runtime) they are destroyed while not relevant and respawned when they become relevant again

magic yoke
#

it's pretty crucial for sure

#

I'm using rep notify way more than rep overall

marble fox
#

Already having some problems please help me ๐Ÿ˜„

#

What does this mean?

winged badger
#

GetOwner is a function, not a member variable

#

also, especially while still learning, avoid auto like a plague

marble fox
#

Oh i fr didnt see that

#

I should prob go to sleep at this point

fathom aspen
#

So second time, it will fail to destroy because it's already destroyed

drowsy flint
#

anyone know how to fix this i'm trying to make a dedicated server and when i build in development server this errors apper

drowsy flint
rose prawn
#

Hey people, if I trigger a Client replicated event from local player, would it completely ignore replicating and just trigger the event or still use network to fire action? The reason I'm asking is, I normally have a normal function which controls if it's locally controlled. If it's locally controlled, it triggers the logic. If not, it sends the data to client replicated function and trigger that way. So I'm wondering if it's unnecessary or not.

winged badger
#

there is no drawback in just using a client RPC

rose prawn
#

Thanks, will stop doing the thing I do then.

coarse mirage
#

is it possible to disable player collision so players can walk through each other ?

fathom aspen
#

Set Collision Channel to Ignore Pawns or w/e

coarse mirage
winged badger
#

any c++ @coarse mirage

#

?

coarse mirage
#

no, only BP :p

winged badger
#

got enough skills to wrap a function an expose it to BP?

coarse mirage
#

haha no :p

winged badger
#
    /** Add an Actor to ignore by Pawn's movement collision */
    void MoveIgnoreActorAdd(AActor* ActorToIgnore);```
#

this is the function

#

you just need

#
UFUNCTION(BlueprintCallable)
void MoveIgnoreActorAddBP(AActor* ActorToIgnore) { MoveIgnoreActorAdd(ActorToIgnore); )```
#

oh

#

no you don't

coarse mirage
#

xD

winged badger
#

you can call IgnoreActorWhenMoving

#

on your CapsuleComponent

#

that one is exposed

coarse mirage
#

okay, i have no idea what you just said tbh :p sorry, im an idiot programming

winged badger
#

i can only repeat it

coarse mirage
#

np ๐Ÿ™‚

winged badger
#

CapsuleComponent -> IgnoreActorWhenMoving

coarse mirage
#

ty ๐Ÿ™‚ ill try look into that ๐Ÿ™‚

#

oh got it woking ๐Ÿ˜„
But now the camera is going into the player xD
know how this can be fixed ?

#

its only going into the player, when they collide
nvm, got it working now, thanks for the help ๐Ÿ˜„

winged badger
#

it means SetOwner was called, or set in FActorSpawnParameters

dusty radish
fathom aspen
compact talon
#

does server travel use a transition level if I dont use seamless travel?

dusty radish
fathom aspen
compact talon
#

I see, I was going to not use seamless as it's giving me issues but I like using a transition level.

fathom aspen
dusty radish
fathom aspen
#

I'm not sure I understand what the change you made there

#

But anyways how do you call DestroySessionNicely?

latent heart
#

Object->DestroySessionNicely() ? ๐Ÿ˜›

fathom aspen
fathom aspen
#

I'm still not quite sure what type of PlayerControllers should be provided there though. server-side or both?

dusty radish
dusty radish
dusty radish
dusty radish
fathom aspen
twin juniper
#

I have a data asset being replicated. But I then have an asset from a child class of the main data asset class which fails to replicate and outputs the error: LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: NewContainer_C /Game/ObjectInventorySystem/Inventory/Data/Assets/TestingContainer.TestingContainer NOT Supported.
Children of the main parent class replicate, but if it is a data asset from a child primary data asset class it fails until I resave the assets (the asset is already in memory/loaded), and issue comes back if editor is closed. What is going on? If I were to package and clients were to play my game would it fail to replicate to them despite the issue being fixed by saving the assets? (Cant test that because dont have an actual flow for such a test yet).

neon mango
#

Is it possible to connect to a host but not sync anything up? I really just want the connection to send commands from server to client and vice versa but my understanding is all things Unreal Networking related are with the context of things being synced up, same map, same actors etc...

twin juniper
vagrant falcon
#

hi, have following code running inside of component and i dont understand why rep notify doesnt fire up on clients after begin play
so text still not changing ๐Ÿ˜ญ
i can fix it by putting same code as in rep notify on remote
but shouldn't it work so?

#

when i change variable after begin play somewhere on server side it works perfect
for example when collision overlap happens but not on beginplay

neon mango
#

Did you figure out the limitations of sequencer and multiplayer? Voice is synced up and so are material parameter collections but the niagara particle FX and animations are not. Looking into it as we speak.

hazy slate
#

Hello everybody.
I'm looking to make a dedicated server using Java and I'm following this course: https://ylazarev.com/2021/03/31/3-java-game-server-movement-in-ue4/?fbclid= IwAR3HhWq1DkpRly6xH__Lr_oeWaL-UcY8NeGcYaZ5pjdi3efTxeYOTqhlUUo . But for me it lacks quite a lot. Does anyone know a more complete course? And I want to deploy my server after finished to AWS but I can't find any documentation about it. Can someone help me ?

In the previous post we setup a java server with player controller, which will update a players movement. In this post, we will setup Unreal Engine to update the players movements and display any aโ€ฆ

vagrant falcon
#

@fathom aspen In Class Settings Component Replication is True

#

i though post login issues should be solved by using repnotify instead of multicast

#

or am i doing something wrong

fathom aspen
vagrant falcon
#

mby my macro is wrong

neon mango
#

Something interesting but I guess it's just left over and not intended to work is you can set variables inside the animation blueprint to replicate but they will never replicate right? Even if their owning character is set to replicate?

fathom aspen
vagrant falcon
#

hmm weird

fathom aspen
fathom aspen
vagrant falcon
#

ok, my bad
default value of variable was already max health
if i change it, it works like it should ๐Ÿ˜‚

neon mango
#

Should the sequencers replicate playback handle the life time triggers of a Niagara particle emitter put inside the sequencer? You'd think that if it at least tells the client which part of the sequencer we are in that we should see the same stuff happen? It's odd that the client doesn't see those results from sequencers replicated playback no?

#

It seems pretty straight forward though. All the information is there in the sequencer, just replicate the passing of time through the sequencer and things will more or less look right on both, its doing it for audio, but not for the Niagara actors in scene and they have no replication flag sadly even if just for this purpose.

#

it does look like that is what its trying to do void UMovieSceneSequencePlayer::UpdateNetworkSyncProperties() { if (HasAuthority()) { NetSyncProps.LastKnownPosition = PlayPosition.GetCurrentPosition(); NetSyncProps.LastKnownStatus = Status; NetSyncProps.LastKnownNumLoops = CurrentNumLoops; } }

plain spade
magic yoke
#

maps don't, but a struct with an array of strings and an array of (whatever you want) does

#

๐Ÿคก

plain spade
#

Looks like I'll have to pivot then, thank you

plain spade
#

I think what I'll do instead is add a "quantity" variable to my item structure and just get an array of the item names

tame sapphire
#

Does any one have any reference or tutorials on adding abilities when using a server character AI character (Seems to make a difference with message calls on other tutorials) ? Was due to reliably replicating the top down template or let me know if this belongs in another channel?

deep geode
#

Actor component exist both on server and client. Check if actor is locally controlled would be better

#

There should be a IsLocallyControlled() func when you cast the owner of the comp to a character

compact talon
#

I have a variable on my BasePlayerController.

I seamlessly travel from Lobby > Transition > Game, the lobby uses my Lobby Controller and the transition/game level use my Active Controller (both children of BasePlayerController).

I store player information on the BasePlayerController, as the controller persists through seamless travel. However it resets my player information structure variable on my base player controller, instead of persisting it.

Does seamless travel just not work how I expected?

#

or perhaps I am missing a setting, maybe I need to check replicated for the player info var?

winged badger
#

use PlayerState for storing that information, overide CopyProperties

#

PCs having the same base doesn't help one bit, its not the same instance

#

and copying their data would require overriding HandleSeamlessTravelPlayer in c++

#

PlayerState data transfer works out of the box

compact talon
#

I see, I did try using player state as per you recommendation yesterday but I was having a bunch of issues with it and I wasn't able to resolve them

#

let me try something else and see if it works

atomic barn
#

Hi how do I prevent the pawn from being destroyed when the client leaves the game?

winged badger
#

you override AController::Destroyed

compact talon
#

Is this not the right way to set a variable in a player state? The target is my lobby controller and this is happening in a loop for all players within the lobby gamemode

#

It just keeps using default player info from my state

winged badger
#

without seeing the entry point

#

no idea

compact talon
#

hrm, I will finish my lunch and come back with better information.

I was just being a dumbass, I missed a small connection somewhere a lot earlier in my BP...

atomic barn
winged badger
#

its overriden in PC

#

it calls the PawnLeavingGame

#

which destroys it

#

you need to stop it from doing that

latent heart
#

Unposses the pawn and then just call Super::Destroyed

dusty radish
dusty radish
#

so I moved this function over to the widget that calls it instead of having it in the player controller and it works great

crystal crag
#

Can you not use world partition with a dedicated server yet?

pallid mesa
#

tried?

#

I was about to setup an experiment, literally now

#

like - I was opening UE5 to test this

woeful wagon
#

hello friends i have created the code but when it plays it only shows the scene2d component for the first character I've tried for each looping it and it didn't work so does anyone have any suggestions on how i can get a different scene 2d capture to play on a widget for each player in a multiplayer game?

dusty radish
charred crane
#

I have a replicated actor containing a 3d widget and a sphere collision. When a pawn overlaps with the sphere collision, I want the widget to be visible only to that pawn. Any ideas?

pallid mesa
#

this can get pretty expensive specifically in the listen server use case

#

server streaming unfortunatelly isn't supported and I believe it won't be supported

woeful wagon
near bison
#

Can someone tell me how computationally expensive dedicated servers are/will be for a simple 3d board game? I heard even baseline server binaries are pretty expensive for UE5

dusty radish
crystal crag
#

I just was curious because when trying to host a dedicated server using the 5.0.0 release code

#

it crashes and it seems to be world partition related

pallid mesa
#

Okay, all I mentioned is on PIE

#

let me cook a dev build and give it a try on localhost for at least listen server

#

@crystal crag according to your experience this would crash, right?

#

or you only tested on dc server?

woeful wagon
#

ill try creating another function for it but it is not creating and assigning more than one scene capture

crystal crag
#

@pallid mesaIt seems to not happen if I use a standalone game and open up a listen server

#

but if I use a dedicated server, then attempt to join as a client, then it crashes

#

I can also have a client in PIE join the listen server and I don't experience the crash

#

only when joining a dedicated server in PIE do I get the crash. I haven't tried packaging it up and testing that way

pallid mesa
#

Ugh weird

#

I don't get the issue on PIE dc

#

@crystal crag this is a new project, blank with barely any stuff

#

Be sure to update your UE, I'm in the last hotfix

crystal crag
#

Yeah I need to do that

#

I'm still on 5.0.0

pallid mesa
#

maybe that's the case, try updating first and then check if you still get the issue

#

nothing on my side

crystal crag
#

Ok

plain spade
normal garden
#

Hello all, I'm working on an inventory system and encountered an issue I am trying to resolve. When a player picks up an object of the ground it is placed in their inventory. During pickup, I Rename() the component to set it's new outer, then Destroy() the Actor which represented the item sitting on the ground. On the client side this component is unfortunately destroyed as if it never recognized the Outer change, on the server it exists as expected. Is there something clever I can do so that when I call UActorComponent->Rename() on the server, clients can be made aware that the ownership has changed and to not Destroy along with the Actor?

#

Trying my best to illustrate the problem :^)

normal garden
#

Wrapping the Rename() inside of a NetMulticast, Reliable function resolves the issue but this seems incredibly sketchy

#

Another potential solution would be to make the InventoryItem owner some other Actor that is always relevant, that way Destroy() would never affect the InventoryItem to begin with..

magic yoke
#

I'm adding actor components to a replicated array. This crashes unreal instantly. If I turn off replication, it doesn't crash.

#

Has anyone had this bug before?

#

I can set the array in question fine, it's specifically when I try to add to it piecemeal that it crashes

#

(blueprints)

normal garden
#

are you checking IsValid() on the clients before accessing the members of the array?

magic yoke
#

that should give ma a printout saying access null

#

it shouldn't crash unreal itself

#

but yeah lemme do that

normal garden
#

no but if you are accessing a pointer that is not valid on the client you're likely getting a null pointer

magic yoke
#

right

#

but this doesn't give null pointers

#

it crashes the unreal editor entirely

#

lol

#

for curiosity's sake

#

I made it so the repnotify code doesn't do anything

#

still crashes

#

even though the replicated array isn't ever interacted with

normal garden
#

the repnotify would be on the client side, i would expect the replicated array to be interacted with from the server?

twin juniper
#

I dont understand whats going on here, when one client shoots it takes away ammo and adds screen shake to the other:

#

Does anyone know whats going on here?

frosty remnant
#

If you replicate an array of structs, does a change within a struct still trigger replication?

normal garden
#

if it's a UPROPERTY() it should

#

i think that's the case at least

magic yoke
#

it doesn't in blueprints by default it seems

#

still could be my code lemme recheck

normal garden
#

does anyone know if there is an Actor in the world that is replicated to all players by default?

magic yoke
#

gamestate

#

I believe character actors also

normal garden
#

thank you

ornate pilot
#

hey all, noob question but the count column in the network profiler tool is that a count of how many times a actor was checked for replication?

normal garden
#

Does it seem reasonable that the GameState Actor would be the owner (or maintain a list) of all UObjects in gameworld that represent Inventory Items?

crystal crag
#

APlayerState is always replicated and relevant using default settings I believe

#

Characters are replicated, but they have rules that determine relevance and will not always replicate (again, using default settings)

#

I haven't played with the replication graph, so that might completely change things; not sure.

chrome bay
fathom aspen
ornate pilot
#

So my next question is I should be trying lower the amount of times an actor is being checked for replication? I assume I can push updates via code with force net update?

fathom aspen
#

If your actor doesn't change stuff that much then that's something you should really be considering. Also ForceNetUpdate doesn't really force anything, all it does it resets LastTimeActorWasCheckedForReplication(I made up the name, can't remember what it's called)

#

What you can also consider is to use the PushModel, which lets you replicate stuff only when you want them to replicate, so there is no checking on an interval

#

Another thing you can do is make the actor Dormant and FlushNetDormancy when you want it to replicate(also if it doesn't really change that much), but that's far too extreme for what you want to do I assume

dark edge
tawny torrent
#

Is there a special trick to replicating arrays in BP?

#

Cant get it to work with a simple rep notify when adding stuff to the array.

winged badger
#

on clients, Outer tends to be the Actor that replicates the object via its ActorChannel, even if server has different ideas

#

note that you have not changed the Owner here, nor did you re-register the component

#

which i really wouldn't do anyways, as adventures like that that so often lead Unreal into undefined behavior

winged badger
winged badger
dark edge
#

Are you meaning to have non-replicated units?

#

Holy necro lol, Just noticed that was 2 days ago. Anyway, are you meaning for your spawned actors to NOT be replicated?

normal garden
normal garden
normal garden
compact talon
#

I am using seamless server travel and storing player information (such as skin choice and username) in the player state so it persists through level change.

I loop each player controller in the lobby, casting to the state and setting the information inside said state. Then when the level swaps and the player character is spawned it reads the information from the attached state to get the skin to use.

The issue is, this is only working for the host. The host will have their player information in the state from the lobby, but the client loses it.

I think I am not setting it correctly.

#

This is something that happens to all player controllers in the lobby before the server travels to the new map This is within the lobby gamemode BP

#

This is the player state BP and I use copy properties to copy the properties to the new state as the level changes

#

This is the player character, and on the server player it pulls the information set within the lobby gamemode.

For client's the circled red area doesn't have any information so it is using the default values

fathom aspen
#

I wouldn't wait for the info to replicate just to change some other info on the server side character. I would stay on the server and change all the stuff there

compact talon
fathom aspen
#

Also BeginPlay runs on both server and client, so such code should have a switch has authority(remote pin) before it

compact talon
#

Is a switch has authority necessary if I want both the server and the remote clients to run the event?

fathom aspen
compact talon
#

Yeah, I will quickly test that by adding just a long delay to see if it's the issue. I will need to package it tho because I cannot test server travel with PIE

fathom aspen
compact talon
#

oh I see, yeah that isn't what I want to happen

fathom aspen
#

It's not that if client 1(not the host) doesn't have a server instance of that character

compact talon
#

Yep. I understand what you mean now.

fathom aspen
#

I would pull the info from the server side PlayerState and change the skin on the server side Character

compact talon
#

I see, to have that occur all I have to do is plug the last screenshot into authority instead of remote or is it not that simple?

fathom aspen
#

Plugging is first step. Second step is to get rid of that RPC(just run normal function). Third step, make sure that RemoveAllWidgets runs in Remote pin as it runs on clients as you see

compact talon
#

I see, as for running the normal function I am not sure if you mean the on client function instead of on server as I dont run the on server with authority?

This is that section of nodes

fathom aspen
#

Oh I see that's another problem. A skin is stateful event, it's not a transient one. Multicast events are transient not stateful

#

So changing a skin that way would be a problem if there's a player that's not relevant at the time the change occurs, and then becomes relevant

#

He won't see the new skin

#

Same thing for late joiners...

compact talon
#

I think I have something set for that, as late joiners do see the new skin

fathom aspen
#

Oh wait, I just saw that the texture is Replicated(RepNotify)

#

Ok that's why

#

So you don't need to Multicast

#

What you can do instead is just run a normal function that changes the skin and OnRepNotify change the skin for clients

compact talon
#

I see, and I call that function instead of the OnServer RPC

#

in the authority pin

fathom aspen
#

i.e, ChangeSkinOnServer make it a regular event

#

Correct

compact talon
#

Alright, let me try and get these changes and find someone to test them out. Thanks for the help

compact talon
#

@fathom aspen Alright, I figured something out with all this mucking about.

You are right with the switch on authority thing. I removed it to just test the delay and it changes the host skin fine and it changes the skin for the client for a few frames and then it resets. Presumably because, as you said, it is running the event twice on the player. One is right and one is wrong.

#

However I am not too sure as I tried changing the skin on authority and removing the widgets on client but it caused issues as the widget removal wouldn't occur on the host, and the skin wouldn't change at all. Which surprised

compact talon
#

This seems to have fixed it, not sure if its unoptimal but at least the skins and information are transferring properly

fathom aspen
compact talon
#

Yes

fathom aspen
#

Can I see how you do it?

compact talon
#

or to be more clear, my base player creates a dynamic material instance on construct and changes the mesh to use it. Then on the repnotify I change the texture parameter for this material instance

#

sure

#

Construct

#

RepNotify

fathom aspen
#

Why do you SetMaterial each time the texture replicates back? Setting it one time should be enough

compact talon
#

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

#

Good point, this is my first ue game so I am just kinda throwing stuff together that seems vaguely right and hoping it works lmao

fathom aspen
#

Haha it's okay, been there, though I would suggest to not roll with stuff because they "work" ^^

compact talon
#

I think when I did it, it was because setting the material in the construct wasn't replicating properly, so I set it on the rep notify as it calls the rep notify from the construct

low helm
#

Repnotify doesn't fire if a value hasn't changed

compact talon
#

I could perhaps check if its already valid/set though, and if it is then skip re-setting it or something

low helm
#

so his implementation is fine

fathom aspen
#

Yeah. The construction script has some gotchas. That's why I tend not to use it if I can

low helm
#

ehh nvm it is repetitive

#

on the first node

compact talon
#

Mostly using this game as a learning experience to learn the basics of a wide variety of topics in UE, such as blueprinting; GAS; multiplayer; online subsystems; how replication works etc.

Then I will get more advanced with these topics in my second game and hopefully by my third game I will have enough knowledge to consider releasing a game. These are just private learning experiences to play with my friends.

fathom aspen
fathom aspen
compact talon
#

I felt pretty intimidated starting with a party game but it's honestly a lot more relaxed than any other game. There will for sure be a ton of bad optimization but because it's a small party game they will never really see noticeable impact on performance in game.

Optimization is just such a huge daunting task that I want to spend a huge chunk of time learning it for my second game, as well as making high ping multiplayer feel less jank.

Anyways I am going to head to bed, it is 3am and I have work in the morning. Thanks for the help ๐Ÿ™‚

fathom aspen
#

As for SetMaterial you can move it to BeginPlay I guess

normal garden
winged badger
#

they even have an implementation example in that header

normal garden
#

I saw that but it's super light

winged badger
#

you do need your FFastArraySerializerItem

#

which would probably have a pointer to the InventoryComponent, your FItemData or equivalent, and the inventory slot information

#

then on PostAdd/Change/Remove, it "contacts" the InventoryComponent it has a pointer to, and informs it of what has changed

#

obviously, all your InventoryComponents would have to register themselves with the AInventoryManager

#

and all of them would have to (on server) update their information in the fastarray on any change

normal garden
#

posting for reference

#

Still absorbing this in to my brain

gritty flume
dense thistle
#

Can someone help me with a really basic question? im in a vc

livid sluice
#

Hi guys I have a quick question based on security.
When we say run on server, I know the code is exclusively run on the server. But does client have "visual" of this execution as well. I know this seems vague so let me give you an example.
Say I have an early access system and the keys for early access is saved on a server somewhere. If I wrote a "Run on server" function which obtains these keys from the database and checks it, will the client be able to access these keys for that time period as well? or is this completely happening on the server and the client had no idea what these keys are.

chrome bay
#

The client won't run any of that code

#

If you have dedicated servers and aren't shipping the server binaries to end-users, it's worth compiling the sensitive code out altogether.

livid sluice
#

Ah okay awesome thanks.

glad escarp
# winged badger you just SetViewTargetWithBlend while aiming

So this works out pretty nicely as far as camera functionality goes, but how does one make sure the gun is aimed where your FPS center screen is so that when you zoom in, its at the same point of aim? That is currently boggling my mind. And then how do you continue to control the camera's pitch?

static flare
#

Can I have an actor-instance stored in e.g. the GameState (without being spawned), have it replicated to all players, and let clients decide for themselves where and if it should be physically spawned for them?
And if that is possible, when playing on a listen-server and the host spawns it in their world, can I prevent this action from being replicated, while still replicating other properties on it?

chrome bay
#

Well you can't have a non-spawned instance, that makes no sense

#

And no you can't replicate it's properties if the actor itself is not replicated

#

You can just turn off replicated movement then move it where you want it to be client-side

#

Strange use-case though

static flare
# chrome bay Strange use-case though

Yeah.. It's a very client-authoritative game, where the dynamic world is built in runtime on client-side, and not necessarily the same part of the world as other clients (e.g. they're on two different planets). But there's always exactly one "home base" (one actor, with several sub-actors), which exists one place. All players must know of the base and its properties/states at all times, so I was hoping I could just instantiate the actor with NewObject in the GameState and then decide on client-side whether or not to spawn it (based on where you are in our own coordinate-system), and was hoping that it would be as easy as just saying something like BaseActor.SetWorld(GetWorld()) or something.
I was initially planning to create a thinner replicated data-layer struct describing the base, with all information necessary to reconstruct it anywhere, but I had to keep adding a bunch of information to it and would need a sort of diff-tool to avoid recreating it on every change, and got a lot of ugly hard-coded properties between building-actors and struct-layer, and in the end I felt like I was about to duplicate the entire Actor-lifecycle and re-invent the wheel so to speak.. Was hoping to just use the Actor.

chrome bay
#

No that's not going to work

#

You need to spawn the actor server-side and replicate it

#

NewObject won't even work with AActor derived types anyway

blazing spruce
#

Hi, is it okay to use this delay here? this is running on the game mode and gets called when players have loaded into the map, the player state cast sometimes fails on the first attempt because it can be called slightly before the players have loaded in, the full logic is I have a timer thats ran every 10 seconds checking if all players have loaded, if they are all loaded it'll then check to make sure we have the expected amount of players that travelled over from the pre lobby, if the expected amount of players are reached a pre game timer is started and the AssignTeams event is ran

grizzled stirrup
#

If you set NumPublicConnections to 3 when creating a session, it is impossible for more than 3 players to join a lobby?

#

Or do you have to manually disable joining in progress when 3 players have joined?

winged badger
#

its slightly more complicated for TPS

#

as when close to an obstacle, the weapon shot can be blocked where camera shot isn't

#

but that is typically solved by drawing a red X widget where the weapon trace to camera hit location is blocked

glad escarp
#

Ok so this is how I would set it up as well for a weapon that actually fires a physical projectile too? I'm not currently using a line trace for firing because I'm just spawning a projectile actor at the muzzle location/rotation.

winged badger
#

then its camera trace and you set the bullet on its path to camera hit location

glad escarp
#

Ok. Makes sense. I'll figure that out. Thanks m8. Any suggestions on controlling the camera pitch? When I blend into the weapon camera, I lose the ability to pitch the camera though I still have control of yaw (through the player controller I assume.)

spring tangle
#

Hello! I have a beginner question - my characters are controlled using floating pawn movement but it seems like the client can't send inputs. I have tried putting the input axis value in a variable and using repnotify to actually call the movement code but it doesn't seem like my client is updating in any of these cases. Any tips? Thanks!

lucid basin
#

I followed a tutorial where you use ip but i when i send the package to my friend and gave him my public ip he did not connect. Thanks

lucid basin
#

anyone?

silent valley
lucid basin
silent valley
#

You're best off following a tutorial on port forward but it will probably be your local lan IP address of your PC

lucid basin
#

so ipv4 or public?

#

btw is it only 7777 or are there more?

silent valley
#

say your IP is 192.168.0.90 you want the router to forward incoming connections on port 7777 to your machine which would be 192.168.0.90

lucid basin
#

so ipv4 or public?
is it only 7777 or are there more?

silent valley
#

7777 is all you need unless you have changed the port it is listening on

lucid basin
#

ok

#

btw TCP or UDP?

#

@silent valley

silent valley
#

UDP

lucid basin
#

ok

#

What are the differences if you know it

silent valley
#

between UDP and TCP? best off googling it, but they are quite different. fast paced games always use UDP

lucid basin
#

ok thanks

#

It did not work

#

@silent valley

silent valley
#

Sorry I'm about to go out, could be many things! Did you test on your local machine? Two clients.

#

Do you have another machine on the lan you could test with

#

So much can go wrong, you gotta simplify first

lucid basin
#

No. Im doing it with my friend over discord

torn geode
#

Hello, ive got a bug with raycasts and that they do not want to sync, is this a known issue and is there a fix?

#

(it is fully replicated but idk what ive done wrong lol)

#

never mind im just dumb i turned on componenet replicates on the scene componenet the raycast shoots from and now its working

hardy surge
#

hi there, i need to make a video chat inside android Unreal apk, its posible to do that? i know the android camera plugin, but i need replicate the video, its there a way to replicate render target? or material? and then use voice chat?, please i really ned help with this,i am able to pay for the help

grizzled stirrup
#

If your game requires solo play but also drop in / drop out multiplayer, is there no harm in just creating a private session whenever the user loads up the game and have it available should they decide to invite a friend? Or should sessions only be created when a multiplayer session is definitely desired? Listen servers in this case

hardy surge
#

no solo, multiplayer with two person, its a video chat like app more than a game

dark edge
#

The game is completely seamless from startup to shutdown except when joining another game.

hexed pewter
#

https://forums.unrealengine.com/docs?topic=506005
if I understood correctly this article from knowledge base says that subsystems are not ideal for multiplayer scenarions. Is there any kind of Specialized subsystem that does well in MP?

grizzled stirrup
#

I'm not sure if bAllowJoinViaPresenceFriendsOnly and such can be updated on the fly or if a new session needs to be created, but will figure it out!

#

Worst case scenario they just destroy their current session and create a new one with the updated params. Just one last question on that, travel isn't mandatory for a new session to be created right?

#

As in they can load in to the starter map and create a session without having to travel to a new map with those session params? Sessions can be thought of separately to the actual gameplay / currently loaded world?

glad escarp
#

Dude. Syncing the third person mesh with the first person mesh in an FPS is a huge challenge. I must be trying to go about this all wrong lol.

latent heart
#

A huge challenge in what way?

glad escarp
#

Pitch in particular. I can't get the pitch of my third person gun to match the pitch of my first person gun so that the muzzle effects/projectile origin are the same. They are both in the wrong spot if I look up and down at all.

latent heart
#

When looking at the character from another client?

#

Or when you switch cameras?

glad escarp
#

when looking at the character from another client

latent heart
#

I'd have it constnatly dumping the pitch out to the log and see if they sync up.

#

On both clients

#

The pitch of the 1 specific character, not their own characters.

#

then you can find out if it's a view rotation problem or a skeletal one.

glad escarp
#

hmmmm. Yeah I can try that. Thanks

fathom aspen
tawny torrent
#

Is there a special trick to replicating arrays in BP?
Cant get it to work with a simple rep notify when adding stuff to the array.

dim parrot
#

Hello I am working on an online survival game like ark or Conan and im trying to figure out the best way to save world data like player builds so it persists over server restarts

fathom aspen
#

That's a known bug with stuff that are RepNotify in BP

deep geode
#

Does anyone know a tehnical document on how valorant does its hot registration?

chrome bay
#

I've done this a couple of times, works nicely

glad escarp
latent heart
glad escarp
# latent heart On both clients

I'm using a Trasform (Modify) Bone node in my anim graph which is modifying spine_02. The Layered Blend Per Bone nodes that control the hipfire and the ADS poses are both set from spine_02....

#

so I don't know what's going on

latent heart
#

Is it a pitch value issue?

glad escarp
latent heart
#

Or a skeleton issue?

glad escarp
# latent heart Or a skeleton issue?

Looks like pitch. From another client looking at the guns, they are in the same position and same rotation/pitch. But in the first person view, the weapon is rotating up as well as the camera. I must have something in the code that is locally rotating my gun or fps arms mesh

#

hmm.... I can't find anything unless set world rotation propogates to children by default or something. I'm not specifically altering the rotation of the gun mesh anywhere... Just the camera that it is a child of.

glad escarp
# latent heart Or a skeleton issue?

So, I thought it might be because I'm limiting the angle of the camera but I checked the camera rotation against the adjusted control rotation values and they are identical lol. This is baffling.

blissful totem
#

I wouldn't replicate the widgets. I would replicate the player name in the player states and have the widgets read the player name from that locally on each client

pallid mesa
#

I quote

The values of our replicated variables are sent by the server to the incoming connections, so if a new player becomes relevant to us, they will set our replicated variables to the incoming values.

#

Essentially, Multicast and Client RPCโ€™s are for one-off events, meaning that they donโ€™t persist any state. New connections have no clue which RPCs were sent recently.

obsidian cargo
pallid mesa
#

the article i sent covers in fact that specific issue

crystal crag
#

I wonder why Epic didn't use their new motion warping in lyra when using melee

#

Is anything stopping us from using motion warping while running an ability?

#

Or maybe it's because it's not the best approach just for what they were trying to achieve and it has nothing to do with whether or not motion warping can be used in an ability graph

quasi tide
jade iron
#

hey everyone,
Is there anyone here that has experience using a custom server to manage game state and connecting a UE 5 client to it? I am currently porting over everything from unity

glad escarp
# latent heart Or a skeleton issue?

I think I know what it is but I have no idea at all how to solve it.

So the first person camera is a child of the capsule component. It inherits its rotation from the controller directly. And it's pivot is in a different place than the pivot point of the third person mesh's spine_02 which means even though they are technically pivoting at the exact same angles, they will never match.

#

And I don't think that parenting the FPS camera to the third person mesh is gonna be a good option because then my camera will inherit all the movement of the character's animations, which I don't want.

charred crane
#

I have a replicated actor containing a 3d widget and a sphere collision. When a pawn overlaps with the sphere collision, I want the widget to be visible only to that pawn. Any ideas?

glad escarp
#

But that's not a solution. Hmmm

latent heart
#

I always kind of assumed the FP arms would be like "gloves" that go onto the TP skeleton.

#

Shrug

fathom aspen
#

When the pawn leaves the sphere you can un-own the actor

#

Yes sounds like a crazy solution, but can't think of anything else, as I haven't done such a thing before.
Well another thing you can do is make that actor only relevant to that pawn and not to the other pawns

#

That can be done overriding IsNetRelevantFor

charred crane
#

Hmm. i must be doing something wrong

neon mango
#

As is tradition

#

I follow said tradition a lot as well

#

If its only to the local pawn then shouldn't a local event that tells the widget to be created be enough?

charred crane
#

Here's a picture of what's going on

#

client doesn't see anything. server sees anyone overlapping

#

Here's the logic

#

I feel like there's some sort of checks related to ownership or local control or something that needs to be done to fix it

spark ivy
#

Hi guys what avatar plug-in do you guys like the best for human avatar players? I currently have Character customizer

fathom aspen
fathom aspen
# charred crane Here's the logic

You would also prolly want to make the actor itself OnlyRelevantToOwner. But anyways if more than one player can see the widget, then you shouldn't be going this route

charred crane
fathom aspen
#

Yeah then the owner thingy won't work for you. Only one owner at the time can be there

#

What you can do is have that widget component attached to the player instead with OnlyOwnerSee as default. And when you overlap that sphere you activate the widget component(it starts deactivated)

neon mango
#

Yeah I'm trying to figure out how to basically do only owner see for just one pawn, not for all of them

#

Only two player, listen and one client. Post login called twice, both times its false

#

I just moved it to game instance and it works now but that is confusing

fathom aspen
neon mango
#

Nope

#

But thanks for confirming it should not be the case

fathom aspen
#

o7

neon mango
#

Its doing it do all variables inside game mode and I think that is why I have issues :/

#

moving them all to game instance for now as a work around but yeah I don't think that should happen like that

#

Maybe its an editor debug thing, IDK atm

ionic arch
#

Does anyone have any idea where to find AWS SDK for Unreal Engine 5

chrome bay
pallid mesa
chrome bay
#

All connections for me

#

The manager acts as the accessor to the system, the actor registers itself with it when it's received so anybody can easily access the state. Most of the logic is in the manager, the actor just replicates the state

#

Similar to how GameMode/GameState work

#

Difference is that the "Mode" actor is the Manager and it exists on all connections, and you access the "State" through it

#

But the two are coupled

pallid mesa
#

manager is the actor, here, right?

#

but you mentioned the world subsys spawns the actor

#

or does the actor exist in the world and fetches the subsystem on received beginplay?

#

i think it wouldn't matter much in this case

chrome bay
#

No the manager is the subsystem

pallid mesa
#

ah! okay

chrome bay
#

The idea being it's always going to exist when you need it client-side, so you don't need to worry about race issues

#

And it pushes out events when the state actor is received

#

My command system does quite a lot of that since it keeps track of commanders, commandable objects, the global command "state" and each "division" actor as well

#

pencils in another blog to write up

livid mist
#

Does anyone know why my multiplayer would stop working when I enable "DefaultPlatformService=Steam" instead of NULL? If it's on NULL it works fine but as soon as I try to use steam, game hosting stops working completely. I've searched for days and can't find the answer. ๐Ÿ˜ฆ

#

You can test a game and play together via steam with the default app ID, can't you?

#

I'm also using the Advanced Sessions plugin on UE5 but not sure if that matters.

pallid mesa
#

still working on the initialization blog post, right?

chrome bay
#

yeah, got a few in progress

pallid mesa
#

gotta do the release party

#

๐Ÿฅณ

glad escarp
kind ermine
#

HI everyone im using blueprints to host session and join on lan ..its not able to find session...i dont know what im doing wrong here

neon mango
#

Does set view target with blend change possession of controller to the other pawn?

chrome bay
#

no

quasi tide
chrome bay
#

Then the actor can register itself with the subsystem when it arrives client-side

#

So it's accessible from anywhere easily

safe marsh
#

hi, I am trying to do some quick MP debugging - I can connect to a dedicated server locally when its built

#

but if I launch it as a separate process from editor I cant connect with open localhost open 127.0.0.1

dark edge
safe marsh
#

I am using Launch Seperate Server to launch a dedicated during PIE, but Standalone wont connect to it

#

is there some extra parameter I need to add?

dark edge
#

IDK, PIE can get fucky. You unchecked single process?

safe marsh
#

yeah, its not once process, its opened up the same map, but the dedicated it launches doesnt even seem to listen for connection requests

charred crane
dark edge
#

@safe marshJust make a couple batch files like this and try it
Client

 "C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "%CD%\Islandgame.uproject" MainMap -game -nosteam

Server

 "C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "%CD%\Islandgame.uproject" MainMap -server -log -nosteam
safe marsh
#

thanks, I can try that but it will need to build it, right?

dark edge
#

its the same as right clicking the uproject file and hitting launch game

#

or just launching the game

#

except its launching as server

safe marsh
#

@dark edge I solved it, needed to add the port as PIE server doesnt use default port >_<

#

but thanks for that, will try it for automation later

neon mango
#

Using VRExpansion, I added the ReplicatedVRCamera and that replicated to clients fine, then I added the Replicated Motion Controllers and now the ReplicatedVRCamera doesn't update its transform for clients

safe marsh
#

you can try asking in the vrexp discord server, not sure how to fix that issue sorry

dark edge
#

Ahow some code and we can look

winged badger
#

all instances of every character on every machine call BeginPlay

#

also, you should use a HUD derived class for widget manipulation

#

unlike the Character, its there only for the locally controlled PC

pastel totem
#

Hey I have a question regarding Seamless Travel. The players stay connected to the session when travelling to another map right?
Is there a way to check if all players have finished loading the new map? I want to wait for all players before starting the match.

winged badger
pastel totem
#

Damn, totally overlooked this. Thanks!

fathom aspen
charred crane
#

I figured it out. I had to pass the actor reference to my third person character through a client RPC and set the visibility on it there.

#

I needed to get the local clients replicated version of the actor

fathom aspen
#

Though Client RPCs are for transient stuff, so that might make you issues down the line.

charred crane
#

not really clear on how that could cause me an issue

fathom aspen
#

But I'm guessing you want only the client to be able to see it, so that might not be an issue

swift pulsar
#

Hello, I'm having recurring problem with this - can I set replicated variable on the server only and expect it to be set on clients? It doesn't seem to work. I have to set it via multicast...

ornate pilot
#

Afternoon, a quick question. what is the the Red box that appears next to Channel ReceivedRawBunch in StatNet? Is this a problem?

short void
#

Question, is there documentation for these project settings anywhere?

I cannot find anything

dark edge
#

The basics are that you have a function to accumulate an error value, and you hard snap if it gets too high. While it's low, you gently ease to match the server's position and velocity

pallid mesa
swift pulsar
pallid mesa
#

also careful multicasts are for transient stuff

#

repnotifies are there only if u need behav when the value changes

swift pulsar
#

Yes, my problem this time was probably caused by the fact that I tried to access replicated variable on the client when it wasn't yet set.

#

Desynchro issue, I guess.

pallid mesa
#

oh yes totally that's a nice race

swift pulsar
#

: )

pallid mesa
#

not necessarily desync, more like... latency existing ๐Ÿคฃ

#

our worst enemy

swift pulsar
#

Yeah

pallid mesa
#

but be careful, you can shoot ur knee very easily with some programming patterns

swift pulsar
#

As a rule of thumb, I try to use multicasts only for VFX and SFX.

#

But this replicated var being null on client keeps returning. ๐Ÿ™‚ But I guess it's about latency, as you say. That's why it's often solved by using RepNotify + OnRep combo.

patent hatch
#

i have an actore where "Send json" are call and "update data" don't want, (call from owning client) have idea why?

river dome
#

Hey guys if only my server is able to move and recieve input what could be the issue then? ๐Ÿ˜„

ember sinew
#

How do people test their multiplayer code (specifically with a listen server and one or more clients?) I tried testing in editor with 2 players and one as the listen server... but then behavior is different compared to running two instances of a standalone build on the same machine... but when playing two instances on the same machine, whatever window is not in focus caps it's framerate so testing the client means everything replicated is super choppy and unreliable.

magic yoke
#

it means you've got a replication issue, things aren't properly being replicated

#

I've been testing everything on client only, because that way you know for sure you're not making mistakes with replication since the listen server can "cheat" since it's a client that has authority (no other clients will have authority)

jovial pike
#

I would love some help regarding replicating a door with a dotproduct variable. Everything obviously works for server but clientside the door opens based on where the servers dotproduct float is.

#

heres my blueprint/ and function

#

how do I get the client's dotproduct to replicate to the server?

magic yoke
#

what is the dotproduct in this case?

jovial pike
#

the position of the player based on their proximity to door

magic yoke
#

oh there it is

#

so you want to tell the server where the player is

#

right?

jovial pike
#

yes/ that way the dotproduct variable tells the door which way to open

magic yoke
#

so the server doesn't know where your character is

#

?

#

seems strange that there's a desync there

ember sinew
# magic yoke if listen server vs solo server is giving different behaviours

I meant more specifically in editor - things like singletons or other actor references (sometimes when server-spawned, sometimes not) - behave differently than two separate running builds. I did have some replication issues - but I didn't find out until testing in separate builds because those issues weren't present when testing in editor.

jovial pike
#

those numbers are what the printstring reflects

magic yoke
#

you can always just do an RPC that tells the server directly what the relevant value is

#

but it seems to me that you're calculating the server side info wrong somehow

jovial pike
#

Oh I definitley am haha

magic yoke
#

the server knows where characters/pawns are

#

if you calculated it right server side, the dot product should be what you see client side or very close barring a bit of lag

#

so sending the dot product over via RPC would bandaid the issue

#

but underlying there's something else going on

#

btw

#

"get player character 0"

jovial pike
#

Thats what Im trying to figure out by asking. If someone could review the blueprint _ I can provide better quality images

magic yoke
#

is a bit of an issue server side

#

since only client 1 is considered player 0

#

that's my first concern

#

if your player ref is set wrong, that'd wreck your dotproduct server side

#

since it'd always be calculating it from client 1's pawn

jovial pike
#

how do I fix that?