#multiplayer
1 messages ยท Page 262 of 1
Steam?
Also why do you multicast the server travel
I am testing EVEYRTHING lol
Only the server should execute that
Are you using steam with your packaged build?
I was throwing crap at the wall to see what stuck
We are using SteamCore
packaged in the editor
So the builds are actively run through steam?
Are your GameModes set to Seamless Travel?
Yes
Yes to what
and levels are set in the editor map
No clue on Steam and run through, SteamCore is a plugin
I know - I was just trolling
I am using package build in editor
Okay so its not getting the actors correctly. it knows theres 4 because it runs the loop 4 times, but it only sets 3 of them for some reason
Buddy you must know if your game is using steam when you host, join, etc
SteamCore is the plugin, that does this. And yes, its working
I can host a server, friends can join, steam shows up
Steam core doesn't matter here
Thanks
And you are sure you are seamless traveling?
That's not the point. If you game would not have the steam app Id text file etc it could still run Null
Am i doing something wrong in this section where i set the platforms? length is 3 (4) but in the player platforms it adds 1 with no reference for some reason
Ah
The only reason packaged with steam could not move all players is if you were to use hard travel
And please don't multicast the server travel
I have a GameMode for the Lobby, and have seamless travel turned on
I have a GameMode for the Main level (not lobby) and seamless isnt on there. Does that matter?
Are you calling get all actors of class every time?
yes each player does it i think
You should preferably only do this once. You can't guarantee the order will be the same
The whole setup looks pretty cursed tbh
its on the game mode begin play. does that fire for each client or just once?
its from a lobby tutorial xD im in too deep now to make my own
Begin play just fires once for the server in the GameMode
okay so its only firing once then
i just dont get why its adding one as null all of a sudden
Are you potentially expecting tags 1 to 4 but pass 0 to 3?
nah i always get 0
I would suggest you get all Actors of Class for each of the classes once, then save them to an array, and then loop the arrays and compare the tags
That way you can debug this easier
sorry bad explanation. So i get them all on begin play on game mode, then store it, the playerplatforms array is replicated too.
Then whenever a player connects, it gets all player controllers, loops them and adds to an array and sets a bool once its done.
Then it loops the playerplatforms array, and for each it gets the player controller variable of that platform, if its invalid, it spawns a character on it and loops til all of them are spawned. Then when someone leaves, it does the same thing
ive been trying to debug for ages, only thing i can find is this one platform is empty, but it still has 4 items in there (i have 4 playerplatforms)
Unrelated but where is player platform array declared?
game mode
Make no sense to replicate it then.
Game mode only exist on server.
Clients dont have a copy of the game mode, they will never know an array called player platform.
You probably should read exi's guide pinned in this channel.
alright thats off now. Only the game mode handles the platforms and spawning too
Bp lobby players are placed at editor time?
at run time yeah
You need to debug on your end. First check if you get all expected lobby players, also checking each of the tag.
Then you check if all the platform have the matching tag.
I dont know what you are doing but it may be neater to just spawn a platform for joining player and assign that platform to the joining player.
That is printing that theres 1 less platform in the array than its finding, but if its finding them all, why arent they added
Need to debug more, read above.
Add a break point and you will see why.
Most likely there is a tag that doesn't match, hence it return null.
Also using get all actors here is pretty nasty imo.
Heed what exi says about getting it once and caching the result.
You then iterate from the result that way the order is guaranteed.
Okay thanks ill keep at it
Question when setting a PC on the Server for an actor. I assume its only 1 PC owner per actor?
Yes
lame
so that means I can have only one PC owner that can send RPCs to the server
via that actor?
Any client can send server rpcs from any actor they have network ownership of
Via one single actor yes
So basically If I have a sim proxy actor B and lets say I don't touch the gamemode or PC. Then this means my sim proxy will need to sit on tick an poll when a player connects so I can assign it an owner for that SimProxy
Then I can call RPC functions to the Server Version on that SimProxy Actor
Finally got around to implementing it (Screenshot from mess around project), once again I really appreciate your tips, only took like 20 minutes to get up an running.
For anyone interested, here is the only code required to make this work. Just copypasta this inside of UEditorEngine::CreateInnerProcessPIEGameInstance in file PlayLevel.cpp above the following line here:
// Might be invalid depending how pie was launched. Code below handles this
if (InParams.DestinationSlateViewport.Get(nullptr).IsValid())
bool bUsingSplitMainView = CVarEnableMultiPIEInMainViewport.GetValueOnGameThread();
EPlayNetMode PlayNM = PIE_Standalone;
GetDefault<ULevelEditorPlaySettings>()->GetPlayNetMode(PlayNM);
int32 PIEWindowIndex = PlayNM == PIE_Client && InPIEInstanceIndex != 0 ? InPIEInstanceIndex - 1 : InPIEInstanceIndex;
if (bUsingSplitMainView && PIEWindowIndex < 4) // The 5th client falls back to the old way of creating a new PIE window.
{
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
TWeakPtr<ILevelEditor> WeakLevelEditor = LevelEditorModule.GetLevelEditorInstance();
if (TSharedPtr<ILevelEditor> LevelEditor = WeakLevelEditor.Pin())
{
TArray<TSharedPtr<SLevelViewport>> Viewports = LevelEditor->GetViewports();
for (auto IT = Viewports.CreateIterator(); IT; ++IT)
{
TSharedPtr<SLevelViewport>& VP = *IT;
if (!VP->IsInForegroundTab())
{
IT.RemoveCurrent();
}
}
if (PIEWindowIndex < Viewports.Num())
{
SlatePlayInEditorSession.DestinationSlateViewport = Viewports[PIEWindowIndex];
InParams.DestinationSlateViewport = nullptr;
}
}
}
@thin stratus was supposed to reply to you ๐
(Anyone copying would need to implement their own CVar if you want to toggle it like my implementation)
But then how do you tell client which text to load? xD
or maybe you want to hard code one answer
I also added something on our end that morning that spawns the windows (not the viewports) in a nice 2x2 grid.
Can try using a StringTable.
As long as your gameplay tags are deterministic (loaded the same order on the client & server) i'm pretty sure there's cheap replication for them
Not sure what the identifier for their columns are though.
im am using string tables
im pretty sure Ftext is serialized as key not full string
Check fast replication is enabled in Project Settings -> Gameplay Tags
If you mean replicating a list of them, try a FGameplayTagContainer
There isn't really anything special to consider here. Tags are usually replicated as ints due to being FNames internally. The only useful thing that GAS has is the Tag Counter thingy.
I mean Matt checked that and said it was a lot of bits. But maybe he didn't use a proper LOCTEXT
Yeah although you might want tag counts so I would suggest you just copy the tag count map thing GAS has.
Value.TextData = MakeShared<FTextHistory_Base, ESPMode::ThreadSafe>(TextId, MoveTemp(SourceStringToImplantIntoHistory));
any iris gurus ?
[1/2] Fragment: L_WorldMap_C_LifetimeConditionals DescriptorId: 0x1820fd811fed97ce DefaultStateHash: 0xb16437061a0eca2b
FPropertyReplicationState L_WorldMap_C_LifetimeConditionals
0 - AttachmentReplication : (AttachParent=None,LocationOffset=(X=0.000000,Y=0.000000,Z=0.000000),RelativeScale3D=(X=0.000000,Y=0.000000,Z=0.000000),RotationOffset=(Pitch=0.000000,Yaw=0.000000,Roll=0.000000),AttachSocket="",AttachComponent=None)
1 - ReplicatedMovement : (LinearVelocity=(X=0.000000,Y=0.000000,Z=0.000000),AngularVelocity=(X=0.000000,Y=0.000000,Z=0.000000),Location=(X=0.000000,Y=0.000000,Z=0.000000),Rotation=(Pitch=0.000000,Yaw=0.000000,Roll=0.000000),Acceleration=(X=0.000000,Y=0.000000,Z=0.000000),bSimulatedPhysicSleep=False,bRepPhysics=False,bRepAcceleration=False,ServerFrame=0,ServerPhysicsHandle=-1,LocationQuantizationLevel=RoundWholeNumber,VelocityQuantizationLevel=RoundWholeNumber,RotationQuantizationLevel=ByteComponents)
2 - NetCullDistanceSquared : 0.000000
[2/2] Fragment: L_WorldMap_C_State DescriptorId: 0xb10480b0ce3459a3 DefaultStateHash: 0xa5791ced902d251e
FPropertyReplicationState L_WorldMap_C_State
0 - bReplicateMovement : False
1 - bHidden : False
2 - bTearOff : False
3 - bCanBeDamaged : False
4 - RemoteRole : ROLE_Authority
5 - Owner : None
6 - Role : ROLE_SimulatedProxy
7 - Instigator : None
Printing default state hash for members of [1/2] Fragment: L_WorldMap_C_LifetimeConditionals DescriptorId: 0x1820fd811fed97ce DefaultStateHash: 0xb16437061a0eca2b
Member: 0 AttachmentReplication
Member: 0 AttachParent Serializer: FObjectNetSerializer Hash: 0xbe6056edf5e94b54
Member: 1 LocationOffset Serializer: FVectorNetQuantize100NetSerializer Hash: 0x3f317f46466233af
Member: 2 RelativeScale3D Serializer: FVectorNetQuantize100NetSerializer Hash: 0x3f317f46466233af
Member: 3 RotationOffset Serializer: FRotatorNetSerializer Hash: 0xbe6056edf5e94b54
Member: 4 AttachSocket Serializer: FNameAsNetTokenNetSerializer Hash: 0x9ae16a3b2f90404f
Member: 5 AttachComponent Serializer: FObjectNetSerializer Hash: 0xbe6056edf5e94b54
Printing default state hash for members of [2/2] Fragment: L_WorldMap_C_State DescriptorId: 0xb10480b0ce3459a3 DefaultStateHash: 0xa5791ced902d251e
Member: 0 bReplicateMovement Serializer: FBitfieldNetSerializer Hash: 0xbe6056edf5e94b54
Member: 1 bHidden Serializer: FBitfieldNetSerializer Hash: 0xbe6056edf5e94b54
Member: 2 bTearOff Serializer: FBitfieldNetSerializer Hash: 0xbe6056edf5e94b54
Member: 3 bCanBeDamaged Serializer: FBitfieldNetSerializer Hash: 0xbe6056edf5e94b54
Member: 4 RemoteRole Serializer: FNetRoleNetSerializer Hash: 0x47a24c13b17e583e
Member: 5 Owner Serializer: FObjectNetSerializer Hash: 0xbe6056edf5e94b54
Member: 6 Role Serializer: FNetRoleNetSerializer Hash: 0xbec09cc447469d8b
Member: 7 Instigator Serializer: FObjectNetSerializer Hash: 0xbe6056edf5e94b54```
Warning LogIris index 0/2 named L_WorldMap_C_LifetimeConditionals identifier (0x563ca04a11f2a58d, 0xb16437061a0eca2b) Pointer: 000006319AB26C00
Warning LogIris index 1/2 named L_WorldMap_C_State identifier (0x1ce45043dc41f9a7, 0xa5791ced902d251e) Pointer: 00000631A7AB3800```
hitting this ensure ensureMsgf(NewProtocolId == ProtocolId, TEXT("FReplicationProtocolManager::CreateReplicationProtocol Id mismatch when creating protocol named %s with in ProtocolId:0x%x Calculated ProtocolId:0x%x"), DebugName, ProtocolId, NewProtocolId);
You might as well use FGameplayTagContainer at that point
But yes, you should enable it anyway
It should work even with an array
found another solution.
I can retrive key and name space from FText
const FString* sourceStringPtr = FTextInspector::GetSourceString(message);
TOptional<FString> sourceNameSpacePtr = FTextInspector::GetNamespace(message);
but in both cases, I did not predict that I sometimes still need to pass values to format text ๐
which makes this kinda restricted to simple messages
I just realised I was randomly replicating all my ai controllers with an always relevant flag and net update rate of 100
I have some old code from when I first started the project and was new to MP and just spammed multicast lol
Sign me up!
Ensure you have done everything listed here (the old way) https://jambax.co.uk/replicating-uobjects/
Oh - this is really neat. Yoink!
Didn't even know you could do this
btw, I don't think you can have more than 4 players in PIE.
Cursed or what aha
Epic has a max count at 10
#define MAX_PIE_INSTANCES 10
static TMap<FGuid, FGuid> PIEGuidMap[MAX_PIE_INSTANCES];
Just a heads up I noticed there was a bug there with dedicated where the first viewport is skipped, would be a super easy fix by just checking if its a dedicated server with the InPIEInstanceIndex but I just have been busy with other stuff
I just updated it now so it works with dedicated just fine
I'm an indie with a bubblegum budget. I don't do dedicated.
The real question is - do I need a source build, lol
Yeah unfortunately
Can you have a TFastArray Item contain another nested TFastArray item in it? then mark the inner and outer items dirty and still get the PostReplicatedChanged etc call backs?
I did just tryed it out of curiously but I wonder if you really need to do some custom serialization stuff
So you can Imagine you have two TArray Containers where each item in the outer container has a set of items. Then when the inner item changes of that array changes I can get the outer item change and the inner item. This way I dont need to do any extra inner checks to find the inner index that is changed?
hello!
Does any one find a new contextstring in 5.6?
{,,UnrealEditor-Engine.dll}::GPlayInEditorContextString -> this is not working anymore in 5.6
That should work, perhaps remove .dll
nope, still error
Iโm on mobile and it linked the wrong thing, if you expand the side bar you will see Tips and Tricks
That will give you the correct expression
@verbal ice Are you still using GMC and its network prediction stuff? If so - still going pretty well for you? Any updates on frustrations you've found?
Haven't used it in a while but I still do yeah
Personally don't have much negatives to report
The author added support for instanced structs in the move data so now you can pretty much sync w/e you want
(or you can add custom sync data too via some macro definitions if instanced structs are too heavy)
The community created the GMAS (General Movement Ability System) which is a plugin similar to GAS in function but made to work with GMC
Yeah - I'm curious about the stability of GMAS
It even has stuff like server applied effects that are "predicted" by the client
So you can do stuff like stuns with no errors
Server just tells the client to apply the effect and the client tells the server it has applied it within move data
I know GMAS is used by at least one big project atm and they contribute to it a lot
I've been pondering combining GMC + GMAS + U# ๐
Having used it myself it is pretty good
What kind of project?
The first two I'm probably gonna end up using in my project that has Lua as well 
Standard run of the mill MP zombie game honestly.
Yeah that'll do fine
I love the rollback stuff it exposes
I generally end up routing shooting netcode through the GMC too
because of how sweet it is to be able to shoot at the same position as the client on the server
You end up with pretty much what games like CS do
- GMC's rollback capabilities are cool
(Even though I technically wouldn't use them very often, they're expensive, depends on the player count and all)
But for instance it's able to rollback players around the player you're applying movement to
So you can do player to player collisions fine
Yeah - rollback type stuff is.
Overall it's great
The code is very readable too so if you need to modify it or improve performance it's defo doable
I like that it buffers moves (it's a setting, you can change how it works)
But you can do a static X ms buffer or adaptive based on the player's network performance
being able to peek into the future that way is nice
The downside is that anything not networked through the GMC will be "out of sync" with that buffer so you gotta be careful
like for instance you'll see players X ms in the past like other games do, but regular replicated properties don't care about that buffer
I think that's probably my only "issue" with it. It's not a deal breaker of any kind but you have to work around it/be wary of it
If you don't need to worry about cheaters and it is co-op you can do a lot on client without having to worry about rollback stuff
I'm very very well aware
I'm already pretty comfy with UE's stock stuff. Just curious about GMC stuff specifically and I know Cyn uses/d it
Nice ๐
I love the GMC and will probs use it for all my projects
Do you find the rollback is warranted even in purely pve games?
where it doesn't really matter if clients can confirm hits
Not really no
At least not for hits
If you need to rollback for player to player collisions or the likes sure
Or moving platforms which GMC can do as long as you can deterministically roll them back
Makes total sense ๐
I've been enjoying giving the client a lot more freedom in my game, nice to give clients the most responsive feeling game within your design limits!
Yeah
It also makes your game code so much more cleaner
The shooting netcode one is an example I use a lot
You don't have to check if the position the player reported the shot at is valid because you've already validated it
You're running their shot at the same time you processed their movement input
since the shot input is within the movement input
Oh right - just make sure you're not using Iris, I don't think the GMC supports it yet
sounds useful for competitive games! the CSGO rollback still blows my mind
I probably am staying on simple vanilla ue with a heavy trust on client to simplify hits
client hits on his screen, tells server he hit, server deals damage
Yeah if you're trusting the client that's fine
GMC's just got a lot more to it that I like
custom collision shapes for one
Being able to change them at runtime
i.e. prone players can have horizontal capsules
How easy it is to add new data to the move stuff
And it being fully Blueprint compatible, like you can't add custom movement data to the CMC in Blueprints
sounds like a dream for competitive games. I still haven't been brave to even try just because of how hard it is to prevent cheaters even with a good anticheat
I wouldn't do it personally but it being a thing makes it awesome
Yeah it cuts out a lot of stuff since you can do a lot of client prediction you wouldn't be able to do in the CMC without heavy modifications
Cheaters will always be a problem but you can do a lot to make it harder for them
It's just discouraging to see even AAA companies like COD still have rampant cheating
makes me want to focus efforts on games where cheating doesn't matter
all it takes is a single cheater to compromise the trust of players and ruin a competitive economy especially if you were running a game that lasts longer than a few matches and has persistent inventory
hats off to the games that can pull all that off
I mean most games just don't have cheating affect the inventory, when possible
Like CS
Although some games like Escape From Tarkov somehow allow cheaters to "vacuum" all items in the map into their inventory, like holy shit what kind of rats nest is that codebase
Well say games where a player with an aimbot can eliminate another player that drops inventory
Hell i've seen clips of cheaters stealing a SCOPE on a weapon that was held in another player's hands
It's hilarious
They also sell packs of keys so you can keep getting banned and save money on your cd-key re-up.
Yeah that does fuck with those kind of games yeah
Oh yeah they defo just allow cheaters to buy new keys heh
Gives them more money
I'm surprised that game still has a community in that sense, but not too much since it's the only game of the sort that does it well
Every other game tries to be a new EFT but like, you can't unless you make EFT 1:1
The playerbase for that game won't want anything else
I do admire how games like path of exile have absolutely everything serverside and they manage to keep a steady economy that isn't exploited
Yeah
MMOs have it a little easier in that sense
Or well, it's difficult in different ways than we're used to
It's mostly botting they have to combat afaik
yeah for sure
games like COD ranked where you have people soft cheating are the really annoying cases as the entire game revolves around having fair gunfights
not sure things will improve with the looming AI stuff
Even worse was the MMR exploiting.
no amount of anticheat can fix that games horrific unsafe netcode
doesn't matter when the game itself leaves itself wide open lol
Would you not just straight up quit the game if you grinded for gear for 10 hours and some cheater aimbotted you and stole it?
on a severed artery
Why do players stay?
Only game of its kind
thats what i did ๐
Every other attempt to make a similar game has died
and pretty much everyone i know did the same
or was just too different for them
yeah I stopped playing years ago
that game is not good for my mental health LOL
most games tried to be too similar and just be a tarkov lite. but then why the fuck not just play tarkov?
Yeah
then there was the cycle which somehow had a WORSE cheating issue than tarkov
i just genuinely dont know how games are made to be this wide open
like surely someone along the path of development raised the question "what if someone cheats"
i'm doing the bare minimum
movement i can at least understand because its so hard
but inventory management? like cmon man
and tarkov has no concept of relevancy with their networking. so everything is sent to every player all the time
Really shows that a good idea matters more than a good technical foundation
players dont care how a game is built under the hood as long as it works well
Hey all,
Have a strange question.
I have a button that gives my characters a skill (add the string "lockpicking" to a string array on the character pawn)
when I press the button, I am trying to replicate it correctly but I think im doing something wrong.
On the client itself, its skill list is being updated properly and when it interacts with a locked door, the door opens as expected. But the door opening does not replicate to other players, only to the client that has the lockpicking skill who opened it.
When the door is not locked, it replicates the opening fine.
Im trying to deduce whether the skill itself is not replicating correctly to tell other players that they have the skill to open it or if there is an issue with my door logic for locked door replication.
anyone have some ideas to help debug this?
Hmm so if you were to use cmc you will tie the shooting in the saved move?
No, the CMCs too much of a clusterfuck to extend that way
It's possible but I've never done it for a client
The opening or closing state should happend on server. The visual part can be replicated to client.
I see, ty for the input.
just tested from server + client and you are right. Thank you! was driving me crazy haha
I move away from always relevant, I had to replicate the teams colour and update it on a timer but got massive performance gains. Will have to keep an eye out since there is now some graphical information that might be inconsistent (seems ok so far though) but shouldn't be too hard to fix and definitely worth the tradeoff.
Making everything event based is difficult, especially with race conditions and in Blueprints fwiw. Just don't fall into the trap of using RPCs to update state like the colors
In theory most of the time a combination of OnRep variable and EventDispatcher goes a long way in keeping stuff like team colors event driven.
Well what I do is replicate the team colour variable and then hide the widget when player is far away anyway, when player gets near enough I set the team colour locally based on the replicated variable (which will get replicated sooner or later because the net cull distance > widget hide distance and my min net update rate is like 5), sometimes the team colours do flash black for a moment (the default colour) but I can probably just hide them if they are black easy enough
theres a chance units will display wrong stats and stuff so may need to fix that but its just cosmetic all the fighting logic is done on server anyway
Why don't you put the color into the PlayerState?
Then you don't have to worry about the Widget not having the info replicated in time.
Or probably better even just replicate the team through the playerstate and have a DataAsset or fwiw a map somewhere for Team to StaticTeamData, so the local player can just look up the color
yea im sure ill figure out a way tbh it works ok now i fiddled with some stuff only it does flash black for a second
the map cannot replicate on its own fwiw, so this would be on an asset both sides have the same data in
Yeah hence the static part
by team you mean all my allied ai?
some small ID that represents the team they are on or something?
i have that
owner id i call it
if i did on widget a binding it would be pretty much instant just less performant i guess i can do like tick every 0.05
but then still black for those 0.05 lol
hey. just started looking into networking side of ue and I started with the 3rd person template but when I play as client side the camera doesn't rotate, how to fix?
Hello hello, if an actor is replicated and replicates movement, should SetTransform called on server context not update the transform on all clients?
Is the actor hidden? There are some caviates to how set transform skips stuff
Multiplayer movement is normally handled by the character movement component. If you don't use character movement component it's much less smooth and you need to handle a lot of net issues yourself, eg you can get bad rubberbanding
Setting transform directly doesn't involve using character movement. The 'replicates movement' flag corresponds to the character movement component and not custom movement nodes like set transform
I suggest to use nodes that involve character movement component, or AI nodes like AI move to also use it
Actually I realised I am just assuming you're talking about a character here. It all depends. if it's something like teleporting a static object without physics as a one time thing then yeah you can just multicast or repnotify set transform (actually if it is replicated it should move on clients too, maybe you have replication turned off for a particular component?
But replicates movement flag has nothing to do with that kind of repositioning
Tbf lots of things can move that aren't just characters, the engine also supports interpolation/extrapolation methods for actor movement being replicated
A platform moving, a door opening etc
A lot of that would be in C++ though right
Wdym, for physics sims (what you would interp/extrap for anyway) its just an enum
/** Which mode to replicate physics through for this actor. Only relevant if the actor replicates movement and has a component that simulate physics.*/
UPROPERTY(EditDefaultsOnly, Category = Replication)
EPhysicsReplicationMode PhysicsReplicationMode;
ah well maybe my knowledge is not 100% correct, however replicates movement is certainly not intended for stuff like set transform node
I do agree that you would usually replicate something like a platform or door different, IE send the final position and let the local client handle interpolation. You can then get fancy by subtracting HTT to try get it more in sync but yeah, I was just saying you don't always need a MC for it
Is a replicated actors spawn transform quantized when sent to clients to spawn or is it full floating point precision
pretty sure all actors's spawned on server send position/rotation quantized unless disabled by a cvar
well the spawn transform at least
net.QuantizeActorLocationOnSpawn=1
net.QuantizeActorRotationOnSpawn=1
thanks
Hello, is it possible to change replication condition of a property in children classes? So if actor A does DOREPLIFETIME(ThisClass, Foo), is it possible for actor B that inherits A make it be something like DOREPLIFETIME_CONDITION(ThisClass, Foo, COND_InitialOnly)?
I got this message while failing to join a game - I think someone was trying to join at the same time, and the server limit of 4 players was hit:
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_PlayerCharacter_C_2147473386. Function Server_SetEnabled will not be processed.
I'm not exactly sure how to interpret this message. Anyone can tell me what it means?
hey
replication only works from server to clients?
or like from authority to others
it's a very basic question but Im unsure
Yes only the server is in communication with all clients, if A wants to talk to B it must go from A -> Server -> B
Same goes for property updates, if A wants to change something that is replicated, it must do it via the server otherwise it and all clients will be out of sync with client A
Calling an RPC before the player is possessed and has a player controller/net driver to sent network traffic through
there is some info linked under "pinned" messages, where you might find answer to basic questions.
Can't directly answer it but there are macros to override if they replicate or not. Maybe you find one for the condition if you open the file that contains those macros
Should've done that earlier ๐ Yes, there's plenty of them, thank you
Answer:
DISABLE_REPLICATED_PROPERTY_FAST(ThisClass, TheProperty);
DOREPLIFETIME_CONDITION_NOTIFY(ThisClass, TheProperty, COND_SkipOwner, REPNOTIFY_OnChanged);
i have a situation where a plyer can get "killed" and they become soemthing that can be picked up by another player, when i do this i attach that dead player to an actor, and then that actor (basically an interactable sphere) is picked up by another player, this works until the player that picked up the player jumps from high distance or flys at all, it seems that the height or Z isn't updating on that client that is dead, and on their screen they falll through the ground. but the server still maintains everything so everything still works its just not appealing to be the captured player in that case as you just fall thruogh the ground in certain cases
which one is more likely recommended to use in terms of stability and optimization?
void AArmaRealPlayer::SetBoardingPlane(ABoardingPlane* NewBoardingPlane)
{
BoardingPlaneRef = NewBoardingPlane;
const bool NewInBoardingPlaneState = BoardingPlaneRef ? true : false;
SetInBoardingPlane(NewInBoardingPlaneState);
}
void AArmaRealPlayer::SetBoardingPlane(ABoardingPlane* NewBoardingPlane)
{
BoardingPlaneRef = NewBoardingPlane;
SetInBoardingPlane(BoardingPlaneRef != nullptr);
}
SetIsBoardingPlane(!!BoardingPlaneRef);
I called it SetInBoardingPlane, because its just setting a bool not the actual actor ref
! converts the pointer to a bool based on whether it's null. !! inverts that.
Not null -> true
Super helpful! Thanks
Has anyone gotten online beacons to work via Steam Relay?
Anything that would make that impossible?
this feels so wrong
It is wrong
why have 2 variables representing the same state
Redundant at best and a bug factory at worst
just check BoardingPlaneRef when you wanna know if you're boarding or not
What's next, MyCurrentWeapon and bCurrentlyHasWeapon?
That was not an option!
how many different shapes?
I suppose what are you trying to do?
it'd be far easier to make a bp for YourReplicatedThingy then just set whatever you want in it
you'd make 1 asset, not 1 per shape
What is the actual problem here
your asset would reference the packaged shapes
you'd just be able to replicate the asset ref and swap the shape out on both ends
Replicate an enum. Use an onrep for that enum which changes the mesh.
1 enum entry per shape.
Could you spawn actor deferred, add a static mesh component, set the mesh to some hardcoded asset, turn on breplicates, and then finish spawning it?
I don't know of any other way to do this with your other constraints.
You said the shape is on the user side already
Is it even possible to create multiple steam networking sockets for one server
Was thinking one for the server itself, and one for online beacons
Im thinking of upgrading a game made on 5.3.2 to 5.6, in terms of multiplayer, can anything break? the rest of the game is quite simple.
(Im using listen-servers, replication, multicast, etc)
oh hell yeah it is, gonna need some tinkering and probably a custom steam plugin for what I want to do
but you can request multiple ports for your fake ip from Steam
So I'll do one for the game server and one for the beacon host
Don't think so. 5.6 actually made replication simpler by not requiring DOREPLIFETIME macros anymore (even though I'd still do it)
so if you have a replicated property that isn't registered, it'll start replicating once you upgrade to 5.6
Otherwise, I don't think there will be issues
Great, I will upgrade then.
mostly because apparently now it saves the position of my PIE windows.
(size, position, etc)
it was driving me crazy
what?
since when and where
that sounds like a huge (and potential bug creating thing)
That sounds awful
It was helpful having those errors if I forgot to add something, because its probably COND_Simulated...
Now it will just silently replicate to all
๐ฆ
Yeah should've been opt in
Just out of curiosity.
Why is that bad?
For one, the DOREP is sort of acting like a check for the programmer, asking "are you sure you want this replicated". If its missing, UHT will complain about it. So you have to either add it and be sure that was intentional, or remove the Replicated/ReplicatedUsing from the UPROP.
With this you can easily just forget that you added that specifier to the UPROP and all of a sudden that variable is affecting change across the network.
I agree opt in is better but like that said itโs bc of iris so they would need to make iris opt in too if that were the case. Being a cvar now means it goes from a compiler error to runtime error which is slightly more annoying but eh
I havent been keeping up with Iris (or anything UE5 really), how does Iris come into this specifically?
This simulates the default behaviour when iris is enabled
So theyโre making it default in standard replication to better align with iris replication
I have only touched iris in a fiddle project, I havenโt needed it myself so Iโm in the same boat really
So theyโre making it default in standard replication to better align with iris replication
I get that part, im asking what part of Iris does it align to?
Iris does it by default, so to make it aligned with that? Easier to switch between the two
Are you saying when Iris is enabled you don't need DOREP (prior to 5.6)?
Iris does it by default what exactly are you saying Iris does by default?
I'm saying the inverse, one replicates without tht requirement and the other (pre 5.6 needed it) so now it's making both not require it lol
From the way I read it, itโs saying the default behaviour in iris is that and this change is to simulate that same behaviour
I mean, I could be wrong and If I am let me know, that was just how I interpreted the change note
I just realized, they actually tried to fix the bug some people here had.
Basically, if you have a property, like a boolean, set to false in the BP Class and then to true in an placed Instances of the BP. And the Server sets it back to false before the Client connects, the Client won't get the OnRep call for it properly.
Cause it will compare False to False and then say the value is already correct.
I would still argue this is a setup issue on the BP though.
something changed in 5.6? I can't add this variable to be watched
what is your editor module's name? check the module list
I meant more in the rider debugger module list
but that is technically a module list... fair
In my case for some reason it changed to being named after my target
{,,BattlementEditor-Engine.dll}::GPlayInEditorContextString
In my case my project is called "battlement"
try using that thing you found in that list
honestly my fault for not being specific lol... I am not great at this stuff
you would want DXPUZZLES2024Editor-Engine.dll I assume
can't find any
and I assume this watch is not working because of this, but I have downloaded symbols...
Is that the only -Engine.dll?
Yes
Hey!
Does anyone know if there's a way to disable the root motion montages from syncing? It seems like Montage_SetPosition when with root motion also somehow affects the owning client of the character
basically calling SetPosition without root motion works fnie, but with root motion it also "jumps" the montage on the client
Does epics online services for ue5 work for both pc, and xbox
GameMode->SpawnAeroPlane [Replicated Actor]
AeroPlane->GS->GetPlayersArray [Board all players in a server only array]
Player->PlaneRef->ServerTryEject(this)->PlayerArray->ifcontains->MultiCastEject(player)
UNetDriver::ProcessRemoteFunction: No owning connection for actor BPBoardingPlane_C_0. Function ServerTryEject will not be processed
if i replicate the players array it works fine, but why would i need to replicate the players array in case the player is passed to server to look in the server only player array to eject?
PlaneRef is also replicated so client can have valid plane it is attached to
Playing as server works fine, and No owning connectiononly when i play as client
Setting the owner this way works fine on both server and client, but is it not against the unreal network model where the actor can have only one owner at a time?
void AArmaRealPlayer::OnBoardedByPlane(AArmaBoardingPlane* NewBoardingPlane)
{
BoardingPlane = NewBoardingPlane;
BoardingPlane->SetOwner(this);
SetCanMove(false);
SetbOnTheAir(true);
SetActorEnableCollision(false);
SetActorHiddenInGame(true);
AttachToActor(BoardingPlane, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
}
or does it mean each player will be owner of their own instance of the plane?
one thing i can think of is to spawn a seperate spwner actor that will spawn the plane and put that spawner as owner of the plane
How are you supposed to use characters with NavMeshWalking in multiplayer? Do you just always include the navMesh on clients? Why would you ever not?
hmm, seems like setting ownership of a replicated actor by server only sets ownership for server, and clients will not know about it even if the actor is replicated, so i guess need to set the ownership by multicast...
logs for server only ownership of a replicatd actor:
LogTemp: Warning: Player trying to eject: BP_RealPlayer_C_0
LogTemp: Warning: Boarding Plane Authority: BPSpawnManager_C_0
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BPBoardingPlane_C_0. Function ServerRequestPlayerJump will not be processed.
Setting Owner on Server is enough.
Owner is replicated.
And you can only have one Owner on a given Actor at a time.
is there anything missing in my setup? when i try to eject on client it says no owning client, on server it works fine
Can more than one Client do the Eject on a Plane?
yes, all players are boarded , they can be any ammount currently joined
And all of them are supposed to run the Eject function?
yes when they press interact key locally
Then you can't do it like that. Then you need to route that ServerRPC through an already owned Actor of the Client. Like the PlayerController, possessed Character/Pawn, PlayerState, etc.
Most people have an Interaction System set up for stuff like that.
Hm, not sure I have an example for not wanting to include it. Other than times where you really don't need it.
Yeah. I'm curious why it's possible to use NavMeshWalking in a project while not providing the navmesh to the client, because it just breaks if you do so.
Don't think I've ever said to not include it. Don't know why you wouldn't to be honest.
Plane spawns by the game mode , so character needs to tell the game mode to eject from the plane?
void AArmaGameModeBase::BeginPlay()
{
Super::BeginPlay();
if (HasAuthority())
{
SpawnAircraft();
}
}
void AArmaGameModeBase::SpawnAircraft()
{
FTimerHandle UnusedLocalHandle;
GetWorld()->GetTimerManager().SetTimer
(
UnusedLocalHandle,
[this]()
{
ensure(BoardingPlaneClass);
FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
if (AArmaBoardingPlane* Plane = GetWorld()->SpawnActor<AArmaBoardingPlane>(BoardingPlaneClass, FVector::ZeroVector, FRotator::ZeroRotator))
{
Plane->SetOwner(this);
}
},
5.0f, false
);
}
this is the whole system i'm testing on
Is there an improved or preferential method for showing a widget on all clients and waiting for the display time before proceeding?
I was wondering how bad the wait node is and possibly just replacing the timer with a wait. This is in the game state. Or am I way off from the start. Currently all users get the widget displayed
What does this widget actually display?
is it a countdown to a start or something?
What is the actual state being represented
@dark edge so it is currently for changes in game phase/state e.g. i have a decision phase where you can make a choice for each server phase. its similar to a tabletop game so charge, combat, movement as well as the decision phase then new turn start. so will display where in the turn it currently is
its all time limited so was hoping to not eat into that with the widgets display time
Well character needs to tell plane to eject.
Usually if you have a system like this you have some form of variable on the character or some component on it that holds the vehicle or plan.
onrep that state
Server RPC in the character to then call eject on the plane/vehicle basically
@dark edge I am rep notifying the E_phase
ok so use that to show the widget
you shouldn't be multicasting anything here, you can do a turn based game 100% with onreps
and should
@dark edge ok.... but currently its only in the decision phase for 20s as an example if im showing the widget for 3-5s i was hoping to have the phase start after maybe im just too tired and missing it
this is the first multicast
no multicasts, just have the onrep of the state do the things that changing into that state should do
yeah i have that currently but im just missing the delay part?
What delay though
I think like a toast
the delay fopr the length of time widget is shown
just slap that in the widget if it's meant to just be a toast
or in whatever is managing showing these things
Isn't that a setting in theory?
Like, is this dynamic and different every time? If not, then the client should already know the delay
You mean like the "Your Turn" thing here right?
https://www.youtube.com/watch?v=RWsLWFqeQDM&t=235s
This is my first time playing Dungeons and Dragonds (DnD) type of game and I have a great experience playing this game. This is one of the combat experiences from Baldur's Gate 3. The combat is very strategic and I find it fun and challenging at the same time. One of the best games that I've played so far!
ABOUT ME:
Iโm Maryo and I upload gam...
so yes theres a setting and it works for widget display time but if i change to the phase and use the phase to show the widget instead of 20s you only have 17s
how long should the phase last and how long should the widget be shown?
Because of the delay caused by the replication?
yeah pretty much i could just not disable anything whilst that widget is active
no delay is a setting time for the length of time it is displayed on screen
is it different from the length of time the phase lasts?
You aren't being very clear at all
No I mean, how do you get to your "it's 17 instead of 20"?
depending on the notification type its currently set to display for 1. 3 or 5s
and i did have input disabled whilst it was showing so it ate into the decision time. I should just not disable the input so it doesnt matter
@tame sapphire like this?
Oh I get it. You want them to choose something in game for 20 seconds but the notification blocks gameplay for 3 seconds.
Yeah I'd just have it not block
yes
yeah that BoardingPlane variable is replicated and i have it, i am exactly calling eject from it which turns in an RPC fail if calls from the client
Yeah no blocking is the answer then
Everyone would hate it blocking if it's meant to just be a toast or popup
You can't call the server rpc on the plane
if all notifications of a type have the same duration then just bake that into the class. If not, make it a parameter on the ShowNotification code along with the notification class and context
so its blocked anyway whilst the server resolves your choices so didnt think it would matter if it was extended for the first and last notification
The server RPC has to be in e.g. the character
I just refactored it and RPC now on the character, and it works fine.. i feel like boarding should be done by the plane and ejecting should be done by the character itself as you said.
but now the plane will check an extra call when auto dropping players Player->IsAttachedTo(this)
since player can't call the server rpc to modify the array of players when it ejects/detached from plane but plane still have it in the players array
if (IsValid(Player) && BoardedPlayers.Contains(Player) && Player->IsAttachedTo(this))
{
UE_LOG(LogTemp, Log, TEXT("Dropping player: %s"), *GetNameSafe(Player));
UE_LOG(LogTemp, Warning, TEXT("Boarding Plane Authority: %s"), *GetNameSafe(GetOwner()));
DropPlayer_Internal(Player);
}
I'm guessing that on player login you'd load a players data that was saved. But does anybody know the best way to reference a player?
Like, let's say you're playing a multiplayer game you've played before... like.. something with an inventory and when you connect it remembers what your inventory was.
What's the best identifier for a system like that? Any ideas
FUniqueNetId
The online subsystem you use should assign one to the player state
thank you.
are webview plugins (plugins that would open a url on client machine) be secure enough to use in a multiplayer scenario? i suppose it would be the same issue as any other client input but im not sure if that's not a good idea
i would use it to launch a url and bascially use it to get back some data from that interaction
Probably better to wrap that into a more natural custom UI and use proper HTTP requests for what you want to send.
Hi everyone, I am creating a fast api server for my unreal app. I want to package and distribute it with the game so that it runs simultaneously when we start the game. It's a local server type setup. Is it possible to do it and how?
It's definitely possible. Remote Control does the web server thing, for instance.
Not sure if it's an external one or not.
yea that would be ideal, im not exactly sure how to do such, but there's also probablya. plugin for that if
I mean you can always use a C++ library that you can tie into UE via a Plugin that loads the library.
And then use that same plugin's module to start/stop your stuff
Fwiw you might even have stuff in the engine for this already. As Daekesh said you might want to check the RemoteControl stuff.
@thin stratus I am integrating SLM and using python to do it. I don't want a user to install python and all its dependencies that's why I am using portable python. I am not able to integrate python script in packaged app that's why using it as a server app to communicate with it using the rest api. So is there a way to run python script in unreal engine?
I mean, UE has python support but I think only for the editor.
Nothing should stop you from writing a plugin that includes the portable python stuff.
Hello, I am trying to setup my builds, I created a module for the client binary and another for the game server, the problem is the game server module keeps trying to compile code from the client, i've tried blacklisting, returning early etc, but its being ignored and code from the client is leaking into the server build with errors
0>StormAccountWidget.gen.cpp(7): Error C1083 : Cannot open include file: 'UObject/GeneratedCppIncludes.h': No such file or directory
am i just trying to swim up stream and should just not bother trying?
Most people only cut out server code from the client, but mostly with #if UE_SERVER. Doubt a lot of people actively use two different modules.
can also make a target with Type = TargetType.Client; and wrap server only stuff with #if WITH_SERVER_CODE
maybe i am over engineering things
Im trying to defer some logic for each client until all necessary actors are replicated from server to each client
Im thinking of making some subsystem on the side to register all replicated actors to keep track of until all actors are replicated and the client is ready
Just wondering if there is any more reasonable approach or built in one?
Could use something like this
https://github.com/TheJamsh/UnrealSnippets/tree/main/Code/Network Event Subsystem
extend as per your needs
link updated
Will take a look, ty
any idea why this only destroys first item in array?
I have 4 objects which needs to be destroyed
and it always just do it for first one
hmm it looks like it destroys pawn before processing them all
I will try send to game state
completed but still two things in array
is it an engine bug?
I'm surprised that doesn't crash?
you're looping through the array of actors from the start
so index 0
can you do a reverse for loop?
yeah
Basically what i want to do is to remove attached actors when player disconnects
my guess is that the array is resizing or something though I have no idea how arrays work in bp
We have floating actors stuck in the scene after logout ๐คฃ
if it's like in most programming languages, it probably resizes immediately after it removes the first actor
so it's at index 0, remove that actor, move all others down by one index, increase index
so now actor 1 is at index 0, actor 2 at index 1, actor 3 at index 2 and our active index variable is at 1
that's why half the actors get left behind
so get -> store as array variable -> process
you can try deleting from the back like plinyvic said
or do a for loop (e.g. x = array.size, after that for i = 0; i < x; i++, idk the correct blueprints) and always delete the first one
just in case here I made an extra variable because I don't know if it's possible for the array.size value to change during the for loop, that's why I save the original one into a temporary x variable because that way it is sure to remain the same, even if the array shrinks
cheers
Would it be super difficult to implement a feature where two players have to carry an object on each end in a multi-player setting?
I haven't seen anything really implement that and I am sure a good part of that is due to limited audience / use-case, but I'm also trying to think about (high-level) how you would go about doing that.
Maybe you would have a replicated flag that, when set, would prevent the player from moving outside of an acceptable radius of the other player, using an AnimBP to make it look like they are both "carrying" the item. I'm not sure I really like that being placed inside of the CMC though. Maybe that would be implemented as a GA / GP-Task?
Well, it would have to be implemented in some way inside of the CMC, to limit the inputs.
do client rpcs not work on actor components?
The owning actor has to be replicated, but I don't see why they wouldn't work
ah ok, wont work on player controller 
Well only the controller owned by the player on the client is replicated, so the same rules should apply for the components attached to it
The other player controllers do not exist on the other clients. The all exist on the server and only each player's own controller exists on their client.
Client RPC will work fine on a player controller
i also thought that but if he was just destroying the actor and not removing it from the array, it probably would just get nulled
but i have no idea if BP arrays automatically resize or some jank if a UObject they point to gets destroyed
regardless its always better to reverse loop through an array if you're deleting things
(or use an iterator)
why does a client get to say when to destroy this thing anyway
Clients locally destroying things after tear off or something isn't that weird if it's mostly for visuals
But not sure about this case
If a client does not send any info to the server and is only receiving information, does that add any major strain to the server?
I'd like to have a feature in my game where players can join as spectators who see the game live and can fly around locally. They aren't able to do anything that the server would care about. But I'm wondering if having a bunch of spectators could cause any overhead on the server that the actual players could experience?
well they'll receive just as much data as anyone else
Its a bit more nuanced than that.
The Server needs to know where the Client is, so that it can apply things like Distanced Based Relevancy for networked Actors.
But the server is sending data to them, I'm more wondering if a lot of receiving only spectators would cause the server to have overhead that could cause lag or issues. More wondering about the server side than the spectators getting data
So the "Spectator" would need to be telling the Server about changes in its position.
I didn't think about that! So it will need location for sure. Good to know
I am obviously doubting my game would get this popular. But just a hypothetical.
If there was like a "pro" match for a tournament and a thousand people joined to spectate, I'm assuming that would cause major overhead for the server then?
Even though it's just location
How many Spectators do you want to support is a question you should ask. If you are planning for a large number, you may want to explore alternative solutions that involve Streaming the state of the Game.
The Server might send out the state of a game to an external service. Which Spectators could use to replicate that state by connecting to the Service instead of directly to the Server.
That makes sense. What type of service would do something like this? I haven't really heard about a process like this before. Any information is a great starting point ๐ I appreciate your input
The act of writing the packages does cost performance btw. But that only matters with 50-100 players.
Well not "only", but that's when you will start noticing it piling up
If spectators only get to spectate players directly (their POV), you could just use the same relevancy as them
Would be a lot cheaper
I doubt there is a service that does this out of the box.
This is a very custom solution type thing.
TLDR: You will likely need to do the entire thing yourself.
Yeah that makes sense haha. I just don't really understand where that begins, would it be like spinning up another set of servers that allow X spectators and have to get the data from the main game server?
Or are you talking about something else entirely
This is a great idea if I can't figure out the other issues!
I think you probably need to just stick to what you can reasonably achieve within the limits of your capabilities in engine.
This solution would involve stuff outside of UE
Which personally, Im not even qualified to comment on how to achieve.
Im just speaking conceptually.
Okay. I'm not focusing on it for now I just thought it would be an interesting idea and assumed it would be complex. Just wanted to hear some thoughts on this!
Thank you for your advice and input I appreciate it
I wonder if a relay server would actually gain performance on the main game server.
How do you mean?
Quantization only happens once for all players, but iirc it still has to serialize the data individually. Now if it would only serialize once and send the data to another server, something non-ue, that then forwards the data to each player, it might improve performance on high player servers. But that's a wild guess and lots of work
It's probably easier at that point to multithread iris
Even then, in his context he is talking more about like a dummy terminal
The Client cant do anything
So its not like they can negotiate back with the main game server
What he is talking about should just be tested in terms of performance first before even thinking about custom solutons
Well thats why I asked how many Spectators
If its like 10 slots or something
Its not worth leaving UE
For that
Yeah
Yeah this would be for a more custom solution to allow many spectators. More just a hypothetical, for now I will have something simple in the same server with a few spectators
I was kinda thinking about a large game like league of legends or csgo or something imagine if people could tune in by joining a spectator mode and watch themselves from whatever perspective they want ๐
If this was a popular thing to do, I would have thought it would be something LoL would support.
Or those other high profile comp titles
Yeah that's what I was imagining lol
But I cant really think of an example of any game that does this
Only thing is less money for them in competitions because people aren't watching the streams as often
Its likely not worth the trouble.
Outside of massive esports titles, would it really be worth the effort to support.
Definitely. I don't really think it's a good idea for most games, it just seems like a cool idea so I wanted to bring up the hypothetical here. Maybe eventually our team will try something out! Thanks again
Your other alternative is Replays.
I do like the idea that Cyn mentioned for a more dumbed down version. If they don't get free-cam but only get direct POV they can use relevancy of whoever they spectate
But Replays are generally post match offline
So like, the Server records the state of play throughout the course of a match
Caches that somewhere
Then you as a player can receive that replay
For that match
And quite literally replay it
Makes sense
PUBG has something like this if I remember rightly
So do some other games like Marvel Rivals and some other competitive games
I remember using it to validate if someone was cheating when I died lol
Its the same principle behind Killcams like you might see in COD
The state of play is recorded as it progresses.
When you die, the game recreates that state behind the scenes for the Killcam
Plays it
Then resumes regular play afterwards.
If that's the case, couldn't the replay system technically be "near" live and just do the full match with a bit of delay as the server records and sends it off to be stored? A user could read the stored data in real time with a bit of a delay
Instead of waiting for the match to fully finish before allowing replays
Probably, but again, you would need to setup some sort of custom streaming service.
Not to mention the custom mechanism for receiving that stream AND replaying it as its streamed.
So not quite the walk in the park it might sound like on paper.
Yeah. This has me brainstorming some things. I think Marvel Rivals does exactly this the more we're discussing it. They are using UE as well
I will try to find some info about it. You can spectate your friends or any of the top 100 players games at any point with only a few seconds delay
Good luck finding reliable sources that arent wildly out dated lol
You can share, but its not for me.
In UE you actually duplicate the world for that. Native demo net driver is only for replaying outside of a connection in theory.
Thats kinda what I meant by "recreates that state behind the scenes".
And that thing cheats a lot. It basically locally calls the SerializeActor code and write it into memory or onto the disk. And then acts later like it received the data from the server when replaying
Ive done a Killcam like it before duplicating the world etc.
I love that one can actually do a seamless! Client Travel with that
It is pretty cool
Just need to stop the net driver from nuking the original world and do it manually once the new one has the connection set up.
Its not surprising how well it works when its kinda what the Editor does with PIE anyway
Yeah
Is there a consistent override for when a playerstate has their unique name +id and has begun play? It seems local players take a distinct flow from clients. Client's beginplay happens before registering with the session and getting a unique ID but locals are the opposite
I suppose I can just handle each separately but... sheesh
I looked into it for hit Validation but it's a bit too pricey for the server for that
Duplicating the world to roll it back?
BeginPlay is pretty much just tied to the GameState
Yeah, duplicate once and use that second world to do the rollback without accidentally touching the main world
But was just an idea. Didn't follow through on it
Yeah fair enough, honestly hadnt considered that as an option
yeah but clients end up having index 0 every time there. the game session gives the unique id
Does seem expensive though
I guess FWIW I could just do my own unique ID
this was done in Spelunky 2
I did also learn that I can throw collision into the chaos scene that doesn't need a representation visually in the game. So I can push the geo of a rolled back actor and trace against it without needing an actual actor or to modify the original one
But that's also expensive 
What isnt expensive these days ๐
well... you could get pretty cute with when you do the check
there's hardly any physics stuff happening for a large part of the frame
it could be tasked out
The pushing and updating transform of physics stuff is shitty expensice
Ehhh transform updates
you just have to access the particle handle and update the broadphase
The bane of everyones existence I think.
Not even actor transform stuff. Just the updating of a body in the physics scene
Multiply that by 100 and you lost 1.2ms
For a simple fucking box
you can do it in a grouped way
I know
It's also what I'm going to do
I will handle the collision of rolled back actors as one "body" so to speak
And push all at once
in 5.6 they even allow for parallel broadphase updates (which is just it checking if it needs to even move buckets)
so it's not totally parallel but it's somewhat nicer
also FWIW chaos threading in the editor uses a different locking primitive
than a built game
How badly will my fast array serialization break if I give my FFastArraySerializer substruct a regular NetSerialize override (non-delta) so that clients can send them to the server as well?
..yes, that makes sense! Thank you ๐
that said I'm not sure why the client is able to change the array locally
I don't think you want to do that
if they must have local only values they should be a distinct container
What do you mean by the substruct? Are you talking about the FFastArraySerializerItem that is contained by the FFastArraySerializer?
It's not to change it locally, it's more like send the server a wish and receive an auth-validated reply
The FFastArraySerializerItem can have its own NetSerialize override
Sorry I wasn't clear, specifically in my case it'd be my struct FLoadoutRequestsItems : public FFastArraySerializer
The fast array is already replicated from the server
I think he wants to send it via an RPC from the Client
Yes, exactly
I'm going to need a specific example of what this actually is supposed to do and not "wish"
so the client has some elements it sends and the reply includes some elements?
I honestly havent had a usecase that ive needed that, so I cant really answer what it will do.
Why not just try it and see what happens
It would probably just use default serialization in that case
But thats just a guess
Basically add a bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess); to FLoadoutRequestsItems (which derives from FFastArraySerializer ) and send a FLoadoutRequestsItems instance to the server from an RPC, as @fossil spoke said
but why would you need to send something to the server it replcated to you already?
I guess if it's a new one just send the array
He isnt
Its probably in a completely separate system
fast arrays don't care about rpcs afaik
To where he is using it as a fast array
From the Server
@unkempt tiger Just try it, see what happens, I would be curious to know. Ive never needed that.
Why do you need to send the fast array type? As Mega pointed out earlier, why cant you just send a regular array of the inner type?
The idea is to indeed have a client go 'hey server, give me this weapon, and this outfit, and 3 mags of this 9mm ammo' and have the server go 'okay buddy but im not giving you this outfit becuase you don't own it' and have it send back the validated list of requested items via fast array serialization
well
if it's an rpc it's not going to delta anything
in order to take advantage of fast array serialization it would need to be a replicated property
Seems like an odd way of doing that, but sure.
I dont think he cares about that part.
I think he just wanted to be efficient in terms of type reuse
At least thats what im assuming
fair enough
Valid point, the only reason to send the fast array type was to avoid naming confusions, and perhaps allow for some future proofing in the case I ever wanted to add functions to the fast array serializer struct
You could honestly use a fast array replicated property to represent the most recent request IMO and just onrep a request ID in the struct to make sure it's the same one
might need to be atomic though
Yeah I actually do feel it's kind of odd, but this is my first time doing something like loadouts, I'm definitely open for more straightforward ideas
Personally I would just send the array of the inner type, and make sure that there was a separate system that manages interpreting that, for which the fast array could also utilize.
Instead of baking it all into the fast array.
a fast array as a separate thing is fine, it's how things tend to end up
Separation of responsibilities
the code for reacting to a new item can be just called by both
The fast array is just responsible for being efficient at data transfer
It shouldnt be THE loadout system as well
I would send an array with just the Id that identifies the item. Maybe a custom struct with Id and count. That would probably largely be different to what I would even have in the FastArray
I usually create items as DataAssets that are identified by Tags. And the FastArrayItem is usually a combination of that and maybe some object that holds runtime state of the item.
So if I would want to request an item I would just send the Tag/PrimaryAssetId
@unkempt tiger idk if that makes sense to you
I think it does
In my case thankfully my items have no state to manage
so it's more like a grocery list of things to get when spawning in
So I think this is why I wanted clients to send a list of wanted items rather than each item individually, but my mental model of my needs is admittedly starting to liquify ๐ซ
Also I read your earlier conversation about the expenses of updating the physics scene, which I found relatable :(
hey
CMC causes corrections when a mesh is rotated along X axis, it works fine with Z axis, the mode used is simple walk mode, ping is 120
first thought it was cause of my custom movement mode but it works perfectly with Z rotation
so I tested it with simply jumping on said mesh and: correction
what can cause it? does the based movement not handle pitch and roll based rotations? as this doesn't happen with yaw
I think I have an idea, perhaps it has to do with how the objects are synchronized between server and client
as you can see Z axis rotation is fine
that cannot be cause it works with Z axis
Oh still a sphere in the z axis case, nvm
I'm using a server authoritive rotation with client getting the replicated movement
yeah, with Z axis even the custom mode can handle pretty extreme environments
issue is when I change the rotation axis it dies even in the engine provided walk mode
I have a component that ticks and checks against certain input actions to get a reaction. I'm testing as a Client now, and the tick is happening but there's no Input Component present. Would the component only be ticking on the server?
Do this
if (GetOwner()->GetLocalRole() == ROLE_AutonomousProxy)
{
GEngine->AddOnScreenDebugMessage(51312, 5.f, FColor::Green, FString::Printf(TEXT("ServerTicks: %s"), bGreenHit ? TEXT("true") : TEXT("false")));
}
else if (GetOwner()->GetLocalRole() == ROLE_Authority)
{
GEngine->AddOnScreenDebugMessage(325, 5.f, FColor::Green, FString::Printf(TEXT("ClientTicks: %s"), bGreenHit ? TEXT("true") : TEXT("false")));
}
there is also a simmulatedproxy if you want third parties' oppinion
add this to the tick function and you will see on screen whats up
Okay.
it says ClientTicks. So it's ticking on client. Why would it not be able to find an input component, then? I am able to walk around via keyboard controls just fine.
Why does a character on client not have an input component?
It does. You are doing something wrong probably.
Oh! The thing Loki gave me is backward. ๐
Yeah was just about to write that.
yeah, had to rewrite the message it sends
didn't pay much attention, sry
although authority and proxy are pretty self explainatory
Yeah still not helpful if it prints the opposite :D
are you replicating the actor that you tick?
Okay, so this component is only ticking on the server. Why would it not be ticking on client?
like is it set replicated?
Does it exist on the Client?
It should. It's the Game Mode's default player character.
Not the CMC.
No I mean the Component.
The player character I'm using has this component in its BP.
The component is the Combo Component.
Hm.
(Custom).
Does BeginPlay call for it on the Client?
Let me check.
What's the fastest way to check a component's owner's Role through visual studio Locals browser?
GetOwner()->GetLocalRole()
Looks like yets, it is called in both client and server.
what calls your tick function?
is it component's tick or something you yourself call?
is there an 'IF' anywhere?
deviance in variables on server and local can cause it
Aaah, found my problem. I was filtering some data setup out of the client because it involved granting GAS abilities, but I still need to set up the links localy. Let me fix it.
Hmm. Crud. I need to be able to get the spec handle after the ability is granted.
Hi. I have encountered an error when starting PIE in client mode.
LogRep: Error: ReceivedBunch: Invalid replicated field 0 in InventoryComponent
/Game/ProtocolTerminate/Maps/DevOnly/UEDPIE_1_MechanicsMap.MechanicsMap:PersistentLevel.BP_Human_C_0.Inventory
LogNet: Error: UActorChannel::ProcessBunch: Replicator.ReceivedBunch failed. Closing connection. RepObj: InventoryComponent /Game/ProtocolTerminate/Maps/DevOnly/UEDPIE_1_MechanicsMap.MechanicsMap:PersistentLevel.BP_Human_C_0.Inventory, Channel: 98
LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 127.0.0.1:17777, Name: IpConnection_10, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_17, IsServer: NO, PC: Plc_new_C_0, Owner: Plc_new_C_0, UniqueId: NULL:DESKTOP-GS7TPRB-CCF24D2F4DF265A5457B18B7251F9311, Channels: 102, Time: 2025.07.11-06.57.15
LogNet: UNetConnection::SendCloseReason:
LogNet: - Result=ObjectReplicatorReceivedBunchFail, ErrorContext="ObjectReplicatorReceivedBunchFail"
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 127.0.0.1:17777, Name: IpConnection_10, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_17, IsServer: NO, PC: Plc_new_C_0, Owner: Plc_new_C_0, UniqueId: NULL:DESKTOP-GS7TPRB-CCF24D2F4DF265A5457B18B7251F9311
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_17
LogNet: Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet: NetworkFailure: ConnectionLost, Error: 'Your connection to the host has been lost.'
LogBlueprintUserMessages: [ProtocolTerminateGameInstance_C_12] Client 1: Network error: Connection Lost
LogOnlineSession: Warning: OSS: Can't destroy a null online session (GameSession)
This is caused by inventory component.
UInventoryComponent::UInventoryComponent()
{
PrimaryComponentTick.bCanEverTick = false;
SetIsReplicatedByDefault(true);
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1
bReplicateUsingRegisteredSubObjectList = true;
#endif
}
void UInventoryComponent::BeginPlay()
{
Super::BeginPlay();
InitializeInventorySlots();
}
void UInventoryComponent::InitializeInventorySlots()
{
if (InventorySlots.Num() == 0)
{
InventorySlots.SetNum(MaxSlots);
}
}
struct:
USTRUCT(BlueprintType)
struct INVENTORYSYSTEMRUNTIME_API FInventorySlot
{
GENERATED_BODY()
UPROPERTY(BlueprintReadOnly)
FGameplayTag ItemKey;
UPROPERTY(BlueprintReadOnly)
TArray<FInstancedStruct> Properties;
UPROPERTY(BlueprintReadOnly)
int32 Quantity;
UPROPERTY(BlueprintReadOnly)
FInstancedStruct SlotMetadata;
FInventorySlot()
: ItemKey(FGameplayTag::EmptyTag)
, Quantity(0)
{
}
explicit FInventorySlot(FGameplayTag InItemKey, int32 InQuantity = 1)
: ItemKey(InItemKey)
, Quantity(InQuantity)
{
}
bool operator==(const FInventorySlot& Other) const
{
return ItemKey == Other.ItemKey &&
Properties == Other.Properties &&
Quantity == Other.Quantity &&
SlotMetadata == Other.SlotMetadata;
}
FORCEINLINE bool IsEmpty() const
{
return Quantity <= 0 || !ItemKey.IsValid();
}
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar << ItemKey;
int32 PropertiesNum = Properties.Num();
Ar << PropertiesNum;
if (Ar.IsLoading())
{
Properties.SetNum(PropertiesNum);
}
for (int32 i = 0; i < PropertiesNum; ++i)
{
Properties[i].Serialize(Ar);
}
Ar << Quantity;
SlotMetadata.Serialize(Ar);
bOutSuccess = true;
return true;
}
};
template<>
struct TStructOpsTypeTraits<FInventorySlot> : public TStructOpsTypeTraitsBase2<FInventorySlot>
{
enum
{
WithNetSerializer = true,
};
};
It is important to note that after such an error, the client gets kicked to the main menu, but you can create and join a session. And everything works without errors after that.
Maybe I've missed something in struct serialization?
Okay, for the multiplayer team: I have a component on client and I need to get some particular information from the server. This info is set up on beginplay and then edited infrequently. Should I replicate it? Or is there a more one-off way to set the data?
What data? If just variable cant you use RepCondition to initial only or something like that.
edited infrequently
If it's modified by server, you need to replicate it.
but it also depends on what kind of data it is.
Maybe you can just perform the same manipulations on the server and the client at the same time, in which case replication is not needed.
Change of plan: I actually can get the data directly from the AbilitySystemComponent, which is already replicated. However, I need to be notified when the data is available to the client so my component can access it.
The data is a list of FAbilitySpecHandle structs.
Can you elaborate?
Looks like you should be using Reserve instead of SetNum
I don't exactly get what you're trying to do here though
I was thinking of setting the size of the array in advance so that there would be information in advance about which slots could store what.
The number and types of slots are limited.
for example, slots 0-3 for weapons, slots 4-5 for consumables, etc.
It is managed using the FInstancedStruct SlotMetadata
I'll elaborate my problem.
I have a component called Combo Component. Combo Component has some pre-done configuration about what abilities should be activated by the player's ASC and in what condition. Previously I was working in standalone, granting the ability from the Combo Component and storing the FAbilitySpecHandles. Now that I'm in multiplayer, I can't grant the abilities from the client, so the client cannot get the FAbilitySpecHandles. However, those handles are stored in the Ability System Component, which is replicated. How can my client component notice when the handles are replicated and access them?
Replicating handle?
Maybe you mean replicate the abilities?
I guess the simplest thing would just be to replicate the combo component, so the derived data is identical on client and server.
Imo only server shluld grand abilities
Yes, only the serer is granting abilities. But I need the Spec Handles for those granted abilities so the client component can request one be activated (client reads input data and decides which spec handle to activate).
/** Will be called from GiveAbility or from OnRep. Initializes events (triggers and inputs) with the given ability */
virtual void OnGiveAbility(FGameplayAbilitySpec& AbilitySpec);
Isnt the spec handle created from the abilities?
You dont replicate the handle, you grant the ability which has the spec handle?
Been forever since I touch Gas. Gonna keep quiet now instead giving wrong info.
Yes. The component runs on both client and server. On the server it grants the abilities and stores the handles. I need to get those handles to the client component.
I can either replicate them on my combo component itself, or access them from the Ability System Component.
Check the virtial void I've provided above.
You can override it and just call a delegate, which will be triggered on client too.
When an ability is granted in GAS, you get back a spec handle: an ID that identifies which ability instance you want to use. This is how abilities are activated and passed around through networking.
Reading above if its true OnGiveAbility called on OnRep then that's the client on the receiving end. Since OnRep gets called on client.
wow, that helped. Thank you very much.
if its true OnGiveAbility called on OnRep
I've just copy - pasted from AbilitySystemComponent.h
Have you checked the virtual function dogo provided?
Can pass the handle to your combo component from there if that's the aim.
I see it now. I want to avoid tightly coupling the ASC and my combo system, but I'll consider it.
You can not couple it.
Just create a child class of ASC, and get your combo system there.
So your child ASC knows about Combo component, but combo component does not know about ASC
Aha! Better idea. MarkAbilitySpecDirty!
I can bind to ASC->AbilitySpecDirtiedCallbacks
It specifically gets fired whenever an ability is added or removed.
because it's also gets triggered OnRep
yep, I've checked
Well, I was too hasty.
The [issue ](#multiplayer message) still persists, only server works, but client gets kicked immediately on any Inventory slots array manipulation, and this is definitely incorrect struct serialization.
How to serialize InstancedStructs properly?
Ah, you should use NetSerialize
Not Serialize
For all of those
Should fix it
Ah, you're right....
Apparently, that's how 12-hour code sessions affect me
Happens
Hi, I'm trying to move my interaction functionality out into an actor component, I'm using virtually the same functionality as I was before however it wont work properly for the client anymore when using the actor component for interaction.. so on the event tick ive disconnected everything after the 'Choose Interactable Actor' function is called but that's essentially how I was doing it when the functionality was on the pawn class directly which worked.. now however, for the client the IsLocallyControlled check goes false so it wont display any widgets, i then tried putting the widget functionality into an OnRep instead but same thing happens the IsLocallyControlled check goes false for the client
Any ideas how i can get this working properly? Is there any reason that the functionality worked fine when directly on the pawn but doesn't when inside an actor component?
I'm working on the https://www.fab.com/listings/6a167276-1a5c-43fe-9be7-02fe900eb371
It works fine IF the mesh is a UE4 skeleton mesh, BUT if I use a UE5 or Metahuman Mesh the GetActorLocation on clients stop returning the current location, it keeps stuck on the last location before ragdolling.
GOD HAVE MERCY
Quick:Demonstration video and tutorial playlist: Youtube Link!Dedicated server demonstration: Youtube Link!Custom project issue fix: Youtube Link!Playable Demo with host widget: Download Link! (use [1] key to hide-unhide host/mp widget)(UPD - 2022)I am happy to announce all my Unreal Engine content is free now!I hope to support more content crea...
How does the GetActorLocation() always works with one skeleton but not in others?
Hello, why am I getting this error? Function 'OnRep_CurrentInteractable' called from On Rep Current Interactable should not be called from a Blueprint
can it not be set by other actors?
oh, it just fixed itself
Can TMaps be replicated? What about regular Arrays of Uobjects?
- No.
- Should be able to.
Thanks. I will have to send my data as a array and and convert it to a tmap on client.
As long as the uobjects are themselves replicated.
^ they will have to be a subobject most likely
Anyone got any ideas? What am i doing wrong? #multiplayer message
maps not, but you can have array of structs
What about UObjects, specifically?
should be able, it replicates array, it doesnt care about whats inside
these are just values
component replicates?
I have interaction component and it worked just fine so its either component not replicating or sth else
also does server set variables? it doesn't have any switch auth node
Is there a way to curve a projectile, side to side?
they need to be a replicated subobject of some actor or component
My current setup is:
1: I spawn a player character on both server and client.
2: Player character has a Combo Component on it with pre-configured data.
3: Both Client and Server components run a Setup step, building a combo web that connects the pre-configured data and stores it as UObjects locally.
4: However, only the server can grant Abilities to the character, which returns a number of AbilitySpecHandle structs that the component needs.
5: I need to get those structs to the client, preferably with the context of the combo web.
why do you need the spec handle on the client? if you want to activate these abilities you can do so by using id tags
if you really need the handle you can listen for the ASC callbacks
ID Tags? What do you mean?
Yeah, I'm considering using the AbilitySpecDirty tag to get them and I'll have to figure out which part of the combo web created that spec.
a gameplay tag that you can assign to the ability
you can activate the ability by using it instead of having a reference to the ability or the ability spec
It's the error I get if I have interdependent bps and I try and compile one while the other is not compiled or has errors
oh ok, good to know. thanks
if i have a component im creating dynamically on an actor and i only create it on the server and set it to replicate, is the pointer i store it in on the client side ever going to get the version i created on the server or do i need to set the pointer to replicate so that it actually gets the component?
it seems like the component never reaches my client currently and i seem to have it setup to replicate properly, so im assuming its just that the pointer never actually recieves a reference unless i predict the creation of the component
alright i was able to use GetComponentByClass on the client and find it so i just need to think about how to predictively create it on the client properly instead of trying to replicate the pointer cause that seems illadvised
is there specific reason they have to be UObject?
My combo component is just an actor component which is replicated.
Server sets combo data in the AC then replicate the combo data to the client.
That's pretty much it for me.
Client is the only thing that can read inputs. I want combo component to check inputs and pick an appropriate ability then request that from server
Yeah my AC reacts to player input, it's all handled locally on each player.
But wdym by checking inputs then requesting it from server?
My approach is to just dump a combo data for the player and let them deal with it locally.
E.g for a sword man, they get this combo, for another job they get another combo.
I think if I have to wait for the server when I press input then you will introduce input delay, no way around it.
and I think attack should be predicted at least outside 1v1 games like Tekken.
You shouldn't need to use GetComponentByClass to find it
like it should exist, regardless on how you get the component.
Can you show your setup?
Make sure the component is set to bComponentReplicate and the pointer to the component should also set to replicate.
no issue on my end.
@karmic bramble Oh yeah, you need to set the ptr to replicate, otherwise server will never send the info.
Why do you need to predict it if I may ask?
you should only predict things you can get away with.
if this is for important gameplay and not visual, consider your option imo.
Rpc is only for a one time event, if what you are doing is a stateful behavior (every machine should be in sync), then RPC is not the answer.
your ptr will only be valid for the player that gets the rpc, the late joiners or some unfortunate soul that doesn't execute the RPC may / will have different value.
was out walking dog, yeah i realized that. Im trying to think if theres a better way to rethink my component generally.
it basically is a component that holds instanced pawn data, Not unlike pawndata in lyra but take the pawn data there, and then instance it based on various random rolls and other per instance things
its dynamically created because theres a player and ai version of it. (it cant be attached to the controllers because you can have multiple of these character and swap between them)
i can probably figure out a way to sanely unify them and stop worrying about needing to replicate their creation so that the constructor handles that for me by making them default sub objects instead.
mainly trying to avoid needing a player version of the pawn and enemy version of the pawn so that the definition can be universal
worst case i replicate the ptr
May want to consider attaching to PlayerState. That's where a lot of folks dump their AbilitySystemComponent when we don't want to tie it to one specific character.
each one needs its own asc unfortunately though
I mean i guess i could like save out the stats everyime you swap characters mid combat
but it seems more logical that they each own all their own information
Can't give much opinion but if I prefer to have the data lies somewhere persistent and read from it so I don't need the hassle of saving the data.
As for PlayerState, there is one for A.I too but I never touched it. So I guess this way you can create one per A.I and player character?
Can't elaborate though, hopefully the smart people wake up later.
this largely answered alot of my questions https://dev.epicgames.com/documentation/en-us/unreal-engine/replicating-uobjects-in-unreal-engine
ActorComponent already replicate out of the box.
but when it comes to UObject, yeah there is extra steps need to be done.
Defaulted ones will, Dynamically created ones seem to not
It does and I checked on my end.
oh wait, I tried recreating it and getting null.
trying again.
yeah it seems to come across eventually
//.h
UPROPERTY(VisibleInstanceOnly, Replicated, Category = "Monster")
TObjectPtr<UMGMonsterComponent> MonsterComponent;
//.cpp
void AMGMonsterCharacter::GetLifetimeReplicatedProps(TArray<class FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ThisClass, MonsterComponent)
}
void AMGMonsterCharacter::SetMonsterInstance(UMGMonsterInstanceData* MonsterInstance)
{
if (MonsterComponent)
{
//RemoveReplicatedSubObject(MonsterComponent);
MonsterComponent = nullptr;
}
if (UMGPlayerMonsterInstanceData* PlayerMonsterInstance = Cast<UMGPlayerMonsterInstanceData>(MonsterInstance))
{
MonsterComponent = NewObject<UMGPlayerMonsterComponent>(this, TEXT("Monster Component"));
GetMGAbilitySystemComponent()->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
}
if (UMGAIMonsterInstanceData* EnemyMonsterInstance = Cast<UMGAIMonsterInstanceData>(MonsterInstance))
{
MonsterComponent = NewObject<UMGAIMonsterComponent>(this, TEXT("Monster Component"));
GetCharacterMovement()->bOrientRotationToMovement = true;
}
ensureAlways(MonsterComponent);
MonsterComponent->SetIsReplicated(true);
MonsterComponent->RegisterComponent();
MonsterComponent->Initialize(MonsterInstance);
//AddReplicatedSubObject(MonsterComponent);
}
feels weird to have to replicate the object ptr but works otherwise
property has to be marked as replicated if you want it to replicate (server -> client)
Hmm I can't seems to replicate dynamic ac anymore, I thought I did earlier.
im aware, its just that something magically happens for defaulted subobjects. Im assuming its because the client has no idea what the object to replicate the info is without replicating the ptr, which tells it to at least create it.
where as for defaulted it knows it has the object so the ptr cache can route it properly, the component is getting replicated out regardless though its just the ptr that doesnt ever get a reference for free
ty for all the help though i do apreciate it
How can I set a member variable of a replicated actor and ensure that the client spawn the actor with the replicated variable?
For context, I am trying to use ProjectileMovementComponent on a replicated actor. The server spawn using defered spawn sets the velocity then FinishSpawning.
However the client velocity remain 0. I am aware it's not a replicated variable, so what are my option here?
_fragment->ProjectileMovementComponent->bShouldBounce = true;
_fragment->ProjectileMovementComponent->Bounciness = 0.2f;
_fragment->ProjectileMovementComponent->Velocity = _randVelocity;
FTransform transform;
transform.SetLocation(GetActorLocation());
transform.SetScale3D(FVector(1.f,1.f,1.f));
_fragment->FinishSpawning(transform);
Velocity is 0 on client =(.
hmm maybe I just need replicated variable and propagate it to the PMC
^ does the trick.
Does epic online serves for ue5 have cross play between Xbox and pc?
im currently working on this multiplayer prop hunt game and im somewhat new to how multiplayer works. my game works fine without any errors but the issue that im facing is that the score system is messed up. the hunter who kills the prop within the timer gets +100 score and if the prop survives during the whole timer then the prop gets +100 score and i have used a game instance to save the score at the end of each round before doing server travel (which resets the level to start the next round- and yes i need to work on a round system after this). can someone help me please?
@cosmic trench keeping a tab of a variable is the most basic form of multiplayer. Have you read through pinned material in this channel? If not then you should.
As for your score, server can hold the data and replicate to client
You can do this with combination of game instance and GameState
Game state keep the score variable, make sure its set to replicate.
Server set the score and replicate it to client.
Before you commit to server travel, as a server you can store the score in the G.I.
Then on the next map, again as the server you can set the game state score from the GI and that's it.
I've been setting up the score inside player state all this time because it's what ChatGPT told me to do and there weren't much material on youtube that answers my exact question
Youtube can be bad enough to learn multiplayer. Majority of them infact teaches the wrong framework. Chat gpt would be even worse alternative.
The pinned material is your bible.
Player state is fine if the score is tied to a specific player.
You can do what said above but use the player state instead of game state. Both of them r replicated anyway.
Player score = player state
Team A score = game state
you cna use player state copy proprties to transfer variables between levels
The scores are tied to each individual player so i'm already using player state for it
I have just one level and the players keep spawning in the same map after each round, i dont have multiple levels
but you server travel and open new map (restart it)
yeah it does restart it
you can simply use restart game node in game mode
which is why i have a game instance to store the scores at the end of every round
but you can use copy properties function inside Player state to transfer score
i have already come a long way into this logic but it has proven to be an absolute mess to deal with, i have been working on this for a week now and i can't seem to be able to wrap my head around it. how would you guys recommend me to implement this system if i am to start from scratch?
INSIDE GAME MODE
sorry, capslock
to restart map
if its always the same map
in your case set score value
inside player state
should do the job
it will transfer player score to new round
let me try
well it does work and the level gets restarted but maybe because of my previous logic the score doesnt go to the expected player. the hunter who killed the prop is the only one who should get the score but all hunters are getting it
my game is set in such a way that a random player is selected as the prop and the hunters have to find and hunt the prop within the timer
im still not sure if its the copy properties function doing its job or my previous logic is affecting how the saving works
copy do the job, you need to probably fix/adjust your score setup logic to work properly
i should probably start the score logic from scratch
chatgpt and youtube didnt really help me set up a proper logic for this
it shouldn't be more complex then game state setting propert score inside target player state
i was sure it shouldn't really be that complex but i tried a lot of things and it just complicated my entire setup
Hey guys, quick question, the documentation for structs say: ```
UStructs ARE NOT considered for replication. However, UProperty variables ARE considered for replication.
I was just wondering what that actually means? If I have some FExampleStruct and do, say: ```cpp
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated)
FExampleStruct Example;
Or does it just mean that adding Replicated to properties inside of the struct itself won't work?
i'll work on my issues tomorrow, i feel like i've tried everything today and feeling burnt out
frustrated that i still haven't found the solution yet
If the UE docs really do phrase it that way then it does sound poorly phrased
If that variable exists on a replicated object then yes it will be considered for replication (if you also add it as a DOREPLIFETIME), if you have members of the struct you do NOT want replicated you would mark them explicitly UPROPERTY(NotReplicated)
Yeah haha I figured it was some poor phrasing
It's from the official documentation: https://dev.epicgames.com/documentation/en-us/unreal-engine/structs-in-unreal-engine
what do you guys think about "cheats" in UE multiplayer games?
i had some experience in doing those and i could say that once you make it once for one game the rest of games are preety much copy paste everything and change basic offsets and you are good to go
so here is my idea
what if:
- main offsets change each update of the game (and updates occur each week automatically - aka game is being compiled with engine once a week on the server and files are being served automatically to the game servers and clients updater)
- structures such as UObject AActor Field Struct etc whetever is the basic classes of unreal and also some of user defined classes that require to be "mangled" - Will be fully randomized added bunch of random garbage in between variables so when you try to check it in memory reading softwares you can just see random garbage and you will not know which is where
- just doing that will make most if not all cheat makers/developers give up after few weeks
additionally you can add a detections for macros/mouse virtualized movement etc. but thats just additional...
This will absolutely not be enough to fight against cheat developers, you're better off just using an actual anti-cheat like EAC
Tricks like these are usually pretty easy to negate or automate against
As a developer EAC is okay, but as a player or user it's awful. Its kernal level access is deeply concerning.
I wish there was more options for devs to use for Anti-cheat measures but that weren't kernal level.
compile time randomized amount of vvariables with random values on each instance creation? i doubt...
eac doesnt work most of the time
the only games eac works is fortnite and pubg as pubg has 3 more anticheats ontop of it...
and not sure what rust has but its AC implementation is also good
Yes, it doesn't matter at all
Rust uses EAC
do you know how cheats are made?
external or internal
The problem is that the moment you give up kernel access it's no longer possible to protect against memory read/writes
Yes, I'm familiar with how cheats are made
And with how anti-cheats are made
So I can tell you with high confidence your approach won't work
At least not long-term
WRONG
i dont mean how they read memory etc.
noone cares about that
what my method does its making all cehat devs fully reverse the game engine to make sdk
so then they can make cheat
There's a million ways to write cheats other than auto-generated SDKs, it just happens to be the easiest way with Unreal Engine because of the reflection system
imagine that each update even smallest one you need to reverse game engine again and again
Finding the structure of the basic UE5 classes to fix up some SDK generator is a ten minute process at most for starters
Second of all, even if you do that, they can still do their things /without/ auto generated SDKs
Offsets of things you don't change, pattern matching, etc
I know WarThunder uses or did use EAC
making all ingame offsets (as you change core class field structure) will make it so everything will shift in different places its preety much too tidious to make cheat for that