#multiplayer

1 messages · Page 216 of 1

kindred widget
#

That sounds like something you would maybe store locally on the client and pass through an RPC during login.

#

There's an async login thing that allows you to delay logins for a short time. So you can RPC the client, tell them they're logging in, send an RPC back with the picked data which finalizes the login.

velvet jacinth
#

Is there an updated article/guide for UE 5.4 about ReplicationGraph?
All I can find on the web or Youtube are deprecated lines of code in the ReplicationGraph class that doesn't exists anymore.

kindred widget
#

AFAIK Iris was supposed to be an intended replacement for the replication graph.

maiden flame
#

If you are using a dedicated server, you can try adding `[PacketHandlerComponents]

+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface` to your project's DefaultEngine.ini

thin stratus
#

If you have C++ available to you, youc an simply use the Player Options String. There is a function on the ULocalPlayer class you can inherit from that creates the option string. That's also how the ?name= one is passed. That string is then Available in the Login functions of the GameMode and can be used to set it on the PlayerController, and then from the PlayerController can be used in the GameMode's GetDefaultPawnClassForPlayer function (might be called slightly different).

#

BP only you are locked to keeping it local and sending it via a Server RPC after connecting.

rustic sable
#

looks like in PostLogin(APlayerController* NewPlayer) the player should return the options with GetOptions? I'm not seeing this tho

verbal ice
#

PreLogin and Login both have the Options string

kindred widget
prisma storm
#

Hey, I have a question about multiplayer regarding data serialization between Client and Server. I know that JSON is not very efficient in terms of speed, and I’ve tried Flatbuffers, but I found there’s an issue with validation when using multiple schemas, as if everything has to be in one schema. So I was wondering, how do you handle data serialization between Client and Server?

rustic sable
#
        FString ServerString = SelectedServer.Address + TEXT(":") +     FString::FromInt(SelectedServer.Port);
        FString Options = FString::Printf(TEXT("?CharacterIndex=%d"), CharacterIndex);

        FString FullServerString = ServerString + Options;
        FName ServerAddress(*FullServerString);
            
        UE_LOG(LogTemp, Warning, TEXT("Joining %s"),*FullServerString);
        
        UGameplayStatics::OpenLevel(GetWorld(), ServerAddress, true);

I'm still on the passing it in part, so when I open the level it would be like this>/

kindred widget
#

That looks correct at a glance.

#

Open Level though? This doesn't seem like you're joining a server as much as hosting one?

rustic sable
#

is that not the one to use?

#

I mean it does work when joining a host but I just came across that server travel is another option

prisma storm
#

but also other information such as the attack system, as I don't use the Unreal Engine network system.

rustic sable
#

I mean I'm opening connection to a remote host from a login widget so not sure if open level or server travel is more appropriate

shrewd ginkgo
#

In the stabbing event everything works properly and the simulate physics in onrep healt works but the UI show death menu in the same place does not work.

#

UI show death menu also works if I use this dmg actor

#

and players other than the server can't run the kill event.

verbal ice
rustic sable
verbal ice
#

Then you execute open YourFullUrlWithOptions

#

yes

#

Technically you can just do GEngine->Exec(World, "open ..."); but Exec functions can be stripped out in a shipping build if you change defines

#

The ExecuteConsoleCommand() function handles that scenario

rustic sable
#

ok I'm getting confused in order to get retrieve the options I heard
GameModeBase::Login(UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)

#

GetIntOption in GameplayStatics

#

now this 😅

verbal ice
#

Okay so, I'm confused as well

#

What are you trying to do exactly?

verbal ice
#

You wanna use ExecuteConsoleCommand not OpenLevel

verbal ice
#

