#multiplayer

1 messages ยท Page 97 of 1

tepid lark
#

The line at KTBMcharacter is BindASCInput()... which I don't think is the issue... above that is

AbilitySystemComponent->RefreshAbilityActorInfo();```
#

and in the logs ```Script Stack (1 frames):
Pawn.OnRep_PlayerState

[2023.06.26-21.59.51:616][572]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2023.06.26-22.00.51:649][572]LogWindows: Error: === Critical error: ===
[2023.06.26-22.00.51:649][572]LogWindows: Error:
[2023.06.26-22.00.51:649][572]LogWindows: Error: Assertion failed: InOwnerActor [File:D:/UnrealEngine-4.26/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayAbilityTypes.cpp]

sinful tree
#

And whatever a dialogue is, is what you should be retrieving through the interface to send back to the client to execute.

#

If it is static data then you likely want to use references to that data rather than replicating a string.

oak pond
#

why can I never find any results for the simplest things

dark edge
#

or you're doing something new / unknown

oak pond
#

often seems to be the case, but I just need to make a multiplayer event not affect the controlled player

#

literally just do it on the other players end but not your own game

tepid lark
oak pond
#

how do you mean

oak pond
#

I even tried checking if locally controlled

#

then it just does nothing (as in doesnt change anything, event still happens to both)

sinful tree
#

Why cant you just use the built in character movement component?

icy jetty
#

mb, I misread

oak pond
#

far too late for that now

#

I could list the problems with that for hours. well, maybe a few minutes

#

its nice to have a player controller that isnt constantly stuck to the floor

icy jetty
#

don't fight the engine

oak pond
#

my player controller is infinitely better for the specific type of game Im making

#

I debated this for a long time, tried using default cmc for as long as I could but it just was not a fun game until I made my own

icy jetty
#

i c. I wish you luck, the CMC has circa 1000 lines of intricate code iirc

oak pond
#

yeah thats the thing its built more for realistic games

#

or simple

#

idk what Im saying

#

but yeah mine works nice for this game, just makes multiplayer harder

tepid lark
#

not sure if anyone cares... but for the record getting rid of the spawners and just spawning one ai works so that's something.

oak pond
#

even though Im sure I just did something that I already did earlier and it didnt work buuuut ok idk these things are very specific

sinful tree
dark edge
#

yeah predicted movement and physics is a clusterfuck

#

it can work fine, until 2 clients disagree on what the box they are pushing is doing (since they are both in the future vs the other)

#

Non-predicted movement and multiplayer physics is just fine, everyone sees what the server sees

oak pond
#

yeah, Im still doing this "ghost" approach kinda thing, the other player has no collision or even physics it literally just sends the location across

#

obviously I wanna avoid physics for multiplayer wherever possible

oak pond
#

how do you simulate lag again?

dark edge
oak pond
#

cant seem to find it

#

ah emulation nvm

#

THATS WHY IM DOING THIS

pallid gorge
sinful tree
pallid gorge
sinful tree
#

No it doesn't have to be. You can put it basically anywhere you want, but the RPC starting the interaction in the character and receiving the data in the character makes sense, you just route the received data where you need/want it.

nocturne quail
#

If I wan to crouch

void OnRep_bCrouch()
{
  StartCrouch();
}

void StartCrouch() //user input`C`
{
  bCrouch = true;
}

I am doing it correctly?

vital adder
#

Hi there, is there anyone that knows why the movement for the client is jittery? (Only when walking backwards & to the sides. Walking forward is perfectly fine), I've also replicated sprint which works perfectly forward, however, same jittery movement backwards etc.

Any ideas on this? I use Unreal Engine 5.0.3.

latent heart
#

Does other clients know you're walking forwards or backwards?

#

I think you'd get what you describe if whichever client is getting the jitter was thinking that the moving client was always walking forwards.

#

Rather than other directions

vital adder
#

I've added a flashlight so you can clearly see what's going on.

#

I've tried numerous stuff. Cannot seem to get it to work ๐Ÿ˜…

#

(Client is on the left)

dark edge
#

The actual movement is fine

#

its your animation stuff

vital adder
sinful tree
nocturne quail
sinful tree
nocturne quail
#

thank You for correcting me

sinful tree
nocturne quail
#

does Unreal supports p2p ?

oak pond
#

there was a discussion about that earlier actually lol

latent heart
#

If you want to use replication and such, absolutely not.

#

You can add on your own network layer if you want to.

nocturne quail
#

oh, all right, I will think about it )

latent heart
#

But this would not be supported by anything in unreal, except for the fact you probably have some socket managing classes.

nocturne quail
#

Thank You for quickly correcting me

oak pond
#

I still donโ€™t understand it ngl. sounds like what multiplayer does anyway. I guess listen server relies on the server itself than each otherโ€™s machines?

oak pond
#

so like rather than peer to peer, listen server would be like, peer to server to peer?

latent heart
#

There are no "peers" in unreal. Everyone is either a server or a client.

nocturne quail
oak pond
#

oh so C is the host in this image

latent heart
#

Correct.

#

That can be either a dedicated server (no player) or a listen server (has a player)

oak pond
#

that makes sense then yeah

#

that reminds me that I always forget to playtest in other ways than just as client

nocturne quail
latent heart
#

Yes

nocturne quail
#

I will definitely use it

#

also the project will open source, so people can correct my working dirty code

#

๐Ÿ˜„

latent heart
# nocturne quail does Unreal supports p2p ?

Just to confuse things, you can get P2P networks where there is a single authority, but that's decided by the group and doesn't have to be respected. As everyone talks to everyone, you can say whatever you like "behind the back" of the "apparently" authority.

#

It's up to the machine you talk to to verify everything you say with the authority.

nocturne quail
latent heart
#

Unreal has the best model for gaming. By a long way.

#

But it's not the best for every type of game.

#

For instance, some games which use multiple servers and a lot of databases, might have a tiered authority system.

nocturne quail
#

tried to do blendspaces with C++, but it needs to hard ref tons of animations, thats why choosed editor to do this job

keen hound
#

@latent heart yo what should I use for dedicated servers? AWS and Azure seem to deny my debit card so I think I need a third party

quasi tide
#

Pretty much w/e you want

keen hound
#

so I can't use them

quasi tide
#

Pretty weird to be honest. It's just a program.

#

Digital Ocean should be fine

keen hound
#

since the server worked fine on my pc\

lost inlet
#

(though DO do that lol)

#

but with DO it's 100% CPU for a certain amount of time because they think you're mining

sinful tree
#

So just need to duty cycle the mining

meager fable
#

is there a delegate that fires when we leave the session on any reason(kicked, left, timed out etc)?

nocturne quail
#

will upload it there once completed

wind moat
#

Aight, ping me then xD

stoic acorn
#

Hi, I'm using the Advanced Input Actions on a Character Actor (Armour) that I want players to be able to possess. When it's the server the Armour can move fine but with the client it doesn't move.
Any ideas why?

#

p.s. When I use the previous InputAxis Turn & LookUp it works fine.

stoic acorn
#

nvm I figured it out. For those that care, here's what I did.
I was using the Event Possessed to add Mapping Context but of course that's only run on the server. I added a custom event and use the overlapping instigator controller on the Enhanced Input Local Player Subsystem node. Seems to work now

#

I'm actually failing to see why the Enhanced Input mapping is better than doing it the old way

#

Seems fiddlier to set up

thin stratus
#

@stoic acorn You are aware that you are adding that on EVERYONE, cause you are using a Multicast?

#

Also there is OnControllerChangedEvent you can override that calls locally and on the Server

#

No need for an RPC

pallid gorge
#

Hi guys I need help with a dialogue still
This blueprint is in my PlayerCharacter

#

This is in the NPC blueprint, why it doesn't call dialogue server?

calm prawn
#

Hi. Why the player state is not called inside game mode?

dark edge
#

print the player state, what is it?

calm prawn
#

In widgets and other places, I can call it.

#

Another thing is to call c_call (client) in player controller -> s_call (server)-> get player state

dark edge
#

Print the player state, what does it print?

calm prawn
#

When I saved to player state, I should have saved with the server? c_save -> s_save -> save to player state?

short arrow
#

otherwise there's a problem with your code

calm prawn
short arrow
calm prawn
#

I've tried from player controller.
Tab -> server_call to game mode -> game mode cast to player controller -> get player state from player controller -> cast to player state -> get the info and it's not returning anything. But I suspect though, that I should have saved on the server at first the game state infos?

chrome bay
#

Wait you're casting the GameMode to a Controller? That ain't gonna work.

short arrow
#

yeah I'm confused, screenshots would help

chrome bay
#

Also once the player has logged out, they are disconnected from the session - they can't make any Server calls.

#

The Server should be handling backend session management, clients should never deal with that

calm prawn
#

Not going to work like this? ๐Ÿ™‚

limber gyro
#

hey guys, im printing some values on "InitNewPlayer()" but the values are returning 0, even when playing as dedicated server

if (HasAuthority())
{
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, FString::Printf(TEXT("GetNumPlayers(): %f"), GetNumPlayers()));
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, FString::Printf(TEXT("playersPerMatch: %f"), playersPerMatch));
}
#

players per match is just a variable i set to 2 in the .h

#

am i missing something here?

chrome bay
# calm prawn

Should work. The Gameplay Framework does all manner of stupid and unspeakable things when a player logs out to the Player States, but AFAIK that would work.

#

But since that info is not replicated and is server-only, it's probably better on the Player Controller anyway.

#

Player State is really more for sharing data with clients, and they are also swapped, duplicated, moved around a lot etc.

stoic acorn
#

Here's a thing. I have 2 teams, TeamB players can possess and control a variety of 'Armour' items.

  1. When they possess an item I'm hiding their character mesh and disabling collision while they're 'out of body'.
  2. I'd like to be able to unpossess the Armour with a button press and have them re-possess their original character.

Question
What is the best way to retain a link between all Characters and the Armour they're possessing?

#

My guess would be to store a variable on the PlayerController in question as it's only the server and owning client that care about that connection, but I'm often VERY wrong ๐Ÿ˜ฎ

cosmic trail
#

Is there a proper way to handle collision prediction between two players when say they are heading at each other? Small differences in position may make one player swerve left on the server vs. right on the client and vice versa. At high latency, this will require a very jerky reset to the correct swerve direction before continuing prediction. Now imagine this with more than 2 players and it starts being very hard to control

limber gyro
#

the CMC should handle all that with smoothing and replication

#

