#multiplayer
1 messages · Page 12 of 1
Fair enough. Thanks for taking the time. I will rethink my approach!
Why is it not just a big array of structs?
How many players in total are in play, like 100?
I don't mean in an individual game, but what's the total dataset
when to replicate vs rpc a variable?
Prefer replicate
But it depends
If it's state, replicate it.
replicating variables dont seem to work, i always have to rpc them if its via bp
for example, i have an input action set to true when pressed and false when not pressed, if these bools are set to replicate, when the server checks if there are true/false, it will always be set to true. if i rpc them, it works correctly
this is what i have to do to check right now and its the only way it works
I think I will just use all structs for the most part. My brain was just running into the initial problem of discovering that you can't call UFunctions actually on the structs (so no RPCs directly on the structs). But I think I can just call the RPCs on the structs managing owner AActor, then keep the functionality actually in the struct.
And I have hundreds of teams, with >10 players per team, but I don't think I should have a big problem with this amount of replication, as for the most part the data within isn't changing often.
I appreciate you going back and reading this from this morning, and if there is anything I am saying here that sounds incorrect, I am all ears.
I don't see any replicated variables in the picture. Inputs are fired locally, which is usually client-side, unless you're on a listen server. That's why you need to fire a server RPC before you change your replicated variable. You can't change it before you server RPC and expect it to replicate. The one who has authority over replicated properties is the server
I have a multicast function that i want to call from the server to change all players pawns, what the best way to get the PC in a multicast function? or do i always have to pass the PC to the function with say, a loop for a example?
Changing pawn is automagically replicated
just change their pawn on server
but i need the player controller to call posses right?
how much players can amazon gamelift can handle?
Yes, or have it called through some other means in Gamemode or wahtever. There's a lot of ways to change the player's pawn.
so i am gonna have to use a loop of some sort to get all PC's and change the character then i assume
does polygon matters in multiplayer?
No more than in single player and no, not really. Polys are cheap.
let say i want to make a multiplayer game that can able to handle 500-1000 players
which solution is best?
for dedicated server
You don't do that
500-1000 is custom server or heavily modified engine territory.
If you have to ask, you're not doing that.
I want a solution for that. The game is very simple
the solution is coding your own server or changing UE4 source code
which thing should i change in server or code
also does by using amazon gamelift server solves this problem?
u cant just change things or use an external server to get 1000 players online
its not that simple
its not something any regular person can do
and there is not a service as far as i know for that either
coding a server that handles that kind of simultaneous players is a very hard task
I have a very basic game. I need solution for that
does anyone uses amazon gamelift?
Looking for others' thoughts on this, like if this happens to you and if so what do you do about it:
When you are trying to get something to work and it isn't the way you think that it should. And then you go reset the changes you made and suddenly it works?
Also, @fathom aspen and @sinful tree (sorry if this disturbs whatever you are up to right now, or is random) I managed to get it to work with an Event Dispatcher. I'm not sure if that's the best way necessarily though.
I just wanted to let you both know and wanted to thank you both for your help! 
That's called black magic 
what is best way to host dedicated server over internet?
Do I have to write custom movement modes if I don't apply movement changes via inputs?
if you want them replicated i think you do
I have an asset that has properties of CMC, and I replicate that asset to change the movement modes. I think I can't write a custom mode for each asset
Is there any workaround for this?
I'm thinking about having a subsystem and indexing all of the movement modes, and just replicating an index in a custom movement mode
So I can just bind an int32 to CMC's reconciliaton system
but not sure how it would work
Is there any ways to know which game mode our map is running on the client?
APlayerController::ReceivedGameModeClass
ty
why these functions are not called when you play as a listen server if you modify/add/remove elements from the array?
void PreReplicatedRemove(const TArrayView<int32> RemovedIndices, int32 FinalSize);
void PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize);
void PostReplicatedChange(const TArrayView<int32> ChangedIndices, int32 FinalSize);
Hey, just wondering how this kind of lobby are made. precisly about the camera, is this a pawn? or just a camera on the map?
Because they are called client side
so I need to call them manually if the net mode is a listen server or standalone?
Yeah pretty much like an OnRep
you can do it without a pawn, face the camera where you want, add the background stuff to the level, when a player joins it'll spawn an actor (without possessing it) and slap UI onto it which doesn't even relate to the level
make sense, and what about character order? Like the player always see his character in first place?
You make it so the actors are spawned locally on clients via multicast or via server->client RPC for those that are joining. You'd have to have a means of determining which pawn being spawned is which player, so you'd probably have to pass along a playerstate. If the playerstate == the local controller's player state, then that one goes into the first slot. Others are populated into the slots as the messages from the server are received.
big up datura
I'll try this, thanks man
I am trying to implement an alternate reality, and when one player goes through to the other side, I have a post-processing material on the player camera that changes, however, it does this on BOTH players. I have tried to just add the code to a custom event that is replicated only for client, but it still doesnt work. Any ideas how to make this work properly?
Go get a DigitalOcean instance and have fun.
You'd have to call it only on a single client. How were you doing it before that didn't work?
So I hoped that I could make multiplayer platformer...everything work in editor, but now I found out that packaged game won't find steam session...
I remember that I got this problem in the past, but unable to resolve it...
Tried every obvious Google result...
I use app id 480 but I think that is not the issue, bcs from editor everything works 😦
Can I just do SetReplicateMovement(true) or SetReplicates(true) if I want to replicate rotation of an actor body, or will that differ from doing an OnRep with DOREPLIFETIME_CONDITION_NOTIFY(..., ..., ..., REPNOTIFY_Always/REPNOTIFY_OnChanged) everytime I change my rotation value?
bInitServerOnClient=true is set in DefaultEngine.ini
Here's a question I haven't ran across before. What if I wanted to spawn something on the client, control it completely from the client, but still have it replicated? I know it's counter intuitive, but something I want to explore.
Don't do that, you're just inviting cheaters into your game.
You can spawn something client side and not replicate it, but other players won't see it or interact with it.
Is adding an input delay on a listen server to be half the client's ping a good way to achieve a bit more fairness in high ping situations? Are there any drawbacks to be aware of?
If it's not a replicated actor, then the server wouldn't really know about it, so there's nothing to actually replicate to others. I think with a bit more context as to what you're attempting to accomplish there probably is a solution.
Before the code in the picture, I have a Custom Event Node that is set to Replicate on Owner Client. But it still effects both cameras
What class did you create that custom event in?
Its an Actor BP I created
Actor lol sorry
Just a normal Actor. When the player touches the box collision within the BP, it fires the code
Ok, so that's probably where the problem starts.
- You cannot "Run On Owning Client" on an unowned actor and expect the clients to get it. By nature any unowned actor can only replicate events to clients VIA OnRep variable events and Multicasts. This scenario you wouldn't want to set the owner. You're probably also getting a warning message in your log about "No owning connection for..." in reference to that particular actor.
- The only reason the event is firing at all, is because the OnComponentBeginOverlap fires on the server and all clients. So when the clients see that trigger happening, they are then proceeding with executing the code, including the "Run On Client" event as they can still do so - once one player overlaps, all clients respond to that event, thus causing all clients to end up executing your post process change.
To fix:
- Remove the "Run On Owning Client" event. It's not what you want in this situation, and is not doing what you're expecting it to do.
- Decide if you want this to be an actual replicated event or not. Clients could potentially just do this all by themselves without the server caring if they overlapped or not.
If you don't want it replicated:
- Put a "HasAuthority" node right after the overlap event, on the remote path continue with your logic.
- Right after your ParentCharacterBP, you can take the reference and check if it is LocallyControlled, and if true, proceed with everything else that leads up to the post process getting changed
** If you want the server to tell the client to do it:**
- Put a "HasAuthority" node right after the overlap event, on the authority path continue with your logic.
- You'll need to route it through a "Run On Owning Client" on a player owned class, such as their character or their player controller, and when running on client, lead up to whatever you wish to get the post process changed.
lol Woah! Thank you so much! I am going to go through this now and see if I can follow your steps. I really appreciate it
Cheating is irrelevant for what I'm trying to do, I just want some insight on how to accomplish it.
I want to spawn an actor on a client, give the client full control over the actor, but still have it replicated to other clients.
So that would need to be a replicated actor. "Full Control" cannot be given to a replicated actor, however, if you make that actor owned by a specific player, then you can send RPCs through it, and the server can do what it is you want it to do in order to replicate it to everyone.
You can make a replicated actor that only the owner can see.
form what I understand; simple move to location is NOT replicated through the CMC and custom c++ has to be written. This ue market asset claims they made it work with replication through bp, can anyone vouch for this?
https://www.unrealengine.com/marketplace/en-US/product/multiplayer-ready-topdown-templates
You can move a character in a top-down fashion fairly easily using the CMC which is replicated.
Blasphemy!
CMC movement is replicated, I haven't used simple move to but from what I understand it uses the AI controller, which in turn should use the pathfollowing component to walk on a navmesh, which uses the CMC. So it should already do it
The way I read what the issue is, is that when attempting to use Simple Move To, it is not using the CMC, so it isn't replicated, but it's an easy means of moving something from one place to the other. For example, something like the below examples won't work in multiplayer, even though the "Simple Move To" is what they use in the top down example.
How do I implement a "Drop weapon" (throw it out of inventory, to the ground) in multiplayer? RPC or Property replication or a combination?
Hey guys. I'm currently building several multiplayer systems. I'm about fed up with structs so I've started moving calculated data into UObjects since they can have their own internal functions. I have UObjects nested inside of UObjects, with a really great system for each object to perform procedures on itself and return simplified data to whatever system is requesting it. This has made a lot of systems FAR more reliable, and allows me to keep that code all in one place. The problem I currently have is...UObjects do not replicate... The UProperties inside of them replicate, but the UObject itself does not replicate. This means I would have to build an RPC to tell the client to build a matching structure (The same number of UObjects nested inside the parent). This seems like a really ridiculous solution to me, so I was wondering how others handle situations like this?
It's state so property replication
Always go by this golden rule:
State - property replication
Transient - RPCs
You will most probably have a TArray for your inventory, when you want to drop an item you remove it from the array
As the array is replicated it's removed client-side too, and you can even get a nice callback to tell that client that it happened
UObjects do not replicate... The UProperties inside of them replicate
I don't know how such a thing is possible, but anyways replication is meant for actors, otherwise you will have to work a bit to get UObjects to replicate, which you seem to have done it, but that statement doesn't compile for me
Thanks, WizardCell. It's good to have golden rules!
I previously had, say, the inventory system replicated as a struct. Items have a lot of unique data in them since they are all given random colors, stats, and meshes at time of creation That random data is all created server side and handed down. Having them as nested structs replicated very well, but they are an absolutely nightmare to make any changes to (and we have loads of changes while building these out) and updating their values during gameplay is a pain. UObjects essentially makes those paint points disappear, but I cannot replicate a UObject reference, I can only replicate their property references. I really want to keep this data in UObject format, but I'd like to have a way to replicate them without some pretty involved RPC calls. What do most people use for complex data that needs to be replicated?
I'm not saying you shouldn't use a UObject, but I'm saying that replication there isn't handled for you out of the box. IIRC someone here mentioned that the inventory in Lyra is a TArray of UObjects. Also this is an excellent post in this context: https://jambax.co.uk/replicating-uobjects/
Thanks for the link. I'll take a look at this, it looks promising!
Here you are talking about OnRep_ (replicatedUsing) and the blueprint equivalent, right?
Right
How should I handle the visual dropping to the ground of the actor? In the OnRep_ when an old equipment is not in the newly replicated array? Or in the Equipment when its owner changes?
Maybe that's just handled by the state of the equipment
"I am in no inventory, hence, drop to ground"
(meaning, unhide, add collision, etc.)
(put on floor visually)
Does anything that happens after unequipped matter for gameplay purposes?
Like can it be picked up from the location and which it was dropped or does it just drop and kind of disappear?
Equipment can be dropped and picked up again
If you are using cpp, i.e. OnRep, then that's pretty simple. OnRep(OldArray) and then you can compare the old with the new. In bp you have to make an old array for yourself
Preferrably use a FastArray and you ger per item callbacks
Yeah I saw that there was a sort of "overload" of the OnRep, with the Old value, looks valuable
FastArray?
FastArraySerializer
It's a sophisticated array
I see it more used in cases where your array is too big
So it's a pita to compare whole elements
Define "Too big"
No immediately obvious guide for using it pops up when I search for it. Might look into it though, sounds valuable for a big inventory.
Writing a "TODO: Optimize, look into FastArraySerializer" comment 🙂
ᵘˢᵉ ᵗʰᵉ ᵖʳᵒᶠᶦˡᵉʳᵎᵎ
I'm familiar with FFastArraySerializerItem for more optimal network replication of TArrays' of UStructs. Does TArrays' or UObjects do something similar or do we have to wrap the UObject in a UStruct (i.e. FFastArraySerializerItem) for optimal replication?
i'm trying to build a lobby system, i have an array of connected controllers in the lobby gamemode, how should i relay this to clients so that their UI can show the connected players too?
should i just sync the array with every controller and every client UI reads it from their respective player controller?
or is there an opinionated way
There's a player array in the game state. This is a list of all connected player states.
You can serialize an Array with UObject references as part of your struct using the FastArray...
How ever, the UObject it self must be replicated using subobject replication.
BUT If your UObjects them self don't need RPCs you can also write some custom replication (Very usecase dependend so doesn't necessarily fit your usecase)
Technically you can replicate the properties of your UObject on your own and send it with the bunch and then you just need the object type and some factory to recreate the object and fill it.
But as said, this only could make sense in very specific usecases, so I wouldn't recommend it for the general case, but wanted to mention it^^
Hey guys i'm having trouble with replication, is somebody willing to help?
the project is super simple but i just started unreal so i am not very good at it
very simple idea i have two tanks used by two player you can click it and move it similar to a classic top down template
using the arrows you can rotate the turret and the cannon and i have a spline that predicts the shell trajectory
the problem is that if I move the turret as a client the listen server (or the other client) cannot see that movement
as you can imagine is not only an esthetic problem since the shell will go out based on where the turret is pointing so on the client's screen it goes towards the server tank but on the server screen it goes straight
i have tried both a repnotify and with events but i can't get it to work because of my inexperience
can you show a video, it's hard to understand paragraph long problems
you are right I'll do it now
the models are only for test purpose, i know they are bad but easily fixable that's not the problem 🙂
the problem here is you have the client setting the rotation of the tank
the client needs to tell the server where it's rotating the tank, and then the server can multicast that information to everyone else
it's working on the server because you are calling "Turret Rotation Multi"
because listen server is the server it can call multicast events
clients can't do that
sorry I was in a valorant game. Lost though because my omen went 4/22 in my ranked game
ok thanks a lot for the help, i will try a way to make it rotate from the server
Hey guys. I have a question. Where do you host your multiplayer game? I've read something about gamelift, a dedicated server for games.
Raw Aws instances at the moment. Gamelift is more than just hosting though, it's a framework for managing servers, spinning up in demand, etc.
I'm working on an asynchronous multiplayer game, and I previously was thinking that I might need dedicated servers, but I thought of a different potential solution. I am not quite ready to implement this yet, but I was wondering if I could use a Listen Server setup. In this setup when a player went to login/join a previously joined game, if no one else is online, it could make that player the host. If someone else is already online as the host, they would join as a client. Locally, the player would store save data that would identify which game/save they would need to retrieve when logging in, and the rest of the save file could be stored online (steam cloud or other hosting service that would just host the save files, not the full game). Is something like this feasible and not extremely difficult?
Hey, I've implemented this replicating UObject class from this website https://jambax.co.uk/replicating-uobjects/ (had to make a few updates as some of those functions are on their way out). I've exposed the class to Blueprints where I've made a child of this class for some testing. I've set the actor that owns these to replicate, I've created the UObject on the server with a valid replicating outer reference, and I've assigned the object reference to a variable that is set to RepNotify. The RepNotify is called on the server, but not the clients. I admit I only understand a portion of what's going on here but I was wondering if I'm doing something horribly wrong here? My goal is to create UObjects with a LOT of unique, randomized data on the server and pass those values down to the client. I was previously using structs for this purpose, but they are an extreme nightmare to develop features with. Just wondering if anyone had some insight onto what I'm doing incorrectly here
You definitely do not want to do that. People could send whatever data to your online storage and effectively wipe all player data.
Whats the data being used for?
Would an asynchronous game usually use a dedicated server then? Or is there potentially another way to use a Listen Server setup like I mentioned in the first part of my post, without the stuff about storing save data?
I've had the same problem recently and decided to move to structs as opposed to UObjects, as I could not get the UObjects to replicate correctly/consistently to clients either. I read through some posts here (by the guy who wrote the replicating subobjects article) that said that UObjects have a narrow use case and should really only be used when you need inheritance (I didn't, maybe you do), otherwise use structs.
If you're using a listen servers, the best you can do is rely on that listen server storing the data, which means that you'd always have to connect to that same server (if it's available, since it is a listen server indicating that someone is hosting while also playing). Even if you were attempting to just save for a specific player in the cloud using some means of authentication, that one specific player could still spoof whatever data they may be sending into their save, so then you're opening up a big avenue for cheating.
If you want any sort of data integrity, for players to play any time with that data, and to limit cheating, then you must host the servers yourself.
They could be simple spot instances with minimal power, if that is all it requires.
I use these objects for several different things. Inventory, equipment mesh details, calculated stats, stat modifications on the player, calculated damage and tracking, and a few other things. They all contain structures of data that the Uobjects calculate and store
#multiplayer message here's the conversation I'm referencing
dbd - probably the most popular async game tried to get away with listen servers. It was god awful.
Use that information how you please
That's not an async game.... That's an asym game 😛
#rekt
But, listen servers on that .... yea, same kinda problem.
Yea I just moved FROM structs to UObjects. I converted a ton of systems before I realized that UObjects just simply do not replicate. Now that I've used UObjects, I cannot possibly go back to just using structs, the amount of flexibility, reliability, readability you get out of the UObjects is just unmatched. Structs are just a nightmare to alter and maintain. I'm currently attempting to force replication on UObjects, but if that fails then I may have to just create the UObject on both the server and the client, then replicate a Struct with build data into that UObject. It's a bit more work but it'll replicate fine
Thank you for the help! For now I will gameplan with dedicated servers in mind. Everything you said makes sense.
Hey, I've got an issue after teleporting players. everything all right for the server (of course lol), but for clients, all other players, they are stuck in falling anim state. I tried to use Reset anim instance Dynamics (Informs any active anim instances (main instance, linked instances, post instance) that a dynamics reset is required for example if a teleport occurs), but still same result. Do you have any idea?
Side note, I wish I had found this community earlier. It's pretty incredible how much people are willing to help.
What is an example of how UObject is so much better for you in your use case?
Inventory: You can store an array of objects. Each of those objects can have their own sets of data, but still be stored in the array if they inherit from say an "Item" base class.
A structure based Inventory can't do this. You pretty much have to define all the data that would be present in the structure, though there are ways around this like using map variables or nested array structures that can be used to house generic data.
I several, honestly. I have DataTables that I keep general build data in, then at runtime I pull the appropriate row and populate a UObject. Items are randomized so I have a randomizer that populates all the mesh data, combines the random color data, gets the randomized stats data, and packages it into one reference object. Then I have modifiers that can be applied to those items, and using a UObject literally just means I can add a modifier UObject into the item and the item keeps that upgrade information. Then when I spawn an ability I calculate all hundred or so stats against the item properties and I create a damage object to store all the instanced calculations so I can pass that to all the various systems that read it. My abilities also have the ability to be altered by other players, and UObjects make that a BREEZE to adjust during run-time. I was doing all this with pure structs, but it was an absolute clusterF. Then those abilities contain effects and conditions that apply to the character and they have variable tick rates, damage amounts, damage types, etc. UObjects contain all that data and I don't have to worry about updating a huge series of structs
Hi! i'm trying to apply time dilation effect when i hit a creep (similar to what black desert does on Hit)
Does anyone know what is the best way to achieve this on multiplayer? i can't dilate time for everybody when I hit a creep
Set custom time dilation on specific actors.
sounds good, gonna try it
probably a very noob question but is there a component that i'm certain that is the server? i need to do a multicast and i know that it only works if it is the server sending it, how can i do it?
You make sure you're running on the server when you call it.
You have IsServer as a boolean you can check if you are currently running on the server.
if it can help i wrote before today, I even sent a video of my very simple project
Even for FFastArraySerializer, don't you have to mark its properties with UPROPERTY(Replicated) ?
and also the underlying list entry type's properties that are to be replicated with UPROPERTY(Replicated) as well?
ty for this, i also got an extended answer/solution from epic evangelist, with specifics of how to approach and alter lyra code to achieve possession/unpossession in the most pain free way, i'll try to implement it this weekend and share with community if it works
I would solve by putting the code in the game mode because i am sure it is the server, is it very stupid and to avoid or is it ok?
That'll work, sure, but the thing is the multicast can't be within the game mode itself as it only exists on the server's end.
So what should I do? Is there a way I can create a blueprint that runs on the server? sorry but I practically just started unreal
Anything spawned on or by the server will run on the server.
The issue you have is that replicated actors will have events that also fire on clients.
So you need check the events themselves to know if you're running on the server or not for most actors, and you can do that VIA the boolean IsServer.
ok
Has Authority is another one commonly used, but it's not a great one to use if you're using listen servers.
yeah I checked the IsServer and it was vey useful
so Has Authority basically set what I put after on the server?
Has Authority is a check for if something has authority over the actor, but it's not a good means to know if it's the server or not because if you spawn something locally on a client, they have authority over that actor, not the server.
mm ok
so if i make the game mode spawn something can i use it as a way to communicate between the client and the server in order to make the multicast on the server because of something "asked" by the client?
Has anyone here been able to get replication working for simple move to without just RPCing it or using an AI controller
anyway thanks a lot because i am learning a lot of stuff
that's what i am trying to do lol 🙂
I literally gave you the answer yesterday.#multiplayer message
@sinful tree this is not how simple move to works
It uses pathfinding/navmesh
Honestly, I don’t think there’s a way to do it at all in BP, you would have to make some changes in the CMC code
But I can’t find any examples at all of anyone accomplishing it, all they say is “I did it” without actually explaining how, or they misunderstand how replication works and they just RPCd it or they don’t even use navmesh movement
btw i am not trying to do the SimpleMoveTo ops
i have problem with replicating the rotation of a component of a character blueprint
I don't think you're fully understanding.
The class of a blueprint doesn't determine if it's something that runs on server or not, with the exception being Game Mode which most definitely only ever exists on the server.
Just because it is the only class that exists exclusive on the server doesn't mean you need to use it to perform all server related actions.
Example:
I have a character. On Begin Play of that character, for whatever reason, I want the server to set a replicated integer to 5. All I would need to do in this case is put a "IsServer" check on begin play, and if true, set the variable to 5.
Second Example: Lets say after the player has pressed the "Shoot" button, I want a projectile to spawn that everyone sees. If I proceeded to spawn the projectile off of the Input event, the projectile would only exist on the client that pressed the button, not anyone else. In order for everyone to see the projectile, I would need to do a Client -> Server RPC as the "Shoot" input event only triggers on the client. Once we've RPC'd to the server, we know that event now is running on the server, and the server can proceed with spawning the replicated projectile actor, and everyone can see it.
Third Example: Borrowing from the above example, now I want to play a sound effect when the projectile is fired. We don't necessarily want to do this on BeginPlay of projectile (there are reasons why you don't want to, but I'm not going over that right now), but we can do a Multicast immediately after we called to spawn it as we already know we're running on the server, and that multicast event can then play the sound effect.
Fourth Example: We want a sound to play after a barrel is hit by the projectile. We have an overlap event that we can use, but the difficulty is, this event triggers both on clients and on server. We need to use the IsServer check to know we're running on the server. Once we know, we can destroy the barrel, and multicast for the sound effect.
So regardless of what actor, you can perform networking, so long as it is a replicated actor. It's a matter of you knowing where you're running on the server or not. You have to make your own checks and put the logic in where you want it to happen.
Ok, then what's the issue with replicating it/using an RPC? Just the matter that it doesn't work on player possessed characters?
There is no client replication using this method l, and is essentially the whole basis of the CMC, which does not include navmesh movement. When the ping gets high, you will have rubberbanding because there is no client replication whatsoever using this method/just RPCing
are there any braindead solutions to prevent a physics object from nondeterministically falling through the floor in a networked game?
they don't have nearly enough velocity to be skipping the collision check but nevertheless they sometimes fall through in actual online play (can't repro it in the editor/standalone against myself)
oh that's a good idea
Yo guys struggling a bit, with a flashlight using the control rotation dubbles the pitch movement. And theres not much of an other way to replicate the flashlight pitch 😕
Is there a fix for this?
I know that the DemoNetDriver can be used to record gameplay and playback saved game recordings, or use in memory to do instant replay. But, is there a natural way to use this system to create 'ghost' actors? This would be something similar to the way that racing games have ghost cars of your prior runs that you can race against.
How do I override an RPC? Do I need to re-declare the _Implementation functions?
or is it as simple as doing 'void Client_MyRPC() override;' and I have something else wrong
With _Implementation and it's a good practice to have the virtual keyword at the start
And in case you're calling Super you call it with _Implementation
Here... I figured out a way to allow clients to predictively move between points using navigation data. Probably could use some clean up and you'd probably want to tweak how some of the movement is handled, but it does work predictively using the navigation points determined on the client. It does need you to enable "Allow Client Side Navigation" in the project settings as well.
Whenever I openlevel(this, IP, true, "") my client attempts to open the server IP with the default map path appended. Why isn't it opening the server IP with the current map path like everything I read says it should?
Doesn't sound like it should behave this way
First of all don't travel in PIE
Second of all this:
It shouldn't behave this way lol, I worked through this like a year ago and am now finally at the point of deploying for real world use, didn't have problems back then.
Server is deployed in AWS, I'm running a packaged debug build from my headset
Packaged, heck.
Server is running the map I expect, oculus headset does all the internet stuff to get back the server in question, and browses to the serverIP+\defaultmap instead of the serverIP+\currentMap
I guess there's no real means of validating the server is actually running the appropriate map? Open Level to an IP should just ya know, join that IP at whatever level it's playing at.
the server build is debug too, so I have it sitting on "took xxx seconds to load 'expected map'"
I would assume it's running the right one, theres no change in the logs and it's also the default server map
So when the client is joining, it still just sits on "took xxx seconds to load..."?
no, it gets all the way through its normal processing
sorry didn't mean to add confusion
S'all good, this is decent info for trying to figure this stuff out 🙂
and all my oculus specific processing happens after map load too, so it should definitely be chillin on the server default map and waiting for clients
Any indication in the logs that the client left the server? Like perhaps it's failing to actually join, so then it's getting kicked back to a default map?
the only indication of anything occurring is on client side logs, where it says successfully connected to port 7777 on the default map
it's like the information it's getting back about the server is wrong? I don't know how to better put that.
Game starts->asks oculus for my server IP->pass that into openlevel(ip) and the first level it tries is the default map
and not server map
Ive got a quick question, I figured out that if I want to play multiplayer with people around the US and world in general I need and online subsystem, currently I implemented steams online subsystem, I followed the documentation online to put it in, when I dont package the game and Launch the project, the steam thing shows up and everything, but when I package it and play it doesnt show the steam overlay etc, does this mean that the online subsystem doesnt work when packaged, really im just trying to getit so I can join anyone through the subsystem
Does everything work unpackaged?
yes everything does
did you test this when playing as client?
Yep
id doesnt work for me, only when playing as server
Did you set the allow client navigation in the project settings?
yup, i am getting an odd error though, its accessing none on get controlled pawn
That's expected when looking at the code example
The Controller will not have a valid pawn on BeginPlay I guess. At least not instantly on the client
You will have to check if the ControlledPawn is valid
@sinful tree or anyone could you help me with this? Why character movement not replicated for itself but on server and over network when I use "Simple Move To Actor"?
- You can't use GetPlayerController in multiplayer unless you somehow manage to keep track of all the player indices (it's not worth it!)
- GameMode only exists on the server, so having an event marked as "Run On Server" in the game mode effectively does nothing and no clients can communicate with it.
- OnPostLogin fires for each client that joins the game and gives you a reference to their player controller. I'm not sure why you'd loop through all the spawned pawns and make everyone respossess when someone joins. You can use the OnPostLogin event to actually spawn a pawn for that player and then possess it, otherwise, you'd have to loop through all the pawns, check if they are already player controlled, and if not, then allow that player to possess that one (again using the New Player pin which is their controller)
You need to enable this, then SimpleMoveTo can work on clients.
@sinful tree I'm already do that but it won't work. SimpleMoveTo actually do move capsule. But capsule not rotation and velocity is 0
Hi people, I'm having trouble with servertravel and getting servertravel to work. Seems to only be executing on server. I have the actual consolecommand running inside a server event but I thought the command was supposed to teleport all connected players?
hmm it works in standalone actually, just extremely slow
Hello, I have a question, I noticed that when running multiplayer (Both players client) the character customization does not work, I tried messing around with the custom events and the cast modes but nothing seems to work in my favor, here is my code, any help is appreciated, thank you.
Little question : I've got this replicated properties
UPROPERTY(BlueprintReadOnly, Replicated, meta=(ExposeOnSpawn=true))
ABL_ItemMaster* Item;
.cpp
DOREPLIFETIME_CONDITION(ABL_ObjectVisualiser, Item, COND_InitialOnly);
Sometime, on some rare case, when a player load the map and join the server, the Item is = nullptr for some frame when the actor is created (and the update happening AFTER the creation on the client)
As i need this property to be valid on the actor spawn, how to ensure this ?
Anything that is stateful should be handled through replicated variables with notify (OnRep). You use the generated OnRep function to perform what you need with the variables being changed.
So if you were allowing a player to tell the server what mesh they want to use, you'd need to do a Client->Server RPC with the client providing the server the mesh number, the server then would set the value into the replicated variable, and then the OnRep would set the skeletal mesh based on the selected number. Saves you from having to create a whole bunch of functions for every choice too.
The answer is that when no response is received from the server it'll load default map. No response was being received from server because AWS has an additional network console for port allowances outside of the typical windows firewall garbage
And the other answer is also that I'm an idiot 🙂
Hey glad you were able to figure it out.
Me too lmao
First time this property updates to the client right before PostNetInit is called and that's part of the actor creation cycle. Also it's the function that calls BeginPlay client-side
It's server only and it should move all connected players
You've missed this: https://vorixo.github.io/devtricks/stateful-events-multiplayer/
Yup, but the call of the property is read on beginplay.
So it must be replicated.
The way to fix it for the moment was to re-call actor intialisation on a rep notify of the property, ensure the initialisation is called.
Oh heck I missed the code above. Is Item another actor that you spawn and reference there?
Yup.
Oh then that's not the case.
You can't guarantee it has replicated in time
It's not a subobject
yeah so rep notify i guess.
Correct
Understood, thanks !
fun fact
got the same issue on the Owner of the actor.
I guess it's cause the way actor are spawned on the client, are not hierachical.
Yeah you have no guarantee whatsoever for different actors
It's wild I know 😅
Will that get sorted out in Iris? I doubt
Yeah it's a bit weird
i would assume, AT LEAST, the owner would be replicated with the actor spawn itself.
noticed lag is a hella lot worse in standalone - or not so much frames more like movement snapping, need to fiddle with settings
How would one create a multiplayer game that works over WAN with blueprints for Android?
I know that the players could use the same VPN but Im hoping that there is something similar to the Steam Subsystem for PC
I thought you replied to my Iris statement xD
That isn't even the case
Say you spawned your pawn and then your weapon which has the pawn as owner
You are not guaranteed Owner will be valid when weapon replicates
Usually that is the case cuz you don't spawn the weapon right after the pawn, and so the pawn has already replicated
And you always have OnRep_Owner 🙂
Yeah that what i was saying =/
this player array in game state is replicated right?
i'm trying to create a list of players in a lobby, if this is synced on all clients i can put player profiles in the player state and retrieve stuff from other players to display in the lobby user interface
I have ACharacters possessed by AIControllers, is it possible for them to have WidgetComponent use different Widget blueprint depending if Client's PC is ally or enemy?
Hello!
Has anybody managed to get beacon host and client to connect while using EOS OSS?
I've searched and followed the very limited amount of tutorials / info on beacons and have not yet been successful.
yes
It's not replicated but synced, so yes
Have a an OnRep property on the AI Pawn of it's status (ally/enemy) and when the OnRep is called you access the widget component and update the widget accordingly
I don't get it
it can be ally to one Player and enemy to other
I got 2 teams, I want different over head displays for ally/enemy
get a reference to player's pawn and decide on which widget to show
or the reverse would be better probably
Then you should have the notion of teams set up
the widget switching logic should execute on the owning client i think
no client owns them
server spawns characters
characters assigned team number
how do I get Clients to "see" different widgets?
Have a team property replicated, tied to an OnRep. The OnRep is called for each connection on client. You can get the PlayerController(0) there and check if they are on the same team or not and show the right widget accordingly
It's showing client-side so it will be different for different clients
is PlayerController(0) always current Client?
no other PC's exist on clients
I tend not to use it, but it's one of the few good uses to it
I see, thank you
i'll print cedric's compendium and worship it
On multiplayer standalone testing, if I try to move or resize any screen too early, it causes insane lag and sometimes crashes of clients
nick and question matches
but who is he
Half the room covered with pages 😛
Also I finally have enough storage space to download a source build and build a dedicated server 😂
any great ideas for this case? :
have a dedicated server running a map,
connect with 1 player that is setting his name and then replicating a nameplate to show others on the server their name.
connect with 2nd player, they cant see the name of the other player until next time the name replicates.
Is firing some sort of update event when people connect a good idea?
Other tips?
How are you replicating their name though? Is the issue that there’s a small time frame of probably less than a second where you can’t see their name or is it much longer?
just using a repnotify and updating it in a widget
but i dont have a persistent state yet where i could constantly get a name from, so its fired in 1 event
but that event istn fired for other clients if theyre not connected on the server
so they wont get any updates about any namechanges
I was thinking to make it some sort of event in the gamestate, and on connection to the client fire it
But why do you need a separate event if you already have a rep notify? Once the client connects to the server I assume it passes on the name, from that point forward you can just store that in a replicated variable and then clients that join receive it automatically because it’s replicated.
so its a nameplate that another player is showing to me
and if im not on the server once he updates his name
when i login i dont have this update
cause im not asking for an update on login
if om on the server when he connects and sets his name then its all good
But that’s exactly what replicated variables are for. If I rejoin the server and you have properly setup the replicated variable the server will pass that onto the joining client 🙂
a repnotify only happens if the variable is changed
so me login in doesnt change that variable
unless i set it up that way
It does not for newly joining clients. The server passes that name again to make sure everyone is in sync.
i was printing the repnotify it doesnt update when i login
Can you show what your setup is?
think the issue is that im currently setting the name from a widget on a connected client
then i need to multicast the update in the widget for other players to be able to see it in the widget
i made this test to try and do this from a client
from a widget which has an inputfield
the first event is called from a widget, which is client only
so i use the owner of the widget to make that first call
if other players arent connected when this is fired they dont get any updates
I see where you been all this time...Congrats 🥳
Also I'm booting up Unreal to show what I meant, Belzebub.
May take a few minutes lol.
@twilit radish yes, but do u see the issue here?
I know that I could probably do it differently with a login screen or something and do this in playerstate or something before
I see the issue yes, but that's why I'm saying use replicated variables 😉
but im just messing abuot here and trying to do some stuff
yeah but this is a replicated variable
There's absolutely no need for a multicast in this scenario.
if i dont multicast there then the other client cant see the name
and the first client
can see that name on both clients
on both players
i mean
its as if that variable doesnt have its own instance of itself for some reason
That's why you use the OnRep to get notified whenever it does update, like I said Unreal replicates the variable again to clients that just join. Otherwise it would be absolutely impossible to persist state without so much pain.
yes i understand this
but like i said
client 1 can see that name on both players
because its replicating that variable to both
so player 1 sets the name, and palyer 2 also gets that name
when im using a repnotify only
and then updating it in their respective widgets
and then client 2 doesnt see anything, cause his widgets arent updating anything
I'm quite new to multiplayer and all, i seem to understand the basics.
Every tick i call a function to RotateClientToCursor then replicate the rotation, client controller and client character to the server with a custom event (i don't actually need the controller anymore but i haven't removed it yet) that custom event uses a multicast to set the player rotation and player character.
Is this the right way to do this?
It also seems i'm getting errors even though everything works fine and i can't quite figure out why i'm getting these errors nor what to do about them
(I'm aware these first two are about adding a movement input, which seems to work fine aswell.)
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Add Movement Input Graph: PlayerMovementBrain Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Add Movement Input Graph: PlayerMovementBrain Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue". Node: Return Node Graph: RotateClientToCursor Function: Rotate Client to Cursor Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Return Node Graph: RotateClientToCursor Function: Rotate Client to Cursor Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_ClientCharacter". Node: Set Actor Rotation Graph: EventGraph Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_ClientCharacter". Node: Set Actor Rotation Graph: EventGraph Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Add Movement Input Graph: PlayerMovementBrain Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Add Movement Input Graph: PlayerMovementBrain Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue". Node: Return Node Graph: RotateClientToCursor Function: Rotate Client to Cursor Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue_1". Node: Return Node Graph: RotateClientToCursor Function: Rotate Client to Cursor Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_ClientCharacter". Node: Set Actor Rotation Graph: EventGraph Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_ClientCharacter". Node: Set Actor Rotation Graph: EventGraph Function: Execute Ubergraph BP Player Main Controller Blueprint: BP_Player_Main_Controller
Hey does anyone know off the top of their head if structs replicate data that has not changed? If I have 10 variables and I update 2, are just the 2 updates sent or are all 10 variables sent?
Just the 2
They don't replicate atomically unless you make them so
Just don't use the editor
Launch standalone from cmd or uproject
I'm guessing you're just getting a small burst of these errors but then it stops?
Player Inputs Name > RPCs To Server the new Name > Server Sets w/Notify Variable > OnRep function is used to update the widget.
No multicast required.
So if another client knocks you back (i.e. LaunchCharacter), is there anyway to have the local client do so without network corrections? Or is that just impossible since the local client cannot predict it?
Yup i think so
Rather than using GetPlayerCharacter, use Get Controlled Pawn. As this function requires you to have a possessed character, it's likely happening that your character isn't replicated yet when this function is firing. Use an IsValid check on the controlled pawn before calling the function.
wow ur so smart
i honestly didn't think about that lol
but it makes sense
What ini setting do I have to set to stop the game client from almost instantly disconnecting because I hit a breakpoint in the dedicated server?
I am in there for like 5 seconds and the game client disconnects
I'm having problems debugging my animations in a multiplayer game. I have a Blend Poses node that thakes an enum to switch between different animations. When I switch debug object to either client or server version of the problem character, either seems to have value "3" which is the correct enum value. The animation is wrong though, and if I unplug the variable enum input and just "hard-code" it to the correct value "3", then it looks correct; it works like it is supposed to.
Is there a way to get the actual value out of a server animation blueprint while playing as the client?
Oh yeah, I also wouldn't pass the character/controller through to the Run On Server event - the server already knows the controller (as it's the object you're working on) and it can retrieve the controlled character from here. If you allow players to pass in whatever character they want in the RPC, you're allowing the player to tell the server to rotate whoever the client chooses as someone with knowhow can spoof the RPC call.
this would be better right?
Probably not. What's connected in to the SetActorRotation?
Here's the thing...
Your controller only exists on the client and on the server, so other clients aren't aware of other player controllers.
So a multicast in a player controller effectively does nothing other than fire on the server and the owning client.
i mean it seems to work but honestly i don't understand half of the things ngl :/
it makes sense but it doesn't if you get me lol
Well, if you're setting an actor rotation on the server, that usually replicates down to everyone else already.
You're setting the character rotation.
So that would get replicated.
But there's no real reason to do a multicast on tick then.
Normally input goes:
Player Input -> Client->Server RPC -> Server Does stuff.
So if you want to, on tick in the player controller, do a HasAuthority>Remote path, and do a Server RPC with the desired yaw input (from the part in the below screenshot). Then the server handles the rest on its own. Also make sure you're not using GetPlayerCharacter when running on the server as then you're referring to a specific character, if you're in the controller, you can just use "Get Controlled Pawn"
Should look like this:
Aaaaand after testing it, even that doesn't work. You'll need a multicast in your character 😛
haha
ohhh yeah i'm stupid
Then instead of has authority, use is local player controller (true) or is locally controlled (true) in order to execute things you only want executed by the "clients" and the listen server host.
This is here just so that the server isn't also running the same tick function on everyone's player controller.
So, just joined project to help with general programming stuff and I have the AWS EC2 dedicated server running and in an attempt to connect, I show now logs or network traffic.
there are my client logs from the packaged build I was connecting from. It is odd since it seems to be calling the proper port and public ip of the dedicated server on the ec2.
Logs from the server show nothing odd or even a sign of a connection attempt. Been looking at the bug for a couple hours and no luck; AWS connection traces come back positive form gateway to instance.
Probably firewall issue / ports not properly forwarded?
My main AWS/UE4 experience is with GameLift, im very dated on the new setup for the EC2
ahh possibly on my end
nah, knocking down my security did not work :/
ty for suggestion though
What about on the EC2 instance?
firewall disabled, still the same output log of a timeout
The server's IP is reporting port 7777 is closed.
It is just a standard EC2 instance? It's not through gamelift, right?
And is it a windows or a linux instance?
windows standalone ye, was set up by the previous dev
You probably need to configure the instance itself to allow connections to port 7777. I can't really guide you to it, but it would be in the AWS EC2 instances manager. I know it allows you to add a security group that allows you to set up what ports are opened when launching an instance.
Like I can add this port here (though I think its UDP, not TCP you need to use)
hello guys,
I'm having fun working on a Node / socket.io server these days. Most of the things are working fine.
One question I have is:
I have a train moving that should be sync between all players
Have a timer server side that keep track of the train progress.
When connecting players get the actual position of the train.
My question is should the train be a sequence / a a spline (with a timer event) ?
the sequence is a good option but framerate is quite varying between pcs I guess
I have a question regarding fast TArray replication hopefully someone might be able to help me with. I setup my 2 structs and everything works great. When I call MarkItemDirty() after adding an item the PostReplicatedAdd() method is called. All good until then.
The TArray is inside a struct and is normally replicated:
UPROPERTY(Replicated)
FLWDInventoryList InventoryList;
This works all great.
Now my question is: Can I have a replicated TArray of structs with the fast TArray replication? Basically just instead of one struct that is replicated do this:
UPROPERTY(Replicated)
TArray<FLWDInventoryList> InventoryLists;
My main problem here is that if I now update one struct and call MarkItemDirty() the PostReplicatedAdd() will no be called this time. Even if I force a replication on the TArray of structs by changing any other member variable.
I did search for the problem and I found a lot of questions and answers about fast TArrays but unfortunately nothing did really answer my question yet. At least I am not aware of it.
https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Engine/FNetFastTArrayBaseState/
===================== NetSerialize and NetDeltaSerialize customization.
You can do what's said in NetSerialization.h. FTR is already an array of structs.
Any maneuvers to what is said there will probably end up in things not working as you want. For example if you look at the callback functions signatures they are expecting a struct and you are giving them an array of structs, so I have no idea what you're expecting there.
I think I read that differently. Do you mean you want an array of FTRs?
Yeah exactly. I am not quite sure of that kills the purpose of fast arrays in the first place...
I am building an inventory similar to World of Warcraft where you have bags. So my first approach was to have a fast array struct for each bag
I can see it as you only want to encapsulate a bunch of FTRs together but I'm not sure what's the purpose of that
But now that I think about it maybe that's a bad idea all together. If I just use one fast tarray with a flat list of inventory items and the bag and slot index inside the struct I can easily populate the bags as well. Maybe I was over engineering that
Right. Much simpler approach, and much more maintainable. I'm still wondering why you didn't get callbacks 
I get the callbacks if I just replicate one struct. If I access the struct within a replicated TArray I don't get the callbacks. This is what I didn't understand. Basically I call something like InventoryItems[0].AddItem(itemToAdd) and within the AddItem function I call MarkItemDirty at the end but the callback is not firing.
Doesn't matter now. The new approach is much cleaner as you said.
thank you for making me overthink this
Hi everyone, I have a oculus game in development. Can I destroy the session simply when the user exits from the game or do I have to create an exit button? Thanks
I mean, ideally both I guess? You probably want to if possible always nicely clean up the connection / state. People can force the game to exit but a nice quit button is also good to have (maybe even necessary? Meta/Oculus have certain requirements for apps, might want to check that out!)
Question. I noticed it is possible to join session even if it is full (simplest way to reproduce is find session when not yet filled and then wait until it is filled by other players). How to deal with that?
Hello everyone I have a question about OnRep_Playerstate in APawn. If I add a variable called TeamNumber to my Playerstate, how come OnRep_Playerstate isn't called when TeamNumber is replicated ? Is it possible to force to call OnRep_Playerstate once TeamNumber is replicated to all clients ? Thanks guys
Replication question: if an Actor X is replicated and contains several replicated properties inside, and a client joins later (so, a late join scenario), when X is spawned on the client is it guaranteed that ALL of its properties are already replicated and valid?
Suppose X has a "InitialOnly" replicated property: in the BeginPlay() can I safely use that property knowing that a late joiner will have it filled already by then?
Because TeamNumber replicating doesn't mean the PlayerState has finished replicating. OnRep_PlayerState will fire when PS has finished replicating and that NetGUID can be resolved into a replicated actor. And anyways how would you access a property on the PS if not by the PS pointer?
That is usually the case for POD types. But say you have replicated pointer to an Actor, you can't guarantee it has replicated when BeginPlay is called. That's why you need OnRep for such case.
hello, i'm getting this warning in logs when trying to open level & the level never loads : [2022.09.04-22.11.04:375][686]LogNet: Client netspeed is 100000
[2022.09.04-22.11.04:409][687]LogNet: Join request: /Game/Maps/ThirdPersonMap?Name=kingkostia123?SplitscreenCount=1
[2022.09.04-22.11.04:411][687]LogNet: Join succeeded: kingkostia123
[2022.09.04-22.11.04:411][687]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:442][688]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:474][689]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:508][690]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:541][691]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:574][692]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:607][693]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:640][694]LogReplicationGraph: Warning: No Replication Lists were returned for connection
[2022.09.04-22.11.04:672][695]LogReplicationGraph: Warning: No Replication Lists were returned for connection
anyone have an idea?
Ok thanks for your answer I think I pinned down my issue
also how can I get the playerstate that just got replicated ?
PlayerState
Oh it's private then you need to get it
You already have the function there
Yeah but if I have a few players
each instance of Character is gonna call this with their own Playerstate no ?
Correct
that's my problem 🥲
I don't see it
well when onrep_playerstate is triggered on each client for one playerstate
each client is gonna call SetPlayerTeamSkin with their own player state instead of the one who just got replicated ?
Or am I misunderstanding how OnRep works
maybe i should mention that I want to compare the client's playerstates between each other
The pawn will call it with the PlayerState that is spawned by the PlayerController that possess that pawn
OnRep is called for each connection unless you have conditions
Maybe you should mention what are you trying to achieve
Like from up top
okay i'll explain
so my game has 2 teams
when you enter you're greeted with this screen
this will assign you to a team and i'm trying to outline the teammates in the world
so to do this I need the team number
which is stored in my player state
this is my code for the teamNumber in my player state
after the ForceNetUpdate it calls the OnRep in my character again
so thats good
Then in setPlayerTeamskin i wanna compare the controllers playerstate team with the playerstate that just got replicated
and that's the part where i'm not too sure
hope that makes sense
If you're OnRepping the playerstate, that's happening on the character that's had its playerstate replicated. From that OnRep you can do whatever you want in regards to that particular character, and it'll happen on all clients for that character.
I see so i'm only doing it for one ...
any idea how to compare that playerstate with all the other characters ?
You don't need to.
oh so what I did is correct ?
I join the game, my playerstate gets replicated. All clients receive the OnRep for my playerstate on my character.
okay
Similarly, I would receive the OnRep for everyone else's playerstate, so then I run the OnRep for all their characters.
yes but I don't see how that solves the comparing part
The more important question is why do you think you need to compare this playerstate with another one?
In order to differentiate the players between the 2 teams so that I don't show an outline on an enemy player
How do you track teams?
I have an int in my playerstate that I assign once i click on either of the buttons above
these ones
You don't need this OnRep then. You need an OnRep for that property in your PlayerState.
yeah I thought about that however there's a problem
it's gonna be too early and the character won't be instanciated by then
You're going to find that there's a ton of correlation to the functions you'll call in OnReps and on Beginplay. Basically your PlayerState has this value, you set it. This needs to call an OnRep that gets the PawnPrivate and calls the skin function on it. The PawnPrivate OnRep probably needs to do the same, and the character's Beginplay and it's PlayerState OnRep also probably wants to try to grab the PlayerState's team value and set it. All four of those functions will cover most cases of the data arriving on client in various ways and eventually you'll end up with the correct view.
okay gonna try and cover these cases, thanks for your help !
I just don't understand why onrep_playerstate isn't called when one of it's variables is updated. Or why there isn't any way to force it to update
like a second time I mean
The OnRep is per property. The property for OnRep_PlayerState is a pointer to the player state associated to that pawn. So this pointer isn't going to change until the playerstate is destroyed, or it's set to something else on the server and then replicated.
okay that makes sense
if I add a delay everything works but I feel like it's kind of a cheap solution
PawnPrivate is not replicated, but synced. It's set client-side in Pawn::OnRep_PlayerState. Was amazed to figure that out a while back 😄
Oh. Huh.
There could be cases ofc as @kindred widget said, but I guess the said function covers them all. Considering OnRep is called for each connection, I would do the comparing part like this:
GetPlayerController(0).PlayerState.Team == GetPlayerState().Team
That's ofc inside Pawn::OnRep_PlayerState @mild urchin
I would stick this logic to the pawn as it can become not relevant
Also be careful with GetPlayerController0 if you're running Listenserver with seamless travel.
Landmines everywhere.
Haha right right
well to be honest @fathom aspen that's already what i'm doing
You are not
yeah haha got trapped too many times with this already 😉
Thankfully getting the local controller from GameInstance is safe.
but that's what I do in setPlayerTeamSkin
does it make a difference ?
Nope. But we didn't see what you did there so I supposedly said you didn't ^^
You could show us ofc
true sorry should've mentioned
Personally. I wouldn't even pass the playerstate. The pawn has all of the information it needs to update itself. And I would also advise making this a BIE call. Blueprint tends to make it easier to designery stuff.
give me a sec i'll show you
for now i'm simply printing the team number and it is incorrect without a delay
You don't need a single RPC here.
What this has to do with what I asked for 😄
then i misunderstood what you were asking for
You asked for the comparison part. Here you got it
alrighty
void APawn::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
if(GetPlayerController(0).PlayerState.Team == GetPlayerState().Team)
{
// set outline here on the `this` pawn
}
}
Realistically I don't think you need to call this anywhere other than the playerstate's OnRep_TeamID, and the pawn's beginplay. Pretty sure it'll cover most cases.
can we agree that this =
?
Why are you printing?
Correct that even covers relevancy
to make sure it's the correct team ID before i go further
Nice. What it's telling you?
well I get 4 calls for 2 players and only one of them seems to randomly work
okay I wasn't too sure if the controller could be accessed from the PState
It can, but it doesn't need to be here.
That has nothing to do with what I posted though. That has to do with how you set up your teams. Double check that
I can check sure but i'm pretty sure it's okay
controller calls gamemode
gamemode sets teamNumber
then playerstate
this is probably useless but anyway
You can't expect us to spot the issue from a bunch of screenshots that have been cut. What you asked for has been given to you and from a bunch of different angles. See the debugger and never say I'm sure about something
Printing stuff doesn't help much
Well, part of the issue is that OnRep_PlayerTeam() needs to not ForceNetUpdate. As this is not on the server, so pointless. But instead do Cast<MyPawnType>(GetPawn())->SetPlayerTeamSkin()
I was simply replying because I need help and i'm not ashamed of that
Ofc but learn to use the debugger
if (AMyPawnType* MyPawnPtr = Cast<AMyPawnType>(GetPawn()))
{
MyPawnPtr->SetPlayerTeamSkin(this);
}
That needs to go in OnRep_PlayerTeam, replaced with your Pawn class name.
okay gonna try that out right now
amazing that works 😄
I didn't expect my pawn to be ready by then but awesome thanks !
Which is why you should put the same function in your pawn's Beginplay.
yupp was gonna do that straight away
Beginplay will run whenever the pawn is spawned on a client. This includes if the other player runs out of range, which destroys the pawn from relevancy, and then they reenter range. Can happen multiple times over the course of a game even if the pawn is never actually destroyed on server or other clients.
Tf no way seriously? That's crazy didn't know this
Yep. 😄
That's why you tend to call the same functions on Beginplay as many OnReps.
Unless you make your pawns always relevant 
hello, question: I have a "UnitHandler" actor that i spawn on server from GameModeBase that I want replicated on all clients. if there are 4 connected players, each client's Level should have 4 "UnitHandlers". However, I want each client to be able to locate it's "owning" handler. ideally 3 of the UnitHandlers will have LocalRole set to SimulatedProxy, and the owning UnitHandler has role set to AutonomousProxy on each client box. Any ideas on how to do this?
nvm. figured it out
Hi! in your experience, is it worth doing Niagara System collision for abilities? or just go with actor mesh? (On a multiplayer setting)
Niagara collision means you're using a CPU sim instead of GPU. For my game I'm mostly CPU bound when there's bots playing otherwise GPU bound on levels when playing alone. Characters consume CPU more than they consume GPU so I prefer to keep all of my particles as GPU and handle collisions using the capsule collider to minimize the amount of CPU time spent overall.
Ok I've been pulling my hair out all day with this. After building and publishing my game on steam, everything works! players can invite friends, and friends can join. Even on standalone I can load into games with Find sessions advanced. But for some reason after being built on steam you can only join off of friends presence and steam invites, but cannot join from "find sessions advanced". I cannot find a single video or forum post that addresses this specific issue, I have found ALOT for similar issues, but not this one. If any one has any pointers, or even a resource that would help me figure this out I would love you thank you :3
I'm using
blueprints
UE4.27.2
Advanced Sessions
Advanced Steam Sessions
DefaultEngineINI settings have been sextuple checked
My games unique App ID in the INI
Up to date Visual studio 2022
2 different PCs with 2 different steam accounts
Anyone have experience with VOIPTalker?
I have it working with Advanced Sessions (Using EOSPlus+Steam) but the VOIPTalker only works if I don't log in to Steam.
Once playing with Steam logged in, it breaks. Any ideas?
how do MMORPGs and multiplayer games with dozens of players handle projectiles?
The first question you gotta ask is: do you really need projectiles?
if the answer is yes, then you might want to ask yourself on-going questions like
how many projectile weapons do I have in my game?
what is their rate of fire?
if you don't have many projectile weapons then you might get away by using actors as projectiles
this is the model employed in fortnite, pretty much
the same technique can be used in case your weapons have a not so high rate of fire
it will be totally okay for you to use actors as projectiles
buut
what if your game is made out of projectile weapons with high rates of fire?
this solution will likely not work for you
and you'll need to invest time in another solution that handles projectiles as data
in a centric system, in which one single manager would hold the simulation of your projectiles
the next step is finding a representation for the data in the wold
i've seen people in the past using meshes, niagara particles, and a bunch of other representation methods
one technique that might become highly popular in unreal for projectile systems is using #mass
mass is Unreal ECS system and enables centric processing over cache aligned data
we do have a projectile sample in the MassSample project
more to come in Unreal 5.1
To learn more about mass: https://github.com/Megafunk/MassSample
@pallid mesa my game will have a high rate of fire, with many actors firing
is there any documentation on best methods for this
maybe only spawn the actor on the owning client and vfx the server projectile?
also, is this issue only if the projectile is replicated?
Did anything change about BP OnReps in UE5? I have an OnRep for an FString and in that I call a function that sets the OnRep (On the Server) to the same value, and it infinite loops.
Should the second call stop cause setting it to the same value should not call the OnRep?
I can prevent calling the OnRep, that's not the problem, but wondering why that suddenly shows up
I'm not sure if this is a UE5 exclusive but seem to explain what you're facing
Conclusion: C++ 😛
I would use a setter and check if the values are equal.
Just do that generally for every variable...
Also does anyone know what happened to the async physics tick system in UE5? Is that still planned for a future release?
Or well.. Planned to be developed further as from what I understood it was rather a WIP?
Would be really nice to have for multiplayer stuff 🙂
Not that I'm following the news. Can you provide a link to what's that? 
They at some point announced to have an option with the physics engine for UE5 to run at a fixed interval, which for MP stuff would be amazing as you don't have to struggle with the madness of delta time. However they took the slight documentation it had down at some point and I've also not heard anything about it any more.
But let me see if I can still find a link or video or something.
Yeah this was talked about a while ago here, with the expectations being so low in regards to that xD
Of it ever getting finished you mean?
Yes
🥲
Considering that the engine was not built from the ground up to support it 🥲
They had code for certain stuff in the ue5-main branch, but most of that has never been into a release branch.
This is all I can find about it regarding from Epic: https://portal.productboard.com/epicgames/1-unreal-engine-public-roadmap/c/381-asynchronous-physics-simulation
It's not some kind of holy grail yes. But it would have been really nice regardless for certain stuff as rollbacks.
This behavior also serves as the foundation for networked physics, as it allows the server and its clients to tick physics at the same rate, making it easier to synchronize the results.
This though 😍
That's what I meant yes xD
Wow that's amazing. We can always pray and hope 
Also I'm finally starting the insanity of trying to get a dedicated server to run 😂
You can have a trip for two weeks and then check back on it
🤣
Epic will make their steps after this 
It's been downloading for a good 40-50 minutes now already yeah.
I was tempted to do it honestly x)
Also did anyone see the blog post from Valorant with how they tried to remove wall hacks from their game? I think it was a pretty interesting take on it, although I have absolutely zero clue how well it works.
The fog of war one?
Yes.
I'm not sure.
You can trace it up
Seems like they pause replication (instead of making them non relevant) for players that are behind walls
That was my takeaway from that conversation but I have to dig deep in it
Maybe to prevent having to constantly reconstruct the player I guess.
Yeah seems like that comes in costly
I don't think building the engine source is going to finish before I have to work lol.
A clean download of the engine binaries is currently 3-4gb, which may take some time to complete. Subsequent checkouts only require incremental downloads and will be much quicker.
Oh I was on 4.27 docs, they just removed that in the UE5 docs 😂
Good if they removed it at least heh
To be fair I don't blame them, I wouldn't want to update nonsense like this each release as well haha.
Though you would be amazed to see such things exist: #cpp message
UE5™️
Unless it was something they messed up recently, I wonder how this hasn't been fixed all this time.
Lol yeah
I really wish they would improve the docs honestly. I know it's a massive pain but it's sooo extremely useful for everyone.
It's like they put the doc of another function when they don't know what the function in question does?
Then we always have this as well.
That's something I rarely notice xD
I have a file on my todo-list with some of the non-sense typos like that I plan on hitting them with in a PR eventually
My past experience proved they accept such PRs 😛
Yeah maybe in 2080™️
When i package my project and try to "Load Stream Level" its never found.
Failed to find streaming level object associated with 'CharacterPreview'
I've already tried adding to the DefaultEditor.ini -
[AlwaysCookMaps] +Map=/Game/ProjectName/Maps/CharacterPreview
also adding it to DefaultGame.ini - MapsToCook.
Even when enabling option to cook everything.
Also when setting streaming method to Always Loaded.
I am using dedicated server build with UE5.0.3 stable branch, but that level should be loaded before connecting to the server. Am i missing something? In PIE everything works as expected.
Hey what where would y’all suggest to start researching implementing multiplayer?
i want to know more about those Event Containers, as it was a pain to repeat missed multicasts after actor gets into relevancy
i wish it was more than one sentence
Check 📌, especially compendium
What are the rules when connecting players who are running different versions of the same game?
If I package two versions of my game: one with a blue cube and one with a red cube, then we can still connect and we will see whatever colour corresponds to our version.
Does this behaviour scale reliably? If I were to package a game with RHI on DX12 to utilize lumen for lighting, but then package another version with DX11 and basic lighting (maybe with light bakes too), would we still be able to connect?
If I spawn an actor from another actor then replicate the spawned actor from within the spawning actor, does that just serve to replicate the reference to that object, or does it do more? I assume I would still be responsible for replicating the spawned actor's properties from within that actor.
That replicates the actor not the reference to it. Replicating the reference is just an easy means to find it client-side
Otherwise you have to find it
Replicating the reference is what I want to do, but I'm not sure by your message whether I am doing it correctly right now. Right now in the spawning actor I just replicate the pointer to the spawned actor. Is this correct for replicating the reference, or is there another way?
Awesome, thank you, I have both the spawning actor and the spawned actor set to replicate.
The spawning actor doesn't have to be replicated though
Imagine the GameMode is spawning Pawn
But if I want the reference to the spawned actor to be able to found client side, wouldn't I? Essentially if I want to put the reference to the spawned actor into GetLifetimeReplicatedProps and have that replicate, I would need to replicate the spawning actor, right? By your example, if I wanted the client to be able to access GameMode->Pawn->SomeProperty, I would need to replicate both GameMode and Pawn (just for example since GameMode isn't on clients)
Thanks for your help!
will i run into server load issues if i spawn actors frequently through multicast RPCs?
the actors will not be replicated
not server load
but... everyone's load, so yes, but please use the profiler
🤣
And you can never know if you don't try it and use the profiler
🤣
Hi there, I am still learning multiplayer.
I was wondering if I call a Server_CustomEvent from another Server_CustomEvent does it cost me any network.
Is unreal engine smart to check if it's server to server it just a function call or it follow the function type to RPC call to the Function.
Thank you
Noted, Thanks
Hi guys I want to ask something, can I create custom rooms where I can set the number of players can play on dedicated servers?. Or correct me if my approach is wrong. Please help me it's so urgent please also give me a direction how can I achieve it please.
Steam has it's own dedicated server or I have to set up a machine for that.? Like aws provides us the servers, Can we do it with steam?
Im not to sure about this but I beleive you can set up the steam online subsystem to work with your project, enabling the use of online sessions etc
A dedicated server runs as a single instance of the game. There is the possibility of having multiple worlds loaded and running at once, but it's not directly supported by default within the engine and I doubt running multiple multiplayer worlds would be something that would easily be done.
Generally speaking when games have things like lobbies, you're usually using an online subsystem, like Steam. These subsystems just provide a means of matchmaking - finding games that are running or are looking for players.
You can allow servers to start their own sessions through Steam, but the server needs to be hosted somewhere, either by hosting the server yourself, through hosting services like AWS, or allowing players to run their own servers.
Thank you so much. I really appreciate it but I don't understand the multiple world thing. Can you please explain it again?
And one more thing how can I allow servers to start their session please guide me if you know. Or you can give a direction. Thanks in advance.
A World in the engine is effectively like it's own instance and it contains only information pertaining to itself. So you could have two worlds running in a single process, each running their own level, game mode, list of players, actors, AI, etc. and they are separate, completely unaware of one another (unless you make them be aware of course!). Actors spawned in one world wouldn't be available in another. There's a plugin on the marketplace called MultiWorld (it's really expensive!) that could help facilitate something like this, but if you look it up it can probably give a few better examples of what is happening.
As far as having servers host the session, I'm not super well versed on it but I've looked into it a bit, and it seems it can be as basic as on Begin Play of the Game Mode you register the session, and when you want a player to find the game, you either make external API calls or use something within the engine to look up the sessions and display them to the player so they can then select the session they want to join, and then you make their client join it. #online-subsystems would probably have more info.
So it ends up acting like the server is saying "Hey I'm here, come play" and a player can select "Ok I'll play!"
Thank you so much. Thanks a lot, it gives me a way much better idea to improve my approach.
@sinful tree Can you please guide me on this.
Not really as I haven't really implemented it myself - I've read about, that's about it. Check the #online-subsystems channel and its pins, I'm sure there's lots of info in there about getting it working.
OK thanks a lot.
Hi guys i'm attempting to move my player character (client) on the server side, authoritatively ignoring the player, using the character movement component, i have been trying different functions and making a custom movement mode but no luck, can someone point me in the right direction ?
Is it normal behavior that an Entry Map loaded on the client at the beginning before connecting to the server will not render? I ask because I can only see my login UI, but no 3D content, once i Open Level, connect to the server everything renders fine. This only happens after packaging, not in PIE.
What about it doesn't work?
@ wizard, remember me for how I was 🥲
You really don't even need to build that many things
You can cut it down to ~3500 by just not building the things you don't need
You expect too much from me. This is the first time I'm doing this 😂
We should do one big party when this is all done 
I'm struggling a bit with RPCs on an AI. The server triggers something that requires an animation, so I'm trying to run an animation on owning client, but there is no owning client. The only hack I can come up with is to, in my AI, save a ref to a player controller, and call RPCs off that player controller to do everything back on the AI
That seems overly hackey, whats the right way?
Non-player owned actors can only multicast or replicate their variables.
So if you need to communicate with a specific player, then you'll have to either assign that actor ownership (which may not be what you want to do if multiple players can perform the task at once) or Server->Client RPC through the player controller/character of the player that you're trying to interact with.
As I was typing I realized I dont really need it to be run on owning client. I suppose the animation running on server would just replicate right?
or is the anim multicast?
You can try it. If it doesn't work, multicast it.
Hey folks, does anybody know how stable the 'duel process' PIE mode is?
I'm getting some really nasty errors on subsequent runs, but only after editing/re-saving assets.
LogNetPackageMap: Error: GetObjectFromNetGUID: Failed to find outer.
To me, it sorta smells like UE4 isn't properly cleaning up the process, between subsequent runs...?
I can "fix" this issue loads of ways:
- Don't use 'dual process' PIE
- Restart the editor
- Play in editor multiple times, but always do it sequentially, without editing assets
Yes
In this case, I was testing Play as Client, 1 player, and I unchecked Run under single process
Here is the description it generates for me (interesting design choice haha...)
In the NetMode dropdown I'm selecting PlayAsClient not PlayAsListenServer
Alrighty, I gtg though. Thanks so much for your help, I will look into that tmrw.
can anyone tell my how to add multiplayer to my game because im new and want to make a multiplayer game dm me if you can help please
i use ue4 version 4.27
That's way too broad of a request. Find a tutorial to get a basic understanding. And always consult the Bible: https://cedric-neukirchen.net/
The network compendium
Does anyone know how I can rout sound from VOIP to sound bus?
Is there any way to get notified when the playerarray has been copied in the gamestate?
I have a lobbymap that players connect to with a lobbygamemode & -state. The gamestate calls an event whenever a new player logs in or leaves, and the UI for each player gets notified and updates, that works fine.
My problem is that when a client joins an existing lobby, the playerarray in the gamestate on that client is not yet populated when that players' UI is initialized, so all the players that are already in the lobby are not shown. If I use a timer and wait half a second to initialize my UI then it works fine because by then playerarray is populated, but that's obviously a terribly ugly solution.
Are reliable RPC's guarantee to arrive in order regardless where they're being called from i.e) A RPC called via player controller and called via an actor ( which from my understanding goes through something called an UActorChannel? )
Only on the same actor are reliable RPCs going to come in order.
just so i can read up and understand it more, where did you get this info 😮
and also how would i ensure certain RPC's are in order if they're on different actors ( if there is a way )
Just through shared knowledge, posted in various places. Part of the reason why is because of what you've already found: the UActorChannel. This is the object that manages the replication for a single actor, and it handles calling the RPCs for that particular actor. As each actor has their own UActorChannel each are responsible for their own RPCs, thus, you can't guarantee order of reliable calls between two actors, but within a single actor you can.
oo cool thanks for the info 😄
what channel does player controller rpc's go through then?
It would go through an ActorChannel created for the PlayerController.
Could you use an OnRep for the playerarray that just initializes the UI once it is replicated?
PlayerArray isn't something that's replicated, it's managed locally.
The PlayerArray that unreal uses in the gamestate isn't replicated sadly, PlayerStates simply add themselves to it once a player joins
Funny thing is, there's actually an 'AddPlayerState' and 'RemovePlayerState' method in the gamestate that you can override, and they get called correctly! However, at the point where the playerstates add themselves to that array, they're not properly initialized yet, so they dont have the playername set etc., which means they're useless to me at that point...
yeah this
If anyone has any ideas hit me up, I've been scratching my head at this for a while now
Are there any On Rep functions in the player state class itself that you can override to get that info and update the remote machines via order of execution when it becomes usable?
Hey so anyone know the basics of networking? Im trying to figure out how to set up live link for my phone but my pc has an IPv4 for adapter 4 and 6 one for a private network and one for a public network. Im at home so Im not entirely sure which one my pc identifies with over the ethernet so I can put it into live link
Im smooth brain and new to this if that explains the basic question to you guys who I assume are well experienvced

