#multiplayer
1 messages · Page 162 of 1
okay mb i already fixed that
Hold on...
hah.
It's a "bug" if you'd like
it doesnt happen when you increment 🙂
by doing repnotify on the time worked
but if you set w/notify, it triggers locally
Yea the increment thing doesn't trigger the OnRep, it needs to be done through Set in blueprints. In C++ land a ++ could still trigger it.
yey consistency 😄
already bugs me how OnRep needs to be called explicitly for server in c++ and not in bp
Why? Its extremely useful is certain usecases that you wont want to call the OnRep. Its actually more of a pain that BP does call it automatically…
The inconsistency is the annoying part, but I also prefer being explicit about it, yes
So the c++ version is superior 😛
We never call OnRep server, makes your debugging life easier.
Calls from OnRep = client side
Have a function inside OnRep that calls what you need.
so on listen server you call that instead of onrep
so when you see onrep, you know its getting called from client
maybe there is a marketplace plugin that allows BP to do multiplayer c++ stuff ?
like what?
i dont know all the stuff than cpp can and BP doesnt in multiplayer
but for example the onrepnotify
BP has rep notifies
i was talking about this functionality of the repnotify
also, i got another question:
why does the clients know about other player states ?
I think all player states are replicated to all clients also?
afaik every clients have a copy of game state and player states
yeah
because that's what player state is for.
Clients may want to know the attributes of other player. Take Hit point for example,
If you are playing a co-op shooter/rpg game, wouldnt u need to know other player's hp?
you got a point
I'd place HP on the player's pawn, but yeah GameState/PlayerState are available to everyone
Useful for stuff like the game's current state (round number, time left, stuff like that) or a player's global state (score, kills, deaths, etc)
Some extra indirection if hp were to livenin playerstate
with GAS all attributes anyways lives in player state, as the ASC is on the player state and the pawn just holds a pointer to that.
@dark parcel that was what i did
Is there a way to have a delegate for when a character has set it's player state on server?
Oh okay there is APawn::OnPlayerStateChanged() for this
Hey,
in my Player Blueprint I toggle Aim Down Sight. As this also has impact on the weapon calculation this needs to replicate. However if I play on P2P Sessions and the Client is toggeling ADS, it's also happening on the Servers Player Blueprint.
why?
Hello,
We're trying to replicate the scaling of an Actor. If I scale it to 10, all the attached children remains its scale on the server. But when the transform is replicated, client side the root is scaled to 10, and the attached children are now set to 0.1.
How do we make the attached children keep its relative scale when their parent is transform is updated by replication?
Is Replicate or Send RPC using UObject is stupid idea?
Replicated subobjects are pretty common so I wouldn't say it's stupid by any means, but actor components do provide most of the setup you need
I'm making UInventory : public UObject for holding UGameItems : UObject (TArray<UGameItem>)
And UInventoryComponent is have Inventory.
In this circumstance, replicate Inventory and GameItem is possible?
(I'm trying to achieve this system but It's not really going well...)
yes, this is what I was referring to as replicated subobjects
and for that some setup is required
Okay I will test it
I was thought I'm doing stupid things because it's not really going well...
Hi all. I'm running into some trouble with persisting information about players between level loads in the Lyra project (using it to test a plugin I'm developing). Once a player logs in to the game server, I run a function to verify the player, and if they are verified they get a session ID. I need to store this session ID somewhere that enables me to know that a player has already been verified when transitioning between levels. I've tried storing this on player state, but as far as I can tell, at least in Lyra, player state is destroyed between level loads. What should I do? I can't re-verify the player when they reconnect because the token used to verify them will have expired.
@umbral grove Try using the Game Instance? It persists between levels.
What about PlayerControllers? (when using ServerTravel on the Server)
They're also destroyed I believe.
Player controller is the proper place to store session ID and similar data iirc. When using seamless travel the player controllers will remain instanced. Not sure about the specifics of how lyra handles this though.
I can't make any assumptions about whether seamless travel is being used or not unfortunately
Ah, using an options string might work to pass the session IDs mapped to a client ID of some sort and reassociate them with the players controllers.
Hey guys.
Has anyone used Nakama with Unreal Engine ?
Yes, that's something I considered and I think it's a sound idea, but I'm not sure how I can adjust the player's connection string once they've been verified after joining the server so that when they reconnect they have those additional options. Any thoughts on that by chance?
i've been able to replicate uobjects from client to server but i'm now stuck on what I have to do to get the clients to see what the server sees for uobjects
Pretty naive question - is it more stressful to send 3 floats in an RPC or 1 FVector3D? Is there any difference?
Other than the fact FVector3d is 3 doubles, no real change
It's micro-optimization, if even
Gotta save those bytes where we can !
won't be a difference between 3 floats and FVector3f
I'm not sure about UObjects, but you may be able to just mark a uproperty as replicated, but I don't think UObjects are replicated generally; I'm not sure if just marking them as having a replicated property would make them be replicated. You may want to check out https://www.youtube.com/watch?v=JOJP0CvpB8w
In the client, OnRep_AccessoryItem is triggered, and a single element of AccessoryItem is replicated from the server. But right after one tick, the data disappears. Does anyone know why this is happening?
Garbage collection?
I don't really know why garbage collection is triggered
If you have any UObjects that are not marked as a UPROPERTY, that is one way they will be garbage collected (at some point)
If it's replicated, it's UPROPERTY
show code
I want to upload screenshot here but I can't upload image right now i think discord bug?
I still have this issue. Event when I call the event addInventar directly from the character and pass the ref, its still not working
The server cant destroy the actor and the client cant send the code to the server with Run On Server RPC
With Discord not shwoing images properly atm, it's hard to help
You cant see the images`?
This is my situation video
The video uses a codec I don't have. Can't seem to play that
sorry let me change the codec
No, Discord is broken
maybe i can send the unreal forum link where I describe the issue
Well, Changed codec doesn't allow to upload here.. I think it's bug too
Hi all, I have a replication issue and I don’t know what is wrong. I call an interface event in my replicated CharacterBP in an non replicated event: It get executed on my pickup Item: It prints “server” on the server and “client” on the client which is fine: This event is Run on Server but only the listener server prints “2” and ...
https://youtu.be/no7nJ1Lmuvk
This link video is Showing my bug. please someone help me
Oh, I think my voice doesn't record here
What I'm trying to show is AccessoryItems is replicated when pickup the item and right after one tick (CheckAccessoryTempFunction is triggering every 0.01f second) AccessoryItems TArray is Empty.
You can't run RPCs on Actors that the Client doesn't own
Your FirearmsPickup is probably not owned by the Client
The RPC has to happen earlier, in the Character for example
@hazy scroll
So I cant use interface logic and make the events in the pickup item?
You can, but you have to RPC first
Interact-InputKey -> ServerRPC -> Somehow Get Actor Reference -> Interface Interact function
I would also suggest not mixing your language so much while coding
Is there any way to debugging where that data is Garbage collected??
So i created a Server RPC on characterBP and it calls Interaction Interface with the hit actor passed
but still the issue
yeah thats a thing I cant decide between english and my languagexD
I'm not convinced your issue has to do with replication, at least not in the way you think it does. If you look at the actual UInventory object while debugging you'll notice that they are actually two differnt objects with different names at different memory addresses
Inventory_0 may very well still exist in memory. You might be able to verify this by dumping the memory at its memory address then seeing what's at that same memory address some ticks later.
Oh, wow I didn't notice that. Thank you
And I didn't know about dumping memory. Is that possible in Rider Debugger?
I don't know if there's an automated way. When I've done it in the past I've just gone into the memory viewer and copied a block of memory by hand
Oh, wow your genius Thank you
Happy to help 🙂
In InventoryComponent BeginPlay, I created inventoryObject client and server both side. So that issue is happened.
The problem is solved after change like that
You are genius Thank you!!
That's great 🙂 Glad you figured it out
It seems that both exceute it now, but the weapons doesnt get destroyed
👍 I learned a lot thanks
Not sure if this is what you're after, but why not just create a Map that associates the verification ID/token with the client ID? In that case you could store it on the server game instance, and you'd be able to retrieve the player's state, controller, etc. from their net ID, without losing the token when changing levels.
That's more or less what I'm trying now; Not storing it on game instance but in an engine subsystem. There are still some problems to figure out in terms of when that map should be filled and when it should be emptied, but I think it's the right direction
Is there a good plugin or something for multiplayer voice chat I can look into?
whats the difference between
is local controller
and
is locally controlled
One checks if the controller is local, the other is checking whether a pawn is locally controlled.
okay ty
Question: If you were to set up a character customization system (swap skel meshes) and need other players to see your changes, how would you do it?
I have mixed results, I can't seem to save or load the proper items
As in, what's the call stack for this type of thing?
You use replicated variables that use OnReps. When you change the variable, the OnRep will fire on other clients, you use the OnRep to then drive the changes.
@sinful tree Thank you so much for answering. I'll give that a shot
Example like this?
Yep.
No
Awesome. So the rep notify, what exactly do I hook up there to change parts?
My current setup, that sucks haha
That's basically it.
You're replicating a structure that contains those integer values. The integers are then used to read the value of the appropriate mesh from your array and setting the mesh to the associated component.
Like this? Per body part mind you
Why would you replicate an array of meshes though?
Lol you said replicate it haha
No I didn't.
I reviewed. Perhaps I'm just confused
This bit here is the "value"
Gotcha
that value can drive changes locally without requiring additional stuff to be replicated.
So if you have an array that already contains all your meshes, you just need to know which mesh in the array to use
Which is what the value from your structure can do.
My oringinal system was working off that one CharCustomization struct though
Yep, and that is one way of doing it. If you don't want it contained in a structure, then you can use separate replicated integers for each part and stop using your structure.
Third person character, how that gets called
Okay so take off the rep notifies on the skel meshes, but keep it on the struct, got it
I think more so the problem I'm having is that when I load my character, it's not properly loading up the struct
When I go from my menu to my game, the parts don't transition in as well, even when called to do so
What ends up calling your LoadCustChar_CL event? If it's too soon after spawning the character (like on begin play) then it may not be getting received by the client.
does anyone have any idea? issue only occurs after enabling steam sockets
config is done and im trying to achieve a p2p multiplayer system
Yep too soon. It likely won't exist on the client by the time you're calling it so the client never receives that RPC.
Instead, use the Begin Play of the character, check if it is locally controlled, and if so, load the character customization and send it to the server.
will do, stand by
It worked! Just in reverse haha
I'm sooo clooose
@sinful tree Thanks for the help man, we're almost there! Something about the order is off
So I need to figure out why it's reversed now and try to make sure both the menu loads in the right clothes on character spawn and then we level transitioning, to show the right parts on the right characters
I'm like soooo close
lol
does this mean that this BP is own by server and client ?
The actor exists on both the server and client.
okay
the thing is, from a input (so client) i want to change variable values on server
Input > Run On Server > Set Values on Server
but rn it wont fire on server because the client isnt "owning"
not firing
after the call its not fired
its on client (as expected)
PS_Core is a playerstate?
yes
Check your message log.
That should be working ok unless there's some other problem.
Only thing I can think of off the top of my head is that the data in the structure may be too large?
Can test that too by just trying a run on server event with no inputs and having it print a string.
well nevermind
when going to next frame it doesnt switch bp instances
it IS called on server
sorry
I have a strange issue with Multicast and I hope someone can help. So, I call a multicast function from server (when I press J, it'll call the server function) to create an actor for all clients. If I call this function from a client, then it'll spawn the actor for everyone but with a twist... The net owner has 1, but all clients have duplicate, like it spawns twice for clients. What am I doing wrong on this one? It seems that the first actor spawn happens twice on clients, and the for loop happens twice as well (the for loop spawns the apples).
@sinful tree Just wanted to say thank you for answering my questions earlier btw!
Are these by chance replicated actors you're spawning?
Yes, both
Don't multicast the spawn. It's unnecessary.
Multicasts execute on both the server and client.
So then, you're having the server spawn a replicated actor, which then causes the actor to appear on clients, and then you're having the clients also spawn their own copies on their own instances.
I'll check it, thank you! 🙂
Alright, it works now. Although, if I turn off Replicates, I won't be able to Replicate Movement and causes physics desync.
Are you still doing multicast?
If u do, read what datura says again
I get it now, thanks 🙂
So quick question
Do any of ya know why I may be having some issues on my game when it comes to sessions
I've done the code completely normally
(I'm using advanced sessions though FYI)
and for some odd reason
the sessions only work like 3% of the time
you'll join a session and it'll either just work, or what happens like 97% of the time is it'll connect to the session, however no player controller is created, and the level is not loaded on the client
and there's no actual changes
Are the symphoms that you have just static camera that you can't move in the middle of the map?
Or what do you mean by "level is not loaded"? Black screen?
It stays on the main menu
However you see the slight hitch from it connecting to the server on both the client and server
And I know it IS actively connected since upon the server shutting down the client times out and goes back to the default level
So it is connecting, and immedietaly disconnecting?
no like
it is IN the server
without being in the server
its so weird
I'll send a video
Send logs too
please ignore the server name, I have no clue whats up with the names of servers on my game (its not mine its some random other person hosting)
despite it looking like nothing has happened
I'm actually IN the session
meaning if the host left
I'd be booted back to the default level
even though I'm on them enu
*the menu
Lol, It reminds me when I presented the project I made for college, and it forgot to change test names, and there were just a lot of polish swears in the database
Difference is that I'm not the one hosting it
its literally on Steam
its this mf right here
this mf
its fine though
anyway
do you have any ideas here?
since its such a weird bug
Can you send the logs?
its not packaged as a development build so I can't I don't think
and I have to use the version I've already gotten onto Steam since it uses Steam networking
(Standalone game is uh.. cursed)
huh
Ok then
Are you sure its not related to displayed UI?
Like, you said player is actually on the server
Nope
like
it doesn't show it there
but I'll explain how I know its connected
you know how when you join a session, there's a very slight "hitch" if you will
very drastic but quick freeze
well that happens for the server and client firstly
secondly when the server actually shuts down
the client is then booted back to the default level
meaning they were connected
and just lost connection
so it is actually connecting
but something is going wrong still
and part of why its so weird is since its only a "sometimes" issue
like its an issue 90% of the time, then randomly it decides "I'm gonna join"
My "sometimes" experience with joining, is that it has problem to join when something is blocking the spawn point, e.g. another player. But this should be resolved automatically, if you are using character instead of pawn - Are you using pawn?
Another thing - can you see another's player pawn/character on host machine/session or, its interactions, e.g. if you press to move on the remote, does it move on the host?
I'm using a character, also the spawn point is not blocked
And no the player does not spawn
there is no player controller either
since I have a notification for player join (using a player controller being spawned to detect it)
and that doesn't popup when this bug happens
Currently I'm trying to make something of a brute force method if you will
basically retry to connect like 50 times by detecting what level you're in after joining
if its not the level its meant to destroys the session and rejoins
If there is no controller, then I doubt that there is a actuall connection
There is a connection which is why its odd
but I'm still trying to see if I can brute force it

Then, the connection must be something before player controller creation. Maybe its stuck at some handshake
I honestly don't know then
also I've just created this monstrosity to see if I can brute force it 
Your host is on another machine, right?
Ye
Gonna try this for now though
Is it also at another network?
Yeah
it uses steams networking though btw
hence why I have to use the Steam version or standalone to test
Try to host on the localhost, and try to host on the same network
Check if there is a difference
hey guys
so im trying to make a 30k map for my game i tried using world partition but the performance was so bad
also have issue with the streaming sometimes the terrain would just disappear
so anyone knows a better solution for that and what can i do to gain more performance
i have a 13700kf
96g ram
and a 4070ti
so i should expect at least 60fps but i get around 40fps and i didn't even spawn any vegetation
What do you mean by 30k?
30 km
Do you have actors mark as "always relevant"?
but the performance was so bad
what do you mean by this?
And nanites enabled?
nope
i can't get nanite enabled for the terrain always crashes
i mean in a empty scene like that with the size in mind that kinda not good to have only 30-40fps
Ah, the terrain itself is a problem, right?
kind of idk tbh
Nevermind
its no longer working again
Even after trying 20 fucking times it still doesn't work
this literally retries 20 times
disconects from it then reconects
Have you tried to reset the host?
That's the thing even then
How would the host know their lobby is broken
imagine how annoying that'd be
having to re-host like 10 times
even when your lobby literally shows on the server list
as you can see in the 2k map its work so fine and i can see the details of the objects and the player but in the 30k map i can't and looks pixeled
Then try to disable its rendering, and see
i found that the performance issue was that im playing with 2 clients at the time it looks better with one now i get like 120 fps
anyone have recommendations of plugins for networking?
define "plugins for networking"
handling multiplayer
i'm not sure what's out there, so curious what people use for what?
unreal does that out of the box.
yes i am familiar with replication and networking in unreal. i've never looked at plugins at all.
because they largely aren't necessary
unless you have some specific requirement that unreal's networking doesn't meet (which is pretty unlikely, unless your target is a super scalable mobile game that isn't running full game instances for servers, or you're building an MMO and have a budget to back it up in which case you wouldn't be here) it's a question that doesn't really have a useful answer.
target is a super scalable game
again, what requirements does unreal's networking not meet
do you happen to know if online services plugin is something that's commonly used?
also, any experience with aws integration? gamelyft is that something useful?
it's a server hosting solution
The main question is. Are you rich?
okay well like i said, i've never looked at plugins at all, so i'm hoping that someone with some experience can fill me in a bit. but it seems you want me to know exactly what i'm trying to ask when i'm trying to figure out what to ask
i really hate this aspect of dealing with people
You've asked something so incredibly vague with no context, this is the only kind of answer you're going to get.
i can afford to run a server that scales if need be if that's your question
Multiplayer networking (game servers) is not the same as online services (platform, auth, achievements, data storage) is not the same as server hosting.
im trying to ask question and you're arguing about what i'm asking... totally helpful
If you don't have any requirements to list then you're not going to get useful asnwers.
not from you 😄
Because you're not providing anything useful in your question that can be answered.
quiet, i'm trying to figure out how to block you 😄
Fine, you want an answer with the information you've provided? Look at the built in plugin list.
It has tons of online services providers.
much better
You haven't specified what you want so I assume that's good enough.
Lol, he is not. Trying to figure out what do you want is not being useless. I've learnt a lot from him, and if you want to make your development life a little easier, you should show a little humility
it goes both ways
communities are terrible for helping people trying to get help
I'm not even asking for you to be humble - I wouldn't phrase it that way.
I'm asking for you to be specific about what you want.
anyways, i'll get my information elsewheres. have a good night folks 🙂
lol
someone who didn't know what they wanted to ask and got upset when people couldn't decypher what they wanted to know

It seemed like he just wanted a plugins for the sake of plugins
Because using a lot of dependencies is "proffesional"
Node.js syndrome
Like the only thing I can think of is advanced sessions
nice plugin
Are there any other ideas?
Because I genuinely have no clue what's going on
even when it does connect it sometimes just goes to a black void of nothing under the map and no player spawns
I should clarify
server-side it spawns the player
but it isn't possessed
Me neither. You can try to connect via different network, e.g. via phone tethering - I had such case when I've built 3d printer, it didn't want to connect to my home network, but had no problem with phone, because phone has only 2.4Ghz, and home WiFi both 2.4 and 5.0.
Apart from that, only logs could be helpful. Package client for development and try to connect, then send logs here
@plush shoal idk if this was mentioned but joining a Session doesn't mean that your are connected to the Server. JoinSession does that as an extra step, but it can totally be that you successfully join the session but fail to join the server.
Logs would be very needed here to further help
Ah thank you for that clarification
very important distinction
I'll see what I can do
If it's a shipping build then you will need a source engine to enable logs. Otherwise I would suggest having a dev build, maybe on another branch or so
You can connect VIA standalone game launch
since that uses the same APPID
so I have logs from that
I'll check them
Ughhh I'll build the game as dev for now
since its still unreleased
Steam page is public but yknow, I have it set as coming soon
so I can afford it to be dev by default
is it just me or every function in my pawn ends up triplicated because I need to call it on the server and from there multicast it to every client? like except the functions for Moving and Turning most of the others end up having to be multiplied by 3
Turns out, I think I will need to send separate chunk data via rpc anyway
i got a question regarding rep notifies
when the server sets a var, it will :
- try to replicate the variable value change to the clients
- call the repnotify function on server and all clients
yes ?
in blueprint the repnotify function will call on both server and clients
so my 2 staements are correct ?
if the variable is marked as repnotify the following will happend
Server set the variable -> then it will call on Rep Function (In blueprint)
It will then tell the clients to set their variable to the new value. <- This will take some time to arrive, depending on ping
when it comes, the value will be set and OnRep Function will be called on the receiving client
So if all clients have 200 ms.
And you want one of the client to change the the value, it will call server rpc. Takes 200 ms to reach the server.
Server set the variable then takes another 200 ms to replicate it to clients
Btw. Will iris deal with over maximum amount of data, e.g. by chunking it down, or do it still require manual chunking via rpcs?
(Just tested, and iris didn't help)
okay ty
I'm doing session settings for create server function and for some reason only 2 players can join the session before it locks out and blocks everyone else from joining
despite me doing NumPublicConnections or private to be above 2
is there something I'm missing? (this is with steam subsystem)
There is an option to allow players to join a game in progress. Maybe you need to enable that? It’s with the max public connections and other server settings
Yeah true.. I think that might be the only option
I also do not want players joining midway
but I guess i will design around it
Though I wonder if that’s actually the issue since I don’t think lobbies auto start when a player joins
also, when a player joins a session after some time passed, only variables marked as repnotify will be updated right ?
what does UE do ? does it call the last repnotify ?
i believe so
Also the repnotify will not trigger on listen client
so you will need to call the function
wdym by that ?
hey, so I'm trying to create a leap ability, using VInterp
it works technically
but its very jittery cause of the server replication tick/frequency which I really don't want to change
is there a way to move the character using it's movement comp or something so it moves in a predicted way like when the character moves or jumps?
It is a target lock ability not a blind jump so launch wouldn't be sufficient
basically what it does is mover the caster to the target as such following an arc
which works but it is very jittery, which is something I anticipated as it is caused by the replication, but I couldn't find a way to reliably interpolate locally to avoid the jitter
tried using these
these also jitter
@static lava If it has to be done in the Movement Component, then you need C++ and we have some basic examples pinned to get started on that.
For the RootMotionSources, they technically work, but are very picky
You gotta make sure that all parameters are the exact same for server and client.
If you do "CurrentLocation + X" to get a TargetLocation, that could already be wrong
I'm basically trying to create a leap and a "Get over here" scorpion pull ability
but any solution I tried causes this jitter
And you might need to expose FlushServerMoves from the CMC and call that before calling the RMSource
So ue5 is unable to move characters with prediction without me getting into c++?
In almost all cases, yes
I mean its a pretty basic thing to do, as 99% of multiplayer games need this functionality for things like Deathgrip/Scorpion grip
Sure, but those 99% of multiplayer games don't limit themselves to Blueprints, which is not meant to code a full Multiplayer game in
And Multiplayer Movement is never "basic"
It's pretty complex even for the simplest of movements
So are you doing BP or C++?
RepNotify in Blueprints is a "Property Changed Notifier". It's not 100% the same as it is in C++.
In theory, OnRep should call on Clients only, and is triggered by the data being received by the client.
In Blueprints it acts more like a "Property Changed Notifier", that is it will call when the Variable is changed, rather than only when the Client receives the data.
That causes it to also call on the Server when it sets the variable
And even on the Client when that one locally modifies the variable
Client changing it won't cause replication of course
So basically there is not way to easily move a character following a spline with prediction? What about using a projectile movement component, basically It has to do 2 thing 1 move caster towards target with an arcing path and 2 follow if target moves
so when server sets a var with rep notify, the rep notify function will call on server and all clients
ProjectileMovementComponent has 0 prediction
In Blueprints, yes
In C++ it will only call on the Clients
so what should I create in c++ for this to work? Where could I find some things for it as I'm trying to move the character itself that is already replicated
If you move a locally controlled character, you will have to extend the CMC
Or at least expose the FlushServerMove stuff and get the RMSources to work
are you familiar with abilities like Heroic Leap or the set ultimate in lol?
I'm trying to recreate that effect for GAS
Somewhat, but the Grab of Set is something I would not try in UE
I tried it before for a MOBA customer and we scapped it
UE fights this too much
I'm not really attached to root motion, no grab just the movement of the leap
I would do this with a RootMotionSource, yes
so basically I just tried the rootmotion, because I was recommended it in GAS first I tried to use VInterp
any info on how to do hotfix dedicated server side?
for example if I wanted to change a blueprint actor function to fix a bug and apply a hotfix without restarting the server
Which means ensuring there is:
- A valid PredictionWindow in my Ability before calling the RMS
- Ensure the values I feed into the RMS are 100% the same for Server and Client
- Flush Server moves before calling the RMS
I think that was all, or at least close to all being needed.
Don't think that works
You gotta repackage usually
regarding ownership, can i use the debug object dropdown to see who own the actor ?
or is it not linked to ownership
currently i can only think of ways to hotfix if its related to editing values, just not the functionality of things what about you?
I'll look into it then ty. Is there any vid or tutorial I can look into to get started as my replication knowledge is around inventory management currently didn't try movement yet
Buh, not that I know off. It's pretty tricky and people who do this usually don't tend to make tutorials about it.
You can hot-reload some configs fwiw, but in general you gotta restart the server.
thanks, sometimes its best to not complicate things and do a simple restart 😛
situation:
- on begin play of a actor, i set a variable (repnotify type) <- on server
when the client version of this actor will be created, will the rep notify function be called ?
fwiw, as far as I know, DedicatedServesr need a daily restart anyway
In theory it should. There some more complicated bug where this can fail though, but if the Server sets the varaible on BeginPlay (only the Server) then it should call for the Client once that actor gets created
okay ty
does someone has an idea about this ?
USTRUCT()
struct UMyStruct {
GENERATED_BODY()
TArray<FGuid> Guids;
}
...
UPROPERTY(Replicated)
UMyStruct MyStruct;
Ignoring FFastArray for now, and given the delta serialization nature of USTRUCTs, when I add a guid into Guids inside MyStruct, only this guid will be sent over the network or the entire array goes through?
client is creating a widget, i want to save this widget in a variable (on server)
for some reason the value isnt passed to teh server event, why ?
how can I keep two replicated variables in "sync"?
Say I have two variables, TotalDebt and TotalAssets
If the player takes out a mortgage, i dont want the server to replicate one before the other such that their net worth suddenly spike massively in positive or negative direction until the other value is also replicated
I initially thought i could just put them in a struct which would ensure they are both updated together but that doesn't seem to be how unreal handles it
EDIT: Found this article: https://vorixo.github.io/devtricks/atomicity/
@thin stratus You got any idea why the server cant destroy the weapon pickup actor? The Interface is now called on Server RPC on Character
afaik entire array
delta serialization of structs is per-property
Hm, yea :/
But I believe FFastArray could do the trick?
If you're gonna have lots and lots of elements yes
Just checking - properties inside a USTRUCT without UPROPERTY() won't get replicated if the struct is marked as UPROPERTY(Replicated) - am I right?
Sorry for bringing back an old post, but what did you mean by the engine fighting it? Can you please tell me more?
is on rep notify called when doing add item to array ? Or is it called only when using "set"
its been 1h and i still can't figure out why the variable contains null references on the client after i set it on server
the only thing i can think of, is that the server instance exist before the client one, but repnotify should sets the same values.
I might be wrong but I don't think you can replicate DAs that way, they're treated as BP types not BP instances afaik.
I'd still wait for someone else to confirm, but in the meantime try replicating a regular struct or another replicate-able object and see if that works
Well they're not meant to be used in that manner, you generally don't want to replicate DAs even if you could
yes it was working before
i am currently converting my system to DAs
i was using UDS before
Back them by structs, and replicate the structs you extract out of them instead
Use them as a "source" of data, as opposed to "the" data
i found a plugin that allows to replicate uobject (special BP class), the issue is that i dont know how to create data assets from it
You're still replicating the data assets themselves, not the data in them. I'd take a step back and re-think as opposed to try and brute force it if I were you
pls helpž
Data assets are generally intended to be used as a way of defining data at design time, not as actual data instances to use. For all intents and purposes, I personally try to keep them immutable
the point was to have an array of DAs as the inventory
the DAs arent changed
You can use them as instances, but you'd be shooting yourself in the foot most of the time I'd say
before i had an array of names (the item ID), but each time i wanted to show some data (like display name), i had to go though a DT
the issue of that is that for stuff like items it can get slow
well ig i'll go back to UDS
and just use the DA once as the creator
Looking at OnlineSessionInterface at the moment- where is LeaveSession?
I am having trouble when player leaves server, and tries to rejoin, they cannot.
was it removed? (this is 5.2 documentation?!)
i only see findsessions
JoinSession is also in there too
only LeaveSession function call is missing
??
I guess i need to unregister players?
I only know for blueprints, but try Destroy Session @jade ibex
you calling it with advanced sessions?
Yep, and the player can rejoin.
Yeah, that's right I think.
if i change the material of an mesh, i should call it with a multicast from server right ?
Should be a repnotify
material is state
Thats what i finally did
Does anyone know the console command to simulate a client rejoining the game?
I saw it in a youtube video a long time back but can't find it online anywhere
Hey y'all, in a multiplayer game, how should a main menu be handled? Can you just treat a main menu game mode like a singleplayer game, and give the player access to things like the game mode?
Main menu at the very start of the game or when connected to a server?
Main menu like when you start up the game and are choosing between things like "quickplay," "host game," etc.
Yes you typically are in standalone mode at that point
Some people launch as listen server but that's effectively the same as standalone
If you do that, can you still make API calls like getting the player's profile picture, or allowing them to join parties with friends before entering a game?
yes, that's completely independent from Unreal's networking
that's #online-subsystems territory
Got it; I wasn't sure if there was something that tied Unreal's game framework to the networking subsystems. Thanks!
Is there a way to make unreal automatically chunk data for fast array replication, so when it exceeds buffer size, then it sends it in several packets?
Don't have logs for people joining yet
however this is for simply just hosting a server
Pretty confident but I just want to check, away from computer trying to figure out problem. Listen server game. GameMode's BeginPlay() will call, then the host's character will be created/run RestartPlayer() and be created in that order correct?
Edit: Figured out my problem. I believe I was correct above issue was completely unrelated haha.
Hello, a question, does anyone know why this include gives me an error?
So I have chunks with very large arrays to replicate, and have 2 design patterns to choose:
- Replicate them via rpcs, like shown here: https://vorixo.github.io/devtricks/data-stream/
- Replicate via splitting array into chunks, and adding these chunks into fast array replication
For 2nd, I don't know how can I get replication buffer in order to know when to add another chunk. Is is the same as Reliable Buffer?
#include "Interfaces/OnlineSessionInterface.h"
Thanks!!
Hey everyone, I was wondering about maps and UE's client/server system. I noticed that when you play a game, it's usually on a specific map that you connect to, through a "URL". But I was wondering, how does it work to move to a different map during gameplay while playing on the server. I tried the naive "Open Level by Reference" in a blueprint in the Lyra project sample and it was a crash, so I'm pretty sure that's not the right way 😛 And also, is it possible for 2 player on the same server to be in 2 different maps. Thank you. Any reference is welcome. I'm pretty fluent in C++.
You mean, you want to have 2 different maps on the same server, like in minecraft: both end, overworld and nether?
If so, its impossible. What you can do is:
- Make 2 different servers
- Make player a host on different map, and allow other players to connect to it, e.g. warframe does that
- Use this plugin: https://www.unrealengine.com/marketplace/en-US/product/multiworld - in this case you still need to replicate actors trough main level, as other levels are not replicated
Does anybody has a good resource on how to create custom NetSerializer?
Take a look at FHitResult
Oh, alright. That works.
Thank you. 😄
By the way, Matt - FFastArraySerializer went super smooth here.
Where?
I mean, in the abstract way - in our game, hehe
Implementing it I mean
Awesome.
This is my reference - wish it was possible to 'favorite' a message (is it?)
You know if push model will be the default for Iris? 🤔
Push Model is opt in per property.
It is already enabled by default. But its your responsibility as a programmer to use it per property.
thanks I'll look into these
So I have chunks with very large arrays to replicate, and have 2 design patterns to choose:
- Replicate them via rpcs, like shown here: https://vorixo.github.io/devtricks/data-stream/
- Replicate via splitting array into chunks, and adding these chunks into fast array replication
For 2nd, I don't know how can I get replication buffer in order to know when to add another chunk. Is is the same as Reliable Buffer? Also, the 1st design would take much less memory, as 2nd needs to make mirror of the instance data(its location and rotation)
Without chunking data happens what is presented on the screenshot. Can someone more experienced give me direction, what to do about it?
should NumPublicConnections be updating automatically as players join the lobby?
in my testing it did not seem to change at all
Oh there is:
OnlineResult.Session.NumOpenPublicConnections
difference being "Open"
why would the server have to be "sent" the length of the animation
the server is running the same code, and the server has access to the montage.
Question : Should I Enable / Disable Input of players who are in opening a Menu on the server (and it will replicate itself) or that's OK to do it on the client directly ?
UI related things can be client only
Yes but "Enable / Disable Input" is something related to the character, as here I'm referring to inputs related to moving around by the character
and inputs related to attacking, interacting, etc...
well is it important that the server knows that a player is in a menu?
No but here again I'm referring to Inputs
Because I don't want the player to be able to move around, attack, interact, etc... while being in a menu (in this case it's a menu to configure the settings of a game)
two options:
disable inputs locally, when a menu is open on the client
communicate via RPC to the server that the local player is in a menu, server replies to the client and disables the input, then when the client leaves the menu, again communicate to the server via RPC, server replies and reenables movement
That's what I'm asking, which one is better in terms of safety ?
yeah
anything concerning cheating should be server authoritative
again, the server is running the same code
what do you think the play montage node does on the server
that changing a static mesh is not replicated is a completely unrelated situation to this
and no, animations are not in the same vein as widgets
animation data is incredibly important to many if not most games on servers. rendering an animation might not be, but bone positions, timing, and notifies absolutely are.
there's no replication of animation data going on here
the server runs the play montage node just like the client does, and the montage is an input to that node. Not an input replicated from the client, it's just part of the blueprint.
How can I write my own custom array replication? The goal is to create an array that can automatically chunk data during replication if array is too large
Well, fast arrays didn't solve my problem
unless I do something wrong with them
So create your own NetSerializer then
The best ref I found was this http://www.aclockworkberry.com/custom-struct-serialization-for-networking-in-unreal-engine/
Or
Isn't it just optimising amount of bites used? I need an ability to control replication flow for a single struct
@obtuse field If you are running into packet size issues you may need to just spin up a traditional Socket connection to Clients for streaming the data
Though its entirely on you to manage synchronization and interpretation of the data
you mean to just setup custom TCP connection?
Or do something like this:
void AMyPlayerController::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction)
{
Super::TickActor(DeltaTime, TickType, ThisTickFunction);
if (HasAuthority())
{
TArray<FMyData> ChunkBuffer;
auto* Channel = NetConnection->FindActorChannelRef(this);
while (ChunksSent < ChunksToSend && Channel->NumOutRec < (RELIABLE_BUFFER / 2))
{
ChunkBuffer.Reset();
const int32 StartIndex = ChunksSent * MAXCHUNKSIZE;
const int32 NumElements = FMath::Min(MAXCHUNKSIZE, Data.Num() - StartIndex);
check(NumElements > 0 && (StartIndex + NumElements - 1) < DataToStream.Num());
ChunkBuffer.Append(DataToStream.GetData() + StartIndex, NumElements);
// Send a reliable Client RPC with the subarray data here
ClientReceiveData(ChunkBuffer);
ChunksSent++;
}
if (ChunksSent >= ChunksToSend)
{
ClientNotifyAllDataReceived();
DataToStream.Empty();
ChunksToSend = 0;
}
}
}
I'd go with this approach
If you are comfortable with Sockets and data transformation it would be better to go the separate Socket route
As you wont choke the network for normal replication.
Chunking like you proposed can still end up saturating the network causing issues to other replicated data
Setting up Sockets is pretty easy. There is a good API for it.
Can you provide me some sources?
Im on my phone at the moment so its not easy to do that
Just search around the engine source
Or google it
Btw. Reliable RPCs are also working on the TCP socket from what I know. If I use custom TCP socket, wouldnt it choke it anyway?
Making a traditional Socket opens a brand new separate connection.
Then, isn't there a way to use RPC on the different connection?
No because its a barebones socket.
You lose all the fun stuff from UE networking
Dont have any illusion that using a barebones Socket will be easy lol
Oh, I love seeing these "A new, community hosted unreal engine wiki"
This is the way, right?
https://docs.unrealengine.com/5.1/en-US/API/Runtime/Sockets/
Thats the FSocket API
Search the engine source for how its used
There should be helper APIs that utilize that to make interfacing with Sockets easier
I just forget what they are called.
So there is an Api for FSocket Api, to make FSocket usage easier, right?
Yeah. Have a search around the engine source dude. Im on my phone so limited in how much I can help you
Searching rn, just wanted to ensure
There is very large amount of libraries and structs that use FSocket
Not sure what to look for
I'm currently experiencing this jitter but after it a while it is fixed, I'm sure it is caused by the fact that the client and server has a delay os 240ms
so the ability is activated at 2 different times
It is bp as it is a proof of concept before creating it in c++
flush is just the get movement comp-> flushservermoves()
SocketSubsystem?
Relatively sure this only works smoothly the other way round
You'd need to tell the client that it has to move, and that tells the server
Not sure it works other way round without corrections
I see, so Server tells you can do the ability->calls client to respond-> client starts animating and tells server to start?
but if the client starts moving before server won't the server jank it back?
also when you mentioned "prediction window" do you mean the same Tranek talks about in the GASDocumentation or is it a separate concept?
Yeah GAS releated. But if you use GAS you wouldn't need the RPCs, cause Abilities are already communicated via RPCs by GAS
CMC should handle this
Hi! anyone here who's used the Smooth sync plugin alot? I've just started trying it out to hopefully fix my jitter-issues on the client but I get this behaviour on the client when using the plugin and I'm not really sure what I'm doing wrong so I thought I'd try and see if anyone here has a clue? I've tried playing around with the smooth sync component settings but can only see small differences
super noob question (c++): do OnRep functions get called if i replicated actor loads into the client with that variable set? like if the server sets that OnRep variable before a client joins.. OnRep wont get called and i'd have to get BeginPlay to check on the client?
which means i cant rely on just OnRep_AttachmentReplication for a client to keep track of everything the server has attached to an actor
You can rely on that. OnRep gets called for a newly replicated actor if the replicated var is different from the default value.
excellent
is there a way to make an array call OnRep when using add,remove,.. ?
This feeling when due to lack of sources you are subconciously learning chinese
Hey I have a game that works perfectly fine in Editor and Android but on iOS, Apple is blocking wss communication with our Backend Server. I authorize a lot of stuff in the plist and authorized Custom Networks profile on Apple console but nothing works. Ofc paying for Apple Dev Program is not enough to get support by email from them 🙃
If anyone here has any idea I'll be glad
There's a check for default ?
So if myvar is default 0, server sets it to 1, then back to 0, and now enters a new player - is it gonna trigger OnRep or not?
Strange that it would know, to me, thats all
Id expect it to trigger regardless, as long as the server ever changed it
well I try to take my system to another level.
I made a system that is first setting ownership of an actor to be the host of my game.
Then any client / player interacting with the actor has a menu open, the thing is, only the last player that interacted with the actor can trigger a server event,
The other clients that interacted before the last guy just magically lost there reference to the owner (host of the game) that owns the actor.
And even on doing some extra work, the ownership is still the server on there clientside, but they still cannot trigger a server event ?
Is that a common thing that only one player can start a server event trough an actor ?
Quesiton: Using your combined experience, what are some required multiplayer nodes. Are there any you'd add to the list and if so, what function does it serve? Explain like I'm 5
I would say the term of "dont use in mutlplayer" is totally wrong
And should be replaced by something like " can be used only in Owning client event" ?
Yeah, I was thinking if it's running off a ForEachLoop it's fine right?
I changed it to Owning Client Event 🙂
no it's just that if you do that on owning client event, player controller 0 is a good way to get a reference to the owning client
Agreed
I'm trying to nail down the common interactions. Every tutorial I watch seem to skip over this or that and I'm making some notes so I could understand it easier
for this kind of simple stuff like opening widgets and such
Depending on the scope, I use a bunch of IsLocallyControlled() - as the name implies, it returns true if the given actor/whatnot is locally controlled
Yeah, some docmentation say if it's an owning client, then IsLocallyControlled is solid to use
Yes, like, APawn exposes a IsLocallyControlled - and that's really handy
I'm trying to wrap my brain around things.
Another quesiton is when a skel mesh has a RepNotify on it, if that local player changes their jacket, would the other players see that jacked change on that specific player?
I came up with something like this for TCP, now, how can I receive data? Should server constantly on the EventTick Recv?
if(IsRunningDedicatedServer())
{
FIPv4Address IpAdresses;
FIPv4Address::Parse(FString("10.0.0.148"), IpAdresses);
FIPv4Endpoint Endpoint(IpAdresses, (uint16)7787);
TCPChunkDistributor = FTcpSocketBuilder(TEXT("ChunksTCP")).AsReusable();
ISocketSubsystem* SocketSubsystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
TSharedRef<FInternetAddr> Address = SocketSubsystem->CreateInternetAddr();
Address->SetIp(Endpoint.Address.Value);
Address->SetPort(Endpoint.Port);
TCPChunkDistributor->Bind(Address.Get());
TCPChunkDistributor->Listen(64);
}
else
{
FIPv4Address IpAdresses;
FIPv4Address::Parse(FString("10.0.0.148"), IpAdresses);
FIPv4Endpoint Endpoint(IpAdresses, (uint16)7787);
TCPChunkDistributor = FTcpSocketBuilder(TEXT("ChunksTCP")).AsReusable();
ISocketSubsystem* SocketSubsystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
TSharedPtr<FInternetAddr> Address = SocketSubsystem->CreateInternetAddr();
Address->SetIp(Endpoint.Address.Value);
Address->SetPort(Endpoint.Port);
TCPChunkDistributor->Connect(*Address);
}
No
Unless the local player is the server
has authority can be used to "check if it's not the host of a game doing the action"
If not, then you need to start a server event to get the right result, as well
The only way to transmit data from remote client to the server is via RPC, and the server then multicasts to the other connections
Aye, so lets say we're in the third person character, we then fire event to switch head skel mesh, make sure it's set that RPC to Server and another RPC for Owning Client (or multicast)?, then run the RepNotify?
This is supposed to work
This doesn't have to be an RPC, it can be a regular event
This seems perfectly clean to me. Client asks server to change a variable for them. Solid.
It seems however it is not predicted, so the client instigating the change wouldn't have a smooth feedback.
Yeah, things have been working good, I need to clean it up though. I'm using Int's to switch my body parts and I want to clean up my struct to use Skel Meshes instead, then link ever body part (head, torso) to a RepNotify
Make sure to test with Network Lag
That's where I struggle haha. I understand single player game making well enough, but multiplayer has some back end rules that I need to understand more
It's pretty simple, actually: when you call a Server RPC, there's a 'delay' until the information hits the other machine, and there's yet another delay from server doing its stuff and communicating it to the rest of the connections (pretty standard networking stuff)
When you change your skin/body parts, you want your local player to have immediate feedback, so you change it locally and the server can correct later if needed.
So for example
You can also set this variable
Here
That makes sense
After this node
And that's because the RepNotify is replicated by default in the Character class right?
So I can add it after that node
No, that's the thing - RepNotify is only called upon receiving remote data from the server. But the trick is inside your RepNotify implementation: that's where you actually make the cosmetic change. So you can set this variable and immediately call whatever RepNotify is calling.
Right now the RepNotify has this mess in it (which I'll clean up/change)
You can put all this logic inside its own function, i.e. ChangeSkin();
And then make your RepNotify call ChangeSkin();
And after this node, you could set the CharCustomization variable and call ChangeSkin as well
And then, you could also put an if to check if has authority, if true, you don't do anything else; otherwise, you forward the message to the server so it can broadcast it to the world
Trying to peice this together ahaha
(Is this a listen server or dedicated?)
Bah! haha I did that but with the Authority true haha. I'll change it!
Still works
You only need to forward it to the server if it's the client, otherwise if it's the server calling LoadCustChar_CL it is already setting the variable hehe
I appreciate you answering questions man, I don't want to be that guy that crosses the server barrier and asks if you could at times (not all the time and not spam you) get your wisdom?
Aka, can we be friends? haha
Sure thing!
does easy anticheat actually work? 🤔 I see most games using it
What do you mean by 'actually' work?
I think it prevents things like packet injection and scans files but thats it
as in prevent all cheats all around
No, no anti cheat does that
not at all lol
and no anti cheat even does that
:(
it's pretty much a data base and things that exists into it bans players if the code is fund running on there game files
easy anti cheat would ask cheaters to never modify there game files and keep things external to the game files from what i've heard but thats pretty much it
so do we have something to try and spot for wallhacks etc?
i know that wallhacks are inherently near impossible to find
No - I mean, there are the anti cheats who try, but even companies like Riot/Epic/Valve can't avoid them.
that sucks so hard
until someone makes a "VIP" feature or something on steam that you can access only by scanning a finger or something, and if you get banned one day, then you can never play on those servers again x)
AI anti cheat is analyzing your movements to identify players as well, like players as an individual
at what scope do anti cheats usually run
could it be my responsibility to attach it to the game code in some way
looks like the only future to nice gaming experience is to be able to identify each players one by one, and block those who ever cheated
i mean game code is already in charge of doing some validation, so the context is already there
doesnt unreal engine's movement component netcode have pretty good anti-cheating built-in?
im thinking in regards to wallhacking. as long as the server doesnt permit the client to change their collision and move somewhere other than predicted, wont it be corrected?
i guess there's some cheaters who are able to work around the built-in correction system, but yeah just curious
yeah, but then packet injection can simulate a player location and validate things like "is the player next to the object he is looting"
Then your blocking packet injection, so they start making ESP, to find object, so you creat ESP Fog to load no data into things players cant see
and they start making Sound radar to identify anysound location, like it's endless xD
o_o
by wallhacks we mean xray vision, which has to do with rendering rather than movement
o_o
oh, right, thats harder to predict yeah
it's called an ESP
not an actual wallhack
They are getting collisions on the players to display it on there screen usually
then they get data like "level" "KDA" "Gear" from the data base somehow xD
how do they even recognize the player character class?
what do they have to 'tap into'?
at what scope do cheats run? what context do they have available?
no idea TBH, look at tarkov cheats on youtube, you will see pretty much any cheat system used on any game
some are running into 3rd party programms and got there own luncher and shit, some are into the game
Some are getting skeleton location, some are getting collision, most times they manage to get data about players, gears and level / name
They can even see if a GM is connecting to the game
GM?
those guys are proper developper hating the game or making money for renting there anti cheat 200$/month
You know too much man 👀 lol
game master
doesnt server-side validation prevent things like packet injection?
whats a game master? some admin to ban cheaters?
it should yes, server code should never trust clients by validating incoming packets
This is what doesn't click to me. $200 a month to give you an ego boost?
I'm friend with a guy who makes cheats in tarkov indeed, and he got plenty competition lol
nah those games are having rare items that are sold to other players for real money, they make like 1-2K$ per months from cheating
wat
all poor countrys are having legit groups of cheaters / hackers for those reasons
What kind of game we talking about?
Items takes time to farm, farming time is money, they sell to other players the ability to dont spend the time to farm, and thats working for any game
(Valorant Rank)
(Tarkov level and items)
(Apex rank)
(Wow Items and money)
pretty much can apply to any game
cheaters are in most cases people making money more than kids, kids with bad cheats gets spotted quick
Proper cheaters are playing for months, knowing exactly the game and how the game works in terms of spotting people
then if they get spotted they Buy another account and here we go again
thats why identifying players as an individual is the key to block cheaters
yeah but how expressive is the signature space
as in, how accurately can you identify players by their play style?
not accuratly enough lol
Thats why AI anti cheat is not a thing yet
Hmm, and the buyer is always at risk of a retro-ban, if that's a thing
Aight, this is a reality beyond me lol
yeah sure
But then here we are again "how to make a difference from a guy that gives an item to his friend, and a guy who baught the item out of the game"
xD
But that's not the case for ranks, right?
If I buy a top level account, it would be fairly easy to identify my gameplay doesn't match my rank
how do you know the guy did not just moved out of his country ? x)
And how do you know the guy is not just trying to get a lower rank to play with his friend ?
and even worst, how do you know his little brother is not simply playing on his account ? 😄
so in short we're limited to identifying cheaters through sus software detection and statistical analysis
lolol
and the other way around would be true as well - what if my big, badass brother was playing in my account? 😂
exactly xD
im having a hard time finding a reason why my onrep notify doesnt always call on clients
when using breakpoint i see that the actor is replicated and exists for the clients
but when calling onrep from server it only calls on server
net dormancy?
its awake
sus
the weird part is that its random
replication condition?
none
do u have any custom net serializers in the project
nope, im in bp only
there, all you had to do was ask about it on the discord
🦐
agreed
will im here, i got another question
regarding widget components, what is the correct way to use them on network ?
im talking about widgets that are visible for anyone
idk but what immediately comes to mind is to check if u can onrep some var on them or get an RPC working
then have them show the networked data with an observer pattern
if not, then u can always treat them as local rather than networked, and they'll just show data that's networked elsewhere
What do you mean by "widgets that are visible for anyone" @lament flax?
A widget/widget component only exists for the client locally, but they can retrieve identical information from the server.
Not directly tho, or?
Do they, as components, exist on the server ?
So you can replicate props as normal?
The server has to send the information, yeah.
Havnt tried, just know we did it differently
We rep data to the owning actor, and push that to the widget
well, its a world widget placed on a actor, so its for everyone's eyes
but now i still got my repnotfiy on the actor not firing on clients
thats exactly what i am trying to do
I think you'll have to create it for each client, and then get data from the server.
so this is not possible since the widget "dont exist" on server ?
its weird because on the server i can retreive and cast the ref
and on rep notify it will execute only on server
^
For some reason you've marked your widget component as being replicated, which is also wrong.
UI is intended to be client-only. You should not be trying to replicate data through it.
UI should read from something else that does have proper replication.
so its not the same instance for the server and clients ?
no.
each of them has its own ?
yes.
there is no point in making the widget component replicated, all you've done is waste some resources.
i changed the setup and the widget isnt changing
both breakpoint where called
Does that count for the component here tho?
Not the widget part of it, thats sorta separate?
Yes, it does. There is no reason to replicate the component.
yeah thats what i am wondering
The component can replicate but it won't do anything useful.
Fair
So as I said: all you'd be doing is wasting resources.
even setting the widget data from client didnt do anything
Is BeginPlay called from an actor that is only spawned on the server?
its not begin play
left screen is onrep when changing a var
Ah
But your clients get the notify function or no? I understood it like you had problems with this earlier.
rn this works
on left screen the breakpoint is hit because its firing on client
I have server and a client, but its not connecting ConnectionState is set to Error after a short while
if(IsRunningDedicatedServer())
{
FIPv4Address IpAdresses;
FIPv4Address::Parse(FString("10.0.0.148"), IpAdresses);
FIPv4Endpoint Endpoint(IpAdresses, (uint16)7787);
TCPChunkDistributor = FTcpSocketBuilder(TEXT("ChunksTCP")).AsReusable();
ISocketSubsystem* SocketSubsystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
TSharedRef<FInternetAddr> Address = SocketSubsystem->CreateInternetAddr();
Address->SetIp(Endpoint.Address.Value);
Address->SetPort(Endpoint.Port);
TCPChunkDistributor->Bind(Address.Get());
TCPChunkDistributor->Listen(64);
}
else
{
FIPv4Address IpAdresses;
FIPv4Address::Parse(FString("10.0.0.148"), IpAdresses);
FIPv4Endpoint Endpoint(IpAdresses, (uint16)7787);
TCPChunkDistributor = FTcpSocketBuilder(TEXT("ChunksTCP")).AsReusable();
ISocketSubsystem* SocketSubsystem = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM);
TSharedPtr<FInternetAddr> Address = SocketSubsystem->CreateInternetAddr();
Address->SetIp(Endpoint.Address.Value);
Address->SetPort(Endpoint.Port);
TCPChunkDistributor->Connect(*Address);
}
Nvm. Changing ip to 127.0.0.1 worked
looks like the widget only update when using "set widget" on the widget component before each change
Not really,
If you have the correct reference to the widget, it'll update when you update the widget
well it doesnt
the ref is valid
not changing
then you got it mixed up
wdym
somewhere along the way, you got it mixed up
and why would this work ?
Not quite sure
all i know is that im updating my widgets directly and it's working like a charm
like it always has
how do you do it ?
WC > get widget > do stuff ?
well im doing the same
this doesnt look like a binding to a broadcast
on begin play i create a widget (for each client) and assign it to the widget component
old image, let me show you the actual one
how could i know... 🐬
you couldnt, nw
(the create widget bool is used to trigger stuff when client is created)
the "update data" is always called on the widget, but it only update in the world when i do "set widget" before
what is the rpoper one ?
you're directly setting the variable of the text block
instead of the function
function likely calls Redraw() or similar
you've changed more
what is incorect i the stuff i show you ?
just try swapping Set Text (var) to SetText function call
the variable should be private
void UTextBlock::SetText(FText InText)
{
Text = InText;
TextDelegate.Unbind();
if ( MyTextBlock.IsValid() )
{
MyTextBlock->SetText(GetDisplayText());
}
OnTextChanged();
}
didnt work
rip
yeah i want to kill myself
Hello, I want to create such an attack for a multiplayer game, and this attack should be implemented on the server.
I can currently create a Circle trace, which can either be standalone or within a specific large range.
But all of these events happen within a single frame.
How can I implement something like this to ensure it's not very performance heavy when running on the server?
why does a door that replicates properly as a standalone actor not replicate properly as a child actor of another blueprint? Specifically, creating 2 instances, opening one and leaving the other closed. I have figured out the one that stays closed is the local copy, as i can walk through it when the server says the door is open. I can also run a concurrent event to open the door locally, but it literally is opening and closing two doors, doubling the sounds, etc. What am I missing about replication
I want to replicate/RPC a really long JSON string but I'm getting an error that the bunch to replicate is too large
any work-arounds?
Well if you can't just serialise it to a struct, then you can just send over multiple RPCs
Hello, I am trying to make something similar to the Lyra turn in-place system and I have run into a bit of trouble when replicating it over the network. Currently I allow the actor to rotate with the camera's yaw. I then counter rotate the mesh with a calculated Root Yaw Offset which is applied to the root bone in the AnimBP. This works fine locally, however there appears to be some jittering when played over the network. The server seems to able to see everything fine (left view in video) but the clients see some jittering when other clients rotate (right view in video). From what I can tell in the Lyra demo it doesn't have this issue, but I am unsure what they do differently if so. If anyone has any advice I would greatly appreciate it, thank you!
Hi
I'm trying something to see exactly how ownership and ability to start a Server event can be handled trough actors.
To achive that i'm doing something super simple.
1- When my player host begin plays, then "switch on has authority triggers an server event that sets the ownership of all actors to have the server as there owner"
2- Players that are interacting with the Rock are starting a client side event to open there widget and sets the rock actor as the interacted rock"
3- From the opened widget, I'm trying to start a server event that fires from the actor, the actor ref is fine, and the ownership is supposed to be the player host.
And yet, no server events are firing on any clients, only the player host can start a server event.
Here is the code. Can someone help me understanding how this works and why is it not starting a server event if it's owner is the player host ?
What you've said is somewhat confusing, but it's likely you're misunderstanding one of these things:
- Server RPCs can only be called by clients that own an actor. A client trying to call a server RPC on an actor they don't own will have that call ignored by the server.
- The server does not need ownership of everything, it can already do whatever it wants.
- Widgets are not replicated, an RPC on a widget will go nowhere (or at best execute on the client itself - depends on the type of RPC)
I managed to make that work on another actor
What I did was "when interacting set ownership of the interacted actor to be the server"
And when doing that, I was able to start a server event from a widget, cause the widget was asking the actor to do the Server event.
My problem was that when I had another player interacting, then only the last player that interacted could start a server side event, so 2-3 player could not mine the same rock x)
So #1.
This is still not a good way to go about things - what happens if two players interact with something at the same time? It is better to route your interactions through something the player always owns (like the character, controller, player state, or a component on any of the above) and pass the targeted interactable through the RPC. The server can validate that the player is allowed to interact with the object and call whatever it needs to from there.
the thing is that the widget is a mini game, so the mini game is checking if it was done properly or not, I cannot do that into any other thing, So I was like "then lets start a server event from there since I can get a ref to the Rock they interacted with anyway"
Cause I dont really want the player controller to have 10-20 mini games handling into there controller
That... doesn't change what I said.
RPCs must be routed through something the client owns, and each thing can only be owned by a single client.
The solution is not to swap ownership constantly - that is just asking for buggy behavior and race conditions.
it's never swapping ownership since it's ALWAYS the server that owns the actor ? I dont understand
What?
I'm talking about clients sending server RPCs
Clients can't call a server rpc if they don't own the actor the RPC is on.
yeah then here it's always clients sending request to replicate since it happens from Widget and widgets cant be replicated 😄
I genuinely have no clue what you're talking about
I'm talking about what you said here
What I did was "when interacting set ownership of the interacted actor to be the server"
which is generally a bad idea
Bad Idea why ?
it's a required step to allow this actor to start a server event
This is changing the ownership.
yes, it's changing it to be the server @sinful tree (player hosted project)
No, it's changing it to be whoever the player controller is that owns the pawn.
this event only happens after a "has authority" happened, only the host has authority, right ?
(the code is starting from the pawn class begin play)
Authority doesn't really have much to do with ownership.
Other than only the authority can change the ownership
it's a way to check that only the host fires the event
And then it's a way to make sure that the "get controller" can only give the controller of the host, right ?
No it isn't.
If I spawn an actor locally on my client, I am then the authority of that actor, even though I'm not the host.
those actors are placed into the map, they are never spawned, if they are spawned, they are from the server
so that its replicated (those actors replicates movement and replicates)
When spawning a pawn, and possessing it with a player controller, ownership of that pawn is assigned to the player controller. This is what allows the client to make RPC requests on that actor.
If you're changing the ownership of an actor based on the owner of another actor then you're assigning it whatever the owner is of that actor, regardless if it is the host or the client.
so what is the safest way to make sure that the owner of those types of actors is the server ?
Don't change the ownership at all on that actor.
if even has authority + get controller does not return me the controller of the host, then how the hell I'm I suposed to make this actor able to start a server event ?
That's what Siliex was saying - you're not supposed to run the RPC on that actor. You run it on something that the client owns.
how can I serialize it into a struct?
either manually or https://docs.unrealengine.com/5.3/en-US/API/Runtime/JsonUtilities/FJsonObjectConverter/JsonObjectStringToUStruct/
Converts from a json string containing an object to a UStruct
I saw that yeah,
I'm trying to understand what exactly is giving the ability to replicate ^^
That means I should make that code so that "if mini game success into the widget"
Then get player controller to start a server event that interacts with the minned rock ?
I just dont wanted to have this player controller to handle all the mini games I planed lol
I actually tried that but my struct ended up having a map and maps don't get replicated
I just dont wanted to have this player controller to handle all the mini games I planed lol
You don't have to. There are tons of ways to break up your code - you could create a replicated component to handle things, you could have a more generic "minigame did thing" function on the controller, you could even spawn a new actor that exists purely to be a go-between for the minigame.
my main goal was to be able to have any amount of clients able to mine a same rock, and when any of those clients sucessed there mini game then the rock is sapwning a rock for the client and moveing into the ground to get smaller x)
DId you just reinvent bitcoin mining into rock mining in a game?
lol
Whenever they succeed does the rock reward get a bit smaller?
I guess a ref to the interacted rock passed trough the widget should give me a way to start a server event on there controller that changes the location of the given rock for everyone
What is the minigame?
something simple
There is a pick axe Icon that spawn, you need to place your mouse on it, then press a given arrow selected randomly, after 1 sec it check if you pressed the right direction
Then the duration of checks becomes smaller and smaller so that you can mine faster and then dont pay enough attention and fail, and the check duration goes back to 1 second on fail x)
ok so the first question is, do you care about cheating?
But I wanted multiple people to be able to mine the same rock properly, cause ressources will be kinda rare
obviously not since it's a local host project and there is nothing I can do with 0$ budget to make any kind of worth it anti-cheat lol
cheaters will be packet injecting actions as hard as possible lol
I at least made the Icon location random. And colors random so that they cant use a basic Bot to just clic always at the same spot, or recognize colors
In that case, just have the game state live in the widget and on completion, it does a call into the local version of the Pawn or Playercontroller (I'd prefer pawn)