afaik

cosmic trail
limber gyro
sinful tree
limber gyro
#

have u tried messing with that?

#

probably not the best solution but could help a bit

#

theres also some variables that let u ignore corrections but im not sure those would help u

#

since its a rts maybe it could work

cosmic trail
# limber gyro i think theres a variable that allows you to set how big the error is before u g...

so the problem is kind of like going through an obstacle. In the prediction, we go left around the obstacle, on the server it goes right. With say 150ms delay and enough speed, the player may get halway through the obstacle on the left side, but then the server message comes back and says, no, you should be on the right side. So then you kind of are forced to not do smoothing and jerk it to the right.

#

because if you do smoothing, you'd smooth through the obstacle

limber gyro
#

so its a pathfinding issue

cosmic trail
#

not really, since it involves player vs. player collisions, which pathfinding doesn't do

#

the other player is the obstacle

limber gyro
#

i would love to help but i dont have a solution for that, its a bit above my head

#

i feel like u probably need to do some sort of validation

#

to be fair 150 ms now a days is a bit of an extreme case

#

so if its working fine with say 99ms i wouldnt worry about it

#

im getting about 30 to 40 ms playing with people from india/america with a server hosted in europe

limber gyro
#

only 6 players tops with a few extra actors

#

i assume that helps

tepid lark
tepid lark
graceful flame
tepid lark
graceful flame
#

So it would be constantly having to do smooth corrections instead of just one quick snappy teleport to the right position.

tepid lark
graceful flame
#

That opens the door for desync though

#

Say you're making a racing game and there's a fork in the road and Player A is aligned to go left and Player B is aligned to go right but there's a lag spike just before Player A decides to change direction and follow Player B to the right instead of left. The server thinks Player A is still going left because it didn't receive the inputs to go right. So it would have to issue a correction which appears like a teleport for Player A from right side back to left.

tepid lark
#

I suppose that's why network programming is a specialization

graceful flame
#

and if it didn't issue a correction then Player A and Player B would see different things and the desync chaos takes over

tepid lark
#

(take the mountain pass)

graceful flame
#

and if you let clients have authority over their position then cheaters can just fly their cars and teleport to each checkpoint then the finish line like its no big deal

quartz iris
#

I have text on the front of each player's house, how can I show the name of the player who owns the house? I have a variable with the controller for the owning player inside the house bp

sage light
#

when I travel to a new server as a client,do my actors save their variables? or is the entire game loaded as new besides of the game instance?

hollow eagle
sage light
#

Also, a player opens the game build, will they always be standalone if they are not connected to server? or can they be client?

wheat niche
#

hey is there a lobby leave function?

pallid gorge
#

It is so wonderful

lost inlet
#

NM_ListenServer if hosting a game

cosmic trail
slim mist
#

For some reason when a client joins they are switched to a spectator momentarily after correctly spawning as a pawn. Does anyone know why?

latent heart
#

Do you have bDelayedStart set to true?

#

(in your game mode)

quartz iris
#

Am I getting the player's name from the playerstate?

hollow eagle
quartz iris
#

Ah got it

#

So I can just change the variable to player state?

#

Everything will work?

pallid gorge
#

Why is a wonderful day today

tepid lark
stoic acorn
#

Can't pawns commjnicate with the GameMode through an interface?

sinful tree
dark edge
tepid lark
stoic acorn
#

I'm trying to unpossess a character and repossess it's original body. Can't figure out where to put the code

sinful tree
tepid lark
sinful tree
stoic acorn
#

What's weird is that I can possess a character with overlap that communicates to the game mode (which is handling the possessing code)... but I can't do the same with a keypress

sinful tree
#

Thats because overlap events occur on both the client and the server. Keypresses only occur on the client.

stoic acorn
#

aha, that makes sense

dark edge
#

and why is it not replicated?

quartz iris
quiet cairn
#

hey all, I'm using AInfo derived class to store player XP. I generate the AInfo object on the server and it has correct property values on the server. but once i try to either pass it to the client or try to read from the replicated variable on the client, i get an empty AInfo object (the properties are set to default instead of my values). the AInfo derived class replicates and is always relevant. the properties on it are not replicated (but i've tried replicating them too -- same result).
does anybody know why that would be?

dark edge
#

onrep playerwhoownshouse -> set text or whatever you update

quartz iris
#

It just shows Text in game though

dark edge
#

you never set Player Who Owns House

#

also you have a bit of a data race / sync problem

#

the pawn has the house it owns

#

and the house has the playerstate who owns it

#

what if they disagree?

dark edge
#

a playerstate or playercontroller

quartz iris
#

player controller

#

of the player who joined

quartz iris
dark edge
#

OK so when do you set PlayerWhoOwnsHouse?

ocean geyser
#

is there a function or something to call that can force a variable to replicate? for example i have a replicated array that sometimes when modified will end up being the same, but it utilizes the OnRep to actually do something so i need it to actually replicate back down to the clients

#

do not

#

other option ive considered is a struct that contains said array with a replicated uint8 and just tick up that uint8 each time it changes

#

yes, but given that there are some cases where when the array gets changed, the end result remains the same (oldarray != newarray) it does not trigger replication of said array

#

yes sorry

#

basically refreshes a bunch of uobjects

#

going to try marking it dirty and setting the property to use the push based model and see if that does it

#

nope still treats it as normal even without being marked as dirty oddly enough
edit: nvm aparently that is a config setting (not sure if related to iris?)

ocean geyser
#

alrighty set it up to work wish push model and all that worked fine and as intended (planned to do this anyways) but same result. not sure of a way to force it to replicate aside from something like the above incrementing a uint8 alongside it to trigger it

#

could. ill try to refactor it, theres another way it can be handled that might be better overall

hot pebble
#