(okay I checked OpenLevel should work as well but it's confusing)

rustic sable
verbal ice
#

Okay so pass it as an option when connecting to the server, then retrieve that options in PreLogin or Login

graceful flame
#

Some games allow console, are they packaged using Testing configuration instead of Shipping?

lost inlet
#

Shipping but allowing the console

graceful flame
#

how?

verbal ice
#

ALLOW_CONSOLE_IN_SHIPPING=1 in their definitions

graceful flame
#

oh

lost inlet
#

Requires source build too

graceful flame
#

thanks!

verbal ice
#

should work fine

rustic sable
#

ok let me give it a shot

jade scroll
#

i set in my character when i create widget and add to viewport

#

i set the variable character in my widget

#

all works fine in first seconds... after a few for some reason the variable is not valid anymore -.-

#

how is this possible

#

sometimes it works correctly....

#

sometimes after few seconds the variable is not valid anymore -.-

lost inlet
#

how are people still using UMG bindings

#

the secret perf killer

rustic sable
#
    FString Options = GetWorld()->GetMapName(); 
    int32 RetrievedIndex = UGameplayStatics::GetIntOption(Options, TEXT("CharacterIndex"), -1); 
    ```
how would I get this after connecting to the server, I'm getting the default
lost inlet
#

how does this snippet make sense?

rustic sable
#

its from a previous ongoing conversation

lost inlet
#

the args passed in the URL are in AGameModeBase::Login

verbal ice
#

You use the Options in PreLogin or Login

#

On the server side

#

If you need clients to have access to that, just replicate it afterwards

rustic sable
#

nope server is fine since that what is going to use it

#

so don't get it from the GetMapName then?

lost inlet
#

no?

verbal ice
#

No

rustic sable
#

k

lost inlet
#

GetMapName has no context about the joining player

#

virtual APlayerController* Login(UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage);

#

It really is right there. Options

rustic sable
#

why does this return a pc at the end, what the point of it?

verbal ice
#

It's the PC that was spawned for the player

lost inlet
#

because this spawns the player controller

lament flax
#

the ROOT of the player that joind is the PC

lost inlet
#

you can see what it does by opening GameModeBase.cpp

lament flax
#

from the PC you got the pawn, PS, etc

rustic sable
#

well yes, I know that last bit, just didnt know the login actually spawned the pc, interesting

rustic sable
#

ok weird question but what has authority before you connect to a host 😅

Like I launch my client which at first is just a level with a widget that retrieves the game servers, at this point is there anything that has authority? One you connect to a host it then it all falls into place but before that it's basically a single player game?

verbal ice
#

Same as a singleplayer game

rustic sable
#

yeah makes sense, like when testing as a local client something is handling the authoritative side but I wasn't sure about the diistinction, becuase when you actually connect to a dedicated server alot of things behave differently and it caught me off guard a few times

#

I guess editor does its best

rustic sable
#

what do I need to do to multicast a material parameter? currently trying it like this to set it on all the replicated components but it's not picking up

#

I have one dynamic material where I actually need to change textures, the rest are just instances likt the body color

verbal ice
#

Don't use multicasts

#

Use a replicated property and a rep notify

rustic sable
#

so like just a bunch of on rep floats that set the param?

dark edge
#

skincolor is one float

#

when it changes (onrep), apply it to the material instances

rustic sable
#

yup

#

I have other properties too but i get the idea

dark parcel
#

but using multicast deffinitly not the way to do it

vocal merlin
#

Hello, wondering if anyone can help with a movement desync issue I'm dealing with.

In my game if you walk into an enemy AI, sometimes it causes player movement desyncs which show with p.NetShowCorrections 1. It makes the movement very stuttery. I'm not sure what I need to do in order to fix this. Has anyone ever dealt with this before?

short arrow
vocal merlin
thin stratus
#

If it's moving it's somewhat expected to cause corrections. The client predicts movement but the AI they collide with is slightly behind. And on the server the AI already moved further. There isn't really a way to fix this, even with forward prediction, which I don't think exists for the CMC, you will get these corrections. Keep the ping low and it shouldn't be too noticeable

shrewd ginkgo
#

In the stabbing event everything works properly and the simulate physics in onrep healt works but the UI show death menu in the same place does not work.

#

UI show death menu also works if I use this dmg actor

#

and players other than the server can't run the kill event.

vocal merlin
twin juniper
#

I'm having an issue with my replicated flamethrower. It works fine when two players are facing each other and shooting. However, if one player is not looking directly at the other player (meaning they can't see the Player Character itself) but they can still see the flames from the flamethrower, The rotation of the Niagara Component for these flames doesn't seem to update (they aren't rotating correctly for the other player), which is confusing me. Any help would be appreciated!

twin juniper
next belfry
#

What happens if an Actor that is being replicated from the server, has a hard-referenced and unloaded asset inside it, does unreal engine streamer will load it automatically?

next belfry
# verbal ice Yes

Thank you, also does actor creation on client side wait for all hard-references asset to load before spawning them?

queen escarp
#

how would i add a delay in the loop body ?

#

like 1 sec before going to next etc.etc ?

next belfry
queen escarp
#

hmm

#

thats true

verbal ice
#

But AFAIK it won't be on the client without all of its hard references being ready

next belfry
heavy trench
#

Apologies for the vague question, but I have recently been getting a warning when spawning a client instance in PIE (Listen Server, 2 Players) where I am receiving the warning:

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_GASCourse_PlayerCharacter_ElfMale_C_1. Function Handle Gait will not be processed.

This seems fairly new so I don't know what I did to introduce this. This warning is coming from the character class BP_GASCourse_PlayerCharacter_ElfMale. I am not sure what I did to cause this warning to appear, or if I had just been blind to it and now only realizing its there. Any help would be appreciated, thanks!

lament flax
#

This will help you what the warning is telling you

#

Short answer:
you cant call a Server RPC on client side if the client doesn't have a owning connection (the PC is the root of that owning connection , its used by the Pawn and PS)

burnt coral
#

Is it necessary to put the:

bReplicates = true;

or should I just do this to the blueprint version of the object?

rose pollen
#

has anyone done performance benchmarks of mover 2.0 vs the cmc? does it do simple things like handle sprinting just via movement speed changes out of the box?

fossil spoke
#

CMC is prebuilt with many many features which you might not utilize.

#

Mover is more performant but less reliable.

#

CMC is less performant, more reliable.

rose pollen
#

got it, i am really using only very basic things, walk, jump, and sprint. the only changes to the default CMC that i need are predicted sprinting really so there isn't a ton for me to have to build, but dealing with bugs at that layer is super time consuming so maybe not worth

#

hmm, also GAS play montage and wait type stuff

fossil spoke
#

GAS does not integrate well with either the CMC or Mover, since all 3 have their own prediction...

#

Which makes it a pain in the butt

rose pollen
#

yes lol

#

can the net prediction plugin be used as an intermiedairy to resolve that or not really?

fossil spoke
#

Mover uses NPP i believe

#

So no

#

All of them would need to move to NPP to work together properly

#

Which is unlikely to happen anytime soon.

#

Maybe UE6 😛

rose pollen
#

lol

fossil spoke
#

Whats more likely is GAS moves to NPP and the CMC gets supercedded by Mover.

#

But even then, its not a small task.

rose pollen
#

probably most practical to just work with CMC for the time being for me then, but i have stamina and sprinting and really would greatly prefer gas to handle the stamina and its a pain

fossil spoke
#

If you are planning to release your game within the next few years, then I would stick with CMC.

rose pollen
#

gas + mover both with NPP sounds awesome

fossil spoke
#

Thats pure speculation BTW

#

Wishful thinking even

twin juniper
rose pollen
twin juniper
#

I'll check that out for sure!

lost inlet
# fossil spoke Wishful thinking even

Extremely since Epic have pretty much said repeatedly that NPP is basically in maintenance mode, but i did see a commit the other day that adds an interpolation service for fixed tick

#

So you can do Quake/Source style prediction

fossil spoke
#

Do you know if there is any clue as to whether Mover 2.0 is being integrated into Fortnite?

lost inlet
#

I think you'd see that through the context of commits

fossil spoke
#

Makes you wonder why they even bothered if that isnt the end goal.

lost inlet
#

If Fortnite's using it, it's getting the VIP treatment

short arrow
#

Is mover worth using yet?

fossil spoke
#

Anecdotally it is not.

lost inlet
#

Also during the Mover talk, it was explained that experimental = we're not using it internally, and beta = we are

fossil spoke
#

Interesting, havent heard that before.

#

I guess it was just a side project for an individual within Epic?

lost inlet
#

So far yeah, so hopefully he doesn't end up leaving like the NPP dude did

grizzled garnet
#

Having an issue with my shipping build, port 7777 is not opening when ?listen is on. In editor it's fine, and I see it's an issue with the program as in Windows resource monitor I do not see the port under listening ports. Steam SDK is set up in the game, could there be some conflict going on from this?

fossil spoke
#

And not the IPNetDriver?

#

If you are using Steam to drive Sessions, you will not be able to connect via IP.

grizzled garnet
#

yes I'm using the steam net driver

#

fallback IPnet

#

so I guess if not launched through steam then it would work over IP

#

I'm wondering, I have the game set up in multiple steam accounts for testing, if I could just join a friend's game? Idk I didn't do much setup beyond basic session searching and creation

#

though it's clear currently steam isn't properly set up for the server browser

grizzled garnet
brazen anvil
#

Quick question. In something like a FPS, do proxies run animation blueprint code? Or is there position just updated?

fossil spoke
#

Has nothing to do with the network context

brazen anvil
#

Ok got it. Thanks

grizzled garnet
#

There's a setting to actually run animations server side I'm fairly certain, had to do it in my game as actors attached were dependent on the animation state. Don't try syncing animations server-client though, it's too complex, work around it with some technical animation magic

quasi tide
fossil spoke
quasi tide
#

@fossil veldt What say you? About perf with Mover

heavy trench
# lament flax Short answer: you cant call a Server RPC on client side if the client doesn't ha...

I've read through the Ownership section and I'm still confused because my client character is being possessed by a controller so shouldn't that mean the character has the same owning connection as the controller possessing it?

I could have swore that these same server RPCs were working before in my project but even in a blank 5.4.3 the same idea throws these warnings so idk what's happening 😅

heavy trench
# heavy trench I've read through the Ownership section and I'm still confused because my client...

And I also am getting similar warnings in the character owned component for health, which I am more confident wasn't happening until recently which makes me believe a recent change is causing this. The most recent change was the integration of the Cog ImGui plugin but I tried disabling it and commenting out it's relevant code to successfully recompile but the warnings still show.

Any suggestions to where to look from here?

lament flax
#

Can you show where you call it ?

#

Also, arebyou sure that your character actor and components set to replicated ?

heavy trench
# lament flax Can you show where you call it ?

I will follow up with details once I am home again, it's morning where I am and I'm at work

I will verify that the character and the components are replicated after work as well; however I am fairly certain they are

heavy trench
sharp hamlet
#

Why does OnPostLogin returns PlayerController and OnLogout returns Controller?

lament flax
#

OnPostLogin returns a AController

#

its the BP version (K2_PostLogin) that gives a PlayerCOntroller

#

but they didnt do the same for the K2_OnLogout

#

yeah epic is kinda dumb here, they only call K2_OnLogout if its a APlayerController, but they didnt set the correct parameter type

#

so in your BP you can safely cast the AController to APlayerController since if its called it means its a APlayerController

sharp hamlet
thin stratus
#

Does anyone know why the CMC applies RootMotion Velocity (Translation) before Movement and RootMotion Rotation after Movement?
Comment only says what's happening, but not why.

keen oar
#

I'm currently making a backrooms type game. More of a passion project of mine which I've really been enjoying making.

I've gotten quite far into development and when discussing with one of the streamers who will be playing the game on release, he suggested multiplayer.

Now this game is in BP and I don't MIND making it multiplayer I was just curious if the process would require me to restart my whole project? Also, since it is BP, would i have to start writing it in C++ now too?

abstract arch
#

Greetings!

If I want to communicate with players from the GameMode (eg call a function / not replicate data) is it common to keep a list of connected players in the gamemode ? using postlogin and logout to update that list ? or does one
use the GetWorld()->GetPlayerControllerIterator() every time you need a player ? (C++)

abstract arch
#

or get the playerlist from the gamestate ?

chrome bay
#

If you're doing this for Server logic, i'd probably use controller iterator

abstract arch
#

yes dedicated server

#

would you explain why this would your preferred way ?

chrome bay
#

Well, since it's the Server, you probably want to refer to the actual controllers as that's the true player representation

#

Player States have a slightly different lifetime, they can even be reused etc

#

For clients though, yeah you would use the PlayerArray from GameState usually

abstract arch
#

I see because the server keeps its own copy of the playerController ?

#

but how would I then know if the iterator takes the true playerController ? Want I want is to trigger a function being called on the player client by the dedicated server.

#

what about storing a list of playercontrollers on the gamemode, adding them on PostLogin and remove them on Logout ?

thin stratus
# keen oar I'm currently making a backrooms type game. More of a passion project of mine wh...

Turning a Singleplayer project into Multiplayer is usually not a thing. The logic and assumptions made in Singleplayer very often don't apply to Multiplayer.
Multiplayer is loads more complex and difficult and requires you to follow a lot of rules to make things work properly.
The chances are high that your Singleplayer project would need so many changes that writing it from scratch would be better.
That's also why everyone says you can't really add Multiplayer after the fact. At least not without a lot of headache.

BP vs C++ is a different topic. BP can do Multiplayer, but the majority of useful (and often needed) logic and stuff is in C++ land.

#

Obviously mixing BP and C++ is usually the preferred workflow anyway.

chrome bay
chrome bay
#

Network performance is vastly worse

#

Like it's night and day

abstract arch
chrome bay
#

also mover being based on NPP, like Cedric said, makes it rotten to the core

thin stratus
#

I thought we should avoid discussing this here so that the rot does not spread into our sanctuary, #multiplayer ?

#

Otherwise, I shall start screaming about Mover and RootMotion. You all don't want that.

pallid mesa
#

Lol i think w'all jumped way too early ship onto mover X'D

echo lynx
#

Multiplayer is significantly different than single player.

fossil veldt
echo lynx
#

You will most likely end up with 30+ cpp classes minimum (it's not possible to make a networked multiplayer game of decent quality without c++l

fossil veldt
#

ngl I have appreciated the CMC way more since

pallid mesa
#

cmc is confusing at times

#

(at times) hahaha

#

i just feel mover is not yet baked

#

they reworked parts of the root motion recently for the motion matching stuff

#

i saw the fixed tick thing, which was an adapted PR

fossil veldt
#

Justin imho needs to just completely gut NPP and throw it out and replace it with a Kinematic mover liason which just works like CMC+

#

I get the feeling Epic is just doubling down on the physics prediction liason as the default which kind of sucks

lament flax
lament flax
chrome bay
#

chaos unrelated to NPP

#

Oh well, I guess they ahev the scene prediction stuff with fixed tick. Never gonna use that myself

lament flax
quasi tide
abstract arch
#

question about playerIDs, what is the difference between playerID and UniqueId in playerstate ? are these set automatically ? or do I need to set those myself using the setPlayerId or setUniqueId functions ?

#

also what is a good place to learn more about these things ? the documentation on the unreal site seems very barebones

chrome bay
#

PlayerId is pretty useless. UniqueId is a globally unique id for a player account which usually comes from whatever platform service you are using

abstract arch
#

what do you mean with platform service, something like amazon gamelift ?

lost inlet
#

no like Steam, Xbox Live, PSN, EOS

abstract arch
#

ah so unique id associated with someones steam account for example ?

lost inlet
#

yes, Steam will use the 64-bit Steam ID as an identifier

abstract arch
#

ok cool. If I would like to add my own identifier, could I user the playerID for that ?

#

in stead of adding an id variable to playerstate

chrome bay
#

playerID IIRC is just an incrementing counter, not really anything special about it

abstract arch
#

thanks!

woeful ferry
#

Anyone knows why the inventory gets the doubled the size from the server? I set the inventory to be size 25 on server, when it gets replicated down to the client, they have 50, but it says it added 25 indices

Client does no calls to setting the inventory

daring gorge
#

anyone know how to fix this jitter?
ive used the same system of attaching player to a vehicle and sending their input to the vehicle on my boat, the attachment is replicated too, boats work perfect w the same system and im currently using smooth sync for the time being, however this jitter appears on client, when i play as listen server its perfect

lament flax
woeful ferry
lament flax
#

x)

woeful ferry
#

Editor restart solved it

heavy trench
# lament flax Yes it should work

I have confirmed that both the character and the component in question are set to replicate. For the time being, I am calling the Server RPC on tick of the character actor in order to update locomotion variables used with the Gameplay Animation Example.

The chain of events that leads to the final PossessedBy is PostLogin-> HandleStartingNewPlayer -> RestartPlayer -> RestartPlayerAtPlayerStart -> FinishRestartPlayer -> Possess -> OnPossess -> PossessedBy

lament flax
#

calling RPCs on tick is just saturating bandwitch

#

you might start experiencing late replication for other stuff

lament flax
heavy trench
#

its in Blueprint

#

Get Desired Gate uses enhanced input to get the vector2d length of the movement input action and uses that to compare with a minimum threshold for walking and running and sets the enum accordingly

lament flax
#

i would like to see your original setup

heavy trench
#

There is no other RPC that I am calling so I don't understand what you are referring to

lament flax
#

so since the beginning yo uare doing this in tick ?

#

you should redesign that

#

make the variable "Gait" replicated

heavy trench
#

yes, I am doing it right now based on the example project animation setup and it was working fine for a while until it wasn't and that is where my confusion stems from

lament flax
#

also, i dont understand why you call this from client for server

heavy trench
#

It is based on enhanced input values which is data that comes from the client controller, no?

#

Get IA_Move in this case

#

I assume it would be better to handle this enhanced input event from the controller and pass the data to the character instead?

lament flax
#

i would suggest listening to changes on client and only tell the server when it changed

#

this would avoid unecessary RPCS

dark edge
#

get desired gait is local so just do that on tick on serverside version of the actor

#

what drives the gait?

heavy trench
#

Enhanced Input action value length, so the left thumbstick

dark edge
#

Shouldn't gait be derived by velocity anyway? Do you want to sprint into walls?

#

Unless you have some specific reason to drive gait by input and not resultant velocity, you can just do all of this in the anim bp

heavy trench
#

this just to drive animation changes, the logic comes from the gameplay animation example project

#

it uses a chooser with this enum to pick the appropriate motion matching data

dark edge
#

You using CMC?

heavy trench
#

yes

dark edge
#

why not do the choosing in the anim bp, everyone agrees on the velocity of the thing by default

#

that's the typical approach

#

input drives movement which drives animation choices

#

input driving movement is already handled for you through the CMC

heavy trench
#

I am just working with the example that epic made and exploring from there; not sure why it was decided that the chooser logic was driven by character exposed variables and not in the anim bp itself

dark edge
#

Did the example explicitly run the chooser logic on INPUT or on resultant STATE?

#

Anyway, remember that inputs are local only. If you 100% wanted to proceed with whatever you're doing, you'd want to send the input vector or the resultant enum choice to server on tick

#

not a good design IMO though

heavy trench
#

the animation example definitely was not made with multiplayer in mind so I will take all that has been said into consideration when moving forward

grave lynx
#

I have a issue with GetOwningPlayerPawn() inside a widget in multiplayer, on client side. In player controller, OnPossess, I run a client rpc and I CreateWidget, the owing object is this since we are in Player Controller.
Then, inside widget Construct, I'm just trying to check if pawn is valid.

if (GetOwningPlayerPawn())
{
    UE_LOG(LogTemp, Warning, TEXT("VALID"));
}
else
{
    UE_LOG(LogTemp, Warning, TEXT("NOT VALID"));
}

Maybe the workflow is not right, any idea?

subtle kernel
#

guys, I have the same code on windows machine and osx machine. I package DebugGame for both server and client. Windows run server, OSX run client. When I try to connect to the server I get error:

[2024.10.10-17.19.10:167][251]LogNet: NotifyControlMessage: Client IpConnection_2147482446 connecting with invalid version. LocalNetworkVersion: 3441883198, RemoteNetworkVersion: 2142559453, LocalNetFeatures=GenericReplication, RemoteNetFeatures=GenericReplication

How to make them match? What makes the difference? Is it possible to fix?

#

Should I manualy set version like:

[/Script/Engine.NetworkSettings]
NetVersionOverride=3441883198
ivory halo
#

Hi, I'm encountering a problem : I updated a project from 5.1 to 5.4, but now clients don't have access to variable, it returns "none" for them; give that in 5.1 everything worked correctly, am i missing something ?

velvet current
#

Struggling with ApplyDamage. Why does the first collision print damage of 0, and not get seen by Event Any Damage? When I print the target hit it's always the same (correct) actor, whether or not Apply Damage is actually delivered. Happens with and without emulated network latency.

velvet current
velvet current
ivory halo
velvet current
ivory halo
keen adder
#

Heyas, is there any float optimzations like FVector_NetQuantize?

#

Or should I just cast it to an int and back, multipling/dividing to save the decimal points?

queen escarp
#

hmm how do u guys handle npcs attacks ? if u have a mob witha swordfor instance do u use event notyify on a specific point and trace or whats the best way ?

dark edge
#

I like to keep it consistent though, whatever the system is, it should be the same for an NPC or the player's pawn

#

They should literally be the same base class IMO

queen escarp
#

hmm

#

hmm aye

#

its just somethings weird with my settup

#

sec ill show u

#

hm ok so basicly i have a timer by event that loops every 0,01 seconds and i pause it

#

then when notify in montage starts it unpauses then pauses when montage notify end i run

#

and i trace between the points,

#

works on player but on the enemy it dosent work

dark edge
#

Why timer?

queen escarp
#

each tic is when i trace

dark edge
#

why not use tick

twin juniper
#

In C++ multiplayer development in UE, should I use the deprecated built-in Damage System or create my own? It doesn't seem very complicated. Thanks in advance!

dark edge
#

you don't get to do stuff faster than tick

queen escarp
#

aye i know, its just easier to keep them seperate with the timer

#

just preffered way really

dark edge
dark edge
#

if you just have damage and that's it, who cares

#

if it's more complicated than that with damage types and fancy math, it can be different

queen escarp
dark edge
twin juniper
dark edge
queen escarp
#

or wdym ?

twin juniper
dark edge
#

like HP

twin juniper
#

I'll have something like this for sure, but for doing something like this:
Shot -> Hit Actor -> Apply Damage to that actor

Would that just be a function inside that component?

dark edge
#

The shot damages the StatsComponent, what that does is up to the component and its owning actor

twin juniper
#

Can that be done with bones? (Complex line trace)

dark edge
twin juniper
dark edge
#

Yeah me too, it's just too much

#

but a gas-like system is def. worth doing

twin juniper
dark edge
#

you're talking about HP per bone?

twin juniper
#

yes, also asking if with a complex line trace you can check if the actor hit has that component? (because I currently only know that it check for bones)

dark edge
#

Trace -> hit thing -> do it have component -> no -> oh well

#

that'd be like gun hitting a rock or whatever

#

for the bones thing

#

Trace -> hit thing -> do it have component -> yes -> tell component you hit its actor (also tell it what component got hit and what bone index or whatever) -> let it handle it from there

queen escarp
#

hm i kinda solved it but im using a event tic now, is that a common way to use attacking ? i rarely use event tic cost im afraid of the cost :/?

dark edge
#

Each frame, do you care about whether or not a hit just happened?
Something somewhere has to tick to check

queen escarp
#

yeah i know

#

i just never use event tic but ive heard ppl use it before for this type

dark edge
#

how do you move things

#

how does anything happen

queen escarp
#

yeah i get what your saying event tics are everywhere

dark edge
#

The cost of tick in blueprint is just the fact that some people put a bunch of blueprint nodes on it and do unneccesary work every frame

#

Basically your cost per frame is NumThingsTicking x AmountOfStuffTheyAreDoing x 100 if in BP or 1 if in C++

queen escarp
#

oh really bp is that much more costly :/

dark edge
#

yes but whether or not that matters depends

#

going from 0.01 ms/frame to 1 ms/frame, not a big deal

#

going from 1 ms/frame to 100 ms/frame, huge deal

queen escarp
#

true

twin juniper
#

well 1 ms is kind of a big deal

#

if you do not need it

dark edge
#

Yeah I'm talking total cost

#

the fact that BP is slow is a nothingburger if your total BP cost pales in comparison to the rest of the base cost on game thread.

#

but if your BP cost is dominating the game thread, it's time to refactor

shrewd ginkgo
#

Blueprint Runtime Error: "Accessed None trying to read property GameUI". Node: Set with Notify RemainTimeSec Graph: OnRep_RemaingTime Function: On Rep Remaing Time Blueprint: InGamePlayerController
Blueprint Runtime Error: "Attempted to assign to None". Node: Set with Notify RemainTimeSec Graph: OnRep_RemaingTime Function: On Rep Remaing Time Blueprint: InGamePlayerController
Blueprint Runtime Error: "Accessed None trying to read property GameUI". Function: On Rep Remaing Time Blueprint: InGamePlayerController

#

I don't understand why it gives this error even though I created the GameUI variable. The strange part is that it works without any problem, but when I close it, it gives this error.

dark edge
#

also GameMode only exists on server

#

there is no clientside GameMode to RPC to

shrewd ginkgo
#

I used it because I want it to reflect in the UI every time the variable changes. the counter should be in gamemode and I should distribute it to the players

#

what I need to do

dark edge
#

Counter should be in GameState probably

dark edge
shrewd ginkgo
#

can everything else remain as it is?

#

already using rep notify

dark edge
prisma snow
#

Would there be any reason that simulating a multiplayer game (listen server + client), if I run under one process, everything runs fine, but if I run in different processes, client has a lot of lag?

dark edge
#

you using network emulation?

prisma snow
prisma snow
dark edge
#

You've effectively been testing with 0 ping this whole time is my guess

#

Not sure, but I'd guess there's probably some race condition that didn't show up before and now is

prisma snow
#

So generally I tested without ping, but I also did run some controlled tests with emulation settings, nothing felt half as laggy as now (it was time ago, so the game complexity is now higher).

dark edge
#

define laggy

#

what is actually happening

#

might not be network related at all, gotta know what's actually happening

prisma snow
#

What I don't know, is why ping would be so high given that both processes are running on the same machine

dark edge
#

do you know that it's actually a latency issue?

#

what's the symptom?

twin juniper
#

on the same machine, ping is 0

prisma snow
#

So I'm testing RTS movement, and one change I did recently was that pathing is now calculated on server and replicated instead of calculated on client and server

#

the replication of the path (which a small array of 3-4 vectors) takes enough to be noticable

#

I'll first of all debug the ping, should have done it before

dark edge
#

who knows

prisma snow
dark edge
#

or whatever it's called

#

project settings

prisma snow
#

funny, I unchecked the option and it's still doing it

#

stat net shows ping between 50 and 150 depending on which window I have focused

dark edge
#

maybe you do have network latency in the mix somehow

#

that's sane ping, make it work

prisma snow
#

yeah it's sane but weird, would have never imagined

dark edge
#

does it seem to take 50-150 ms for something to move once you give the command?

prisma snow
#

yes, or more

dark edge
#

perfectly reasonable for a server-authoritative RTS with no prediction

prisma snow
#

but maybe it is the path replication that is slow

#

I am using a FFastArraySerializer

dark edge
#

Could be, I'd do some timing tests

prisma snow
dark edge
#

have client send an RPC and time how long it takes between setting the replicated var and getting the RPC back

prisma snow
#

and thanks a lot for the support

dark edge
#

RPC should be as fast as possible so it'll give you a sanity check

#

I'd look at replication frequency too

worn flint
#

Do you guys know of any way I could get my character's last inputs to be replicated to the server without sending data ?

#

I saw that there's a FSavedMove class that is used for network compensation, could I get the last inputs from there ?

prisma snow
# dark edge RPC should be as fast as possible so it'll give you a sanity check

yeah, I'll check all that. However you made me think that actually, this is a good situation because if I manage to make it work better in this conditions, it will be a better playing experience overall.
I think I'm going to try to implement prediction for the pathing - it's not that complex and should give good results most of the time.
One of the things we wanted to implement was some debug/log information about how "deterministic" the game is, to track which things tend to desync more and work on those

#

Also I have realized that the move order (which is not predicted, it's a reliable RPC) does arrive back to the client very quickly, while replicated path is very slow. Maybe the problem is the FastArraySerializer helper actor, will try with a normal replicated array and On_Rep to check

twin juniper
brazen anvil
#

Is it better to have more components with less replicating variables each, or less components with more replicating variables each?

shrewd ginkgo
#

In the stabbing event everything works properly and the simulate physics in onrep healt works but the UI show death menu in the same place does not work.

#

UI show death menu also works if I use this dmg actor

#

and players other than the server can't run the kill event.

jade scroll
#

guys the unrela engine is full of bugs. i cant even work with this bugs. my whole project goes down.

#

nothign work anymore. if i change some code from save game or some structure.

#

if i ge tthis bug i can only code the project new. nothing will help anymore. the is the most fkc on earth

fossil spoke
#

If the engine was full of bugs as you claim, no one would be using it. Maybe you need to re-evaluate that assertion, perhaps its you that have introduced those bugs in your own code?

jade scroll
#

my code working fine

#

its the structure bug of unreal engine

#

the most people dont have any project or sturccture... they only playing wiht unreal

#

if you have big project you will know the bug

#

its the biggest fkc inearth

verbal ice
#

Worked on big projects, no idea what you're talking about

jade scroll
#

then you never workd on project 😄

#

i give my blood for it.

#

do you have strucures in your game?

#

structure? do you have ? in your game?

#

referenced by 20 blueprints

verbal ice
#

Pretty sure this is the wrong channel for this

#

Elaborate what your issue is, if it's Blueprints, #blueprint, if it's C++, #cpp

jade scroll
#

pssst you never code anything. dont talk anymore thanks.

#

unrela engine is full of fkcn bugs. i need now again my project from new.

#

compelte from new. -.-

fossil spoke
#

@jade scroll This is not ontopic for this channel.

verbal ice
#

Lovely :^)

jade scroll
#

if some code with unreal. you woud know this bug 😄

twin juniper
jade scroll
#

i give my blood for this my face and ym word

fossil spoke
#

Please move to an appropriate channel if you want to continue. Otherwise move on.

dark edge
#

That code is messy though

#

are you intending for the boolean IsDead to only ever be set on server and owning client? Because the controller cast will fail on other clients

lament flax
brazen anvil
dark edge
lament flax
#

do what fits the best for you design and comfortable

dark edge
#

fitting the design is the most important thing

twin juniper
#

How to force an actor's transform to replicate always?

brazen anvil
#

the design works both ways

dark edge
twin juniper
dark edge
twin juniper
dark edge
twin juniper
#

I think I know the error

twin juniper
#

So since camera isn't valid on the server WHEN the player character is out of your viewport (which is weird), should I be sending server RPC on tick to update the a replicated value? (unreliable tho)

dark edge
#

what are you actually doing here?

twin juniper
#

I'm spawning weapons based on the camera's forward vector

#

Would it be 'fine' to call a Server RPC on tick?

jade scroll
#

if no one here know the structure bug. this cant be real xDDDDDDD

dark edge
#

don't rely on the camera for anything but the local players stuff

dark edge
jade scroll
#

waht im talking about? haha

#

did you ever code soething in unreal engine?

twin juniper
dark edge
#

Yes, now what is this structure bug you keep talking about?

jade scroll
#

hahaha

#

go to your project. add a variable to strucure

twin juniper
jade scroll
#

and nothign will work anymore

dark edge
jade scroll
#

bullshit? are you kidding me?

dark edge
jade scroll
#

go to your srucute add a varibale and all blueprints refnreced with this trucute will not work anymore

twin juniper
dark edge
jade scroll
#

it works fine?

dark edge
jade scroll
#

show me your strucute show me your project

#

you ar ekidding me 😄

twin juniper
dark edge
twin juniper
#

this is server replicated?

#

Is this integrated in the camera or camera boom?

dark edge
dark edge
dark edge
twin juniper
#

ye, I think I'll go with RPC on tick since I have a pretty customized setup

#

because it's another rotation, not exactly like the one from the camera

dark edge
#

I mean if you need a replicated rotation then you just need one, but look into GetBaseAimRotation

#

btw we talked about this a while ago lol

twin juniper
#

I don't think so

#

when?

dark edge
#

LOL I was mistaken, I was talking to you about something at the same time someone else was dealing with this problem.
#multiplayer message

vague ocean
#

how do I stop the customrenderdepth from replicating?

vague ocean
#

it has to be, im setting it to highlight an object that a player is focussed on

vague ocean
#

but its showing on all clients

hollow eagle
#

you sure you aren't just running your code on all clients

#

custom depth doesn't replicate

dark edge
#

I bet you're doing that instead

vague ocean
#

great question haha

#

I haven't looked at the code in a while

#

ill check in a little bit

#

unreal takes a bit to boot

twin juniper
#

what's custom depth?

vague ocean
#

Ok, so its a bit convoluted, but here's the setup
Interactable.h interface: c++ UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interaction") void Focus(AActor *Caller);

InteractableBase.h implements it: c++ virtual void Focus_Implementation(AActor *Caller) override;

implementation: ```c++
void AInteractableBase::Focus_Implementation(AActor *Caller)
{
this->m_InteractableMesh->SetRenderCustomDepth(true);
}

#

Discord formatting 💀

vague ocean
vague ocean
hollow eagle
#

I don't know what you're doing

#

the option to render custom depth is not replicated

#

but your code telling it to render custom depth may be

vague ocean
#

there's not a single multicast in the project

#

if thats what it would mean to run it on all clients

hollow eagle
#

I didn't say anything about multicast

vague ocean
#

Yeah thats what im wondering

#

How would it run on all clients?

hollow eagle
#

Multicast is not the only way for this to happen

#

Because every client may be running the same logic even for non-local characters

#

I don't know your code

#

something is calling Focus on all clients, or you have other code enabling custom depth somewhere.

#

The engine does not do this on its own.

vague ocean
#

Hmm

#

Ok ok

#

This is a good starting point to look for it

vague ocean
hollow eagle
#

no

vague ocean
#

hm

vague ocean
# hollow eagle no

Something is very sussy lmfao, for some reason when focussing on an object on a client, it always shows the focus on the listen server instance, but only sometimes on the other clients?

#

does it sound like unreliable replication or am I losing it

hollow eagle
#

You're just making wild guesses. Is anything involved in calling your function involve replication or RPCs in any way?
Is the code that calls this function running even for non-local clients like I've said multiple times?

#

And if you don't know what calls this function or from where, debug it. Place a breakpoint.

vague ocean
#

I've looked at every call, there doesn't appear to be any RPCs

hollow eagle
#

Is the code that calls this function running even for non-local clients like I've said multiple times?

vague ocean
#

Mb lmfao

#

Lemme check

daring gorge
#

anyone have any idea why this is happening? my attachment is properly replicated and im using smooth sync for the time being, my boats work properly with physics being simulated, however my heli doesnt.
im attaching player to vehicle and passing input to the vehicle

vague ocean
#

Not replicated, it is being called on all clients

#

How tf that is happening is the next question

hollow eagle
#

Because you're not checking if something is locally controlled before running code that should only happen for the local player

vague ocean
#

My networking mental model is not accurate, I thought that was the default tbh

#

I gotta reread the compendium

hollow eagle
#

If an actor exists on all clients then it runs code on all clients. Some actors only exist for the owning player, some exist for everyone.

vague ocean
#

Ok ok, that makes sense

#

What is the correct check to do?

#

isLocallyControlled?

twin juniper
#

@dark edge I've done what you told me to do, but it still doesn't change the rotation when the client is out of the server's camera's viewport

#

I'm attaching components like this, I don't see any problem:

FAttachmentTransformRules TransformParams(EAttachmentRule::SnapToTarget, true);
Actor->AttachToComponent(Mesh, TransformParams, "Socket1");
vague ocean
#

change the relevancy setting

twin juniper
# vague ocean probs out of relevancy

it's literally 4 meters away, not sure why but when it's kind of in the server's vision cone, it rotates normally on the server or otherwise it doesnt update

crystal crag
#

Hey everyone. I've been out of the loop for a while. At a very high level, using the latest UE 5, what is the best way to handle transferring players into another environment? For example, the players are outside and you want them to interact with the doors to a building to be transferred inside. Is level streaming still the way to go or have better systems emerged over the past few years?

golden seal
#

Hey all, Metahumans/networking question here. I have a Metahuman set to live retarget off of my third person character mesh, and in most cases it works fine. If I set simulate physics on my character from the server, however:
It is fine on the local client
It is fine on the server
But OTHER clients see the metahuman fly off playing the falling animation, reset the location back to the capsule, and fly off again repeatedly.
Even more weird, if I enable visibility on the parent mesh it simulates physics just fine on other clients. It is only the live retargeted metahuman child mesh that acts strange. Does anyone have any thoughts as to what I might be doing wrong here? I've been googling for days and haven't come up with anything

hybrid crown
#

Hum, we agree that a DOREPLIFETIME_ACTIVE_OVERRIDE in PreReplication(), must also be registered as DOREPLIFETIME in GetLifeTimeReplicatedProps ?

ember vine
#

are u supposed to run rootmotionsource on clients and server or just serv ?

thin stratus
prisma snow
#

@dark edge Just writing since we discussed the other day, I timed the client RPC time, then the time when order was multicasted (client recieves order back) and finally the time when the path is replicated:

  • Between client RPC and getting server RPC back, it's aprox. 200ms, which is acceptable delay. It is also quite stable and in line with ping values.
  • Between the RPC getting back and the path being set, it oscilates between 700ms and almost 2 seconds. We use async pathfinding but I don't think this can cause such a delay.

[EDIT]: After more testing, I found out that his delay is only happening if the client moves his units. If the server moves his units, it works very well on the client too (100-200ms of delay). So it seems related to who owns the actors?

crystal crag
#

Is there any way someone could give me some keywords to search when trying to learn about different systems available to help move people into sub-levels? I know there is level-streaming. Are there any other newer / better systems for this?

thin stratus
#

Other than not using Unreal's Networking stuff at all.

crystal crag
#

I'm not nearly advanced enough to even entertain that idea. I'm trying to make a rather simple game this time around. The one I was trying before I just didn't have the knowledge or available time to get it done within a reasonable time frame. The one thing I wanted to do though was (without doing a server travel) let players "warp" (for lack of better term) into the main building when they are outside or warp back outside. The inner building would have its own lighting and actors inside, which can be handled with level streaming, I just thought maybe something more fancy had been released. Something that works in conjunction with world partition and data layers or something. I can't remember where I heard an unreal dev talking about it, but had something to do with one of the earlier UE5 releases.

thin stratus
soft relic
#

Or use something like OWS but not sure how updated that is nowadays

#

Seems like it supports UE5 though

#

But, that most likely requires more advanced knowledge of unreal and networking.

queen escarp
#

question this is on a "npc" but it dosent get cleared

#

since im playing on a client and thisis a server controllednpc

#

what ami missing

dark edge
#

show the code back to the triggering event

queen escarp
dark edge
#

what machines run this code, all of them? Just server?

queen escarp
#

just server

#

i mean this is no different from what i use to do " npc plays montage at notyify trace if hit deal damage... simple as that"

dark edge
#

Put a breakpoint on it, make sure it's actually being hit

queen escarp
#

it is...

#

its not applying damage tho also

#

when i play as t helisten server it works

#

oh wait when i play as listen server + client then it works on the client side also

#

is when im playing only 1 pie as client it dosent react to "server" being enabled ?

hard gale
#

I have an ability (different than jump) that launches a character over a short distance with increased speed (at 1200 speed, compared to max walking speed = 600). If you jump right after this ability, you can make a longer jump than usual, thanks to the increased speed. I'm trying to prevent that, so that if you jump right after, you make the normal jump.

When the ability is used, I toggle a boolean on the pawn (in BPs). This boolean is checked at each tick of the pawn, and whenever the pawn touches the ground, the pawn is slowed down. The logic works well in Standalone mode but in multiplayer it makes a rubberband effect, and doesn't work reliably every time, even with relatively low ping (70ms). Meaning sometimes the jump will still be faster than usual.

To slow down, I've tried these techniques:

  • Slowing down with Add Input (backwards)
  • Slowing down with Set Velocity

For the boolean in the pawn, when using the ability, I've tried to:

  • Toggle the boolean both on client/server and apply the slow down on both
  • Toggle the boolean only on client side, then do the slow down client only, or replicate the slow down on both
  • Toggle the boolean only on server side, then do the slow down server only, or replicate the slow down on both

I always have the rubberband/fast jump regardless of how I do it, am I doing something wrong?
This is implemented in Lyra/UE 5.4

grand kestrel
hard gale
# grand kestrel Add your ability state to CMC prediction. Override `UCharacterMovementComponent:...

I'd prefer not to change how the jump works, because I'd also like to have variants of the game where the player is able to do this fast jump once (but not twice). Is there a way to do this without changing the jump? The ability is done using normal "Launch", so it I thought it should be automatically added to the prediction (the ability in itself doesn't rubberband and works well, it's my added boolean which doesn't work well)

half umbra
#

Hello,
how can I check in the widget if the Player Array in Game State has changed>?

#

create a new RepNotify Array and create an Event Dispatcher?

#

Is there a better, more efficient solution?

queen escarp
#

since if its attacking and i run behind he needs to rotate towars the player

quasi solar
#

Hello everyone, quick question: what is the cleanest and most efficient way to lower a platform in a multiplayer context, without experiencing latency on the clients? I'm using a timeline (in Blueprint) that I trigger on the server, and I replicate the new position of my platform with each update, but the clients experience a slight jitter. I'm not sure if there's a way to avoid that by doing it differently.

I was suggested to try executing the timeline on each client, but I don't really see how to do that. Or to do something similar to the CMC, but I don't really see that either. Any ideas, please?

oak pond
#

wait so is your event on the Update node itself

vapid gazelle
#

Is there anything like a Get Game Time in Seconds, but one that gives every client in the game the same value regardless of when that instance of the game started? My understanding is that Get Game Time in Seconds will be specific to every instance of the game, but I'm wondering if I can get ahold of a synchronized time value somehow that's identical and shared across all of the instances.

I'm guessing some kind of a synchronized clock?

I'm seeing this on the forums:

GameState::GetServerWorldTimeSeconds() is a network synced clock time. The server updates this value every 5 seconds to keep clients synced with a universal world time. Yet, clients values can differ greatly depending on their ping/jitter at the time of update. So it’s never truly accurate. Mainly an approximation.

I wouldn’t worry about time discrepancy on cool downs. If coded so the server maintains authority it won’t matter what the client does or doesn’t do.

Clients are always ahead of the server in respect to movement, location, actions etc. Inputs for an update interval are bundled and sent together. Meaning our clients execute them locally first (client-side prediction), then send bundled to the server.

Updates sent to the server are timestamped. Each input is timestamped. Packet headers have timestamps as well.

blazing bear
# quasi solar Hello everyone, quick question: what is the cleanest and most efficient way to l...

If you do it without timelines, there'll be no need to replicate movement, you can get it to look like a timeline using some math, the key is to be deterministic. Have the server calling the platform to be lowered set the variables used for movement, the variables needs to be marked as replicated, then set a bool bLowerPlatform and enable tick, use OnRep_bLowerPlatform to enable tick for the clients. During the tick, you check if bLowerPlatform is true, do the movement (using DeltaSeconds obv), once the platform reaches the desired location, disable tick. You can also force the platform to have its location set to match the server's in OnRep_bLowerPlatform as sometimes it could be off by a millimeter or so.

brazen anvil
#

When I equip a weapon I need to change a animation layer. Should this be a replicated variable or should I change it in the OnRep when the weapon changes?

fossil spoke
brazen anvil
cloud crown
#

i was not able to fix it my server is not sending data to the clients client to server works but not server to client

soft relic
#

By calling some blueprint implementable function on rep

thin stratus
thin stratus
#

What might help is to understand how that array functions.
It actually fills itself by the BeginPlay of PlayerStates and a single "Get me every PlayerState that is already valid." call by the GameState.

So in theory, instead of clinging to that Array, you could just hook into the PlayerStates becoming valid/invalid via their Begin and EndPlay functions.

#

You can use the PlayerArray to get the initial set of PlayerStates then, and handle the rest via the PlayerStates tell your UI or whatever that they are alive.

soft relic
#

@thin stratus Are you sure? im pretty sure game state had an OnRep for player array no?

#

Or maybe an updated function that was overrideable

verbal ice
#

AddPlayerState

#

RemovePlayerState

#

Both overridable

#

They handle adding and removing to/from the PlayerArray

soft relic
#

Right, thats it then. Not sure why I thought there was a rep but theres that

ember vine
#

when you do a servertravel on the server and the clients go into limbo state before the mapchange, are there any core delegates/events that fire at that moment ? or do i need to setup my own RPC

#

coz PreLoadMap is too late and pretravel on PC is also too late aswell

thin stratus
#

Requirements are somewhat important here, cause there might be stuff you can use if you tell us what you need :D

thin stratus
ember vine
#

@thin stratus load screen basically

#

On the client

thin stratus
#

Hm, I mean that is in fact usually done with the Map Load callbacks.

#

The only times I had to be a bit more crafty was when a Customer wanted to put the LoadingScreen over things that require other Threads to tick.

#

They wanted to cover up from the point the SteamSession gets its update call, which then never returned if using the MoviePlayer for the LoadingScreen, cause that only manually ticks the GameThread, not the Background Thread the Steam callback was sitting on.

#

But even that was relatively fine to solve, since the LoadingScreen was already a SlateWidget, I just wrapped it with a UWidget and plugged it into a UMG Widget which we then added first. Since they look exactly the same no one noticed that it#s in fact 2 different LoadingScreens after another.

I think we also added a UMG instance after the MoviePlayer one to cover up some more custom loading stuff.

ember vine
#

The map load callback is pretty slow tho, the client is in a limbo state for a few secs before it gets called

#

I basically want to hide the few secs where everyone just runs and no rpcs work

proven pagoda
#

So I tweaked Lyra's Equipment system to use Gameplay Tags more and it's working multiplayer in my project, but there's a few functions I'm not sure the reason for them or if needed at all or really why we do this. I understand what the functions are doing themselves, but are these needed? Should I be doing similar things for other components? I never have. ```cpp
bool UEquipmentManagerComponent::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch,
FReplicationFlags* RepFlags)
{
bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

for (FOneLifeAppliedEquipmentEntry& Entry : EquipmentList.Entries)
{
    UEquipmentInstance* Instance = Entry.Instance;

    if (IsValid(Instance))
    {
        WroteSomething |= Channel->ReplicateSubobject(Instance, *Bunch, *RepFlags);
    }
}

return WroteSomething;

}```

thin stratus
thin stratus
proven pagoda
#

Thank you. I could really put it back and default and see if it works, but idk the side effects. I'm nervous just cuz it's in Lyra and I don't wanna leave something important out lol

ember vine
#

its like 5 sec tho its ages for some reason

#

i guess i can just fire an rpc from the server before doing the server travel

proven pagoda
#

I use the Async loading screen plugin and it works pretty well for me but idk if it's too basic for what you're doing

#

When my host hits server travel all clients instantly pop up loading screens and the server takes a second then hits theirs

thin stratus
#

One could also use FInstancedStruct and wrap the Struct with it, but that has its own Downsides.

proven pagoda
# thin stratus The Assets that are UObject based are usually fine, cause they can be resolved l...

This is my version of the AddEntry to the FFastArraySerializer EquipmentList struct ```cpp
UEquipmentInstance* FOneLifeEquipmentList::AddEntry(const TSubclassOf<UEquipmentDefinition>& EquipmentDefinition)
{
check(EquipmentDefinition);
check(OwnerComponent);
check(OwnerComponent->GetOwner()->HasAuthority());

const UEquipmentDefinition* EquipmentCDO = GetDefault<UEquipmentDefinition>(EquipmentDefinition);

TSubclassOf<UEquipmentInstance> InstanceType = EquipmentCDO->InstanceType;
if (!IsValid(InstanceType))
{
    InstanceType = UEquipmentInstance::StaticClass();
}

FOneLifeAppliedEquipmentEntry& NewEntry = Entries.AddDefaulted_GetRef();
NewEntry.EquipmentDefinition = EquipmentDefinition;
NewEntry.Instance = NewObject<UEquipmentInstance>(OwnerComponent->GetOwner(), InstanceType);

if (UOneLifeAbilitySystemComponent* OLASC = GetAbilitySystemComponent())
{
    OLASC->ApplyEquipmentEffects(EquipmentCDO->GrantedAbilityDataTags, /* InOut Handles */ &NewEntry.GrantedHandles);
}

NewEntry.Instance->SpawnEquipmentActors(EquipmentCDO->ActorsToSpawn);
MarkItemDirty(NewEntry);

return NewEntry.Instance;

}```

thin stratus
#

It's very common, when making Inventory Systems, to have a combination of:

  • Some DataAsset for the MetaData that stays the same for Server and Client
  • A replicated UObject Instance with runtime Data that has to be kept in sync
  • A FastArray setup, where the Element holds the DataAsset and UObject pointer
proven pagoda
#

So this is better than spawning an actor for this data

thin stratus
#

TSubclassOf<UEquipmentDefinition>& EquipmentDefinition
Does that need to be a class?

proven pagoda
#

As opposed to?

thin stratus
#

EquipmentDefinition sounds the MetaData I mentioned

#

Stuff that is only setup during Editor time and doesn't change

proven pagoda
#

EquipmentDefinition is the BP asset that defines the piece

thin stratus
#

If it's an Asset, just save the SoftObjectPtr to it

#

Or ObjectPtr in that function fwiw

#

You don't need to get the CDO

#

You use U(Primary)DataAsset for this as a Parent.

#

Set up the AssetManager to know about them

#

And that's about it

#

Getting the Class and then grabbing the CDO is basically the roundabout way

thin stratus
#

That's really long

#

If you do this in an empty level/project, you'll notice it's usually relatively quick.

proven pagoda
#

Lyra does this and makes PrimaryDataAssets for the granted abilities and effects where I use this tag container

thin stratus
#

Yeah I would have used PrimaryDataAssets for the EquipmentDefinitions

proven pagoda
#

That's a lot of stuff I'll have to research I can't conceptualize how to remove the TSubclassOf and replace with a SoftObjectPtr

thin stratus
#

SoftObject is probably not needed at that point, you can load it earlier

ember vine
#

im not sure why it takes that long but its the case on other UE games that ive seen

#

its just GetWorld()->ServerTravel(MapName, false, false) being called on server

thin stratus
#
void USomeInventoryManager::SpawnEquipment(const FPrimaryAssetId& EquipmentDefinitionId)
{
  /// Load EquipmentDefinition via UAssetManager and the PrimaryAssetId
  /// Don't remember the code exactly.
  UAssetManager::Get().LoadPrimaryAsset(EquipmentDefinitionId, /** BundleNames = */ {}, StreamableDelegate::CreateLambda([this, EquipmentDefinitionId]()
  {
    /// Get the Object and cast it now that it is loaded.
    UEquipmentDefinition* const EquipmentDefinition = Cast<UEquipmentDefinition>(UAssetManager::Get().GetPrimaryAssetObject(EquipmentDefinitionId));

    /// Add the Equipment to the list, assuming the List lives in the Manager.
    EquipmentList.AddEntry(EquipmentDefinition);

  }), /** Priority = */ 0);
}

@proven pagoda

#

Something like that.

#

The cool thing if you start utilizing AssetData instead of Classes is that you can export some stuff to the AssetData to utilize without actually loading the Asset at all.

proven pagoda
#

Damn I feel like that's advanced for me

#

I have done 0 research into primary data assets and custom loading honestly

thin stratus
#
void ACH_Structure::GetAssetRegistryTags(TArray<FAssetRegistryTag>& OutTags) const
{
    Super::GetAssetRegistryTags(OutTags);

    OutTags.Add(FAssetRegistryTag(CategoryAssetRegistryTag, Category.ToString(), FAssetRegistryTag::TT_Alphabetical));
    OutTags.Add(FAssetRegistryTag(FriendlyNameAssetRegistryTag, FriendlyName.ToString(), FAssetRegistryTag::TT_Alphabetical));
}
proven pagoda
#

Ok I can read that that's interesting

thin stratus
#

We use that to show the Structures in the UI and categorize them without even loading them.

proven pagoda
#

Wow

thin stratus
#

Yeah there is a lot of cool stuff there.

#

But yeah, tl;dr you really don't need the CLass there, even without SoftObject stuff

#

You have an Asset there

#

Assets are referenced by object.

#

Soft or Hard.

proven pagoda
#

I'm working on just using a regular pointer maybe now

#

But this equip item was marked Blueprint Callable so idk if I can do that

thin stratus
proven pagoda
#

In my meta data I just put a TObjectPtr<UEquipmentDefinition>

thin stratus
#

If it's a matter of UE doing clean up etc., then yes, an RPC would be a solution, given that arrives quicker than 5 seconds.
But keep in mind if you start that MoviePlayer loading screen, it will only tick the GameThread.

thin stratus
proven pagoda
#

Currently it's a struct in a data table

thin stratus
#

Right, that explains some of the trouble

proven pagoda
#

what trouble

thin stratus
#

While youc an totally use both at the same time and it makes totally sense to have some data in the DataTable, ultimately they serve a very similar purpose and you are basically starting to utilize two systems at once.

proven pagoda
#

Oh no

thin stratus
#

The only part where I've seen people mix them for what you are doing is putting data into the DataTable that the Definition then references a row of

#

I think @meager spade has some DataAsset, DataTable, like setup.

#

Basically, if you have some "categorized" data, that you want to not put into the DataAsset directly, and have it as a row in teh DataTable, you can do that.
I actually don't use them in combination. My Data for whatever I'm defining sits in the Asset.

proven pagoda
#

Ok so my inventory uses an Item Tag, and in my ItemDefinition is a data table which I can fetch any row by GameplayTag and in my ItemDefinition I include the TSubclassOf<UEquipmentDefinition> so I really call UseItem and it broadcasts out the TSubclassOf for the Equipment Manager to equip

thin stratus
#

There are probably good reasons for using either though.

#

Remember the FPrimaryAsserId in the function I posted earlier?

proven pagoda
#

I remember it from the code above

thin stratus
#
FPrimaryAssetId ACH_Structure::GetPrimaryAssetId() const
{
    return FPrimaryAssetId(FPrimaryAssetType(TEXT("Structure")), StructureTag.GetTagName());
}
proven pagoda
#

Oh you fetch primary asset ID by tag there don't you

lament flax
thin stratus
#

Yus, it's a combination of the AssetType and a Tag

lament flax
#

using data registry and data raw ref

proven pagoda
#

template <typename T>
T* UOneLifeAbilitySystemLibrary::GetDataTableRowByTag(UDataTable* DataTable, const FGameplayTag& Tag)
{
    return DataTable->FindRow<T>(Tag.GetTagName(), TEXT(""));
}```
#

I just wrote this in a static library

thin stratus
#

I mean you can write a system that does that per DataAsset fwiw

#

That goes beyond the idea here though

lament flax
#

let me get a implmenttion i had

#

i had a DT that holds weapon data
and in my item fragment i have a ref to a row, i load it at runtime

#
void UPGWeaponDataComponent::OnItemLoaded(const FDataRegistryAcquireResult& DataRegistryAcquireResult)
{
    const FPGWeaponDataRow* WeaponDataRow = DataRegistryAcquireResult.GetItem<FPGWeaponDataRow>();
    
    if (WeaponDataRow)
    {
        BulletDamage = WeaponDataRow->BulletDamage;


        bDataLoadedLocally = true;
    }
}
#

nvm, the registry ref was in the weapon component (on the item actor)

#

so not in the DA

thin stratus
#

Or fun stuff like

#
TArray<FPrimaryAssetId> AllEquipmentDefinitionIds;
UAssetManager::Get().GetPrimaryAssetIdList(FName("EquipmentDefinition"), AllEquipmentDefinitionIds);
proven pagoda
#

Ahahaha

#

Ok well honestly it seems like then my current method isn't terrible but I also realize it's not using Unreal the best it can be used. I clearly need to learn more about primary data assets and proper loading systems. I have never done any real research into them yet.

thin stratus
#

They are also not very well advertised :D

proven pagoda
#

I started Unreal 1 year ago this week

#

It's a lot

thin stratus
#

But yeah, the stuff Fishy posts is also nice if you need the additional hot-patching stuff.

lament flax
#
virtual FPrimaryAssetId GetPrimaryAssetId() const override
    {
        FString TagString = Tag.ToString();
        int32 LastOccIndex;
        TagString.FindLastChar('.', LastOccIndex);
        
        FString Name = TagString.Mid(LastOccIndex+1, TagString.Len()-LastOccIndex);
        return FPrimaryAssetId("Items", FName(Name));
    };
thin stratus
#

A lot of people probably skip this, as they just patch the game.

lament flax
thin stratus
lament flax
#

thats for debuging lol

#

so i can use a cheat command to give

thin stratus
#

I guess one could cut the Tag into pieces and use the first part of it as the Type

#

But honestly, probably not reaaallly worth it

lament flax
#
void USLInventoryCheatExtension::InvGiveDef(int32 PlayerControllerIndex, FString ItemId, int32 Amount)
{
    if (APlayerController* PC = GetPlayerController(PlayerControllerIndex))
    {
        ASLPlayerCharacter* PlayerCharacter = Cast<ASLPlayerCharacter>(PC->GetPawn());

        FPrimaryAssetId PrimaryAssetId = FPrimaryAssetId("Items", FName(ItemId));
        FSoftObjectPath FoundPath = UAssetManager::Get().GetPrimaryAssetPath(PrimaryAssetId);
        
        if (FoundPath.IsNull()) { return; }

        USLItemDataAsset* DA = Cast<USLItemDataAsset>(FoundPath.TryLoad());
    
        SL_INVDLOG("InvGiveDef §% §% §% to default inventory", *PlayerCharacter->GetFName().ToString(), *ItemId, Amount)

        FSLAddItemExtraData ExtraData;
        PlayerCharacter->GetPlayerInventoryComponent()->AddItemToInventory_FreeSlot(PlayerCharacter->GetPlayerInventoryComponent()->CreateNewItemFromDataAsset(DA), Amount, ExtraData);
    }
}
thin stratus
#

Yeah for Cheating that's fine.

#

That's a blocking load otherwise.

#

But that code is basically exactly what I meant earlier

lament flax
#

i didnt read the whole convo tbh

thin stratus
#

AssetId to DataAsset (definition) and then tell InventoryManager to spawn that crap

#

Na that was more for Uhr

lament flax
#

im more team soft object ptr

#

than asset id

thin stratus
#

I never considered them to be exclusive though

lament flax
#

they arent

thin stratus
#

AssetIds for custom Assets that need to be grouped, loaded, etc.
SoftObjPtrs for any other Asset, like Textures and stuff.

#

Can of course plug a custom Asset into a SoftObjPtr

#

The AssetIds are after all just a way to manage the Assets.

tardy fossil
#

Sorry couldn’t help myself

proven pagoda
#

Can you not EditDefaults in a data table for a TObjectPtr ? When I used TSubclassOf I could fill in data inside my data table, but now I've put TObjectPtr instead and my data table won't let me fill in any data.

#

I put a TObjectPtr on my GameMode and I can put a Data Asset in there

#

but not inside a struct inside a data table

#

This might really all have to be TSubclassOf if I wanna do this like this

#

Man I just refactor all the code to use this TObjectPtr now I gotta undo it all

#

Yeah I change it all back to TSubclassOf and now I can put it in the data table again

#

man

meager spade
#

Our crafting recipes are a data table holding assetid to definitions.

meager spade
#

Tsubclassof for a datatable?

#

Oh nvm I see

#

@lament flax our asset ids for item definitions are type:assetname for example Weapon:wid_ranged_blah

#

Where wid_ranged_blah is the asset name.

#

One thing I haven't managed to do is handle renaming without breaking stuff

#

But it can be done with redirectors manually

lament flax
#

okay

meager spade
#

The type is determined by the item type tag

#

But ours is done via a lookup cause we can't grab it from the tag directly

#

We originally had an enum but dropped it

sturdy sand
#

Quick question. Is it normal that I'm getting bad latency using mover between clients?

blazing bear
#

Hi, should integrating the OSS (steam) to the game be done as early in development as possible or can it be done whenever?

meager spade
#

If your not using iris I have not seen that though if your using 5.4.3 or less then there is issues 5.5 addressed a lot of them

#

But mover is still highly wip and will be more stable as they start to transition fortnite to use mover

sturdy sand
#

I'm using the released version which I think is 5.4.3 if I'm not wrong. I was planning to move mover files from 5.5 to the engine I currently have.

#

Or are there some other files I would have to move?

proven pagoda
#

In the FFastArraySerializer there's 3 functions PostReplicatedAdd, PreReplicatedRemove and PostReplicatedChanged but I'm struggling with finding timing for PostReplicatedRemove.... I want to trigger logic whenever an element is removed on clients in a repnotify essentially. There's timing for after it was added and before it was removed. The PostReplicatedChanged doesn't fire logic in the add or remove situations, seemingly just when the same index had values changed. Where could this best be handled for the timing of after the array had an index removed on clients

thin stratus
sturdy sand
#

Well I'm aiming for client-side prediction and I understand what you mean but I'll keep using mover and I'll figure it out somehow.

thin stratus
#

CMC has Client Side Prediction though

#

But yeah, you can of course do what you want. Just an early warning :P

sturdy sand
#

I know that CMC has it as well but CMC doesn't have the features I want and I also simply want to figure out how mover works

thin stratus
#

CMC doesn't have the features I want
Which features?

sturdy sand
#

Lack of compressed flags

#

Either way I'm moving to mover. It's nice that the client-side prediction is easier to setup on mover

thin stratus
thin stratus
#

CMC uses Serialized Containers for quite a while now, which allow to send whatever data you need to the Server, including a bunch of additional flags if needed.

Just fyi of course.

#

"A bunch" meaning "as many as you need"

#

But yeah, try out Mover. It's a cool concept. I hope they can get that production ready over the next 6-12 months :/

sturdy sand
#

I'll be very honest with you I don't even know what I need lmao.

thin stratus
#

That's all good. I mainly wanted to warn you about how experimental it is and how many Engine changes it requires to get NPP and Mover to actually work properly.
I've been doing nothing but NPP and Mover coding for the past 6 or so months.
I'm currently patching it up with RootMotion support, cause that is also still too experimental on ue-main

sturdy sand
#

Yeah I knew that before even starting out with mover.

#

This was a while ago but here is the reason to why I moved to mover

thin stratus
#

Yeah, problem is more that it lacks tons of features that CMC has.

sturdy sand
#

It's fine. I'll just wait and work on other things and constantly pull mover files from 5.5 to the engine source I currently have and I'll work with what I have.

blazing bear
#

How can I stop an unfocused standalone instance from being very low fps?

#

for example, a character moving on the screen looks very laggy as if there are replication issues, but the moment I quickly tab out to the window that was looking at the character, the character becomes smooth instantly. So that's how I know an unfocused standalone window is having very low fps

#

I'm sure this is normal since the gpu/cpu needs to focus on the window used. But I'm wondering, what's the best way to debug your game so its results are as close as possible to its packaged version? I've heard it's by using standalone windows instead of PIE, but now I'm struggling with this problem that doesn't exist in PIE

cloud crown
#

Hey why my server is sending montage across the server to the Sim proxies only

fossil veldt
#

well 4 - but 8 if you're daring to use the reserved flags

thin stratus
#
// Get storage container we'll be using and fill it with movement data
FCharacterNetworkMoveDataContainer& MoveDataContainer = GetNetworkMoveDataContainer();
MoveDataContainer.ClientFillNetworkMoveData(NewMove, PendingMove, OldMove);
#

You can specify your own child class of that

#
DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveOld, ServerMovePacked_ClientSend)
ENGINE_API virtual void ServerMoveOld(float OldTimeStamp, FVector_NetQuantize10 OldAccel, uint8 OldMoveFlags);
#

That's the old one.

fossil veldt
#

oh shiet

#

yea i've been inheriting FSavedMove_Character and using the compressed flags

#

hm

thin stratus
#

I mean you gotta do that too.

#

The point is that it's not a hardcoded uint8 param o nthe RPC anymore.

fossil veldt
#

gotcha ok

quiet yarrow
#

So im having a physics replication issue. Im trying to figure out if this is a limitation of replicating a large amount of physics objects colliding or if I just need to adjust some replication settings.

Any additional objects added to the 25+ physical objects inside of a wagon things dont like to replicate accurately. These objects are owned by the client who is hitched to the wagon. After some tests any object over that ~25 threshold freeze in the air randomly from the hosts perspective and slowly update position suddenly.

#

i've been trying to use a network profiler and stat.net but im not sure what I should be looking out for

daring egret
quiet yarrow
daring egret
#

i haven't used that so i'm not really sure if it's any good for this - but sounds like the answer to that is likely no

#

probably that blog post is ur best bet

dark edge
#

you can do that without packaging

#

but you can't really smoke test the game without multiple computers IMO

#

Haven't used it in a while obviously but you get the picture

blazing bear
#

I also launch like that sometimes! -nosteam seems cool I wasn't aware of this one, I guess I don't have to exit Steam now with it

blazing bear
dark edge
blazing bear
dark edge
#

There's ways to reduce that though, look in settings

#

Use Less CPU in Background

blazing bear
#

but it's fine

#

I'll try testing with multiple computers

#

obviously the best way

meager heart
#

Anyone ran into this before? It looks like my character has the wrong player state assigned to it, unless I'm misunderstanding something

This would check out with some of the other errors I'm running into with the GAS, but I have no idea why this would happen / I thought this was something handled assigned/automatically

#

This function is running from my OnRep_PlayerState() function, which may actually be the issue (though I don't necessarily understand why)

lament flax
#

i think it depends if the id is local or not

#

i remember cases where my listen server would be character_0/1 and my client being character_0/1

meager heart
#

Hmm that may be something I can check

#

The issue I was running into with the GAS was that actors were sharing the same attributes (which are stored on the playerstate), so this initially seemed like evidence that they could be sharing player states

However after removing this function from firing during OnRep_PlayerState() it looks like my characters aren't being assigned any attributes, so maybe this isn't the issue

primal summit
#

Does anyone know what would cause a map to fail loading on a server, and insisting to try to load a map I do not have selected as the game's map?

#

If I remove said map, it always tries to reference it and then fails (says cannot find that map), and I've also tried to open the map it wants, and then switch to the other map, but it still fails

prisma snow
blazing bear
prisma snow
blazing bear
vague spruce
#

anyone know how to cleanly disconnect players from a server? such as when kicking them?

#

i have this:

    if (NewPlayer)
    {
        if (const auto Conn = NewPlayer->GetNetConnection())
        {
            Conn->Close();
        }
    }

but it doesn't exit me out of PIE. i guess that's intended? but it makes me think i'm doing something wrong

#

this worked:

    UKismetSystemLibrary::QuitGame(GetWorld(), NewPlayer, EQuitPreference::Quit, true);

but i'm wondering if this will close the game for players in the shipped client

verbal ice
#

If you need to kick players there's a KickPlayer function

#

In the GameMode or GameSession I think

unkempt tiger
#

Anyone know how online multiplayer only projects can upload their build when applying for a megagrant?

daring gorge
stable marsh
#

How do I send info from a widget/hud on a client to the actual client's player controller? It's only sending to the local player controller.

#

This all works for the server/client on server, however for the second player (and I assume any clients), Get Owning Player does not access or update the client's player controller. I can't seem to get the correct Hud when I do it from within the player controller either. I am trying to spawn a unit based on the UI button that is clicked (btn1 spawns unit type 1 for intended player, btn2 spawns unit type 2 for intended player, etc...)

Image is from within the Widget Event Graph. Unit Int is within the PlayerController.

vague spruce
#

there's also this NewPlayer->ClientReturnToMainMenuWithTextReason(FText::FromString("Character invalid."));

#

but it causes a gnarly crash

stable marsh
#

Maybe a better question... how do I get the local player controller to talk to the client player controller?

plucky prawn
#

is there a way to get the client a function is running on? for example on an input event i want to get the local player controller that that input was triggered by, but also more generally if theres a way to get the "local player" that is executing the event/function

#

im using Get Player Controller (0) which... works

verbal ice
#

If it's to get the local player controller that triggered input

plucky prawn
#

even in splitscreen?

verbal ice
#

That might change yes

#

What are you trying to get it from

plucky prawn
#

i just need the player controller so i can pass it along to other functions which eventually call RPCs on the server

verbal ice
#

Yeah but what's the input being handled in

plucky prawn
#

just a normal actor since enhanced input lets you do that

stable marsh
#

How do I set a variable without rep w/notify so that it actually replicates?

plucky prawn
#

set it to replicate instead

stable marsh
#

Not working lol

#

I've been banging my head on this for a while now and haven't had any luck

daring egret
#

DOREPLIFETIME ?

#

it's not enough just to mark the uproperty as replicated you have to specify a replication lifetime

stable marsh
#

Oh, where can I learn more about that

daring egret
#

check out the part with GetLifetimeReplicatedProps function override

#

you need that otherwise it's not going to replicate

plucky prawn
#

assuming they are using C++

stable marsh
#

Ah, I'm using blueprints

daring egret
#

oh i'm really sorry i didn't realize

plucky prawn
#

what are you trying to replicate and how?

daring egret
#

it should just be a case of setting the "Replicates" checkbox in the class defaults and then setting the "Replicates" on the property itself

#

in blueprint it's much more automatic

#

have you set your actor itself to replicated actor?

stable marsh
#

I have two players, each with their own hud. They are able to spawn units, with correct color, etc... Anything I've called regarding replicate, I've had to use Rep W/Notify (and worked). I'm running into a problem where I need the execution to come not from Rep W/Notify. The variables I'm replicating just aren't remembering (or updating on the server) correctly.

On the hud I have unit buttons that when clicked, send an int to updated the unit type. The unit type is udpated on the respective player controller and set with "replicated". It doesn't seem to be retaining that information

#

I believe so yes, I've set my players (player controllers) as replicated* and assigned them to an array in my GameMode event graph

plucky prawn
#

you cant replicate to the server. if you want to set a variable on the server you need to call an RPC (server replicated in this case) which updates your actual replicated value which will automatically replicate to clients

stable marsh
#

So should I be moving my "Spawn Unit" script from occuring on the player controller to the game mode graph?

plucky prawn
#

depends where its called. if your Spawn Unit event is called on the server it probably doesnt matter much

#

if you can spawn units from player A and they show up on player B then its being called on the server

daring egret
#

the server really should be doing that anyway

#

unreal is server authoritative by default so you want to be making server in control of the gamestate

#

is this for rts to spawn units from a building?

stable marsh
#

Spawning from player click - after they've selected a unit type.. think Clash of Clans I guess?

daring egret
#

i see, you should do as gambit suggests then and have a "request unit build" RPC to the server

#

then the server checks the players resources and validates if you can do the action, then spawns the unit

#

client just says "hey i want to do this"

plucky prawn
#

the RPC stuff is a bit round-about but its for the best. your server needs to be the "source of truth" so you need to make sure the server knows whats going on. you shouldnt have clients knowing stuff the server doesnt

daring egret
#

if you're being good, you should basically not let the client ever tell the server what to do - only what it wants to do

stable marsh
#

Okay I get what you're saying but I don't get what that means - I'm getting caught up on where the server "exists" within the structure of these events. Dumb question but what is RPC(remote procedure call) if not me identifying a variable as "replicated" etc...? Are there unreal graphs/classes that act as the server (like Game Mode?)

daring egret
#

an RPC is quite simple - it's literally just a way of letting you remote execute a function on a machine that isn't yours

#

but replication isn't the same, replication is one way it trickles down from server to clients only, not the other way

plucky prawn
daring egret
#

RPCs are bidirectional client <-> server

daring egret
#

that's why you ideally never let a client be imperative over the server directly, like telling it to change some state

#

but instead you just use it as a way to say, hey this client wants to change this state or do this action

#

then the server goes - hm is this actually allowed, ok it is, i'l do it np

#

you can optionally just not care about security at this point and just RPC to change the state directly, but it's bad practice because any client can hack and spam RPCs at the server telling it to do whatever they like

stable marsh
#

Okay I misunderstood Replication with RPC. And I get what you're saying about the communication now (handling changes that the client can only REQUEST).

daring egret
#

yes precisely

stable marsh
#

It doesn't seem like that's in Blueprints? Unless that's the Game Mode class I was talking about?\

#

Or Level Graphs (whatever the main equivalent is, sorry I'm still relatively new to this)

daring egret
#

it is in blueprints, it just depends who owns the actor or not, gamemode is owned by the server

stable marsh
#

Okay that's the phrase I was looking for "owned"

daring egret
#

you should read this

#

i believe it will be very helpful to you

stable marsh
#

Thank you for all of the help already, I'll definitely take a look

plucky prawn
nova wasp
# stable marsh Okay I get what you're saying but I don't get what that means - I'm getting caug...

RPCS are a user defined payload of data that can target an object instance that unreal lets you define as simple UFUNCTIONS. This is mostly for things like the client calling ServerDoThing(thing) in a replicated object they own (pawn/controller) on their machine and that turns into a payload of data + target across the connection that calls ServerDoThing_Implementation(int32 thing) with the passed in data on the server's replicated version of that object

This is the most direct way you have to easily send information from client to server in unreal's game framework. Replication of object instances and their replicated properties is only server->client

RPCs can also be from server->client or multicast (server->all clients)

daring egret
plucky prawn
nova wasp
#

ignore the funny letters then I guess, sorry

daring egret
nova wasp
#

replace UFUNCTIONS with BP events I suppose

daring egret
#

specifically this page will be really helpful

#

important image

plucky prawn
nova wasp
#

I know you did, I'm just trying to get across how "simple" they are in a generic sense that they are just "send this data and call a function/event on an instance when it arrives" but I got caught up in C++ examples

stable marsh
#

Okay thanks all, that's extremely helpful and I appreciate the time

stable marsh
#

Okay sorry to already come back with this but I feel like I'm missing something still.
I have this event - which I assume is the RPC (and which I've tested each "Replicates" flag to no avail)

#

Which calls this function:

#

The spawned unit takes that same variable but does not remember it here (except on the server player)

plucky prawn
#

multicast is a special type of RPC which you should not be using for state but rather special effects

stable marsh
#

Sorry I've tried multi, server, client, etc

#

no changes

plucky prawn
#

what do you want this RPC to do

#

is it designed to be called from the server to each client?

stable marsh
#

I want it to update the unit type that is allowed to be spawned for the client that requested it

#

So it works for player 1 (server), but player 2, after they've selected their unit from the ui, the spawn (which is a separate event based on mouse click) doesn't recognize the unit type

#

The spawn event is this:


plucky prawn
#

so... you want to update some state on all of your players

stable marsh
#

I want to retain the Unit type variable that was changed... so yes?

plucky prawn
#

this gets a bit scuffed because by default you arent privvy to all the player controllers in the game which you will need

#

you can make your own list in the gamemode class since it has the events to do this

#

actually

#

is this on a player or non-player-actor?

stable marsh
#

So I do have this:

plucky prawn
#

right but is it a player pawn or nah

#

oh i see what you are doing

stable marsh
#

Sorry, the last image just posted is on game mode setting the players. It's a player controller that executes the spawn, etc..

#

The unit itself is a pawn

plucky prawn
#

this is like a selection menu thing and you want to disable options that are chosen by another player

#

or i cant read

daring egret
stable marsh
#

Here's the actual view if it helps:
Right screen (player two) should update the unit to paper - it stays the default unit instead (because that selection didn't propagate)

plucky prawn