#multiplayer
1 messages · Page 216 of 1
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.
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.
AFAIK Iris was supposed to be an intended replacement for the replication graph.
If you are using a dedicated server, you can try adding `[PacketHandlerComponents]
+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface` to your project's DefaultEngine.ini
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.
tha would be really cool, I was trying to pass in a string like this to open level FString::Printf(TEXT("%s:%d?CharacterIndex=%d"), *SelectedServer.Address, SelectedServer.Port, CharacterIndex);
but I really have not idea how to implement this or retrieve it when it comes back
looks like in PostLogin(APlayerController* NewPlayer) the player should return the options with GetOptions? I'm not seeing this tho
PreLogin and Login both have the Options string
There are functions for it. And you should pass the option as "CharacterIndex=17" There is a function called GetIntOption in GameplayStatics that will pull the 17 for you if you give it CharacterIndex
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?
For what use case?
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>/
That looks correct at a glance.
Open Level though? This doesn't seem like you're joining a server as much as hosting one?
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
For movement, when using the UDP/TCP protocols.
but also other information such as the attack system, as I don't use the Unreal Engine network system.
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
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.
You'd probably wanna use UKismetSystemLibrary::ExecuteConsoleCommand()
for connecting to a remote host in a packaged build?
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
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 😅
My messages were related to this
You wanna use ExecuteConsoleCommand not OpenLevel
ah ok
(okay I checked OpenLevel should work as well but it's confusing)
connect to a remote host and pass along an index, so the server knows which character the player wants
Okay so pass it as an option when connecting to the server, then retrieve that options in PreLogin or Login
Some games allow console, are they packaged using Testing configuration instead of Shipping?
Shipping but allowing the console
how?
ALLOW_CONSOLE_IN_SHIPPING=1 in their definitions
oh
Requires source build too
thanks!
That's exactly what you wanna do yea
should work fine
ok let me give it a shot
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 -.-
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
how does this snippet make sense?
its from a previous ongoing conversation
the args passed in the URL are in AGameModeBase::Login
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
nope server is fine since that what is going to use it
so don't get it from the GetMapName then?
no?
No
k
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
why does this return a pc at the end, what the point of it?
It's the PC that was spawned for the player
because this spawns the player controller
the ROOT of the player that joind is the PC
you can see what it does by opening GameModeBase.cpp
from the PC you got the pawn, PS, etc
well yes, I know that last bit, just didnt know the login actually spawned the pc, interesting
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?
The local client is the authority
Same as a singleplayer game
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
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
so like just a bunch of on rep floats that set the param?
one
skincolor is one float
when it changes (onrep), apply it to the material instances
I guess you can use struct if you have multiple properties
but using multicast deffinitly not the way to do it
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?
Sounds like your AI only has collision on either the server but not clients or vice versa
It does have collision on client and server. The bug doesn't always happen but it happens often enough
Is the AI standing or moving?
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
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.
AI moves yes. I've seen minor corrections happen on Lyra, but it seems to fix itself after a second. In my game, if I continue to walk, my movement keeps stuttering and correcting until I completely stop.
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!
The component I'm using is a UNiagaraComponent. I have a theory that there might be some performance optimizations enabled under the hood that could be affecting its behavior. Disabling some of these optimizations might help resolve the issue with the flames not rotating correctly when players aren't directly facing each other. I would appreciate any guidance or assistance on this matter.
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?
Yes
Thank you, also does actor creation on client side wait for all hard-references asset to load before spawning them?
how would i add a delay in the loop body ?
like 1 sec before going to next etc.etc ?
I would use set timer without for each loop
Not sure. It might do a blocking load or async load and wait for the references to be there
But AFAIK it won't be on the client without all of its hard references being ready
alright will keep this in mind, Thanks!!
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!
In the pins check for the multiplayer compendium and go to the "Ownership" page
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)
Is it necessary to put the:
bReplicates = true;
or should I just do this to the blueprint version of the object?
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?
Either is fine.
Mover2.0 is bare bones, you have to build it up (and work through many bugs) to get the features you want.
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.
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
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
yes lol
can the net prediction plugin be used as an intermiedairy to resolve that or not really?
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 😛
lol
Whats more likely is GAS moves to NPP and the CMC gets supercedded by Mover.
But even then, its not a small task.
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
If you are planning to release your game within the next few years, then I would stick with CMC.
gas + mover both with NPP sounds awesome
Anyone would know about this problem?
i vaguely remember there is a setting like "run simulation even when culled" or somethign roughly like that but i can't find it offhand
I'll check that out for sure!
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
Do you know if there is any clue as to whether Mover 2.0 is being integrated into Fortnite?
I think you'd see that through the context of commits
Makes you wonder why they even bothered if that isnt the end goal.
If Fortnite's using it, it's getting the VIP treatment
Is mover worth using yet?
Anecdotally it is not.
Also during the Mover talk, it was explained that experimental = we're not using it internally, and beta = we are
Interesting, havent heard that before.
I guess it was just a side project for an individual within Epic?
So far yeah, so hopefully he doesn't end up leaving like the NPP dude did
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?
Are you using the Steam Socket Subsystem?
And not the IPNetDriver?
If you are using Steam to drive Sessions, you will not be able to connect via IP.
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
yes I see, I opened the game outside of steam and it's listening on the port now. I'll have to figure out how to get the steam net working properly now but thanks
Quick question. In something like a FPS, do proxies run animation blueprint code? Or is there position just updated?
The Anim BP is executed on every Skeletal Mesh.
Has nothing to do with the network context
Ok got it. Thanks
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
Is it? Last I heard the perf was comparable to CMC 🤔
I'm only going off what others have told me. I havent used it personally. But I would hope that its more performant.
@fossil veldt What say you? About perf with Mover
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 😅
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?
Yes it should work
Can you show where you call it ?
Also, arebyou sure that your character actor and components set to replicated ?
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
This is the Cog ImGui plugin I was referring to: https://github.com/arnaud-jamin/Cog
I can't say 100% if this is the cause but its the most recent change that I can think of
Why does OnPostLogin returns PlayerController and OnLogout returns Controller?
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
Thankss, yeah I had to cast to my PC, it was weird so I thought I was doing something wrong
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.
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?
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++)
or get the playerlist from the gamestate ?
If you're doing this for Server logic, i'd probably use controller iterator
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
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 ?
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.
shite
Ultimately that's exactly what the iterator would give you already, so you've got the same info in two places
can confirm
Network performance is vastly worse
Like it's night and day
I see, thanks for the insight!
also mover being based on NPP, like Cedric said, makes it rotten to the core
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.
Lol i think w'all jumped way too early ship onto mover X'D
Yes
Multiplayer is significantly different than single player.
Hey listen, I saw horrors and turned back 
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
ngl I have appreciated the CMC way more since
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
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
Is it also shit when using Chaos net prediction ?
What are the chances that they accept a PR that changes the signature of K2_OnLogout ? 
chaos unrelated to NPP
Oh well, I guess they ahev the scene prediction stuff with fixed tick. Never gonna use that myself
I meant Mover can use chaos as net "method"
Ouch, lol. In CMC we trust 🙏
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
PlayerId is pretty useless. UniqueId is a globally unique id for a player account which usually comes from whatever platform service you are using
what do you mean with platform service, something like amazon gamelift ?
no like Steam, Xbox Live, PSN, EOS
ah so unique id associated with someones steam account for example ?
yes, Steam will use the 64-bit Steam ID as an identifier
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
playerID IIRC is just an incrementing counter, not really anything special about it
thanks!
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
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
maybe it replicatd twice ? if it makes sense
Solved it. The hot reload of Angelscript had bugged out, it used an old constructor
x)
Editor restart solved it
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
calling RPCs on tick is just saturating bandwitch
you might start experiencing late replication for other stuff
you didnt show code where you called the RPC
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
i would like to see your original setup
There is no other RPC that I am calling so I don't understand what you are referring to
so since the beginning yo uare doing this in tick ?
you should redesign that
make the variable "Gait" replicated
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
also, i dont understand why you call this from client for server
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?
i would suggest listening to changes on client and only tell the server when it changed
this would avoid unecessary RPCS
why is an rpc involved at all here?
get desired gait is local so just do that on tick on serverside version of the actor
what drives the gait?
Enhanced Input action value length, so the left thumbstick
thats not on the server
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
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
You using CMC?
yes
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
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
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
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
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?
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
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 ?
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.
What variable? Can you share screenshots/more info?
you might need to link "GetPlayerController" off of GetOwningPlayerPawn
sure, active weapon is invalid on client (the weapons array is being well set)
sorry, i'm still lacking info when you say the client doesn't have access to the variable. are they accessing from another BP? Is the variable set to private?
nope, they are accessing it from here : what i circled in red is not valiud
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?
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 ?
That can go a million ways
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
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
Why timer?
each tic is when i trace
why not use tick
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!
you don't get to do stuff faster than tick
aye i know, its just easier to keep them seperate with the timer
just preffered way really
What doesn't work about it
I'd make my own but it depends
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
skeleton probably isn't ticking on server
do you think it would be complicated to do my own? or just an interface and it's pretty much done
Interface or a StatsComponent (best IMO)
Why a StatsComponent? What would it be holding?
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?
Shot -> does HitActor have a StatsComponent? -> yes -> call ModifyHP on it
The shot damages the StatsComponent, what that does is up to the component and its owning actor
That sounds good, Thx!
Can that be done with bones? (Complex line trace)
All roads lead to Rome GAS
hell nah, I'm trying to avoid GAS
Do you think I can check if it has that component and get the bone info?
Component can hold a map of bones to values or whatever
you're talking about HP per bone?
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)
You'd trace then decide on what got hit then check if it has a component
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
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 :/?
What cost?
Each frame, do you care about whether or not a hit just happened?
Something somewhere has to tick to check
yeah i know
i just never use event tic but ive heard ppl use it before for this type
So you don't do things per frame?
how do you move things
how does anything happen
yeah i get what your saying event tics are everywhere
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++
oh really bp is that much more costly :/
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
true
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
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.
why is showing UI an RPC
also GameMode only exists on server
there is no clientside GameMode to RPC to
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
Counter should be in GameState probably
And "every time it changes" -> RepNotify
no clue, there's a lot
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?
Your code probably can't handle latency and that's been hidden from you this whole time
you using network emulation?
nope
Mmm could you elaborate? Why would playing on one or two processes be different?
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
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).
define laggy
what is actually happening
might not be network related at all, gotta know what's actually happening
What I don't know, is why ping would be so high given that both processes are running on the same machine
on the same machine, ping is 0
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
maybe server is running at 4 hz
who knows
it is running slow because I don't have the window focused, I can see that (it's a listen server)
Uncheck the "use less cpu in background"
or whatever it's called
project settings
ohhh I didn't know that was an option
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
yeah it's sane but weird, would have never imagined
does it seem to take 50-150 ms for something to move once you give the command?
yes, or more
perfectly reasonable for a server-authoritative RTS with no prediction
Could be, I'd do some timing tests
yeah, I planned to support pings between 0-300
have client send an RPC and time how long it takes between setting the replicated var and getting the RPC back
good idea
and thanks a lot for the support
RPC should be as fast as possible so it'll give you a sanity check
I'd look at replication frequency too
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 ?
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
currently my game looks good for 0 to 120ms, do you think this is enough for listen servers or do I need to make it to 150 or 200?
Is it better to have more components with less replicating variables each, or less components with more replicating variables each?
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.
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
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?
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
Worked on big projects, no idea what you're talking about
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
Pretty sure this is the wrong channel for this
Elaborate what your issue is, if it's Blueprints, #blueprint, if it's C++, #cpp
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. -.-
@jade scroll This is not ontopic for this channel.
HAHA
Lovely :^)
if some code with unreal. you woud know this bug 😄
then code your own engine :3
i give my blood for this my face and ym word
Please move to an appropriate channel if you want to continue. Otherwise move on.
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
i dont think it matters much, the issue in performance is probably somewhere in your design
but the best is to have the smallest amount and size of replicated data
Yeah I know the smallest would be ideal but im sure one or the other is probably preferred.
Probably less components but just keep it sane
do what fits the best for you design and comfortable
fitting the design is the most important thing
How to force an actor's transform to replicate always?
the design works both ways
replicate movement checkbox?
well that doesn't do it
how is the thing being moved?
well the actor parented to it rotates
you mean the actor it's parented to? Does that actor have replicate movement turned on? How is it being rotated
I think I know the error
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)
what would camera have to do with this?
what are you actually doing here?
I'm spawning weapons based on the camera's forward vector
Would it be 'fine' to call a Server RPC on tick?
no don't
if no one here know the structure bug. this cant be real xDDDDDDD
don't rely on the camera for anything but the local players stuff
What are you talking about
yea that's what I do, but then I need to store that rotation on the server, because weapon will retrieve that data on the server
Yes, now what is this structure bug you keep talking about?
he says bullshit, ignore him
and nothign will work anymore
don't. You don't directly care about the camera. You care about a rotation, probably ControlRotation.
bullshit? are you kidding me?
I do it all the time and it works fine. Unless you're talking about BP structs, those are fragile.
go to your srucute add a varibale and all blueprints refnreced with this trucute will not work anymore
right, but I need a FRotator on the server
Come back once you've sobered up.
it works fine?
Yes
I don't see another way of doing.. maybe someone else has a clue
You already have one, sort of. ControlRotation
Here is one of many structs in my projects that I have modified many times. It all works fine. Any nodes that referenced removed properties have to be fixed up but that's to be expected.
https://github.com/AdrielKinnunen/SpectrelightPlugins/blob/492698537d659d9d0636f2e958e7fb8ccf7f15ae/Plugins/SLMechatronics/Source/SLMechatronics/Public/Domains/SLMDomainAir.h#L20
ehh kinda
your camera boom and camera USE IT, at least in the typical setup
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
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
LOL I was mistaken, I was talking to you about something at the same time someone else was dealing with this problem.
#multiplayer message
how do I stop the customrenderdepth from replicating?
Does it?
it has to be, im setting it to highlight an object that a player is focussed on
show code
but its showing on all clients
you sure you aren't just running your code on all clients
custom depth doesn't replicate
I bet you're doing that instead
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
what's custom depth?
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 💀
The main use case I've seen is for highlights around object meshes
would that be a multicast?
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
there's not a single multicast in the project
if thats what it would mean to run it on all clients
I didn't say anything about multicast
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.
Could be a stupid question, but is there any thing inherent about running Execute_Focus() that makes it run on all clients?
no
hm
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
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.
I've looked at every call, there doesn't appear to be any RPCs
Is the code that calls this function running even for non-local clients like I've said multiple times?
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
alright, so that resolves one question
Not replicated, it is being called on all clients
How tf that is happening is the next question
Because you're not checking if something is locally controlled before running code that should only happen for the local player
Ah ok, that makes sense
My networking mental model is not accurate, I thought that was the default tbh
I gotta reread the compendium
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.
@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");
probs out of relevancy
change the relevancy setting
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
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?
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
Hum, we agree that a DOREPLIFETIME_ACTIVE_OVERRIDE in PreReplication(), must also be registered as DOREPLIFETIME in GetLifeTimeReplicatedProps ?
are u supposed to run rootmotionsource on clients and server or just serv ?
PRetty sure if you run them on just the Server they will start running on the Client as part of a correction.
@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?
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?
You are still locked to one World per Server, so despite that and maybe WorldPartition, there isn't much else you can do.
Other than not using Unreal's Networking stuff at all.
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.
Nope, you still gonna hide that interior somewhere in your world (if it otherwise doesn't fit) and stream it in.
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.
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
what machine is doing the clearing?
show the code back to the triggering event
here
Your problem is probably that Ignore Actors Attack is replicated is my guess
what machines run this code, all of them? Just server?
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"
Put a breakpoint on it, make sure it's actually being hit
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 ?
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
Add your ability state to CMC prediction. Override UCharacterMovementComponent::DoJump() to clamp the non-z velocity or however you want to handle it. You might still get a correction but at least it'll recover and players shouldn't feel it
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)
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?
you got any tips on how i would do the ai rotation :/? im kinda using timeline rotation now after ai attacked to rotate towards the actor location with is a very bad way of doing it how would u do it ?
since if its attacking and i run behind he needs to rotate towars the player
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?
wait so is your event on the Update node itself
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.
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.
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?
Ideally you would trigger as many changes as you can from as few Replicated variables as possible. Therefore, using the OnRep from the Weapon itself sounds like a good idea.
Yeah thats the way I am trying to think. I am having more of an issue determining what needs to be replicated for the proxies. But ill figure it out as I go.
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
Expose the OnRep of that variable from CPP to blueprints
By calling some blueprint implementable function on rep
Yeah, making your own would be one way.
That thing has no OnRep
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.
@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
AddPlayerState
RemovePlayerState
Both overridable
They handle adding and removing to/from the PlayerArray
Right, thats it then. Not sure why I thought there was a rep but theres that
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
What do you wish to do in that scenario?
Requirements are somewhat important here, cause there might be stuff you can use if you tell us what you need :D
Yeah, the Variable also doesn't have the typical Replicated Property indicator in BPs :P
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.
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
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;
}```
Since the Server starts the Travel, you will always have the small delay for that RPC to arrive.
Not sure if that isn't outdated by now with that "new" ReplicatedSuobjectList thingy.
But in general that code there ensures the UObjects replicate too.
Ok because the instance isn't there until the equipment is added to the EquipmentList and both the EquipmentDefinition and EquipmentInstance are UObjects
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
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
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
The Assets that are UObject based are usually fine, cause they can be resolved locally.
UObjects by default don't replicate though, so the Instance that is spawned for your Equipment needs to be replicated. And since spawning a Struct or an Actor is both not as ideal, the UObject is chosen.
One could also use FInstancedStruct and wrap the Struct with it, but that has its own Downsides.
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;
}```
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
So this is better than spawning an actor for this data
TSubclassOf<UEquipmentDefinition>& EquipmentDefinition
Does that need to be a class?
As opposed to?
EquipmentDefinition sounds the MetaData I mentioned
Stuff that is only setup during Editor time and doesn't change
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
Hm maybe. What exactly takes 5 seconds though?
That's really long
If you do this in an empty level/project, you'll notice it's usually relatively quick.
Lyra does this and makes PrimaryDataAssets for the granted abilities and effects where I use this tag container
Yeah I would have used PrimaryDataAssets for the EquipmentDefinitions
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
SoftObject is probably not needed at that point, you can load it earlier
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
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.
Damn I feel like that's advanced for me
I have done 0 research into primary data assets and custom loading honestly
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));
}
Ok I can read that that's interesting
We use that to show the Structures in the UI and categorize them without even loading them.
Wow
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.
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
I an only really advice you to let Unreal Insights run while you do that. On Server and Client, and see what takes so long.
In my meta data I just put a TObjectPtr<UEquipmentDefinition>
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.
In theory, the Definition is the MetaData
Currently it's a struct in a data table
Right, that explains some of the trouble
what trouble
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.
Oh no
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.
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
There are probably good reasons for using either though.
Remember the FPrimaryAsserId in the function I posted earlier?
I remember it from the code above
FPrimaryAssetId ACH_Structure::GetPrimaryAssetId() const
{
return FPrimaryAssetId(FPrimaryAssetType(TEXT("Structure")), StructureTag.GetTagName());
}
Oh you fetch primary asset ID by tag there don't you
one example he said was for easy hot fixing
Yus, it's a combination of the AssetType and a Tag
using data registry and data raw ref
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
Right, cause you can load the DataTable from the Harddrive in theory, or?
I mean you can write a system that does that per DataAsset fwiw
That goes beyond the idea here though
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
Yeah and that's fine. With AssetsIds you can ask the AssetManager for them via FPrimaryAssetId(FName("EquipmentDefinition"), Tag.GetTagName())
Or fun stuff like
TArray<FPrimaryAssetId> AllEquipmentDefinitionIds;
UAssetManager::Get().GetPrimaryAssetIdList(FName("EquipmentDefinition"), AllEquipmentDefinitionIds);
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.
They are also not very well advertised :D
But yeah, the stuff Fishy posts is also nice if you need the additional hot-patching stuff.
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));
};
A lot of people probably skip this, as they just patch the game.