Hello everyone! so I just packaged my game for the first time (I'm new to UE) and I have my main menu with a create session and a join session UI, but it doesnt seem to do anything, has anyone encountered this before?

#

It works fine in the editor, I dont know if im missing something

#

I don't know if this also happens to have an issue with loading a new map, do you have to select which maps to export when you package a game?

hot pebble
# icy jetty

Omg thanks this fixed it! I appreciate it ๐Ÿ˜

wanton bear
#

in my animation blueprint event graph im getting the camera pitch and storing it in a variable, but when i print the string playing as listen server, the value alternates between what the value should be and some fixed amount

it also seems its accessing none trying to read property camera when the event first runs despite checking if the character is valid at the start of event blueprint update animation

sinful tree
wanton bear
#

literally just getting the camera component from a validated character and getting the yaw and setting a value

#

if i remove all the math and print like this

#

values are all over the place idk

keen hound
#

do I need the playfab sdk to use playfab

sinful tree
# wanton bear

This only happens on listen server? What happens if you try dedicated or standalone?

sinful tree
wanton bear
#

i switched to controller rotation and seems to be more reliable. not sure why it prints the actual value and the default value one after the other like that, but appears to be working 7739monkathink

#

i say it works... it works on the client now but does nothing on the server

#

be replication problem somewhere

eager flare
#

i heard linux is the best os to host ur game server is that true?

sinful tree
# eager flare i heard linux is the best os to host ur game server is that true?

I'm speaking more in terms of Linux based operating systems in general and not for game servers specifically, but most often Linux servers run cheaper as they don't incur additional licensing costs for hosting providers so you usually get some cost savings, and there is usually less impact on available resources (like CPU time and RAM) when running a Linux server vs. running a windows based server. I'd argue that it's probably more important to work with something you're familiar with as trying to use an OS you may have never touched and as advanced as Linux can present a very large learning curve.

eager flare
#

ive heard u need to type lines of code just to change the background

lost inlet
#

Linux really isn't that hard for the basics

#

You can compile the game server executable from Windows

wind iris
#

what is right workflow to host dedicated server ?
Can we finish multiplayer whole game ue5.1 first
than build unreal from github source.
host gamelift ?

Can someone help me in this area ?

fossil spoke
#

You could test your dedicated server locally though.

wind iris
#

is it epic team workflow ?

fossil spoke
#

The source build simply allows you to compile a dedicated server executable

#

You could start with the launcher build.

wind iris
#

is it only for locally testing game ?

#

I'm more confuse Now ๐Ÿ™‚

rocky kestrel
#

What is best way to profile dedicated server? I have mmo style game and it works players can play on server etc.. but sometimes server crash and I have no idea why.

rocky kestrel
#

Okay I found network profiler!

chrome bay
#

Profiling will give you performance metrics but not crash dumps. You need to analyse the crashes to see why

untold rose
#

Am I right in understanding that when a var that is repNotify is updated on the server, the rep notify event would call on all clients?

chrome bay
#

When clients receive it yes

#

They behave differently in BP vs C++ though. Such is the unfathomable genius.

untold rose
#

Strange, I have a bool that's repnotify but when updated by the server, the repnotify event doesn't call on the client. o.O The rep event calls on the server though so im a little confused haha

chrome bay
#

Paste codes

untold rose
potent token
#

in MOBA game, for minion(pawn) that out of sight, does the minion still get rendered ?

real ridge
#

when I override it then what?

quartz iris
#

Why does this damage code work with the server shooting the client but not the client shooting the server?

#

For most of my code I need it to work for the clients because at the moment it's only working for the server

#

I'm just not 100% sure why the clients aren't recieving info

chrome bay
#

Presumably because the client is not the owner of the actor. Clients shouldn't be telling the server to damage things anyway

#

The setup is very odd anyway

#

A multicast to set a replicated var

junior valley
#

Hi everyone, I'm trying to make a split screen multiplayer co-op game in UE 5.1, but each time I try to move the character with a game pad, it still moves the first player and won't move the second, even with "Skip assigning Gamepad to Player 1" ticked. I have got the spawning a second player down, I just can't seem to move it. Does anyone know any work arounds?

flat spoke
#

why is my dedicated server closing, when accessing him from editor ?

#

with build client it's fine, but ... that's odd !

#

MissingLevelPackage it says

tepid lark
#

ok wtf. been dealing with all kinds of issues with listen server stuffs. reverted project to a state where the problems didn't exist... yesterday movement was working just fine. today I'm getting the old issue of jittery movement and host looks like they're falling on the client screen. literally wasn't doing this yesterday.

chrome bay
#

Clients should never change replicated variables

quartz iris
#

How do I do it tho

woven basin
#

Why does AGameModeBase::PreLogin() not have a reference to the type of person trying to login?

A listen server is treated the same as an external user? So for doing password check, version check etc, I have to pass all the details to myself? Is there a way to just skip this for the server?

stoic acorn
#

could you use switch has authority and if it is Remote do the password check, if it's Authority do nothing, or skip to the next stage of your logic?

latent heart
#

Chances are Address will be 127.0.0.1 or soem such

stoic acorn
#

I'm a noob so take that with a pinch of salt

latent heart
#

Check what it says when you (pre) log in?

#

You could also try checking the netmode. If it's ListenServer and there's no players connected (gamestate->playerarray) then it will be the host.

woven basin
#

This might be what I need.

So if I want extra stuff to end up in ApproveLogin(), which only gets Options passed to it, I can have the client send the extra data via this? I'll give it a try

quartz iris
#

@chrome bay I'm not really sure how I should be formatting my code so that all clients know what is happening

woven basin
woven basin
thin stratus
#

Also how long ago did I answer that

woven basin
#

3 months, sorry, didnt mean to necro, I was searching

thin stratus
#

Ah no worries

latent heart
#

There might be reasons you don't want a user or particular users to join.

woven basin
#

Its really annoying that we ApproveLogin on the listen server for the host themselves. If you reject it for any reason, it is a hard crash - lol

thin stratus
quartz iris
thin stratus
#

That can't be true cause the stuff James meant are basics

#

The replicated variable already takes care of replication for the health. The Multicast is redundant

quartz iris
#

But why is it not working for the clients

tepid lark
latent heart
#

It's unreal.

quartz iris
#

I swear nobody knows this is why I can't find any info on it

#

๐Ÿ˜ข

tepid lark
quartz iris
tepid lark
sinful tree
# real ridge when I override it then what?

That OnRep function is fired when the playerstate has been replicated and should then be valid. You can use that override to then trigger other functions or broadcast an event dispatcher.

tepid lark
# quartz iris Yeah

instead of using that any damage event... can you create a bp actor for a projectile as an example. and when that projectile's collider overlaps, check all overlapped actors then cast them to your player character. have a server rep'd event called receive damage in that character which is called from the projectile's overlap. the server handles applying the damage to the characters.

#

I'm realizing that saying that out loud probably doesn't help and a tutorial would be better lol

sinful tree
# quartz iris Yeah

AnyDamage is called by ApplyDamage. Apply Damage can only be executed when you're already running on the server. The trick here is, is that you don't want to necessarily have a client telling the server to apply the damage, as the server should already know if the damage should be applied or not - eg.You'd spawn a projectile on the server that has an overlap that triggers Apply Damage, then the server should already know when the projectile overlaps and then it will properly call Apply Damage.

Your Health variable should be set as an OnRep variable. This means when your AnyDamage event is properly triggered, you can set the health variable as you need and it should reduce the health of the particular character and replicate it to everyone. The OnRep function for the health can then trigger whenever the value is changed on the server for any other clients, and then the clients can do any additional things you need, like updating UI and the like.

Your best bet may be to place some print strings around so you can see the flow of things.

tepid lark
#

I forget how useful the OnRep variables/functions are

latent heart
#

They are the usefullest!

quartz iris
tepid lark
#

also sidenote I think I found what was causing my weird issue... there is a spectator class that spawns in before the hero class. changing the spectator class' attributes to something other than the hero class' attributes (i.e. spectator attributes) messes things up. so for future reference, don't change the default attributes gameplay effect, modify them via separate gameplay effect modifiers instead.

quartz iris
halcyon totem
#

does event post login take place after the server travel?

sinful tree
quartz iris
sinful tree
# quartz iris Ok, I think I understand a bit more, i guess its strange to me that all variable...

You have to declare which variables are replicated - they don't replicate everything as not everything needs to be replicated. So if you mark a variable as replicated, it will make its way to the clients if it's on a replicated actor that exists on the clients (ie. Player Controller only exists on the server and the client who is that player controller, so it can't replicate to anyone else. GameMode only exists on the server so no variables on it can be replicated on clients as clients can't even reference it, PlayerStates are always relevant and replicate to all, so they will always be replicating their replicated variables to all clients). Using OnRep is still making a variable replicated, but it gives you a handy function that gets called when the client receives a change.

#

There are conditions you can put on replicated variables too that can alter the replication behavior, like skipping the owner, owner only, etc.

tepid lark
oak pond
#

whats the best way to replicate individual animation montages? do I make an event for every time one is used, or is there some way to do it with one event or something?

drifting heath
#

Hey all. I have an issue where my overhead widget for actors is showing at 0,0 in client, but is properly overhead in standalone/listen. I didn't think a component had to be set to replicate for things that are created at construction. Am I incorrect? The widget itself reads replicated data on the actor component, so the widget itself has no reason to replicate.

//header
    UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
    UWidgetComponent* OverheadWidget = nullptr;
//source
    OverheadWidget = CreateDefaultSubobject<UWidgetComponent>("OverheadWidget");
    OverheadWidget->SetupAttachment(GetRootComponent());
#

Static widget, with static transform relative to the root capsule. All it does is read on the tick for current hitpoints, and set the name/level at run time.

#

After running in standalone, it seems to be working fine now. ๐Ÿคทโ€โ™€๏ธ

drifting heath
#

Still having problems lol. Nothing works, until I run it in standalone, then it's fine after that.

#

Current issue is in standalone, the widget wil lface the camera. In client, it faces actor forward

quartz iris
#

2nd half

#

This is for a aiming system (in third person)

stoic forge
#

Trying to wrap my head around multiplayer widgets. I have an actor that calls an event on the player character to spawn the widget (1st image), and then on the player character side I have a multicast to create the widget, which is then called by the server. This works and the widget is added to all players screens it seems.

On the widget i have a "close button" that calls a multicast/server function on the player character to remove the widget(3rd image). and it works as long as I use the "server" character, but I get an "access none" when doing it with the client and I'm trying to wrap my head around why.

#

goal is to have the window close for all players not just the owning player

dark edge
#

delete every multicast from your project

#

that'll force you to do it the right way

#

then re-add them for the correct use cases (temporary things)

dark edge
#

widgets don't network

stoic forge
#

Im aware, i was saying that in context to what im trying to get to work

dark edge
#

if you want a button press on a widget to do something anywhere but on the client, you need to call THROUGH a thing that can netowrk

stoic forge
dark edge
#

any time you're doing get X 0 my alarm bells go off

#

that's a bad idea

#

get player 0, get pawn 0, get playerstate 0 all of that

dark edge
#

OnRep bWindowShouldBeVisible

#

and it should live in the gamestate

#

or some other replicated actor that everyone has at all times

quartz iris
#

and I should repnotify anything I want the clients to know

dark edge
#

if a door is open, the health of something, the currently held item,

#

only multicast things where it doesn't really matter if it happens or not

quartz iris
#

Ok

#

So i'm getting rid of the multicast for the aiming animations etc

#

I guess I could do a repnotify on aiming and play the animation montage there

dark edge
#

There are use cases for RPCs for stuff, like CMC uses rpcs and not replicated variables, but that's fairly advanced and not something to worry about right now.

coarse gale
#

Im runing a script on the server when it starts to generate a variable, Im doing it in the game mode blueprint, I need clients to have access to the variable but they don't seem to be able to cast to the game mode BP, what is the best way to do it.

#

Like, I could just create an actor bp and drop it in the level, run the server script on that and replicate the variable which the clients could access, surely there must be a better way ?

outer sphinx
#

Hello, a question, how can I "possess" (event on "possess") a character in a mmorpg project? I want to make a mount system but I don't know how I can possess the client character with a horse (the horse is the other character)

oak pond
#

still pretty clueless on what to do other than manually creating an event for every montage

sinful tree
sinful tree
glacial grove
#

Hi I know this question might be more specific to the physics channel but since it is also Multiplayer and replication related I am also asking in this channel. I am working on an Multiplayer project based on the chaos Wheeled Vehicle system in 5.1 on the Server side and in single player everything works fine but on the client side the movement just is jittering and resetting the vehicle to an previews position. The documentation & Tutorials only seem to work in 4.27 but not in 5. Is there any way to fix this?

sinful tree
oak pond
#

but this way is still just making an event on every place that plays a montage right?

sinful tree
#

It'd be a single event and you feed in a ref to the montage you want to use.

oak pond
#

ah yeah, I was wondering if it could be something like that

#

maybe thatd be fine then

#

I did try something like that before but I think I just went about it the wrong way

coarse gale
drifting heath
#
...
    UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
    UWidgetComponent* OverheadWidget = nullptr;
...
ANpcCharacterBase::ANpcCharacterBase()
{
    PrimaryActorTick.bCanEverTick = true;
    bReplicates = true;
    OverheadWidget = CreateDefaultSubobject<UWidgetComponent>("OverheadWidget");
    OverheadWidget->SetupAttachment(GetRootComponent());
}
void ANpcCharacterBase::Tick(float DeltaSeconds)
{
  Super::Tick(DeltaSeconds);
  const APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
  if (IsValid(PlayerController))
  {
    const APlayerCameraManager* CamManager = PlayerController->PlayerCameraManager;
    if (IsValid(CamManager))
    {
      const FVector CamLocation = CamManager->GetCameraLocation();
      const FVector fVector = GetActorLocation();
      FVector NewRotation = (CamLocation - fVector);
      OverheadWidget->SetWorldRotation(NewRotation.Rotation());
    }
  }
}

How do I get an overhead widget on an NPC to face the client's screen, specifically in C++?

Currently, if I play in standalone or Listen Server, it works perfectly. However, in Client mode, it just faces the forward vector of the actor and not the player's screen.

coarse gale
#

@drifting heath Not sure how you do it in c++ specifically, but I believe there is an option like render to screen not world or something

#

so I dont think you need to manually rotate it, you should just be able to toggle it to render to screen in c++ somehow

drifting heath
#

I'll try that. I figured using render to screen would make it look weird, versus like it was actually above the NPC's head, but I didn't try that yet. I'll see what happens

#

Yeah... I'm a derp. Nevermind. It looks perfectly fine using screen, and functions properly.

coarse gale
#

well it depends what you are going for, like screen may make it show infront of objects im not sure, that might not be what you want so...

drifting heath
#

Yeah it's showing through objects but that can be fixed.

arctic minnow
#

Do I need to run spawn sound at location on multi cast and server or just server?

#

๐Ÿ™‚ ๐Ÿ™‚

#

๐Ÿ™‚ ๐Ÿ™‚

coarse gale
#

Depends if the server has speakers or not

lost inlet
#

still not sure what's up with the 2x2 emoji grid that you post with every message

#

a multicast call on the server runs on the server and all relevant clients

quiet fjord
#

Guys, can someone help me with a bug that I have in a multiplayer game?

#

Is it happening to me that when I start a game I activate a cinematic where the players see it and when my game mode ends it takes care of owning the players but sometimes there are players who don't own them because it's due?

clever cipher
#

Anyone know why the ping is always 9999 using Steam Sessions? I didn't have this problem on another project I used Steam Sessions with.

uneven lion
#

If I call SpawnActor on the server and then immediately call a NetMultiCast, Reliable function on said spawned actor, the client never receives the event. I also tried calling my multicast event in BeginPlay if HasAuthority(), and still no. Do I have to put it in PostNetInit or what's the right play here?

#

Actually, I can do this with an OnRep so I'll try that ๐Ÿ™‚

worn steppe
#

hello multiplayer discord, it has been a few months, but I am back to working on this networked project. i can't wait to royally screw this project up as I have managed to forget everything I learned. gonna be so MUCH FUN ๐Ÿซ 

latent basin
#

Make sure you have source control

worn steppe
#

that is an exellent idea, why was this not in source control? my past self has been slacking

#

oh yeah, because it's kind of a pain to put all of these binaries into source control.. maybe i'll exclude them or learn git lfs or something

latent basin
#

Source Control can be a pain on systems like Perforce, Subversion but in today's video I'm showing you a very Quick & Simple effective way to do Source Control for Games & Projects using a Folder, Github, Github Desktop, and Unreal Engine 5! This works with older Unreal Versions and many other projects as well.

If you need to Add any Existing P...

โ–ถ Play video
worn steppe
worn steppe
#

woah github private repos are free now?

whole pine
#

how do i make seperate inventories for separate players

worn steppe
#

I store the player inventory on the ACharacter class

near granite
#

Who knows why AI Move To not working in multiplayer..dedicated server

limber gyro
#

blueprintImplementableEvents from pawns spawned in the server will only run in the server?

#

nvm, their not running at all

dim trail
#

Has anyone profiled spawning actors on the server?

arctic minnow
dim trail
#

Iโ€™m debating between making my respawn mechanic just a teleportation and reset vs destroying and spawning

drifting heath
#

If you're using a system like Battlefield, where you're using the same model, same settings, same everything, that would probably be better.

#

If you're using an RPG style system with randomized loot tables, percentages, etc.. I'd opt for destroy & respawn

valid bough
#

If someone can please help me, I'm attempting to do 2 things, when I shoot from the hip it shoots at the center of the screen. Which works. But when I ADS I want to shoot from a socket I created called "frontSightPost". So its always center when you ADS. For some reason even after replicating, it is always at 0,0,0 or some random value. ADS is replicated, I've tried ChatGPT for 2 days, still not helping lol. I am at a loss. This is C++. ```void AFPSCharacter::StartFire(const FInputActionValue& Val)
{
if (CanFire()) {
if (CurrentWeapon) {
bCanFire = false; // Disallow firing

        // Only set a timer for automatic weapons
        if (CurrentWeapon->bIsAutomatic) {
            GetWorld()->GetTimerManager().SetTimer(FireTimerHandle, this, &AFPSCharacter::ResetFire, CurrentWeapon->FireRate, false);
        }
        if (HasAuthority())
        {
                Fire();
        }
        else
        {
            ServerStartFire();
        }
    }
}

}

void AFPSCharacter::StopFire()
{
if (CurrentWeapon && CurrentWeapon->bIsAutomatic) {
// For automatic weapons, clear the fire timer when the button is released
GetWorld()->GetTimerManager().ClearTimer(FireTimerHandle);

    // And immediately allow firing again
    bCanFire = true;
}
else if (CurrentWeapon) {
    // For non-automatic weapons, reset fire immediately when the button is released
    ResetFire();
}

}

void AFPSCharacter::ResetFire()
{
// Allow firing again when the timer expires, regardless of whether the weapon is automatic or not
bCanFire = true;
}

void AFPSCharacter::Fire()
{
if (bIsADS && IsLocallyControlled())
{
ServerGetSocketTransform();
ApplyRecoil();
}
else
{
// If not aiming down sights, spawn the projectile immediately.
FTransform FiringPosition = GetFiringPosition();
SpawnProjectile(FiringPosition.GetLocation(), FiringPosition.GetRotation().Rotator());
ApplyRecoil();
}
}
void AFPSCharacter::ServerStartFire_Implementation()
{
Fire();
}

bool AFPSCharacter::ServerStartFire_Validate()
{
return true;
}void AFPSCharacter::ServerGetSocketTransform_Implementation()
{
// Fetch the Socket Transform from WeaponMesh and store it in a replicated variable
if (WeaponMesh != nullptr)
{
ReplicatedSocketTransform = WeaponMesh->GetSocketTransform("frontSightPost", RTS_Component);
FVector Location = ReplicatedSocketTransform.GetLocation();
UE_LOG(LogTemp, Warning, TEXT("Server Socket Location: %s"), *Location.ToString());
}
}void AFPSCharacter::SpawnProjectile_Implementation(FVector SpawnLocation, FRotator SpawnRotation)
{
FActorSpawnParameters spawnParameters;
spawnParameters.Instigator = GetInstigator();
spawnParameters.Owner = this;

if (AProjectile* bullet = GetWorld()->SpawnActor<AProjectile>(ProjectileClass, SpawnLocation, SpawnRotation, spawnParameters))
{
    FVector LaunchDirection = SpawnRotation.Vector();
    LaunchDirection *= CurrentWeapon->WeaponDistance;
    bullet->FireInDirection(LaunchDirection);
}
CurrentWeapon->AmmoInClip = FMath::Clamp(CurrentWeapon->AmmoInClip - 1, 0, CurrentWeapon->MaxAmmoInClip);

}

keen hound
#

what is this error>

#

using playfab btw

lost inlet
lost inlet
#

And it'll make the weapons feel unresponsive in ADS

covert mirage
#

Hello I have a ui button that when clicked, the button will set visibility to hidden on other widget
this works on client, but doesnt work on host, the widget still visible on host, fyi I run the game on Listen Server mode
Is this bug on host mode ?

lost inlet
wanton bear
#

are socket transforms on meshes in characters automatically replicated?

thin stratus
#

At least the relative one

wanton bear
#

struggling to get this ADS to work in multiplayer...

earnest jewel
#

Hello. I am a newbie and I'm having a bit of problem and if someone could even point me in the right direction, that would be greatly appreaciated.
So the issue I am having right now is that things are working fine while playing in Editor, using those NetMode and NumberOfPlayers settings, but the Build is causing more than a few issue.
An example in animations, I've replicated the variables that are used to check states of animations and as I said before everything is working nicely in Editor, but in Build the animations are not playing.
Someone please help me?

stable grotto
#

is it possible to get another dedicated server ping before connecting through BP?

rocky kestrel
#

How to fix this problem? For example if player opens door and then set door rotation Multicast. --> other player joins dedicated server --> doesn't see door opened but collision works still. Only visual.

#

Should I make timer for example check if door is open every 10s and if it's open then set rotation multicast?

#

I think this problem also comes if client2 is long distance and client1 opens door. Then client2 walks to that door.

chrome bay
#

Don't use multicast for state. Use a variable and an OnRep

#

Golden Rule of Replication

quiet fjord
#

Does anyone know how to change values โ€‹โ€‹from my gameState to my gameMode playing in dedicated server mode?

#

that is to say all client

#

I am trying to do that when a cinematic of the level ends in the blueprint of the level, it calls my gameState with a runOnserver function so that my gameMode does the possessing of the players. This event is marked in Multicast so that it can be carried out to all users but only to me. perform this mechanic well by playing RunOnServer this because it is

woven basin
#

Is it a bug that if ApproveLogin() in GameSession fails in 5.1/5.2 - it crashes the client? What is the point of doing checks there then?

Fatal error: [File:D:\EpicGames\UESource\Engine\Source\Runtime\Engine\Private\UnrealEngine.cpp] [Line: 14939] Couldn't spawn player: Password incorrect

thin fog
#

I wanna ask that how do we add option or widget through which we can just add friends search for friends by username and chat through them via dm (if u have any vid or documentation lmk)

valid bough
sinful tree
outer sphinx
sinful tree
valid bough
#

Can someone please help me again : When shooting on the client, the client's projectile seems to be on a positive linear slope when firing in ADS. I take the ADS socket from the client and on the server it works perfectly. But the client its just slightly off on the Z-axis depening on the distance shot. ```void AFPSCharacter::StartFire(const FInputActionValue& Val)
{
if (CanFire()) {
if (CurrentWeapon) {
bCanFire = false; // Disallow firing

        // Only set a timer for automatic weapons
        if (CurrentWeapon->bIsAutomatic) {
            GetWorld()->GetTimerManager().SetTimer(FireTimerHandle, this, &AFPSCharacter::ResetFire, CurrentWeapon->FireRate, false);
        }
        if (HasAuthority())
        {
                Fire();
        }
        else
        {
            ServerStartFire();
        }
    }
}

}

void AFPSCharacter::StopFire()
{
if (CurrentWeapon && CurrentWeapon->bIsAutomatic) {
// For automatic weapons, clear the fire timer when the button is released
GetWorld()->GetTimerManager().ClearTimer(FireTimerHandle);

    // And immediately allow firing again
    bCanFire = true;
}
else if (CurrentWeapon) {
    // For non-automatic weapons, reset fire immediately when the button is released
    ResetFire();
}

}

void AFPSCharacter::ResetFire()
{
// Allow firing again when the timer expires, regardless of whether the weapon is automatic or not
bCanFire = true;
}

void AFPSCharacter::Fire()
{
if (bIsADS)
{
GetSocketTransform();
}

FTransform FiringPosition = GetFiringPosition();


    // If not aiming down sights, spawn the projectile immediately.
    SpawnProjectile(FiringPosition.GetLocation(), FiringPosition.GetRotation().Rotator());

}
void AFPSCharacter::ServerStartFire_Implementation()
{
Fire();
}

bool AFPSCharacter::ServerStartFire_Validate()
{
return true;
}

void AFPSCharacter::SpawnProjectile_Implementation(FVector SpawnLocation, FRotator SpawnRotation)
{
FActorSpawnParameters spawnParameters;
spawnParameters.Instigator = GetInstigator();
spawnParameters.Owner = this;

if (AProjectile* bullet = GetWorld()->SpawnActor<AProjectile>(ProjectileClass, SpawnLocation, SpawnRotation, spawnParameters))
{
    FVector LaunchDirection = SpawnRotation.Vector();
    LaunchDirection *= CurrentWeapon->WeaponDistance;
    bullet->FireInDirection(LaunchDirection);
}
CurrentWeapon->AmmoInClip = FMath::Clamp(CurrentWeapon->AmmoInClip - 1, 0, CurrentWeapon->MaxAmmoInClip);

UE_LOG(LogTemp, Warning, TEXT("Location: X = %f, Y = %f, Z = %f"), SpawnLocation.X, SpawnLocation.Y, SpawnLocation.Z);

ApplyRecoil();

}

FTransform AFPSCharacter::GetFiringPosition()
{
if (bIsADS && IsLocallyControlled()) {
return BulletSocketTransform;
}

    FVector SpawnLocation = GetActorLocation() + (GetControlRotation().Vector() * 100.0f) + (GetActorUpVector() * 50.0f);
    FRotator SpawnRotation = GetControlRotation();

    return FTransform(SpawnRotation, SpawnLocation);

}

void AFPSCharacter::GetSocketTransform()
{
if (this->WeaponMesh && IsLocallyControlled())
{
BulletSocketTransform = this->WeaponMesh->GetSocketTransform("frontSightPost", RTS_World);
}
}``` I used debug spheres and the socket/spawn location of the projectile is correct , i replicate ADS correctly, everything is working as intened except the path of the projectile which I dont understand. This is UE ver 5.2.1

vivid seal
#

hi guys, i'm once again trying to get client-predicted projectiles working. The current approach I'm taking is spawning a client projectile, then RPCing the server with the firing info. The server then spawns their projectile, and that projectile ticks twice as fast until it has "caught up" with the client (basically i only tick twice as fast until the amount of extra tick time equals the client's ping), then the server projectile replaces the client projectile. Before catching up, the server projectile is hidden on the client.

The issue i'm having now is how to handle predicted hits before the server's projectile catches up. For instance, if a client hits someone point-blank with a projectile, but the server (receiving the firing RPC later) won't hit the same thing as it has moved. Should I be doing server-side rewind for projectiles, or just ignoring client hits with the fake predicted projectile and only using the server projectile?

wind moat
#

Hey, anyone knowing a quick and good way of creating servers for your game, that still do work and communicate with Steam?

graceful flame
young spoke
#

if the projectile firing and collision is faster than the average round time trip of your rpc firing, then the client view will be more correct and server view will always be slightly wrong , especially if the target moves at last second

#

so i feel like in these specific instances, the server should go with the client view and not kick off correction logic

#

i could be totally wrong though

wind moat
forest fulcrum
#

hello guys was having a issue im trying to make replicable a mesh from a PAWN , but can make it happen was trying to make variable replicated and not work

#

how can i achieve it

meager spade
#

you should not replicate the character mesh

forest fulcrum
meager spade
#

i am not sure what you are doing here

#

what you trying to do?

#

you seem to be doing everyone on the local client

#

you should tell the server

#

to do this stuff

#

so pressing E should tell server to possess the hoverboard

#

then you need to make sure all collisions are propogated properly

#

its not as simple as doing what you are doing

forest fulcrum
#

im trying with and RPC but server posses the hoverboard and dont need that

meager spade
#

your using playercontroller 0

#

dont ever use that node

#

get the proper controller for the pawn

#

right click, get controller, cast player controller

#

these should not be used, unless you know what your doing

#

they are bad

graceful flame
forest fulcrum
meager spade
#

no

#

you want the players controller

#

not the hoverboard..

#

just right click get controller

#

and dont pass in the hoverboard

forest fulcrum
forest fulcrum
meager spade
#

why is it a multicast

#

i never said do a multicast

#

@forest fulcrum

oak pond
#

is there a way to make players possess an actor in the map, instead of using a playerstart?

sinful tree
forest fulcrum
#

My approach is player action ->RPC server-> fire event in all clients using multicast

oak pond
#

or rather, doesnt spawn in anything if theres no default pawn class

#

I can do it with a possess node in the actor, with a signifant delay enough for the player to have joined, but theres no way thats gonna be reliable

#

yeah this is dumb

#

already searched all over for anything about this and couldnt find a thing

#

all I need is to be able to spawn players with some variables set specifically for different maps, but guess Ill have to rely on another actor for that

dark edge
#

It has to at least be a pawn

oak pond
#

but I just

dark edge
#

You don't possess actors

oak pond
#

yeah its just my regular thirdpersoncharacter placed in the level

#

but autopossess does nothing

dark edge
#

Ya just check auto possess player 0

oak pond
#

and how would it work it out for multiple anyway

dark edge
#

It would be ass for multiple

oak pond
#

well then how are they all gonna possess the same one

sinful tree
#

Multiple players aren't supposed to possess the same pawn.

oak pond
#

yep

#

exactly

#

so how would you even set up one for each player to possess

pallid gorge
#

I am using this blueprint in PlayerCharacter to Save Character, but I would like to create a new blueprint for make FQuests and variables. Is it possible to do it?

sinful tree
# oak pond so how would you even set up one for each player to possess

If you want pre-placed actors in multiplayer for players to possess, then you'd likely need to somehow get an array of all the actors that players could potentially possess in your game mode. You'd need some way of sorting said array if so desired, and then as players join the game you could use OnPostLogin to retrieve the actor in the array at index 0 and possess it using the "New Player" pin from the OnPostLogin event. Once possessed, you remove index 0 from the array, eventually using up all the available actors.

oak pond
#

doing something similar rn with actors that are basically like playerstarts, but have the variables the players need too. then it just sets them and teleports to one

#

doesnt seem like the most reliable solution though

#

but it does work

forest fulcrum
slim mist
#

Hi all, I'm multicasting the broadcast of a delegate, but the client that is bound to it is not having their callback function called. Does anyone see what I am doing wrong?

APawn* ClientOwnedPawn;
AUnownedDoor* ServerOwnedDoor;

void APawn::OpenDoor(AUnownedDoor* Door /* Door is not owned by player */)
{
    Door->DoorOpenDelegate.AddDynamic(this, &APawn::OnDoorOpen); // this does not fire on the client
    Door->Server_Open();
}

void APawn::OnDoorOpen()
{
    // This does not fire on the client
}

void APawn::Server_OpenDoor_Implementation(AUnownedDoor* Door)
{
    Door->Open();
}

void AUnownedDoor::Open()
{
    if (!IsServer())
    {
        Server_Open();
    }
    else
    {
        Multicast_Open();
    }
}

// UFUNCTION(Server, Reliable)
void AUnownedDoor::Server_Open_Implementation()
{
    Multicast_Open();
}

// UFUNCTION(NetMulticast, Reliable)
void AUnownedDoor::Multicast_Open_Implementation()
{
    DoorOpenDelegate.Broadcast(); // The callback above (APawn::OnDoorOpen) does not get called on the client
}
chrome onyx
#

Any chance you don't have the replicate bool checked?

slim mist
chrome onyx
#

I think you need to also add the delegate to the event's list:
OnBuffCompleted.BindDynamic(this, &UBlahBuffableComponent::OnOwnedBuffCompleted);
NewBuff->ServerOnBuffCompleted.AddUnique(OnBuffCompleted);

slim mist
#

Sorry, I'm having trouble understanding. Could you amend it to reflect the above example?

chrome onyx
#

Yeah I usually do them like I posted above, so you'd (on your pawn) have a delegate, something like:
FOnDoorOpened::FDelegate OnDoorOpened;

Then you'd bind the function you want to that event so:
OnDoorOpened.BindDynamic(this, &APawn::OnDoorOpen);

Then you'd register that delegate with the dispatcher on the door:
Door->DoorOpenDelegate.AddUnique(OnDoorOpened);

#

worth also seeing if it's a problem of:

  1. Pawn event not hooked up to delegate correctly OR
  2. Multicast not reaching the client correctly
#

could be either

slim mist
#

Like seeing up a UE_LOG in the multicast function to see if it reaches the client?

chrome onyx
#

breakpoint or log or whatever yeah

#

if you only get one log per instance that's the server only

slim mist
#

Will breakpoints work on the 2nd PIE session?

chrome onyx
#

yep

#

It can sometimes be a bit annoying to find out if you're on client or server, but "RemoteRole" on actor is usually a decent way

slim mist
#

Is there a way to easily tell if the breakpoint is referring to the first or second PIE session?

chrome onyx
#

and in this case # of calls will inform

#

yeah breakpoint -> RemoteRole IMO is probably the easiest. Print string in BP is nice cause it dumps whether it's client or server ๐Ÿ˜„

slim mist
#

Oh...one more complication...in the actual situation I am debugging, ADoor is actually UActorComponent

chrome onyx
#

yeah shouldn't matter, EXCEPT that you'll have to also check the "component replicates" bool on that component

#

Although if it's an actorcomponent it shouldn't start with an A ๐Ÿ˜ฎ

slim mist
ocean geyser
#

any idea if you can easily force a variable to replicate to clients even if it hasnt changed?

slim mist
#

Okay, this more accurately represents the execution flow:

APawn::Interact(UButton* Button) // owned by client
{
    if (!IsServer())
    {
        Server_Interact(Button);
    }

    Button->Activate();
}

APawn::Server_Interact_Implementation()
{
    Interact(Button);
}

class UButton : public UActorComponent // owned by server
{
public:
    FOnInteractDelegate OnActivate;

    void Activate() { OnActivate.Broadcast(); }
}

class UTerminalState : public UActorComponent // owned by server
{
public:
    FOnPowerSwitchDelegate OnPowerChanged;

    void TogglePower()
    {
        IsServer ? Multicast_TogglePower() : Server_TogglePower();
    }

    UFUNCTION(Server, Reliable)
    void Server_TogglePower();
    void Server_TogglePower_Implementation() { Multicast_TogglePower(); };

    UFUNCTION(NetMulticast, Reliable)
    void Multicast_TogglePower();
    void Multicast_TogglePower_Implementation();
    {
        bPower = !bPower;
        OnPowerChanged.Broadcast(bPower);
    } 

private:
    bool bPower = false;
}

class ATerminal : public AActor 
{
public:
    UButton* Button;
    UTerminalState* Terminal;

    virtual void BeginPlay()
    {
        Button.OnActivate.AddDynamic(this, &ATerminal::OnButtonActivated);
        Terminal.OnPowerChanged.AddDynamic(this, &ATerminal::OnPowerChange);
    }

    void OnButtonActivated()
    {
        Terminal->TogglePower();
    }

    void OnPowerChanged(bool bPowered)
    {
        // this is not being called on client
    }
}
chrome onyx
ocean geyser
chrome onyx
slim mist
#

wait I have to make one more change to my example, I f'ed up

ocean geyser
chrome onyx
#

I

#

AFAIK normally you can't pass components across the network

#

like you might want to make an interface on your button actor or something, or have the interact go to server with the actor (and then on the server, get the component)

chrome onyx
slim mist
#

just updated UTerminalState to accurately reflect the flow in my program

ocean geyser
chrome onyx
#

Right here though it seems like you're trying to send a UButton (which is a component) across the network in Server_Interact

APawn::Interact(UButton* Button) // owned by client
{
if (!IsServer())
{
Server_Interact(Button);
}

Button->Activate();

}

APawn::Server_Interact_Implementation()
{
Interact(Button);
}

slim mist
#

ooooo

#

What would be an alternate way to make it work?

chrome onyx
#

Like I would do:
APawn::Interact(AActor* Interactable)
{
if (!IsServer())
{
Server_Interact(Interactable);
}
}

APawn::Server_Interact_Implementation(AActor* Interactable)
{
UButton* Button = Interactable ? Interactable->GetComponentByClass<UButton>();
if (!Button)
{
return;
}
Interact(Button);
}

#

Bonus points if you have an interface or something to allow interaction with different kinds of things instead of directly casting

chrome onyx
#

but yeah passing target across the network as "actor" is always safer

slim mist
#

Server_Interact(Interactable) I might be misunderstanding, but isn't this sending an actor across the network? Does that work but sending a component doesnt?

#

This is the actual function being called from the APawn's component that deals with interaction:

void UVrCoreHandManager::HandlePrimaryButton(UGripMotionControllerComponent* MotionController, bool bPressed)
{
    if (!IsServer())
    {
        Server_HandlePrimaryButton(MotionController, bPressed); // this just calls HandlePrimaryButton
    }

    // Handle Animation

    // Send input to gripped objects
    TArray<UObject*> GrippedObjects;
    MotionController->GetGrippedObjects(GrippedObjects);
    for (UObject* GrippedObject : GrippedObjects)
    {
        // Check if the gripped object implements IVrCoreInteractableInterface
        IVrCoreInteractableInterface* InteractableInterface = Cast<IVrCoreInteractableInterface>(GrippedObject);
        if (InteractableInterface)
        {
            InteractableInterface->Execute_SendPrimaryButton(GrippedObject, bPressed);
        } else
        {
            // Check if the owning actor is implementing IVrCoreInteractableInterface
            AActor* Actor = Cast<AActor>(GrippedObject);
            if (!Actor)
            {
                if (const UActorComponent* Component = Cast<UActorComponent>(GrippedObject))
                {
                    Actor = Component->GetOwner();
                }
            }
            if (!Actor)
            {
                continue;
            }
            
            InteractableInterface = Cast<IVrCoreInteractableInterface>(Actor);
            if (InteractableInterface)
            {
                InteractableInterface->Execute_SendPrimaryButton(Actor, bPressed);
            }
        }
    }
}
#
inline bool IsServer() const
{
    return GetOwner()->HasAuthority();
}
chrome onyx
#

For an object to be able to be passed across the network as an RPC parameter, there are a number of things that need to be true for that not to be null

#

Replicated actors are always able to be passed, as are structs/basic types of course

#

but it gets hairy when you get to things that are just children of UObjects

#

but you don't have to take my word for it, you can see if the button is arriving safely on the other end of the server call or not

slim mist
#

UGripMotionControllerComponent* MotionController has bComponentReplicates == true

chrome onyx
#

like just check if Server_Interact_Implementation has a valid button when you go from client -> server

#

yeah but components replicate through their owner's actor channel, so it's a bit different

#

ie you can replicate vars and RPCs but the actual object isn't quite the same way

slim mist
#

alright when the client hits the button it works for the listen server, but the client doesnt see it

chrome onyx
#

if you happened to copy my code it doesn't have the Activate on APawn::Interact(AActor* Interactable) cause I was lazy

slim mist
#

I very much appreciate your help @chrome onyx

chrome onyx
slim mist
#

my guess currently is that the issue lay within UVrHandManager

#

because the buttons activate delegate isnt being fired on the client

#

although I'm a little puzzled, I would think that wouldnt even matter if what I'm really looking for is ATerminal::OnPowerChanged to be called, and the UTerminalState::OnPowerChanged delegate bering broadcasted from a mutlicast function on the server

#

seeing that when the client interacts with the button and the listenserver sees it...it is properly being sent to the server

#

but its just not making its way back to the client

chrome onyx
#

yeah like it really depends how you're planning to get that stuff to the client again

#

Typically it's like:
Client (Request) -> Server (Do action) -> Multicast

OR

Client (Request, Do action Locally) -> Server (Do Action) -> Multicast (Skip requesting client)

#

First one's easier, second one is more responsive

#

Like normally for a door, I'd just do client hits button, sends request, server sets a replicated bool, with an onrep that causes it to open/close

slim mist
#

wish I could use onrep more but I'm dealing with huge structs that contain tmaps

#

I have a centralized data store similar to redux

#

with lots of observers

chrome onyx
#

yeah I usually just bite the bullet and use Tarray for anything that needs to rep

#

cause otherwise it becomes a nightmare

#

sometimes I'll recreate the map on onrep or whatever

#

but yeah ue doesn't want to replicate maps thats for sure

slim mist
#
USTRUCT(BlueprintType)
struct ROYALDIVISION_API FBeagleState
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite)
    FFeetState FeetState;

    UPROPERTY(BlueprintReadWrite)
    FEngineState EngineState;
    
    UPROPERTY(BlueprintReadWrite)
    FApuState ApuState;

    UPROPERTY(BlueprintReadWrite)
    FElectricalState ElectricalState;

    UPROPERTY(BlueprintReadWrite)
    FWeaponState WeaponState;

    UPROPERTY(BlueprintReadWrite)
    FTgpState TgpState;

    UPROPERTY(BlueprintReadWrite)
    FSensorState SensorState;

    UPROPERTY(BlueprintReadOnly)
    FActorState ActorState;

    UPROPERTY(BlueprintReadOnly)
    FMfdState MfdState;

    UPROPERTY(BlueprintReadOnly)
    FControlsState ControlsState;

    UPROPERTY(BlueprintReadWrite)
    FChairState ChairState;
};

with each of those state properties having many...many properties

chrome onyx
#

yeah I mean I guess it depends how many of those have to be server auth/etc

slim mist
chrome onyx
#

but yeah if they could all change on server at runtime and have to be communicated that's trouble haha

pallid gorge
#

Why it does show the widget, but it doesn't change the boolean variable to true?

sinful tree
#

Otherwise, the boolean should be getting set within the playercontroller.

meager spade
#

They really need to put s bit notice on these stupid functions

#

Big

#

People use then not knowing what they mean or the purpose of them

pallid gorge
#

yeah it's true

#

i actually don't know anything about ue

#

still learning ๐Ÿ™‚

meager spade
#

Just right click type get controller

pallid gorge
#

why

meager spade
#

?

#

In your event graph

#

Right click type get controller ..

pallid gorge
#

nono

meager spade
#

And delete that get player controller node

icy jetty
meager spade
#

Player index is for split screen stuff

#

And use context matters

sinful tree
icy jetty
#

Yeah, Iโ€™d read that you need to get it from player state for multiplayer but I didnโ€™t realize you just need get controller

meager spade
#

I have never used those GetCrap nodes in any project

icy jetty
meager spade
#

0 is first controller in list

icy jetty
#

I guess itโ€™s just not doing the same thing the get controller is

sinful tree
#
FORCEINLINE AController* APawn::GetController() const
{
    return Controller;
}
meager spade
#

Index is the first controller in the list of conteollera

sinful tree
#
class APlayerController* UGameplayStatics::GetPlayerController(const UObject* WorldContextObject, int32 PlayerIndex) 
{

    UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);

    if (!World)
    {
        return nullptr;
    }

    // Don't use the game instance if the passed in world isn't the primary active world
    UGameInstance* GameInstance = World->GetGameInstance();
    const bool bUseGameInstance = GameInstance && GameInstance->GetWorld() == World;

    int32 Index = 0;
    if (bUseGameInstance)
    {        
        const TArray<ULocalPlayer*>& LocalPlayers = GameInstance->GetLocalPlayers();
        for (ULocalPlayer* LocalPlayer : LocalPlayers)
        {
            // Only count local players with an actual PC as part of the indexing
            if (APlayerController* PC = LocalPlayer->PlayerController)
            {
                if (Index == PlayerIndex)
                {
                    return PC;
                }
                Index++;
            }
        }
    }
// Truncated....
meager spade
#

Which I'd sat 0 fir clients but a server will have say 8 controllers

icy jetty
#

Oh ok so it would be different for the server, itโ€™s always 0 for the client tho, right?

meager spade
#

If you used controller 0 on server your always changing the first controller which might suck for players 2 to 8

icy jetty
meager spade
#

Those nodes shod be used if you need to use then and understand them

pallid gorge
meager spade
#

Single player games sure know your socks off with them

#

Knock

sinful tree
meager spade
#

Or its not replicated

icy jetty
meager spade
#

Oh it's a client rpc

#

Either way likely reading it from the wrong place

sinful tree
#

But again, it is getting set, it's more a matter of where are you reading it where it's not correct?

icy jetty
#

So if you donโ€™t use any of these โ€œgetsโ€, what do you use then? ^^โ€ฆ

sinful tree
# icy jetty So if you donโ€™t use any of these โ€œgetsโ€, what do you use then? ^^โ€ฆ

I just told ya ๐Ÿ˜›
Controller has a reference to its playerstate and its controlled pawn. Pawn has a reference to its playerstate and controller. Playerstate has a reference to its pawn (Pawn Private) and its owner is Controller.
These classes are the primary ways in which a player would be interacting with the game, or in which anything would be referencing a specific player. From any of these, you can get any of the others as needed (with exception to controllers in online multiplayer of course)

pallid gorge
#

At the end I fixed like this

#

idk

icy jetty
#

Right, yeah, I was just confused by Kaosโ€™ GetCrap nodes comment, I thought heโ€™s talking about all nodes that start with get ๐Ÿ˜…

pallid gorge
#

i dont even care sdince its working

#

probsably it's bad but it's owrking

icy jetty
#

You will likely encounter further issues with that

pallid gorge
#

probably

#

but for now it's working ahahahah

random heath
#

So, I am making an endless runner game in integration with Playfab and Xsolla:
1.I am integrating playfab for Leaderboard and Authentication services.
2.I am also using Playfab Economy and created virtual currency on it.
3.I am using Xsolla store and payment gateway to purchase virtual items using real currency and virtual currency.

Issue:
1:While trying to import catalog of playfab in Xsolla, I am getting this error attached below. Any assistance would be helpful.

arctic minnow
#

Is this replicated right ๐Ÿ™‚

#

๐Ÿ™‚ ๐Ÿ™‚

icy jetty
random heath
icy jetty
# arctic minnow

Where is the actual implementation of those events you are calling?

random heath
#

in blueprints

icy jetty
#

I was replying to someone else there

random heath
#

aah mb

arctic minnow
#

๐Ÿ™‚ ๐Ÿ™‚

#

๐Ÿ™‚ ๐Ÿ™‚

icy jetty
#

If youโ€™ve contacted them, then thatโ€™s your venue. It looks like an Xsolla issue so, no one here could prly help @random heath

icy jetty
# arctic minnow

Ok, so which part of the code are you trying to replicate? So far I just see calls to other events

arctic minnow
#

๐Ÿ™‚ ๐Ÿ™‚

#

๐Ÿ™‚ ๐Ÿ™‚

sinful tree
# arctic minnow

Don't make axis inputs RPC to the server reliable. You're asking for a bad time doing that. It doesn't need to be reliable as you're sending them every frame and you don't care if some frames are missed.

arctic minnow
#

Witch ones should be?

#

๐Ÿ™‚ ๐Ÿ™‚

sinful tree
#

Only ones that must be executed for gameplay purposes and would otherwise "feel bad" if players didn't get responsiveness from. Inputs usually you want reliable, but not when you're sending the inputs every frame.

#

Multicasts if used correctly almost never need to be reliable - they are usually reserved for visual/audio effects.

sinful tree
arctic minnow
#

O Ok I see its just weird when I play my game it feels like gravity is fighting me?

sinful tree
#

That's likely something else. Make sure you plug in your axis value into the add movement input rather than setting the axis value and using that for your move forward.

eager flare
#

Is there any good tutorials that shows you how to setup a basic multiplayer fps with dedicated servers?

dark edge
#

Good? Probably not

#

If you're talking about just launching a server, that's trivial. Just launch it.

#

If you're talking about orchestrating a whole automatic-scaling backend, if you have to ask, don't do that. You'll just generate a $100,000 AWS bill.

#

So Garrysmod style servers, trivial.

#

Fortnite servers, hard.

faint eagle
#

Is it possible to establish client-listen server connection between 2 editors running the same project on 2 different PCs in the same local network? I've done it before with online subsystems and on packaged builds but now I need to do it on editor level so I'm wondering if that's even possible ๐Ÿค”

dark edge
faint eagle
dark edge
#

Sure just connect

forest fulcrum
#

hey i was trying to posses in multiplayer a Pawn(skateboard) but it seems that in client doesnt work

rocky kestrel
#

How to update that current players amount? I have dedicated server game.

#

Or is there other way to do it? Can't find anything on Google

halcyon totem
#

I am having issues on my dedicated server , when my map restarts its over riding the code of where I want my pawns to spawn, instead spawning them in random player starts

#

anyone ever expirence this on map restarts?

halcyon totem
#

do we need to override anything?

#

with choose player start?

dark edge
#

Is ServerInfo a struct you added to something?

oak pond
#

how do I even replicate something that isnt an actual player

#

like for example just a physics object, if I wanted that to use physics server side then dont use physics but just set its location on the clients

untold rose
#

How would I go about getting where a player is looking from the server?

oak pond
#

just wherever you set the rotation variable replicate only that

#

set his angle on client, then after that send it to the fake players

dark edge
#

It runs physics everywhere but gently corrects it towards the server side version

oak pond
#

huh

#

unreal 5?

dark edge
#

4 and 5

oak pond
#

what, all I hear is physics cant be truely done

dark edge
#

Well you hear wrong

#

What can't really be done is predicted physics

#

If you're ok with ping lag between a clients inputs and the physics result then it works beautifully

oak pond
dark edge
#

There's a replication handler which corrects them

oak pond
#

how do you set this up though?

untold rose
dark edge
#

There's nothing to set up. Just make sure the actor replicates, replicates movement, and that should be enough. By default I think the replicate physics option is checked for the component that's simulating

oak pond
dark edge
#

There's tuning settings in project settings

oak pond
#

ah yeah, seems to be working, even if a little flashy looking, but if one player shoots one it only moves on his end. I havent replicated the shooting yet but shouldnt it still be doing something?

dark edge
#

Yes the forces and impulses need to be serverside

untold rose
oak pond
#

ok nvm it immediately desynced in the next playtest

dark edge
#

Make a target actor, give it a:

Begin play -> delay -> has authority -> random impulse

#

Tune your setup until server and client agree

#

Then start tuning it for smoothness. Stock settings are super strict

oak pond
#

Ive been spawning it on a slope right now and letting it fall off

dark edge
#

You should see corrections on client with the impulse, that's one way to test it.

oak pond
#

but its not even falling the same way in the first place

#

jeez I just made a new actor thats just a cube for testing this and its even WORSE

#

on one client it just freaks out and disappears from the map immediately

#

what

#

first frame of the playtest on both players

#

can I not just fake it already

#

all I wanna do is just send across the location and rotation. I dont want to simulate physics for each player. Ive already done a similar thing in the player script but in this case I dont know where to get the location and rotation from in the first place. if it doesnt simulate on each player then where? where does it COME from

chrome bay
#

Unless the object it moving on the Server, it won't send an update to that client. A client can desync themselves permanently if they're moving the object locally and the server isn't sending movement updates to them.

oak pond
#

exactly, so Im trying to run the physics on the server only

#

but now the multicast event wont do anything

#

even the damn print string isnt going through to the client

#

as if I suddenly cant do a basic event

icy jetty
#

Ah, multicast the apparent solution to everything

chrome bay
#

You don't neccesarily want to run physics server only, that'll just create input latency and give very jittery/snappy movement on clients. Clients should simulate so that updates between packets are smooth and objects are simulating properly.

#

Are clients controlling these physics objects? If so, make them pawns and possess them, uncheck "replicate physics to autonomous proxy" on the root component, then spam the server with an unreliable RPC about the current physics state of the object. That'll be basic client-auth physics.

oak pond
#

theyre not being controlled, I set it up so that it only simulates physics on the server, that works, and then even the multicast after that returns the location in a print string but does nothing

chrome bay
#

It works in editor, but it won't work well in the "real" world

#

multiplayer do be like that

oak pond
#

I know but in this case Im not actually doing a whole lot

#

literally just a regular server to multicast event

vivid dagger
#

Is it alright to use something like playfab as a database but then use dedicated servers from another source? Does everyone else just make their own databases?

chrome bay
#

If clients aren't controlling the object, then litteraly all you need to do is check "replicate movement" on the actor. That's it

oak pond
#

already did basically the same thing on the player except they use their own locations

#

no look I just did that

chrome bay
#

Clients WILL still simulate physics, whether it's simulating or not is determined BY movement replication.

oak pond
#

theres no way Im trusting separate simulations

chrome bay
#

But they will diverge

#

The only answer then is don't use physics, use a deterministic sim

#

It doesn't matter what you're doing, even if it's just one object, in the real world it won't work

vivid dagger
#

guys you are burying me it took me like 10 minutes to type that

oak pond
#

we were already talking tbf

#

this happens all the time

chrome bay
#

You won't get a steady stream of transform updates at 60hz outside the editor/LAN

oak pond
#

so I suppose not even the one that currently works on the player will either

chrome bay
#

Physics networking is literally one of the hardest things to solve in MP btw, not to disuade you

oak pond
#

it doesnt have to be perfect just not completely broken

#

yeah I know, which is why Im tring to AVOID simulating regularly on both

chrome bay
#

You can't without going into C++ anyway

#

Well, assuming you're using replicated movement

#

Which is the only sane way

oak pond
#

I just want to fake the position

chrome bay
#

Well, I guess you can turn off replicated movement and spam the position with an unreliable net multicast every tick

#

Not gonna scale

#

But memes/it'll work

#

ofc none of the physics replication stuff mentioned earlier has any effect in that case

oak pond
#

well this is pointless then

#

Ill have to make sure not to use any physics at all in any multiplayer maps

#

...in my physics based game

vivid dagger
#

then don't mind me making my entrance once again: Is it alright to use something like playfab as a database but then use dedicated servers from another source? Does everyone else just make their own databases?

chrome bay
#

I mean pretty much ๐Ÿ˜„

#

I've done a lot of network physics stuff, the only sane way really is to simulate everywhere

oak pond
#

yeah I mean as Ive said Ive always known to avoid physics in multiplayer but I dont see why it shouldnt at least do SOMETHING when I try to fake it

#

because its literally what I did on the player so that you can play without problems

#

at the very least Id be happy with individual non colliding objects

#

projectile movement is looking like the best chance

chrome bay
#

Well, projectile movement believe it or not also simulates independently on every connection.

#

And it really has the same deal in that if a client moves the projectile locally and the server isn't moving it, the client will desync permanently.

#

It's just more prominent with physics because things are much more likely to move "on their own"

oak pond
#

what I thought projectile movement was fine for replicating

chrome bay
#

It is, but it's the same deal

oak pond
chrome bay
#

Even characters can permanently desync, there's nothing preventing it from happening. If an object isn't moving server side, the server isn't going to send out updates for clients to apply.

#

But if replicated movement on two physics cubes isn't working, then something else is going wrong in your setup.

oak pond
#

its literally just

chrome bay
#

Does the client "own" the cube?

#

If not, they can't call that server RPC

oak pond
#

I dont even know anymore

chrome bay
#

I thought the clients didn't control the cubes?

oak pond
#

but I can see that I simulated it on just the server

chrome bay
#

I mean that setup is inherently broken. Whoever owns the cube is telling the server it's transform, server is then applying it, and telling all clients to do the same, so there's a loop there.

#

If no clients own the cubes, then that tick RPC is doing nothing

#

And all clients are trying to set the positions of all cubes, while also being told what the position is

oak pond
#

yeah Ive been asking about this in the first place actually

chrome bay
#

So they will just get stuck

oak pond
#

because I dont know how to just go from the server to the clients

#

no one owns this cube its just IN the map

chrome bay
#

Okay, in which case remove that tick function

#

Delete the mutlicast. And just check "replicate movement"

#

Fin.

oak pond
#

oh my god

chrome bay
#

Basically, delete all that, and check "replicate movement"

#

problem solved

oak pond
#

ah yes, immediate desync

chrome bay
#

Also, some other sanity things to check:

  • Cube must be the root component
  • Cube must be replicated
#

<@&213101288538374145> despatch pls

oak pond
#

still can be immediately desynced by just pushing it

chrome bay
#

You are using the default character implementation presumably?

oak pond
#

no thats why I had to use the same location faking method on the players

chrome bay
#

Okay in which case I can't tell you why it won't work

#

Cus I have no idea if the character logic is sound either

oak pond
#

most definitely not

#

but it does work if not influenced by anything else

#

no one mentioned root component before, I had a feeling about that but Ive never had to do that

#

and its not too convenient for some of my other things

chrome bay
#

the actors root component is it's transform, so it has to be the root object if you want replicated movement/physics

oak pond
#

well thanks for the help, maybe I can do something with this. is there any way at all to correct desyncs though? or is it best to just try to avoid anything else influencing the movement

wanton bear
#

hey all, i'm trying to figure out why a scene component attached to a camera on my character has the wrong roll rotation. Before i've done anything to it, it seems that the world roll rotation is 90 degrees off for everyone except the owning client...

#

translation and other rotation values are correct, im struggling eye_think

#

the translation is replicated if its in a character... i see the replication symbol when i drag out

chrome bay
wanton bear
#

oh interesting. if i subtract 90 degrees from the camera roll then it fixes it and the values line up

#

hacky solution because i need the rotation that was on the owning client for the rest of the logic

#

i guess just rotate the scene component lol.

rain condor
#

Yo! I have a drag and drop inventory and i wanna replicate drop items

#

Because pickup items it's replicated

sinful tree
# rain condor Yo! I have a drag and drop inventory and i wanna replicate drop items

When you "drop" the item, you need to make an RPC to the server through a replicated and owned actor/component. So if you have an inventory component that your inventory is stored in, that may be the place where you want to put that RPC. So then in your OnDrop function in your widget, you can call that RPC in your inventory component and do what you want to do when an item is dropped.

rain condor
#

What means rpc?

sinful tree
#

An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.

Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe

00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...

โ–ถ Play video
dusky yarrow
ocean geyser
#

is there anyway with replicating UObjects to have the UObject's properties utilize replication conditions such as COND_InitialOnly? or even push based. currently no replication condition makes any difference, even if the property is set to be pushed based it still checks and replicates all the time even when not marked dirty (only difference was the OnRep never fired oddly enough). same goes with all COND_InitialOnly properties

whole pine
#

how do you make linetracing recognize you are clicking on a different client player

icy jetty
#

Islocallycontrolled node might do the trick

whole pine
#

how do clients work? do they get a number or something?

#

im eventually trying to pull theplayfab name out of which client i click

icy jetty
#

Thatโ€™s a loaded question

whole pine
#

lol

#

i guess i mean how do i get the specific clicked clients info

icy jetty
#

Prly by accessing the referenced pawnโ€™s player state, but someone else here can prly give you the correct answer

whole pine
#

can you explain to me what kind of stuff should be going into player state or no

#

is player state even relevant if im using playfba to handle player info

icy jetty
#

Thereโ€™s also loads of resources pinned

whole pine
#

alright

#

any idea why this isnt working?

#

@icy jetty

icy jetty
#

Youโ€™re asking if the current actor is locally controlled, and then running it on the false, so thatโ€™ll prly never work

whole pine
#

ya im just seeing if i can open my other player's inventory first

icy jetty
#

Drag off the out hit of the line trace, break hit result

#

Grab the out hit hit actor and run the check on that

whole pine
#

what am i getting from hit actor? the capsule?

icy jetty
#

The pawn

#

You want to go up the hierarchy not down

whole pine
#

no get player pawn option

icy jetty
#

Getowner

unkempt tiger
#

When a server calls a UFUNCTION(Client, Reliable), does the server also run that function? think360

#

Or should I be calling the _implementation myself?

icy jetty
#

Client means run on client no?

unkempt tiger
#

it does, but i thought the server also entered the scope for some reason? and i feel like i've gaslit myself now

whole pine
# icy jetty The pawn

so i got the correct widget to show up but if im just trying to click another client do i check if the pawn is locally controlled for the location inputs? cause its just opening the widget regardless of where i click on the screen

icy jetty
#

Show code

whole pine
icy jetty
# whole pine

Ok alot of that seems wrong, idk why youโ€™re getting owner and trying to run code when the value is nullptr. And you donโ€™t have start and end vectors plugged into your line trace

whole pine
#

im seeing if its clicking owner char or another char

#

idk what to even put for location tbh this is my first day line tracing lol

icy jetty
#

Thatโ€™s not what isValid does

#

It checks if the incoming reference is a valid object or None (nullptr)

whole pine
#

well i couldnt plugthe get owner into a branch

icy jetty
#

I told you to check if it is locally controlled

whole pine
#

get owner doesnt go into locally controlled tho

icy jetty
#

Nvr said to get owner

whole pine
icy jetty
#

Lol Iโ€™m losing my mind sry too many chats

icy jetty
#

Yes

#

Except not self

#

Can you not plug in the hit actor into it?

whole pine
#

i cannot. so for location inputs though.... what even goes into that if im clicking another client

sinful tree
#

Hit Actor is an "Actor" reference, you need to cast it to "Pawn" to check if it is locally controlled.

icy jetty
#

Oh cast

#

Duh

ivory bear
#

In the below image, the Weapon_BP and Weapon_BP_3P are ChildActors that use a ParentSocket and ChildActorClass set to a Weapon blueprint of choice that has a first person field of view material (for ADS and object clipping) and ADS offset values. How can I hide Weapon_BP_3P from the first person camera/player and hide Weapon_BP from other players.

whole pine
sinful tree
whole pine
#

its a topdown game tho, so i have no idea. do i use the camera actor or something

sinful tree
#

If you have no idea, how would anyone else?
Think carefully about what you're trying to accomplish with the line trace. What do you want to trace from and to?

whole pine
#

my cursor to a character

icy jetty
#

You can use the show trace options to actually see what youโ€™re tracing at btw

whole pine
#

tru

sinful tree
#

You may not even require a trace for that. There's usually an "ActorOnClicked" event you could potentially utilize. Only trouble is, is that you've got to implement this on any actors you want to click.

whole pine
#

thats useful

#

let me give it a whirl

sinful tree
#

Technically speaking, your mouse doesn't really exist in the game world unless you've made some fancy 3D mouse that does. But you can do traces from the mouse using this node.

whole pine
#

actor on clicked didnt work

#

just opens the owning player's inventory widget instead of the otherplayers inventory widget

sinful tree
#

That's because you're getting the local player.

whole pine
#

ya but its comin off the false exec

sinful tree
#

No i mean, you're using "Get Player Pawn 0" which almost always returns the local player's pawn. So of course it is going to be locally controlled.

whole pine
#

i see

sinful tree
#

"On Actor Clicked" is something you implement in actors you want to be clicked on.

whole pine
#

so i should stickto the line tracing?

sinful tree
#

Well, you could just try removing the cast, checking if self is locally controlled.

whole pine
#

ah ok

whole pine
#

im tryin to think of how i could prevent the owning player inventory from opening if i click the other player

#

i guess just set a is locally controlled where i open the owning player inventory lol

#

thanks for the help

quartz iris
#

Guys

#

Is there a download for the UE 5.2 AdvancedSessionsPlugin/AdvancedSteamSessionsPlugin?

slim mist
#

Hey there, hope everyone is having a not-too-shitty Friday ๐Ÿ™‚ I have an NPC trying to invoke its own Server_ RPC, however I am getting this error:

No owning connection for actor BP_MyCoolNPC_C_0. Function Server_SetMfdPage will not be processed.

What is going on here?

quartz iris
#

It works on 5.2?

sinful tree
#

Yes

graceful flame
#

I'm using 5.2.0 yes, have not tested it on the latest release 5.2.1 though.

sinful tree
graceful flame
#

It was recently updated I remember it wasn't working on 5.2 just a few weeks ago.

quartz iris
#

It does say to rebuild/compile everytime I launch ue5.2 tho

sinful tree
ocean geyser
#

can someone explain the difference here for BP_Chest's Count and the total amount of replicated properties count? i would of assume that the property count and count of BP_Chest should be pretty much the same no?

ivory bear
sinful tree
quartz iris
#

I do get this error though

#

I cant launch UE5.2

ocean geyser
quartz iris
ocean geyser
quartz iris
graceful flame
# ocean geyser can someone explain the difference here for BP_Chest's Count and the total amoun...

My understanding is that Count is the number of times that BP was trying to replicate (netupdate frequency) but the count of properties is the number of times things actually were replicated, but I may be wrong on that. What I do know is that 99.60 waste is high which means you can probably reduce the update rate for that BP. However the more time between net update frequency the less responsive it will be for when you need it to replicate. But since the net update frequency can be adjusted at runtime you're free to apply whatever conditions you want to increase or reduce it. Maybe based on proximity to characters or something. There's also ForceNetUpdate which can be manually called at the end of an event so that it will replicate even if the net update frequency is waiting between updates.

ocean geyser
# graceful flame My understanding is that Count is the number of times that BP was trying to repl...

yep i actually just tested that and that seems to be correct. yea ik lol. right now im testing full blast because i was trying to figure out what the heck was going on since in my uobjects that use the actor for the outer i set them up to be push based and got very confused as to why it seemed it was not working as intended. i do have another question if you know. for example in my uobject i setup all the replicated properties to be pushed based and what i noticed was if i didnt mark the properties as dirty it would still replicate them but the OnReps would fire. i would of assumed if they were not marked as dirty then they would not even be checked or sent for replication but for some reason they are (push model is enabled in project)

graceful flame
#

I'm not too familiar with push model. I just RepNotify all the things. lol

ocean geyser
#

actually guess i can test that inside of an actual compoennt and see if its just a issue in the uobjects

graceful flame
#

oh yea I forgot about dormancy

#

That's like an on/off switch for replication