Sorry to ask, is this for virtual production stuff? It might be better to ask in #virtual-production if that's the case (I know you asked in CPP, they should have known to ask that question first before sending you here to the online multiplayer chat which is a whole different ballgame)...
Also here is some documentation on live link: https://docs.unrealengine.com/5.0/en-US/live-link-in-unreal-engine/
Haha ill go there then, but yeah ive read through the documentation but I can't seem to get it to work and wanted help with it so ill go there now :D
Yeah sorry to ping pong you around channels, I personally don't have much experience with live link but I know it's related to virtual production stuff...
Can I have one actor be the "network channel" for multiple other actors?
Hmm, that's not a bad idea, I could hook into the onrep playername, I've employed an ugly fix for the time being because I'm running way behind schedule, but I'll revisit it and try this, thanks
Sort of as a manger? If so, then yes but not directly using actor channels probably a layer higher where your setting the owning actor and stuff like that, and example of this would be how player controllers work with pawn's and player states(since player states can also do RPC's due to their owning player controller)
Hmm. So an owning actor can handle all the networking?
Yes, check pins
This only works for preplaced actors though
Hmm
Actors spawned at runtime needs a bit more work
Yeah mine would be runtime
Unless you make them replicated which defies what the network manager is responsible for
Zlo explains how it's done here. You can read through: #multiplayer message
For reference, the owning actor is the player controller OR for an example of a non-player controlled object look at the gamestate and game mode actors. The game mode only exists on the server and spawns the gamestate (which is always relevant and exists on all remote clients) and the gamestate can also do RPC'S
That should be pinned honestly lol
Yeah it's. Or we should make vori add it to the article 😄
That and a section on dormancy so I don't have to keep explaining it to other devs everywhere...
I can relate to that too xD
Funny enough I would have expected it to be in the network compendium but I guess not lol
A section on dormancy I mean
Right. The compendium is great but is missing some juicy stuff.
I guess I know what my next article will be about 
YES! Also a low hanging fruit one(if you wanna cover it) is Unreal Insights within the editor for network testing, it's kinda hacky but possible
Yeah nice to have that one too 😎
Do I smell some network bible heretics????
I ask mercy from the MP gods 
Just downloaded the compendium. Never saw this before very useful!
Is this ^ you in disguise?
If client has already loaded map A locally, and client joins server which also is running map A, is there any way to prevent client A from re-loading the map and instead just focus on syncing the state of all the actors?
Say I need 100 actors to sync (via RPC), when I late join into my server.
Is it okay to have 1 Actor, send an RPC to the server telling the server send down the 100 Actor's RPC?
Should the 1 Actor that does the initial RPC to the server be an Actor or the Playercontroller or does it not matter.
Would I come across any issue if all 100 actors get called to send down an RPC at once( I assume no because they're on different UActorChannels).
You know in most multiplayer games where they have a lobby where you can party up with friends before matchmaking and you can see your friends character model as well as any updates like skin changes. What state is that? Is there a server already or is that just a P2P session? I can’t for the life of me find anything substantial about taking a party into a multiplayer server that’s not about listen servers.
No you would use replicated variables
That's an on-going session. Either a dedicated server or listen-server doesn't matter
Dang I was hoping a dedicated server wasn’t involved especially for just getting a group of players together in a party to ultimately matchmake for a dedicated server. A colleague of mine was saying that beacons are good for this so I’m reading up on that. But for the actual system I want to create might require a mix between P2P and dedicated servers the only thing I can’t figure out is the partying system.
By the time they are in the lobby map they are already connected to the server (regardless of its type). From that point they seamless travel to the combat map. I guess you can have some sort of a listen server lobby where one hosts the lobby and others join in. And from that point they all hard travel to a new dedicated server
Though I'm not sure what's the point of that
what if we assume i can't use replicated variables
Then most probably you are doing something wrong and you should use them instead
im sending custom transfer buffers in form of bytes
For stateful stuff you use replicated variables. For transient stuff you use RPCs. That's the golden rule of mp
Sending too many RPCs can fill your net buffer quickly which would end up in a loss of RPCs, especially if they are marked as unreliable
What's the goal of that
when we say too many RPC's can fill net buffer quickly
do we mean too many RPC's from 1 actor or 100 actors,
i've notice sending too many RPC's from 1 actor in 1 frame causes issues
does the latter i.e) 100 actors sending 1 rpc also cause buffer issue?
Either one. Use unreal insights to see the results under the hood
a replicated variable also goes through the actorchannel though right?
same for an rpc via that actor?
I guess the point would be to reduce costs, since most of the things that can be done in the lobby (e.g shop, customize, matchmake) are either client sided or called via a backend api (playfab) so I see no point in spinning up a server instance just to have players sit in there. But as I continue to read it seems like there may not be a choice.
Correct.
so whats the difference between 100 replicated variables, vs 100 rpc for that variable
sorry wish there was more documentation somewhere to read on but the code is so dense its hard to understand
Ah I thought you meant this pre-game lobby where everyone sees everyone else. The other lobby is the one where you can customize, shop, etc. can be a listen-server for sure, and ideally would be a listen-server.
The difference is that property replication is much more less expensive than a reliable RPC and again RPCing for syncing state for late joiners is bad design and a rabbit hole
oo cool thanks ill take a read
Oh okay now that makes sense. Yea listen server sounds best. Only thing I think I will need to figure out is how to take all the members connected to that session into a dedicated server match, making sure they match on the same team. Then once the match is over deform the listen server for the group again. There’s a plug-in on the marketplace for 400$ but it doesn’t support dedicated servers for some odd reason only thing I could guess is they haven’t figured it out yet
I would use those 400 to buy a dedicated server 😄
Probably they won't be enough though
But I would guess you would use beacons in such case
Beacons let you talk to a server you haven't yet connected to
I haven't got my hands dirty with them yet but they seem useful in this regard
And sadly there is barely info on them out there just yet 
What is an example of a stateful use case and a transient use case?
Stateful is skin of a player while transient is a visual effect played when you shoot a weapon
Thank you so much, perfect explanation
State: Setting a players name. Transient: Playing a sound effect.
Heck I had the player name example in mind and changed that to be a skin last second 😛
should i replicate uproperties for AI that doesnt change? for example walk speed, derived from a setup data table
has anyone here worked with putting minigames in multiplayer?
I'm guessing I have to use UMG widgets and not separate levels?
or can i use sublevels?
You should replicate as little data as possible. If you can extrapolate data from existing data, that is a much better approach.
so, if the data does not change, then replication is not necessary?
Well no, because the point of replication is to be able to pass changes to variables down to Clients.
can we use separate levels in multiplayer (mini game) ?
Don't quote me but you could probably stream it in and out
I wouldn't do a hard level change
Or just have the persistant level hold almost nothing and stream in/out the main sublevel and minigames
Got it, thnx.
You can also use OnRep notify for the late joining
I want to know how to implement listen server using AWS.Can you guide on that.
You don't do this. Listen servers are players hosting the game.
Like, literally their copy of the game hosting the server that players would connect to. No AWS would be needed.
HOw to implement on unreal engine then.Like how other players will find this listen server ip and join this.
Through #online-subsystems
But i need to depend on eos or steam so other player across the world can find my session.Right
I want to do that without depending on any other provider so i can do it cross platform.
Correct. You'll need some way of connecting players but that's still going to be some kind of #online-subsystems .
EOS can be used for crossplatform.
How complex is that to set up, I have similar challenge
I need to connect everyone to a lobby first, once they are in the lobby I can send them to different levels (already done)
I know eos can do that.But I don't want to depend on an SDK for just sessions.I can do remaining stuff on aws.I only need solution for listen server
You are totally missing the point
Listen server is the host.
One of the players is the host.
Everything BESIDES the actual hosting of the game session is handled by your OnlineSubsystem of choice or you can make your own system. That's where AWS would come in, if you were to do that.
I got it.But how to make other players connect to my session.How can they find my session info if they are across the world.How would you do that in AWS.Any idea
I'm having problems in set up rotation/possessing with multiplayer
- why debug prints are only on client 1?
- why the display name of boat_Character sometimes has C_0 appended?
is there any flag or way to check if a playerstate is currently leaving the session? I have a lobby with clients in it, but if i kick a client or a client leaves, their playerstate is still around for ages
I'm using a replicated variable to set the actor rotation
but it doesn't work
where am I failing?
On Server or on a Client?
both, the playerstate is kept around, I think to allow people to reconnect
eventually the playerstate is marked inactive, but that takes a while, and I'd love to get notified the moment a client disconnects
I've solved it by setting a boolean in my playerstate when the gamemode calls PostLogin & Logout, and just replicating that boolean
I was surprised though, this seems like something that would already have a built in solution, so if I'm missing something let me know
like some flag called 'disconnected' or something, idk
This is a bit odd if you're using GameMode and not GameModeBase. GameMode has an array of Inactive players that it keeps around. But will also remove those playerstates from the GameState's PlayerArray.
Check out AGameMode::AddInactivePlayer. It'll remove the playerstate from the PlayerArray, stop it from replicating, which will destroy it on clients, and then set a lifespan on it so it will eventually destroy on server too. If you're pulling from the GameState's PlayerArray for playerstates and using GameMode/GameState instead of GameModeBase/GameStateBase, you shouldn't have any problems with detecting if a player is logged out.
That particular function gets called the same place you're setting your boolean state in AGameMode::Logout
hm yeah, I think I'll be able to work with that, thanks a bunch
Yeah there is no flag like that. Coincidentally I wrote a post on this and added one: https://wizardcell.com/unreal/persistent-data/#persisting-data-across-disconnects
I'll check it out, thanks
In the UE Documentation is wrote when an authoritative object changes a replicated variable that replication will work on all client objects. But is it working only from servers? I mean, I cannot send replication from a client authoritative object to server and others, right?
Right. It has to be done on the server
Thanks =)
TMaps replicate? what?
He's referring to SetByCaller TMaps in GameplayEffect
From GAS compendium
At least if I check UE5 source I see this
Unless he means they replicate without the Replicated flag which the source code says it doesn't?
TMaps don't replicate for sure
More likely it's packed into an array for replicating, or written directly
If it even replicates at all
FGameplayEffectSpec is never networked AFAIK
FActiveGameplayEffect is
Oh NMV, that contains the spec - which does contain the TMaps - but they aren't UPROPERTY so they won't replicate anyway
Thanks for confirming!
If I want to do a day / night cycle working for multiplayer, in which actor do I have to write the code in ? Level BP ? Game Instance BP ? Game State BP ?
in theory i think u can write them in any of those, but the level BP would be more apropriate i think
theres also an actor that handles the sky i think, im not sure if its a BP tho
if it is, its probably better to put it there
Game instance would be dumb, game state only one that replicates
But like every variable added in the game state would automatically replicate ? Like for instance the position of the sun ? I don't think variables replicates without setting them to be "Replicated".
Writing it in the Level BP would be a problem I think as imagine you have multiple levels, that means I have to copy paste the code for each level I have 🤔
thats true
so ur best bet would be to make a skyBP and put the logic there
Correct
return 1; What is this madness 🤣
IT looks like I can't get a reference of the "DirectionalLight" I have in the hierarchy from the GameState, so I'm kinda confused 🤔
You'd have to get it in another way
What's the "other way" ?
Writing code that gets it
that's too vague
Hey folks, I'm wondering if anyone can illuminate the causes for such an error:
Error LogNetPackageMap GetObjectFromNetGUID: Failed to find outer.
It seems to be caused by (or is the cause of...?) a Replicated/*InitialOnly*/ property not actually being replicated.
It's only reproducible when running as a Client in it's own process ('Run under one process' checked off), and after saving the object.
--
So the first run, it's all good. Subsequent runs, the client diverges from the server, the replicated property doesn't come through, and it complains with the error above.
Requires me to restart my editor before it will work again
GetAllActorsOfClass is one way
I debugged further, and the ObjectLookup simply has Object = nullptr for the Objects with issues.
You could put thr code in a custom world settings class. It's the only object available by default on every map that can reference map actors reliably.
What does the property exist on?
The property path goes like this:
AActorplaced in level contains aFStructcontains aUObject... eventually we get to aTArray<int32>
Have you set up the uobject replication? It doesn't really do it by default.
Replication works
I mean, it works under single process, when running without the editor, and when deployed to our normal platform.
It's just a hyper specific bug related to dual-process PIE after editing+resaving the asset.
I'm thinking about inventories in multiplayer. I'm worried about multiple people trying to use/loot the same item from a corpse in a laggy situation. The server needs to remove item and return 'you got this item', but how does it know the item doesnt exist when the other players request comes in
The only thing I can think of is having unique IDs on every single item, because I can't reference by item type
Whichever the server processes first gets it?
Every single item surely already has a unique id? An actor or some reference in the inventory?
an index, but the index would change if first player gets it
so then player 2 would get a different item than expected when it should be none
So give each item in the inventory a unique id?
Instead of giving items an ID, just give it to the slots - then if something new gets put into it just give them that instead and players will just accept it as it is
Yeah that's what I'm leaning towards as the only real option
FGuid is fantastic for that sort of thing
Or, if the "corpse" inventory is a 1-shot that will soon disappear or whatever, just a number from 0 to whatever that is independent of the actual array index.
I'll have the item data in the request, which includes ID, so I'll request item by ID
Will it include the type id or the id of the item as a unique entry?
guid
That'll work then.
I wouldn't use an FGuid for this, though, it's a waste of bytes.
And you really don't need to send the whole item data in the request either
I have a modular weapon system. The components are built from Data Assets. I set up the meshes on the actual BP class inside of OnConstruction. Everything works fine server wise. I have it successfully replicating to clients as well. However, when it does replicate to client, the client becomes exceptionally jittery. When I don't replicate it, it runs smooth as butter - can anyone think of why this would be the case?
The config stuff is wrapped in a struct FWeaponConfig. The struct is replicated. I've tried setting up the stuff in PostNetInit as well (for the client side).
I can't find a good unique ID function, maybe guid is the way?
Hey ! I'm using the UE "CreateSession", "FindSessions", and "JoinSession", it works great on editor, and when i'm launching the packaged game 2 times on windows. But when testing with a friend over network, we cant find each other's sessions
Why do you need a unique id function? Literally the index of the array (stored as a separate variable) when they are originally added is sufficient.
Or just an increasing number for that container.
I mean, assuming this is a container that will not last forever and the player can't put things into it.
If you dont use Straight IP your game will not find a game of your friend.
It is a complex idea about a connection via internet, because you have your router that is hiding your PC from internet and router of your friend doing same thing. And for a properly connection you need a third side. For Example - Epic Online Services.
You can find info there:
https://www.youtube.com/watch?v=b7-h54najFY
And there:
https://www.youtube.com/watch?v=ItqVHGdavyU
If after that you cant connect you will need to try reset project settings.
Blueprints-only introduction to Epic Online Services with a modified version of the non-commercial Advanced Sessions Plugin
Modified release of the Advanced Sessions Plugin (contains binary builds for Win64 and MacOS, tested with UE 4.27.2):
https://www.maygames.net/uploads/AdvancedSessions-4-27-eos-rev2.zip
Source code:
https://github.com/loto...
Ultimate FPS Template Plugin: https://www.unrealengine.com/marketplace/en-US/product/ultimate-multiplayer-first-person-shooter-template?sessionInvalidated=true
Patreon: https://www.patreon.com/SneakyKittyGaming
Discord: https://discord.gg/W5g6pZXfjh
In this video we cover the basics of the EOS setup process and test our product using the provid...
Thanks !
At an extremely basic level, an online subsystem is an application that listens for signals from servers indicating they want to host and the server provides the subsystem with all the details like IP address, port, server name, current map, player counts, etc, and stores that data in a database with a lifespan. Your servers would frequently send pings to the online subsystem to update its database entry and keep the entry "alive". If no response is received from a server for some time, it'd be removed from the database. Your game clients can then contact that application and retrieve the list of sessions and all their data from the application and select what session they want to join and then your game client would then connect to the appropriate IP address of the session you want to join.
So in terms of creating your own with AWS, it could be as simple as a few Lambda functions acting as the application, and a DynamoDB database to store the sessions and a few functions within Unreal to make some HTTP calls and handling them.
There's a lot more to it, and I think you're probably better off just using one of the built in subsystems first to see how they operate. And if you're talking cross-platform like having Playstation users play with XBox and PC, its more than likely you'll need to use EOS (Someone correct me if I'm wrong).
You would either use an OnlineSubsystem or build your own.
If you need to ask this many questions about it, you're probably not going to build your own.
Hi, I get this after trying to create and start a new session. I assume there is something wrong with the map name, but I don't get why it mentions the current map and not the map I am trying to start the session in
Is it possible, that some RepNotify is never called for simulated proxies on some clients due to net distance culling or whatever other net optimizations? I'm creating weapons for my mobs on character's begin play only for authority. Then I immediately replicate these weapons via push model (actor pointers, weapon actors are replicated). However some clients that are far away can't really see mobs weapons when they finally reach the mobs. If net optimization is the case here, how do I deal with it?
Yeah that is what I thought.Thanks for info.So plan will be to create the online session on my device,get ip and port store it in db with params and conditions and when it fits something give that ip to users and they will connect to the server.Okay got it.
They are not called when the actor is not relevant to the connection. They are called once it becomes relevant, as in fact it's spawned client-side when it becomes relevant and is non existent on that client when not relevant.