Yeah that's a cool helper to only use the Tag I guess?
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
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);
}
}
Yeah for Cheating that's fine.
That's a blocking load otherwise.
But that code is basically exactly what I meant earlier
i didnt read the whole convo tbh
AssetId to DataAsset (definition) and then tell InventoryManager to spawn that crap
Na that was more for Uhr
I never considered them to be exclusive though
they arent
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.
Cut my tag into pieces. This is my last resort
Sorry couldn’t help myself
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
Data assets hold rows for things like stats etc as datatables can be balanced externally and hot fixed. So all tweak able stuff for balancing is usually curve/datatables using tablerowhandle/fscalablefloat
Our crafting recipes are a data table holding assetid to definitions.
Whut
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
okay
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
Quick question. Is it normal that I'm getting bad latency using mover between clients?
Hi, should integrating the OSS (steam) to the game be done as early in development as possible or can it be done whenever?
There is an issue if your using iris
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
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?
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
Honestly, if you don't have a really really really good reason to use Mover, don't do that. We've been using it for a while and it requires A LOT of custom code on both Mover and NPP to get that thing going. Stay with CMC if that allows you to do what you want to do.
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.
CMC has Client Side Prediction though
But yeah, you can of course do what you want. Just an early warning :P
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
CMC doesn't have the features I want
Which features?
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
You mean you don't have enough flags for Inputs, like Crouch?
pretty much
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 :/
I'll be very honest with you I don't even know what I need lmao.
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
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
Yeah, problem is more that it lacks tons of features that CMC has.
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.
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
Hey why my server is sending montage across the server to the Sim proxies only
wait really? I thought that it was still limited to 8
well 4 - but 8 if you're daring to use the reserved flags
No, it uses CallServerMovePacked by now.
// 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.
oh shiet
yea i've been inheriting FSavedMove_Character and using the compressed flags
hm
I mean you gotta do that too.
The point is that it's not a hardcoded uint8 param o nthe RPC anymore.
gotcha ok
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
you're likely flooding the pipe, unreal stock physics rep never was that good to be honest, you generally need something a bit more custom to replicate higher amounts of physics objects. maybe take a look at fast array and have a manager actor replicating locations and velocities
Im using SmoothSyncs replication, but I doubt thats built for a large amount of physics objects either. Sadly not a lot of documentation with that either. I'll look into that. Any recommendations on some documentation that goes over fast array?
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
re fast arrays: https://vorixo.github.io/devtricks/network-managers/
probably that blog post is ur best bet
I like launching from a script
you can do that without packaging
but you can't really smoke test the game without multiple computers IMO
For example
Haven't used it in a while obviously but you get the picture
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
yeah it's the best way, but in the meantime, before packaging to test with multiple computers, do you use PIE or standalone?
I'll fire up PIE for quick checks but for more thorough tests I just launch like this. It's the same as standalone I'm pretty sure but without the editor involved
Don't your unfocused standalone window experience severe lag though?
Don't recall, I usually test with multiple computers
There's ways to reduce that though, look in settings
Use Less CPU in Background
Yep I tried all of those but unfortunately I still have the problem
but it's fine
I'll try testing with multiple computers
obviously the best way
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)
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
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
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
I was experiencing this recently - PIE works but Framerate is super low (~20FPS) and if I launch standalone, non-focused window runs at <8FPS AND some of my replication (but not all) has inmense lag (like 1-2 seconds delays with 150-200 ping)
PIE will naturally have lower fps than the packaged version because you're also running the engine + IDE if it's open. But yeah unfocused standalone window is a pain, glad I'm not the only one.
yeah ofc, I expect it. For serious testing I would use 2 computers, but I only have one atm xD.
The standalone thing was crazy though, I still haven't figured out the lag. Need to try with two computers soon to ensure it is an engine thing and not the game itself 😅
yep! I also only got one computer, for now at least. having two would be really useful
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
If you need to kick players there's a KickPlayer function
In the GameMode or GameSession I think
GameSession::KickPlayer
Anyone know how online multiplayer only projects can upload their build when applying for a megagrant?
if you are using 5.3/5.4 theres something called as physics prediction, im having the same issue however im using 4.26 so ill be sticking with smooth sync for now, usually people simulate physics locally is what ive heard which is what smooth sync is doing, however it gives client authority for movement so not best
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.
appreciate this. i'm wondering why in PIE it doesn't do anything
there's also this NewPlayer->ClientReturnToMainMenuWithTextReason(FText::FromString("Character invalid."));
but it causes a gnarly crash
Maybe a better question... how do I get the local player controller to talk to the client player controller?
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
That always works
If it's to get the local player controller that triggered input
even in splitscreen?
i just need the player controller so i can pass it along to other functions which eventually call RPCs on the server
Yeah but what's the input being handled in
just a normal actor since enhanced input lets you do that
How do I set a variable without rep w/notify so that it actually replicates?
set it to replicate instead
Not working lol
I've been banging my head on this for a while now and haven't had any luck
have you put the macro in lifetime replicated props?
DOREPLIFETIME ?
it's not enough just to mark the uproperty as replicated you have to specify a replication lifetime
I'm not sure I know that property (function?)
Oh, where can I learn more about that
Learn how to replicate actor properties in Unreal Engine; including conditional replication, custom conditions, and object references.
check out the part with GetLifetimeReplicatedProps function override
you need that otherwise it's not going to replicate
assuming they are using C++
Ah, I'm using blueprints
oh i'm really sorry i didn't realize
what are you trying to replicate and how?
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?
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
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
So should I be moving my "Spawn Unit" script from occuring on the player controller to the game mode graph?
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
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?
Spawning from player click - after they've selected a unit type.. think Clash of Clans I guess?
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"
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
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
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?)
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
think of it as a message to/from the server which triggers an event
RPCs are bidirectional client <-> server
the caveat of this is - they are executing remotely on your machine, therefore you need to make sure it's safe
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
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).
yes precisely
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)
it is in blueprints, it just depends who owns the actor or not, gamemode is owned by the server
Okay that's the phrase I was looking for "owned"
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
you should read this
i believe it will be very helpful to you
Thank you for all of the help already, I'll definitely take a look
this is an implementation detail though. theres nothing stopping you from letting clients dictate state on the server so you need to actually do your own validation to make sure that a request is valid
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)
you're most welcome ❤️
they are using blueprints bruh
ignore the funny letters then I guess, sorry
With the previous information about Unreal Engine's Server-Client architecture and the common classes we can divide those into four categories:
replace UFUNCTIONS with BP events I suppose
its ok i understood 🙂
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
Okay thanks all, that's extremely helpful and I appreciate the time
good luck ❤️
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)
multicast is a special type of RPC which you should not be using for state but rather special effects
what do you want this RPC to do
is it designed to be called from the server to each client?
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:
so... you want to update some state on all of your players
I want to retain the Unit type variable that was changed... so yes?
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?
So I do have this:
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
this is like a selection menu thing and you want to disable options that are chosen by another player
or i cant read
or just get player array from the gamestate
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)
that doesnt work if you need to send an RPC to the player controller
why not