#multiplayer
1 messages · Page 652 of 1
LogLinker: Warning: Failed to load '/Game/FirstPersonCPP/Maps/UEDPIE_0_Map1': Can't find file.
LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: /Game/FirstPersonCPP/Maps/UEDPIE_0_Map1, ObjOuter: NULL
LogNetPlayerMovement: Warning: ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction! Client currently at world location X=-248.518 Y=1589.281 Z=311.647 on base
I guess its not possible to have two levels loaded on the server =/
Yeah the engine is build around one server, one world, one persistent level
Spatial OS costs money and i think they basically replace how the servers work but keeping ue4s replication logic. But not sure. Never used it cause €€€€€
can someone help me with how to spectate random player on death in blueprints?
guys how can I resolve this error when trying to host, I'm getting a headache, I think all other problems are because of this :LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)
here is my host function:void UPuzzlePlatformsGameInstance::Host() { if(m_MainMenu) m_MainMenu->RemoveWidget(); UWorld* World{ GetWorld() }; if (World) World->ServerTravel("/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap?listen"); }
iirc you don't need to have a session open to join
so I don't think this is your issue
I have this warning too but connecting works just fine
y ik it works fine but there is another error so I thought it may be because of this
LogNavigation: Warning: NavData RegistrationFailed_DataPendingKill.
and there is another weird behavior that the camera is sometimes focused on the Player's butt xd and sometimes not
I'm rlly confused about these behviors
Okay thank you Cedric, now that makes sense to me - why i was getting those errors, all clear! all the best
in that case, just one more question, how Atlas game for instance handle big map with different levels? do you know by chance how its done? is it different servers where each server has a specific level map loaded or are they doing level streaming with world composition? or maybe are they using SpatialOS ?
Thanks for your answer. so you are saying that what they might have is: several servers, where a specific server is responsible for each tile of the big map, and in order to go from tile 1 to tile 2 , the player would need to do a seamless travel (disconnecting from a server and connecting to a new one, where the new level is loaded) ?
Should ActorComponents created on the server automatically be replicated to clients as long as their owning actor is set to replicate?
For some reason the actor is not destroyed, even tho DestroyActor is called (checked with breakpoints). The BP_Andre_DrainShield actor has Replicates set as true? Also. spawning works just fine...
My player char is attached to a horse. If I pass MoveForward data from player via an interface to the horse char. https://gyazo.com/1da9af22f507e7be1ed8bfbe89872e4e
In horse BP i've this. Would this work if not how can I get it to replicate? https://gyazo.com/80fc99a6c4d15e8460bacda51b90018b
anyone use the dedicated client config ?
Hi everyone! I have recently done a username system in which the player pawn gets the usernamr variable then it sets it's own widget component to display his name. The problem is that if somebody joins after it does that it fails to display the other players name that have already done their display. I have tried repnotifies and they didnt work any ideas?
As far as I understand it/have been told, Multiplayer worlds (Like ARK for example) use persistent level maps. Generally, at least.
hey guys, how can i replicate a variable from the client to the server? i know i can do some weird event stuff but is there an easy way to keep a variable value consistent across all users?
Multicasting.
Buy how can i multicast a variavle?
Guide to using Replicated and RepNotify Variables in Blueprints.
An overview of the Network Features example level, example 1.4: Variable Replication (RepNotify).
Those should guide you
Thx!
Yeah, make sure you run the replicated variable from the server, not the client
Does anybody know how to spectate a random player when you die in blueprints?
I would just have a special character class that spawns via the server (GameState or whatever) and then have that player possess it and have it set to Only Owner See on the mesh in the character bp.
So make SpectatorCharacter bp, in the left panel select the mesh, in right panel search 'owner' and you'll find a check box for 'only owner see', select that.
If you just want it to follow around a random player you can make it an actor with a camera instead and have the player controller possess that
and probably parent it to the character being followed or something
Thanks for the reply. Right now I have a camera spawning and I can attach it to an actor and it works. The part that’s stumping me is making it attach to a random player
You could probably get an idea from this, too https://www.youtube.com/watch?v=nZWxSactlc8
So in whatever you have that spawns the camera, go to that function. Do a... I think it's Get All Players (I believe you can call this in the Game Instance or Game State) and then get the index of each one. Do a random integer in range, with the range being those indexes, and then use that random number for get by index.
And assign it that way
You can also go in Game Mode/Game Instance (I always forget which) and do AtPostLogin event, with an input if NewPlayer, > add to player array
and pull from that array with a random in range
That'd probably be more efficient on resources
Ok that makes sense, but how would I then make it so it doesn’t select a player that’s already dead
Add a check for IsDead and have each player character have that as a bool
have it switch to IsDead when they die
If I attach the player to a another character. Can I control the second character using the player? Would I need to set owner for replication?
You can only have one person possess a character at a time from what I'm aware.
you can't replicate player controllers
When you posses you give control to the second character. But in my case, I still want control but only i'm attaching the player to the second char.
You don't want the spectator to possess the player they're spectating
That's why you'd probably need an actor or something if you want them to possess anything, or you could possibly set it up so they can view from that players camera. I'd have to look into it more.
Not that. What I'm trying to do. I have a player and a horse character. I want to attach to the horse.
Ok I have a comp
I mean you could probably do it just like armor
Can I do this from a 3rd person char? https://gyazo.com/8b09678521029118a0827d50690cb8ec
I don't see why it'd matter if it was third person. Probably easier, actually.
So what you'd want to do is add the horse component to the character, and set the player movement speed to x.
So say your mount horse button is P. Do a custom event, input key of P. From there, set player movement to x, whatever speed you want.
And Add Horse Component to character
Have a bool on the character called IsRiding that you set when they mount. when player hits P again, check if IsRiding.
If so, then remove horse component from character and set player speed back to base.
You could probably elaborate, but that's the gist of it.
The way I did it. It works in single player. I was trying to control the movement of the horse from the player. Since I only attached the player to the horse but the player still has control.
I wouldn't attach the player to the horse, I'd do it the other way around.
Make the horse a component of the character.
That way it will replicate the player character's replication status.
So you don't need to worry about all that.
All component follow the replication attributes of the parent (character) unless directly specified otherwise.
Yeah, but I feel like it's just easier to attach the horse in a multiplayer situation. Less worrying over replication.
But then I like to be lazy where I can. :p
Back when I used to play WoW, you'd sometimes see issues with mount replication and you'd have squatting players flying mid-air around the map. It was great.
I know. I was just commenting.
Pfft
But if I rotate the socket, the horse's orientation won't change
Hrm
Would I be able to use the same animbp. After mount, the player is in ride idle anim.
If I moveForward, i want the player with the horse to move
The components should move together when they're socketed
thanks @stone vault but that means that on a single server there can only be a single persistent level loaded right?
so for the multiplayer with multiple maps, they would need different servers for each persistent level, correct?
Here we show you how you can attach a static mesh to a socket that we made in the last video, a very common process that allows you to attach items such as weapons to a characters hand's or other parts of their skeleton.
♥ Subscribe for new episodes weekly! http://bit.ly/1RWCVIN
♥ Don't forget you can help support the channel on Patreon! https...
https://answers.unrealengine.com/questions/1017910/server-travel-between-persistent-levels-individual.html check out this link, there was some good discussion on it.
Unless you plan to have multiple servers up, you need to either load the map in chunks depending on something like net cull or you need to use some form of persistent level.
Check this out as well: https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Travelling/
An overview of how travelling works in multiplayer.
Would it be possible to attach the player to the horse then make the player the owner of the horse? attaching the horse causes a lot of issues sicne i've mount/dismount situation
Yeah, that's totally doable. Just make sure you set your replications correctly.
ok that's what I want to know/
I would just set the horse as NetUseOwnerRelevancy
Here's more info: https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Actors/Relevancy/
Information about Actor relevancy and priority
Hmm could it be done via blueprint I wonder
Can what?
It's only a checkbox
You can also do it in the bp like I showed above.
So I pass MoveForward values via riding system. https://gyazo.com/239f35de1fc6766b6b5df04866d32efe
In riding sys, I use interface to pass vals from horse BP. https://gyazo.com/6a3b7ce614f193f0b4bbaad3b163f4be
In horse BP i've this: https://gyazo.com/a1ae45a2d5276ef1561398028507012d
My horse and player animbp looks the default 3rd person template animbp
That code works in standalone only. But if I use 1 client then no
does it make sense to you
Thanks Riane but what i have been told here before, is that I can't have two levels loaded on the server at the same time. So because of that I can't have player 1 on level 1 and player 2 on level 2. I already tried before the seamless travel of a single player to another level and it doesnt work properly, is it true that it a single server cant have 2 levels loaded? thats my question thanks a lot
What parts are you specifically having issues with?
That's why there's level streaming, you absolutely can do it.
Level Streaming allows you to create seemingly endless game worlds that dwarf the player in size. Learn how to use Level Streaming in Unreal Engine 4 now in just a few minutes!
0:00 - Introduction
0:29 - Managing Sub-Levels
1:48 - Streaming Volumes
2:22 - Scripted Streaming
3:03 - Thanks :)
Watch that
yeah I was checking now that, thanks a lot!
i have a question though, how do this relate with world composition? I mean... imagine that both levels are just a simple plane both on coordinate 0,0,0 ... if i have level A loaded initially and then stream level B, what will result is two planes in the my world correct? its everything happening on the same world, what i would need to do is stream out the level A and stream in the level B.
Is this correct? thank you!
It depends on your distance settings and how you set it up, but yes. I've personally streamed a multitude of layered maps into one server. That's how a lot of lower level MMOs do it.
You can make them appear entirely seamless. Just check the tutorial, and look up more on youtube. Just search 'multiplayer level streaming' or something like that.
ahhh i got it, you make them on different Z position
that's clever!! i didn't thought of that
finally i got all my answers 😄 thank you so much!
A key thing to keep in mind is, the more actors and events and things per map you're streaming, the smaller you want them. So if there's not a lot per map, you could do a grid of like 4 maps, at 300x300 meters for example. If they have a lot of stuff, then do 8 maps at 150x150
And that's how you get better optimization
better performance
I do the same with multiplayer lobbies. I have my character selection map that all players start at, which is only accessible/visible to the players in the login/character selection. Once they go to the main map, what I'm really doing is teleporting them to the player start location (or their last coords) and they can no longer see/access the login map.
So it can all be run on a single server. If you plan to have a HUGE game with a ton of people, you want your login stuff to be on its own server.
makes sense!
Yep.
thanks a lot for your help!
No problem. I'm no expert but I'm happy to help where I can.
👍 💯
On a side note, I'm preeeetty sure that Ark also does level streaming, and it was made with UE4.
But that's just a guess from having played it and picked at it a bit.
yes I guess so, sorry to bother you again, i was checking some videos now like you suggested, and notice that even with level streaming i am limited to the boundaries of world composition correct? unless i stack my levels on Z coordinate, would that work?
You're trying to make a large open world sort of map, right?
You can adjust your world composition if so. If you're trying to make it more like individual levels which aren't connected, you could still use it. It just depends what you're trying to do.
yes open world, I am helping my level designer figuring out the limits of ue4, he keeps mentioning that we will be limited to the boundaries of world composition so the open world can have the maximum size of that world composition boundary size (yellow square). and now I understand I can easily use level streaming for performance (so not the entire persistent level is loaded), but that doesnt help me in achieving an unlimited (its not what we are trying to achieve, but just to be aware) world map size on the persistent world itself. But you are saying I can adjust the world composition? you mean the maximum size?
quick question: What is an optional way to spawn "Floating" ACharacters and not have them have gravity applied to them until desired?
It's a multiplayer game, so would prefer avoiding having to start with a disabled character movement component, create yet another replicated variable, to do CharacterMovementComponent->Activate() [using C++ btw]
I am spawning them in the middle of the world
I mean, there's always a limit, yes, and if it's that massive you'll need multiple servers most likely. But going for a project so huge at that point is not a very good idea. Even large scale MMOs don't generally start out enormous. They add in areas over time as the game grows and they come out with expansions.
So if your map is so enormous that you're truly concerned about the size, that's more an indication of an issue in planning, IMO.
I think that's pretty contextual. I'm subpar in C++ (though I've made an MMO in other languages) but if the character needs to have some vast differences, you might be better off having two character classes. One that is the floating character and one that's the usual, and then spawn character > possess > destroy old character as needed.
There's probably tons of other ways but that's off the top of my head.
It is the gameplay character though
makes sense, that's what I though, I will speak with him and tell him that's not an issue at the moment. Thank you again!
No problem. Keep at it, I hope you guys make something awesome.
would be nice 😅 thank you ! cheers you too
You can have multiple characters that are 'the same person' but which have different attributes.
Yep. Don't give up.
That's not really the problem
Well, you're saying you just want the character to not be limited by gravity at certain times, right?
Only thing I need to achieve is to prevent the ACharacter from having active gravity from spawn for X amount of time / until a call is made
No, just initially
Then at construction in the character have you tried mesh > set enable gravity > uncheck?
the "cheap" way is to do start with a disabled character movement component, create yet another replicated variable, to do CharacterMovementComponent->Activate()
Ohh right, c++
It has nothing to do with mesh
gravity in ACharacter is controlled by the charactermovementcomponent
Have you tried setting gravity scale to 0?
while that could work, it's not replicated by default either, so the end result would still be the same framework as this
If it's done from the movement component it'd probably follow the replication of that component, right?
Maybe make a custom event that's called by the server and replicate the event, and have it be a switch that flips the gravity scale?
Hey guys for some reason the use controller yaw rotation does not work on the client, works standalone though fine. The set movespeed worked on client so im confused. How do i fix this?
How do people usually go about supporting both dedicated and listen servers? e.g. since rep notifies don't fire on the listen server, would it be recommended to rely only on RPCs instead? Or to directly invoke the OnRep method when running as a listen server but not on a dedicated server? (i.e. for every property change do something like if (GetNetMode() == ENetMode::ListenServer) player_state->OnRep_Score();)
You can directly call the OnRep method.
you don't usually do it based on listen/dedicated though, it shouldn't matter.
unless the logic you're running is purely visual, wouldn't you want it happening on a dedicated server too? And even if it is purely visual, imo the "if dedicated server" logic should happen inside the OnRep to simplify things.
well, for example, I'm currently using an OnRep method in the player state to update the player's HUD when their score increases (GameMode updates score in the PlayerState on the server, client gets new score in OnRep and updates HUD). Dedicated server doesn't care about this update at all, and a Listen server only cares if it's updating its own PlayerState.
But maybe there's a better way to organize things in general which would avoid the whole problem altogether 🤷♂️
I usually call the OnRep on both ends and filter dedicated server in the OnRep
Unless it's purely visuals then you could also filter the OnRep call itself
As long as you remember that when you suddenly need the OnRep for the Dedi again hehe
I connect to my dedicated server using Execute Console Command BP node with "open 127.0.0.1" as the argument. The client lands on the dedicated server start level. It does this even when the server has moved onto another level. When I do this on a listen server, then the new client joining by the same method arrives in the same level with the server player that it has moved on to (such as a lobby or.gameplay level). How do i get it to behave that way when joining dedicated server by "open" ip address command, instead of landing in the dedicated server start level?
I know there is a session created successfully because Find Session and Join Session nodes give the desired behavior. But once i put this in the cloud then OnlineSubsystemNULL is not going to know how to find the sessions out there
So i need to get to the dedicated server by opening the specific ip address, AND have it open into the same level as the other players are playing on instead of the dedicated server start level.
Why are you using OnlineSubsystemNULL?
If you want clients to find sessions using OnlineSubsystemNULL, the client would make a web request to a backend server that keep tracks of running game server and gives client the list of servers, which you need to set up, its a bit complex and involves JavaScript or other web programming language.
I am learning how to get it working with just one server using a hardcoded ip address for now. Once that's working then I will probably vaRest to request the serverlist
Before having multiple servers will work, I will need to solve this problem where joining a dedicated server by ip address goes to the wrong level instead of joining the level all the other players are on.
Maybe I am missing a step I have to do when joining a dedicated server that I dont have to do when joining a listen server in the same way?
I thought just open level: ip address would be good enough (it is good enough for a listen server)
Its the same, "JoinSession" node ends up executing cmd "open ip" in c++.
Are you using seamless travel?
Does anyone have information on the current state of the Network Prediction Plugin? I'm thinking of giving it a try and I want to know if it's useable for shipping. Also, does it address the performance issues of the character movement component?
Any response will be appreciated.
@chrome questNot sure about the rest, but a large portion of the CMC performance isn't networking. It's sweeping movement. Personally, I wouldn't trust plugins until I'd read through them myself And on top of that, networking is often best done manually based on your own game needs.
You'll probably spend less time just learning the basics of networking to make your own prediction than you will sorting out the bugs with a plugin while not knowing how it works.
is there any place in the gamemode where I could ensure that the GameState is completely initialised and begin play has executed?
If memory serves, GameState calls beginplay on all actors doesn't it? I'd assume that Gamestate would be valid and up by then. Alternatively you could just call a function from server's Gamestate in the GameMode after your GameState's initialization is done.
GameState should be the one executing BeginPlay
Er. That, yeah.
GameMode has InitGameState to set stuff up. But that doesn't take BeginPlay into account
If you need GameState BeginPlay, execute your stuff in exactly that
thing is that I have a wavemanager component in the gamemode and I wanted to connect it to a component that lives in the gamestate
Yeah InitGameState should work then?
mh but the delegate is created in the beginplay of the GS agg hehe, you see what I mean? maybe going gs->gm just on server might be better in this case
Thanks for the reply
Yeah, my issue wasn't so much prediction as performance of the CMC. I'm just thinking up methods of reducing server workload and accommodating more characters. Since it's the CMC that is one of the most expensive portions of the game
Well, first place I'd start is it's sweeping movement. It's really brutal. Even in singleplayer, you're hard pressed to get above 200 with stable framerates with nothing else in the game. If that is taking up a lot of time on the gamethread on your server that'll hurt just as much as networking being unoptimized.
I am using non-seamless travel in the main menu levels (Both tbe servers starting level and the clients starting level) traveling to the lobby. The lobby is on a seamless travel game mode which it retains when it travels to a gameplay level.
But why would it work one way for a listen server and a different way for a dedicated server?
If i invalidate a FGuid on server, it will still be valid on client ? 🤔
hey I need some help for basic setting up multiplayer for VR.
anyone can explain me why we need ue source code to build our dedicated app server?
Cause you don’t want your Server to have useless Client code ?
So you build it apart
That wasn't the question though
The question is why they can't do it via the Launcher Binary Build
Mainly cause Epic chose to not include the required files for it.
What do I need to do in order for a client joining dedicated server to go to the level the server is on instead of the server start level?
I would suggest you start enabling some LogNet, LogOnline and what not and set those to VeryVerbose
And check what your log says
A simple NULL Subsystem Client connecting to a NULL Subsystem DediServer should work just fine.
hi guys quick question,
i am using dedicated server mechanism, and i am thinking about if this is the right way to do it.
The server will save the progress of the player, so when player opens the game the initial level (Game Default Map) won't be of any purpose, i will fetch game sessions and join while there, so the game default map can even be a black screen.
Then after he joins the session he goes to the Server Default Map, but before entering there I would like to have an option to choose character, i believe I would need to put the character selection on that level but on higher Z coordinate and then after choose teleport the player to the right player start.
Is this the way to do it? I don't want the player to create new character before joining the server (so on Game Default Map), because there will be an option to continue game, and the server itself must know when option continue is available or not looking at save files for that player that joined.
Does this make sense??
So we have to use the compiled version of ue4 to package the dedicated server app?
yes that's how I did it 🙂
you have to fetch the engine source code and compile it
Yeah, you need the GitHub version and compile it yourself to get all the required target files to build and package a Dedicated Server
thanks a lot.
Thabks i forgot about the extra logging optiond
okay so i've been using RESET_REPLIFETIME_CONDITION to allow me to add a SkipOwner condition to a replicated property in a child class, but I can't find anything that would allow me to do a similar thing with OnRep. Basically in the parent class I just want a property that replicates normally with no RepNotify, but in the child class I'd like to add a RepNotify. Is this possible?
okay thanks
between NetMode, Role, and RemoteRole, is there a good way to just check "is this actor a listen server, a listen server version of an auto proxy, a dedicated server version of an auto proxy, or just an object controlled completely by the server"
i know for the last one, I can check remoterole == SimulatedProxy, but for the first three they all return RemoteRole == AutonomousProxy and Role == Authority. I need a way to check if the actor IS the listen server, or simply another player on the listen server's instance of the game. I know there's a IsLocallyControlled check for Pawns/controllers, but that requires my components to be casting their owners and checking if they are pawns, which seems to kind of defeat the purpose of encapsulating a lot of stuff in components
Just wanna be sure before it's possible while i'm just doing something wrong.
Is it possible to fire a OnRep in such a case here ?
//Character class
UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_LeftHand_EquipmentChange)
USkeletalMeshComponent* M_LeftHand;
Where it will fire when i set a new skeletal mesh like here ?
M_LeftHand->SetSkeletalMesh(nullptr);
Or would the OnRep only fire when i do something like this here ?
M_LeftHand = nullptr;
i guess a more general question is do you guys know of any good resources dealing with designing for both listen and dedicated server compatibility
@vivid sealI don't know if any resources really, but in general it's just common design practice. Basically all of your Listenserver controls and whatnot should be done just like a client's. This leads to all players having identical gameplay whether they're the server player or not. Don't make any Listenserver specific stuff, and in the end everything should be portable between the two modes.
For instance, one good example is that a lot of people like to purposely not call Server RPC for player input controls on a listesnserver machine. Instead, they branch and call a different function. When in reality, you should just call the server RPC for both client and server players. The ServerRPC just won't network if it's called from the server, but will still run the same functions. This'll lead to having consistent controls across both modes.
i'm mostly concerned about prediction stuff, I don't need any client prediction code to run if I'm on the server
i can gate it all behind Role_Authority, but there's so much stuff that is in the code path
I'm pretty sure most of that is based on the actor's role
is there any issue marking variables as replicated to owner only if the owner could be the server?
the replication just won't happen right? no onreps will be called?
Pretty much.
Well, at least in C++. OnReps are always called in blueprint whenever the variable is set to something else, even on server. But if you're doing network prediction and using roles I assume you're using C++
yeah
@thin stratus @kind ember I think i know what my mistake is now. As a listen server all i had to do was have the hosting client open the level, but with a dedicated server I need to have a client who is controlling the host make an RPC to the dedicated server (in this situation that player is NOT the same machine as the dedicated server) telling the dedicated server to open level, not have that client player open the level.
In my game the first player to join the server gets to decide options like which level and game mode are going to be played by everyone on that server
I tried using the rpc way and now the dedicated server actually changes levels like it should, but the player gets kicked off and has to manually rejoin. Is that what your advice to call Client Travel (or what is it called?) Is about?
U have to use server travel to move all clients with the server @peak star
Okay so originally it was listen server only so I didnt have to do that at this point in my game's flow becuase the lusten server client was the only player there and that was on its own machine so open level alone sufficed. but this time it is dedicated server so yeah exactly what you said. It makes sense now.
When should something be marked reliable? I just realized over 2 years of multiplayer experience, I have never really paid attention to it.
If I something like this, how can I have access to the Blend Out pin https://gyazo.com/fa5a53686c877da80ab0dc96a14624ed
When should something be marked reliable? I just realized over 2 years of multiplayer experience, I have never really paid attention to it.
If not receiving the message could break things in a bad way. e.g. spawning a rocket? If one client doesn't get that message they may die without any apparent reason. Spawning the muzzle flash when the rocket is fired? It's probably fine if that gets lost somewhere.
spawning a rocket should be a replicated actor anyway so it should be done by the server
sure, maybe it's not the best example, but you can get the idea
The client telling the server they want to spawn a rocket, or perhaps the server telling a player that they died are better examples
It really depends on the game and the implementation, though, so the only real rule is "will something important break if this message gets dropped?" Muzzle flashes may be unimportant visual details in my game, but maybe you're building a stealth-oriented game in which muzzle flashes convey important strategic information to players, which would put any player that doesn't see one at a disadvantage. Similarly, if you are regularly sending a buffer of each player's inputs to the server, then the "client wants to spawn a rocket" example doesn't need to be reliable since even if one packet gets dropped the next still contains the missed inputs from previous frames.
From what I understand, it should be used when something is very important to gameplay, however, it should never be something that is done rapidly, or overly frequently as it can end up clogging the network with retries. If you need something rapidly, then perhaps the RPC should be done once and instead just transmit a state instead so the client or server can perform the action until the state changes again (on a separate reliable RPC of course!)
One way which I've used it is for notifying the client of data that the client should know and would otherwise break the client if they didn't. Eg. Turn-in of a completed mission. The client notifies (using a non-reliable RPC) the server that they're requesting to "finish" a mission. It wouldn't matter if the client's "request to finish" the mission didn't go through, as the client would be able to try again anyway if it didn't.
When it does receive the request, the server will verify the requirements of the mission are satisfied, and then mark the mission as complete and then notify the client (using a reliable RPC) that the mission has been completed so the client can clean up and display whatever it needs to (remove UI elements, play sounds, etc.). If it wasn't reliable and the client didn't receive the update, then the data on the client and server would be out of sync and without a proper means of "refreshing" the information client-side that would give them the required feedback that the mission was completed correctly.
mark it reliable if it HAS to happen and isn't being synced as fast as possible.
Inventory Action? Reliable.
Aim Direction? Unreliable.
Open Door? Reliable.
Movement Input? Unreliable.
Basically, continuous vs one-off actions or data
Good point, although those 2 things should be linked. Don't seperatly sync FX and gameplay events, just send over the 1 event.
Yep Execute Console Command: ServerTravel fixed it. Hopefully it takes all the same arguments as the open level node does.
Should I put all of my blueprint code of playing montages based on turns and moveforward values in my component or in my player BP, which will favor replication?
so IsLocalController checks that a controller's remote role is != Autoproxy and that local role == authority.
does this mean that on listen servers, IsLocalController will actually return false for the hosting player's controller? since listen server for whatever weird reason has remote role set as autoproxy.
Hello, What is the difference between NetSerialised struct and just default struct replication? And can i use NetSerialisation for replication TMap?
A custom NetSerialize function will send everything you serialize everytime, or you can implement custom delta replication. Replication of TMap's is not advised, just use TArray and a wrapper struct.
But yeah, you could do it if you really wanted to.
Default struct replication will send changed properties individually.
Im using GAS and when i confirm targeting it crashes saying i need to implement NetSerialize for my struck) So thats why i got curious)
Thank you
Probably something GAS specific then, I'd check #gameplay-ability-system
Is it possible that UE4 replicates properties that are marked to work with the PushModel, but aren't marked dirty?
Because I had a variable that was marked as replicated and to rule out that it causes issues I removed the MARK PROPERTY DIRTY stuff
But the problems persisted. Now I completely removed replication of it and it resolved itself. Makes me wonder if it still replicates
I assume if only one single property in the Actor or UObject is not using teh PushModel, UE4 checks for dirty properties anyway and replicates everything?
Or even maybe even if only one single PushModel property is marked dirty, it will collect all changes, which would be the property I didn't want to mark dirty, and replicate them all to the client
its always possible that unreal screws something up
we had an actor that didn't replicate its initial state on initial replication if one specific replicated property was changed before client joined
to make it a perfect shitstorm, part of initial replication was the seed for a procedural map, and we caught it on release day
Is it okay to replicate a struct that have TMap as member, considering TMap itself can't be replicated?
You cant call an RPC on an actor in the game world without an owning net connection
Is it the same case for replicated variables to receive changes from the server?
If I remember correctly, TMaps within structs don't replicate either.
If the actor is replicated and has replicated variables and those variables are set on the server, then those variables will propagate to clients.
What should i do with struct that use custom NetSerialize and that contains field with struct type of FFastArraySerializer?
TMaps dont replicate at all
TArrays do
you can use an array of struct instead of a map
i know, i just dont undestand hot to NetSerialize struct type of FFastArraySerializer
coz if i understand it right i need both
So there is no workaround for this I guess, thanks
Yes but it loses the appeal of being able to find elements with hash rather than doing a search. But thanks for the idea anyways
i got struct with an array of struct and some other fields. All of this must be NetSerialized. So i have to make NetDeltaSerialize for the array as i understand it, and then NetSerialize for fileds in the struct and array as well, right?
Another question though, is there a more detailed game framework diagram other than the one exists in official docs that shows the creation order of PlayerController, PlayerCharacter, PlayerState as well?
Afaik only TArrays support replication in unreal.
For small arrays replication use a TArray<FYourStruct>
For large arrays replication more than 1 ~ 2k elements use a FastArraySerializer.
And i need to do NetSerialize for the struct that is in the array as well?
yeah i know)
i try to do smth like this
https://codeshare.io/yoNpAq
i think i figure out the way for my case. I checked how epic serialize their types. In case of FVector2D they just do this
bool FVector2D::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess) { Ar << X; Ar << Y; return true; }
No over complication. small type, easy serialization.
So i think my it will work in my case coz my struct is quite small
`struct FMyStuct
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
TArray<FOtherStruct>Items;
UPROPERTY()
int32 SomeInt;
UPROPERTY()
bool SomeBool;
UPROPERTY()
FVector SomeVector;
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar << Items;
Ar << SomeInt;
Ar << SomeBool;
Ar << SomeVector;
bOutSuccess = true;
return true;
}
};`
Right?
Hm yeah
You could use SerializeBits(&SomeBool, 1)
As well as use some NetQuantized Vector
So I have a problem with player names the widget component does replicate the player name though it only does this for players that just joined and when a player that joins later than another player will not see that player's name. Any ideas on what to do?
Repnotify
tried it
Show how you're getting the name to the widget
To reiterate, nothing about the widget should be replicated. You just need the name itself to be replicated.
Player name display is just connected to a text box that is part of the widget component
Yeah it's sadly not that easy
There are so many edge cases you aren't taking into account
- Multicast when it's already RepNotify variable is redundant.
- PlayerState could not be replicated yet when the RPC arrives.
- Player might not even be possessed yet, which also means it has no PlayerState.
- PlayerState can be valid but Character not yet.
It's generally easier if you use a binding here
Get the WidgetComponent on BeginPlay, get the Widget out of it and set a pointer to the Character
In your code where you set the text, get the PlayerState from that Character and then the name.
Make sure you check all pointers for IsValid
It#s of course not good to use Bindings, but here it should make your life a lot easier
Otherwise you will have to account for all sort of race conditions
I just found a problem with my.. older code.
I've used a multicast to equip stuff, but now i know how wrong this way was.
I'm just not sure if my new way would be just as bad.
void UPlayerInventorySystemComponent::Server_EquipItem_Implementation(const EEquipmentSlot TargetSlot, UItemData_EquippableBase *NewEquipment)
{
Multi_EquipItem(TargetSlot, NewEquipment);
}
This was my old code, my new plan would be to create a struct marked as OnRep which stores both parameters. How badly would this be ?
@vague fractal what we do is use an RPC to request the equip from the server, but the server does the equip. The currently equipped item is replicated, no multicast RPC
i use 0 multicasts for equipping weapon (apart from some visuals for the equipping)
i've seen they use SerializeBits for flag serilization like this
`uint8 RepBits = 0;
if (Ar.IsSaving())
{
if (Instigator.IsValid() )
{
RepBits |= 1 << 0;
}
if (EffectCauser.IsValid() )
{
RepBits |= 1 << 1;
}
if (AbilityCDO.IsValid())
{
RepBits |= 1 << 2;
}
if (bReplicateSourceObject && SourceObject.IsValid())
{
RepBits |= 1 << 3;
}
if (Actors.Num() > 0)
{
RepBits |= 1 << 4;
}
if (HitResult.IsValid())
{
RepBits |= 1 << 5;
}
if (bHasWorldOrigin)
{
RepBits |= 1 << 6;
}
}
Ar.SerializeBits(&RepBits, 7`);
so this is just a better way to serialize bool for networking?
My currently equipped item is basically just a replicated USkeletalMeshComponent, but if i only set the new skeletal mesh via the server it will only be visible for the server :s
You should be able to replicate that easily. I'm not 100% sure, but skeletal mesh components should be able to replicate its mesh variable. If not, just have a mesh reference and use rep notify. Why are you not having equipment as actors?
Why are you not having equipment as actors?
Ye, feel like i should do it now 😅
What is the proper class to implement player death in? My current idea is to unpossess >> possess spectator pawn with fullscreen respawn UI and spawn a new player character upon button press. Kind of unsure if I should use PlayerController or PlayerState for this as spawning is server sided anyway.
Depends on what this entails
Any information that everyone needs to know about?
Time until respawn for example
Well not really Im making a small survival game and just like Rust for example they spawn on the client said location
The only thing I can think of is a ragdoll but that would happen after unpossesion anyway
Then most of this can be handled via PlayerController and GameMode
Ragdoll can be handled via TearOff and TornOff (cpp)
So yeah that's character
Kind of try to stay clear of PlayerController sometimes but in this case its kinda tricky
Why though
Thats actually a good question
Using classes for what they are meant to be used is critical
Otherwise ue4 multiplayer becomes hell
Well yeah most logic I implemented untill now didn't really go outside the character itself because its groundwork for movement and combat and some inventory stuff. So I am kinda new to using a playercontroller in a MP environment
Sometimes I feel like there are to many classes but really the playercontroller does suit best for the scenario I asked before because it can just listen on a delegate (is death in this case) and process it
Focus widgets are also a good use for very specific keybind useage like that, which you can't exactly put in a pawn, but might not always want to check behind gates for in the controller.
So i've just found out that it's possible to have parameters in your OnRep methods from this thread here
https://forums.unrealengine.com/t/replicatedusing-with-arguments-shootergame-epicstaff-help/39773
But now i'm wondering how would you ever call it if you have to call it by yourself(Which seems to be needed if you wanna fire it on the server).
Cuz if you'd call it as server you'd pass the updated version instead of the previous version, or ?
Thats something to do with PreNetReceive and PostNetReceive i guess.
You have to cache the old one and compare after PostNetReceive
I have a class that represents diplomacy matrix and other features existing in my game state .
It works great until I realized that I need to replicate it 🤕 .
How would be possible to replicate it, adding to replicated subobjects?
UCLASS(BlueprintType, EditInlineNew)
class UDiplomacyMatrix : public UObject {
uprop int32 size
uprop array rules
uprop(transient) array cachedMatrix
};
UCLASS()
class AMyGameState : public AGameStateBase {
uprop(Instanced, BlueprintReadonly) UDiplomacyMatrix* Diplomacy; <- ???
};
bool AMyGameState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
bool bModified = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
if (Diplomacy)
bModified |= Channel->ReplicateSubobject(Diplomacy, *Bunch, *RepFlags);
return bModified;
}
void AMyGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AMyGameState, Diplomacy);
}
i really do not want to resort to embedding it back into game state or resort to structs
as it makes things very bad to use in blueprints
if you already did override these in your UObject class
virtual bool IsSupportedForNetworking() const override;
in case you need to call rpcs
virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;
virtual bool CallRemoteFunction(UFunction* Function, void* Parms, struct FOutParmRec* OutParms, FFrame* Stack) override;
bool AMyGameState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
bool WroteSomething = Super::ReplicateSubobjects( Channel, Bunch, RepFlags );
if ( Diplomacy != nullptr && !Diplomacy->IsPendingKill() )
{
WroteSomething |= Channel->ReplicateSubobject( Diplomacy, *Bunch, *RepFlags );
}
return WroteSomething;
}
i'm not calling rpcs on them
you will also need to instantiate your UDiplomacyMatrix with a valid outer actor to avoid GC
only issupportedfornetworking
i assume actor will be valid since it is created in blueprint property editor of gamestate
still on refactoring state, can't launch to check
DSL
Discord Shortcuts Language
xD
i extracted diplomacy from game state into struct first, then struct converted to uobject.
as there are more than one matrix possible for some cases, so there was SizeA, RulesA, SizeB, RulesB etc etc and bunch of methods for them driving me crazy
@violet sentinel I'm not sure what your architecture looks like but for diplomacy, I would have the state exist in game state, and run the logic in game mode or on a subsystem
not possible, too much stuff needed to be shared for all players and I can not use game mode
would think something on brand new project but not here
actually, will try with it being actor component
oof, this makes me really sad
https://issues.unrealengine.com/issue/UE-16478
Seems like that's a known thing since ages while it still doesn't get "fixed"
seems fine in source
I'm using 4.25 atm and i've read that it's also not working on 4.26.
I think it's insane if it would only work properly with a source build
did you test it ?
On 4.25 yes, but i don't have a source build
Well, it doesn't sadly. And as i said, it seems like it's a known issue since ages
just to make sure, did you check/set ComponentReplicates/SetIsReplicated to static mesh component
In my case it's a USkeletalMeshComponent, but yes.
That doesn't solve it 😢
works with static mesh for me on 4.26.2
Does it also work with USkeletalMeshComponent's for you ?
What keeps you from handling it manually
Really nothing, it just makes me sad that i have to do it manually >.>
skeletalmeshcomponent does not replicate skeletalmesh
at all
you can browse the source
because it is quite uncommon thing to do
unlike static mesh
For now i'll just use the posted solution from here.
https://answers.unrealengine.com/questions/328659/change-skeletal-mesh-blueprint-multiplayer.html
It's just that it feels natural to me that it should get replicated. From the amount of votes and such it also seems like i'm not alone with my feeling :s
hey guys 🙂
what could be a reason why players can't join my server using advanced sessions steam?
They only get a few messages saying
Removed incompatible build: ServerBuildUniqueId = 0x00000000, GetBuildUniqueId() = 0x00fac1bd
well I'm using default app ID 480, but I've seen it work for other people
ugh, this is a mess. team configurations, states and other data are in game mode class
but the team relations configurations and runtime data in game state
Ruh roh, that's no good. State should be in, well, the state classes.
How does replication differ from using listen servers vs dedicated
ik that listen server acts as a client as well, but how does that change how you have to replicate things
Hi, is there a way to make it so sound can be made relevant again? so i have a fan sound that'll play for like 30 seconds with attenuation set up and with the virtualization mode set to Play when Silent but if the player leaves the Net Cull Distance area it destory's the actor while the actor isn't relevant, but pop's back in to existence when the actor becomes relevant to the player.. same sort of thing but for the sound? so the 30 sec audio plays, player walks 20 seconds and gets outside the Net Cull Distance area but then walks back in at 25 seconds so there would still be 5 seconds left of the audio playing? Otherwise is it just best to increase the Net Cull Distance area to be big enough to last more than the audio clip plays?
Hello there. I have a question about server-RPCs: Is the corresponding _Validate-method also executed when the RPC is called on the server? Would it be ok to always return false in the Validate method if I want to enforce it to only ever be called on the server? (knowing that any client calling it would immediately be kicked)
I think the validate is run on the server.
Yes, of course. But what does it mean when the RPC-call originated on the server, too?
The server can't be kicked, after all.
Well that's up to you of who gets kicked because just returning false in an RPC will just make it so the RPC wont run, unless if you program it to kick if it returns false.
wait maybe idk
I'm not sure I understand. If a client calls a server-RPC and the corresponding _Validate-method returns false, the client is immediately kicked.
i think im a bit dumb
(I had a lot of disconnected clients before I realised that. Had to move the validation code into the actual RPC.)
ok
So now I am curious if I can make use of the _Validate-method in other ways. Maybe I can always return false and then the server would be the only one "allowed" to call the RPC? (Or maybe it wouldn't run at all, I guess.)
but I don't know if you have to have validation for server to client RPC
I don't know, haven't needed that so far.
Yeah, only Client to Server RPCs require the _Validate function
it sounds like if it tries to kick the server then all the clients will be kicked as well.
That's another possibility. I guess I should try to find the time to write up a test then.
Can anyone help me with destroying / despawning a character? I have a collision based character selection and respawning process working in multiplayer but the old actor isn't being cleaned up after respawning as a different one and I'm not sure why.
are you unpossessing the actor that is to be destroyed?
Hmmm I didnt know that's even a thing
What is the order of cleanup? Disable, unpossess then destory?
unpossess disable then destroy
but if you unpossess you wouldn't need to disable input
okay, and as a multicast right?
are you using listen or dedicated servers?
dedi
ok, try using server rpc
I'm not great with using rpcs, I just know the ue4 framework decently.
If properly architected, there shouldn't really be much of a difference.
Can someone be in a different level and still be in the same session? I want to check if all players have loaded in the game level.
you can just have the player controllers send an event to the game mode saying that they've loaded in.
also onPostLogin in the game mode can help
Onpostlogin doesn't work as work as I'm travelling, so I'm using the other node which name I forgot
Is there a node for this because rn, I was planning on each player after begin play increment the player count and start the game when the player count equals the session count
Which is why I asked if ppl can be on the same session but different level
why would they be in a different level?
if the begin play is called on something that is owned by a connection, then the connection is on the session
but I think that a server can only host one level.
Wouldn't the players that are still loading be stuck in the travel level?
I'm not sure tbh, I just assumed so
no, if they've fully connected then they should be in the level
So will every player leave the travel level at the same time?
Because tbf, I assumed the game moved you from the travel level after it finished loading the next 💀
depending on how good there connection is they will connect at different times
you can just make it halt the game for people who have connected, then resume once everybody is in
I was planning on just starting the main gameplay loop within the gamestate after everyone loaded in
Also is there a node or cmd to check if a player is fully loaded or not, is there any easy way?
if their player controller exist, then they've probably fully connected.
Oh ok, then its pretty easy
I can just check the number of player controllers and compare it to get current players from the session, and start the loop after it's equal
I assume
The game state has an array of player states, you can just use that then tell the game mode that it's ready to start.
Yea makes sense
This is not the place to advertise services.
quick question: if I run APlayerState::SetPlayerName() from the client... will it replicate?
I see in its functions that it does run OnRep_PlayerName(), but I assume that I have to be the server to run that function?
ah sorry
what is the correct place?
Good luck! definitely not this channel though
It is about a multiplayer service for projects in ue4, do you think it does not go here?
no, because you're advertising a service. Which this is not the place for.
read #rules - no self promotion.
ok i´m really sorry
there a good way to change the net cull distance handling for spectator players?
Does anyone know how to implement online features?
@subtle raptor What was he promoting?
I have a possess camera code in my player controller, but it's only working for the server not the clients. I've tried all the replicating options and nothings working, anyone know what could be going on?
when I run a client rpc player controller 0 will always be locally controlled right?
If the rpc worked,... Yes?
I guess also via IsNetRelevantFor
GameMode has a ChangeName function which ultimately calls the SetPlayerName function. So yeah has to be the Server.
@meager fableUsually yes, rarely no. It depends on the machine it ends up on. There are rare cases where GetPlayerController0 can actually return a controller that is not the local client's controller on listenserver machines. Game Instance's GetFirstLocalPlayerController is much better in that regard.
I haven't had an instance where GetPlayerController 0 on ListenServer would not return its local PC.
Dedicated Server is another story
Can't find GetFirstLocalPlayerController, is that cpp only?
It happens with seamless travelling sometimes. It's semi rare, but can happen around loading.
And yeah, it's C++ only.
Guess I'll expose it, thanks both of you
somebody help me on teams for multiplayer
I only ever used it in UI stuff before. I don't even do that now. 😄 Zlo blapped me for it after a weird loading crash.
Haha
i can't figure out how i should implement them
widgets literally have a player controller getter function 
lol
Anybody?
You'll have to provide more info. Your Teams have requirements which are needed to know before giving any advice. Also I'm pretty sure people already suggested options for you
alright so how would i exactly would i have a leaderboard without having to loop through each controller and getting each player state?
Leaderboard... you mean a scoreboard? [they're 2 separate concepts]
yeah but is it costly on performance?
what?
I mean... not really
and if you're bottlenecked enough where for looping 15-20 player states goes over budget, then you have way bigger problems
and for a score for each team i'd have to make two variables in the game state which is prob bad idea
no im not but i was wondering if i had more players would it lag
I see that you're fairly new in the world of unreal
yeah im not really good at multiplayer stuff
have you looked at the network compendium?
also, not really
oh
hey what's that\
unless your game is on mobile, you can just pretend you have endless Ram available
google ue4 network compendium
also how would you got about making the variable for the score?
I'm fairly obsessed with encapsulation
so probably a replicating UStruct for handling match global stats
then each player would have a replicating ustruct [a separate one] in the player state for handling match player stats
[also, please don't say that this is a bp only project]
[it's going to limit you big time in the future]
and if you plan to have dedicated servers, you'll have to eventually convert to a c++ project anyways
but would i loop through the player states and then add the score of each player together?
but is it the best way?
I can't tell you what the best way is without really knowing what you already have though
and the fact that you're just on Blueprints only is already [in my book, fwiw] suboptimal 😛
hmm is there a good C++ alternative?
yes. Doing it in C++ 🙂
One of the bigger issues with BP-only systems (you might have experienced this already) is that encapsulation is almost never done right; all systems are messy from everywhere, enums & structs & classes are an absolute mess, and everything is just this ugly conglomerate of things

and follow that line /set of msgs
using things like ReplicatedUsing (C++'s version of RepNotify) and the like.
No like to store the variable of the player where would you put it
in c++?
where would you put it?
I did mention it in my msg above
UStructs are declared in c++
I'm of the preference to declare most important data types & classes in c++ [includes structs and enums]
but in which class would you store that variable
like would it be parent and child
or
I mentioned that higher above as well
Match Data -> GameState
Player Data -> PlayerState
but why would that be any different if i did it in bps?\
That was uncalled for. They did ask about it a bit higher up. If at all they shouldn't beg.
I did. it was deleted by a mod, along with your message
If all you need is:
- Player belongs to Team
- Team has Score
Then it's enough to have the Enum in the PlayerState and two team scores in the GameState.
I agree with the rules
Or an array or so
You can make Teams a lot more complex of course
But you should just start somewhere
Okay, i was just thinkng that my system was bad since using two variables for teams is a bad idea since if i wanted multiple teams it be more than two variables
anyways thanks
What defines the amount of Teams for you?
i just need three
Always?
but i kind of was thinking i could use an array but off of post login it only gives a controller reference so i don't know how i would add that to an enum array
not always but for this specific project im working on
No like, once the game start i call an event, im just temp using it on post login
It would be best if you'd outline the requirements for this, before people can really help you
Everyone here probably does Teams a little different
And most of us probably use C++
So there's a timer, once the timer is done counting down the game start and there's a timer for the round's time. It then assigns you to a random team. that's kind of it other than spawns but i can do that later
Yeah, so the Array in the GameState could either hold some TeamActor, or some Struct. Either way you'd probably have the info of the team in there.
Such as Array of PlayerStates, a Score value, etc.
When you assign that team you can get a random number between 0 and 2 and add the Player to the Arrays Team Info, as well as set the Number on the PlayerState.
Or you do some balancing magic so not all of them end up on the same team
If you know you have 3 teams all the time, you'd just need to make sure that you set the default value of the team to 3 entries
Otherwise you can also just call Add on it three times on the begin play of your GameState or so
There isn't much more to it
I'm not going to show you code. You'll have to just start digging into it
Let's assume an Enemy can be Launched based on my Attack.
How does one make that smooth? AI Movement is Authority Based, so I only have 2 options: Call it on Auth alone, which means a slight (or long) delay before the Client sees this. Or. Call it on both, but then usually run into a correction, because nothing of this is synced, cause the Client is just simulating the AI.
The only way I can see this being smooth is if the Client would be allowed to take over "auth" on this, as long as the Server says it's okay. But I doubt the CMC has code for that on simulated proxies
DO I have to set the movement mode in server or multicast or run through HasWuth?
Client could simulate it from replication, then the server could check to make sure they did simulate it - but it's probably more trouble than it's worth, might be worth a one-off correction now and again.
Almost becomes two layers of prediction. Server prediction what the client will predict 😄
Sort of a losing battle though, because if client A pushes Client B, then they've got to wait even longer for the feedback (their own RTT + the victims RTT)
It's not about Clients, but it could be
It's just the AI being Launched by ClientMovement
It's not a correction now and again
It's either always delayed or always corrected
It's never smooth, not even on 30ms ping.
The Client can't launch the AI after all
You don't replicate sound, you replicate the information that the sound should be played
Sorry i didn't put that in the best way.. what im actually trying to do is make sound relevant.. for example i have client 1 inside the net cull distance area, and client 2 outside it, the one inside presses the button which plays the sound, then client 2 steps into the net cull distance area but doesn't hear the sound, can i make the sound relevant to client 2 if they weren't in the net cull distance area when the sound was originally played?
Nothing about playing sound is networked by default, regardless of cull distances. Unless they play a sound locally, they'll hear nothing.
Thanks, so what do you think is the best solution?
worst case i can just increase the size of the net cull distance to be longer than the audio plays so it's always relevant to them i guess but if theirs a better way i'd rather try that lol
Has the playing of that sound already been "networked" by you?
If the sound is driven by some replicated property, you can use a timestamp of AGameState::ServerWorldTimeSeconds and replicate that, then drive the sound from an OnRep, checking the timestamp at the same time.
Without any context it's hard to give an answer
Im not entirely sure, this is the first time ive delved into sound's working for multiplayer so im not sure if ive 'networked' it or not lol all i know is that i have a custom event thats set to Multicast that plays the sound which is stored in an audio component in the BP actor which somewhat works, if both players are inside the net cull distance its fine, if you're out of the attenuation zone but still inside the net cull distance and go back in range you'll hear it just fine so it just figuring out how to make it work when you leave that net cull distance area
but like i say im pretty new to the multiplayer side of things and cant seem to find good resources on sounds in multiplayer
A multicast is only called once, and only for players the actor is relevant too. If you want the sound to play when a client comes back into relevancy range, then it's technically a "stateful" change and should be handled via a replicated property instead.
If a player doesn't receive a multicast at the time it's called, then they never will.
Ahhh ofc.. i forgot about multicasts only playing once while relevant! So how would i go about setting this up? for this particular on its a tap that gets turned on and plays a continuous sound of running water until its turned off
thats how ive got it setup so far
Do it with a replicated property instead of an RPC, and use an "OnRep" event to start/stop it
If it's a continuous/persistent change, then it's "stateful" and therefore should be handled via properties
This will also handle the case where a player joins a server during an in-progress game.
Hiho, I have a few questions about different characters.
I have all the settings in my third person character so the character can Idel, Run, Jump, Sneak, Health and Manabar work, as well as the EXP and Skillpoint System.
Now I wanted to create different characters from the third person character with the help of Create Child.
Will the childs have their own life and mana or is this tied to the Parent_Character?
Every character has special skills that have to be added to the skill tree, how can I assign this to a character?
Despite the change of the Spwncharacter, I always start the game as a third person character, where (except in the game mode) do you have to change this?
One more question about the skills.
Is it really necessary for each skill from the skill data table
Get Data Table Row 1, 2, 3, 4 to be selected manually or I could make a kind of array in which is stored:
Character 03 has skill (data table row) 1, 5, 7, 9, 11 and exactly these rows are then loaded automatically?
Good morning, I'm back with more questions about replicating projectiles for those generous enough to answer.
This time I'm replicating a slow-moving enemy projectile that spawns either on a timer or when the enemy is shot by the player.
These "projectiles" are actors but they don't use the Projectile Movement Component. Instead, they are attached to the enemy that fired them, thus they continue to move and rotate with the parent while SetActorLocation moves them ever outward from their parent.
Any advice on how to optimize the syncing of movement between server and client of these projectiles would be much appreciated. Even if that advice is just to enable bReplicates and bReplicatesMovement and call it done.
Cheers.
Is there someone here that is using the PreReplicateAdd/Remove from FFastArraySerializer to update their inventory ? I wanted to know if it was overkill to use it only for ui changes 🙂
@waxen socketIf the attach parent's movement is already synced, that should be enough information to sync the projectiles up right? You shouldn't need to replicate movement directly, just attach parent
so i was wondering why this wasn't working but i can't seem to add to an array in a struct it doesn't save. Like the length of the player state array is always the same
Morning - I'm trying to work on getting ReplicationGraph working with my project (using https://github.com/MazyModz/UE4-DAReplicationGraphExample as a base along with his tutorial video + Epic's live stream recording on RepGraph) but so far the only thing I'm noticing is that it makes networking worse. AI characters pop extremely bad (despite setting them as dynamic actors just to test) and intro cinematics no longer sync up properly and this is without the UE4 bad net sim running.
Am I missing something with set up here? Is there a project config I need to set or some other code that needs to be added aside from the RepGraph itself and the delegate to turn RepGraph on?
ShooterGame has an better and OFFICIAL example from epic games on how Rep Graph is working
Is that the same one found here https://github.com/Noesis/UE4-ShooterGame ?
This one isn't updated and is modified
Take the official one on the epic launcher
Nope
Well that's something.
You can find it on Epic games launcher
Looking for that now, thanks
its under the learn section
So, the rotation only replicates if the camera moved, can someone confirm this ?
- Create Project with a player controller
- insert the BP in the image
- start server and client
- see the problem
That's a local only property, why would the camera rotation itself be replicated?
so the server knows where the player is looking..
But why is it replicated if the player moves then ?
Oh sry)
client can keep the server up2date
its in the playercontroller and pcm
client can send a rpc periodically
with its current view target
The server has the ControlRotation which is typically used to drive the camera
The server-side camera of your pawn will sync up with your own, but the remote client one won't as you don't have their control rotation
I'm looking at using "Animation Budget Allocator" or "Update Rate Optimization" for reducing the rate of animation ticking on the server. Which one is better? Is it possible to use either on just the server alone while leaving the client unthrottled?
Could you reformat that post to not be so spammy long?
They way you write it it sounds like it's almost normal that if I jump onto an AI enemy that I get a correction every third time.
Movement that involves stationary objects works fine. It's only the moving ones that are a nightmare.
Cause Server and Client just don't have the AIs or other Players on the same location at the same timestamp.
But maybe it's also some replaying that goes wrong with the amount of custom movement we have
It's such a nightmare to debug this
The time I've spent comparing server and client timestamps...
Did Epic ever released Fortnite's ReplicationGraph sources?
Haven't heard of any Fortnite source release
hello, got a problem. I have 2 struct and custom net serializer. if i replicate them - everything is fine, But if i use them as a parametrs for a RPC - it crushes here
template<class CPPSTRUCT> FORCEINLINE typename TEnableIf<TStructOpsTypeTraits<CPPSTRUCT>::WithNetSerializer, bool>::Type NetSerializeOrNot(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess, CPPSTRUCT *Data) { return Data->NetSerialize(Ar, Map, bOutSuccess); }
and i have not good time at debugging it(
Exception thrown at 0x00007FFBB8084358 (UE4Editor-LearningMultiplayer.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000008.
Yea thought I heard it some where, lol.
Is there a way to attach a debugger when launching the game by rightclicking on uproject? I have a crash when servertravel and that doesn't work in the editor :/
I figure it out. God damn it. I call client function both in cpp and bp - that was the reason for crush. Im so dumb... it took 2 days to figure it out.
Is there someone here that is using the PreReplicateAdd/Remove from FFastArraySerializer to update their inventory ? I wanted to know if it was overkill to use it only for ui changes 🙂
What are the other things ?
Actually I ONLY use it to update my UI
Also how are yall managing ur inventory slots, are you passing the information you need to update ? i.e: UpdateSlot(ItemDefinition, StackCount); or are you passing the Item Object (In my case the ItemEntry.)
Depends
I normally just have the UI query the game for the info it wants, rather than other way around
And bind to events here and there, or just tick the whole lot
game code talking to UI directly quickly makes it hard to separate the two
yeah very true, i mean my quickbar and my inventory is working atm but the code is quite very crap i wanna refactor it but idk what ways to go, shootergame doesnt have any example since it doesnt have physical inventory/quickbar :/
tbf shootergame has possibly the worst UI of any of the templates
apart from all being done in slate it's pretty much inseparable from the rest of the game
Takes a while to rip that crap out
It predates UMG though.. by a few years or so
And yes i forgot to mention it but yeah shootergame is full slate and full Tick update so rly rlyyyy the worst example
tbf the huuuuuuge majority of our UI is just ticking everything and it's far from being the bottleneck 😄
What your game is ??
Here: https://store.steampowered.com/app/686810/Hell_Let_Loose/ There's a lot of UI in that game too
And anyway, i can't rly do tick update on inventory item add/change/remove and quickbar
Oh i have it 😄
Was based on ShooterGame originally but we had to remove all of that nonsense
UI is hard though. Such a weird middleground of programming and art so it can be hard to find the balance
and + i'm sending updates from server so i can't do tick update for my inventory
Yeah i guess that's why UI Programmer is a thing 😭
yeah
definitely a lot to be said for trying to keep your UI and gamecode separate as much as possible though
makes things a lot easier
With the ideal way to update the UI on inventory changes be some sort of in on inventory change delegate?
Also.. about that ? 🤔
yeah
For example my UItem just store an FItemEntry (which is a FFastArraySerializerItem)
item object == UItem in this case
But the logic to send data to UI is still the same.. Do u send needed data or the whole "Object"
well english is not my native language i'm trying to speak as well as i can.
but thx.
Well how you want an inventory to work without UI 😄
Things like healthbar or scores are just cosmetic right
Yeah
im not ok with this.. we can do modular things between gameplay and ui
yeah but dedicated servers doesnt contain client code
so it's not a rly good example
Does the UI just check if inventory changed on tick or something?
In my case i'm storing my items guid on UI (and inventory back), if i need to update my item on ui i send it the guid of the item and the things that changed (usually quantity)
Same for removing, i send the item guid.
What is your game ?
I mean the type
Thanks, Adriel. I'm surprised, but there wasn't a difference when I switched off bReplicatesMovement. Like you said, I guess it isn't necessary to enable if an actor is attached to something that is already replicating movement.
Cheers.
Yo anybody know how to get RepGraph running alongside SteamSockets? I tried the following in DefaultEngine.ini but no joy:
[/Script/SteamSockets.SteamSocketsNetDriver]
ReplicationDriverClassName=/Script/Hydroneer.CReplicationGraph
I guess this here is just a doc flaw, or ? (Same for Reliable)
Cuz i'm forced to use one of them on NetMulitcast's
you always have to specify type for them. Client/Server/NetMulticast + Reliable/Unreliable
prob multicast is missed in docs
It's just that it tells me it's only valid for Client/Server.
Is a NetMulticast maybe considered as Server ?
multicast is server only
not really
That's why i think it's considered as Server
#multiplayer message, page 63
Well, just gonna note it as missing doc information then xD
NetMulticast just fails if you run it on client
well you still gotta make NetMulticast reliable or unreliable no?
Yes, you have to
hehe
Is there maybe any rule of thump when to use 1 RPC which takes a bigger object vs more RPC's which takes smaller objects ?
What kind of object are you talking about here?
Pretty simple ones. It could be just a simple int32 or a struct which may contains 5 int32
it is all about data transfer, 5 ints will be just 20 bytes vs 5ints in struct will be 20 bytes + extra info about struct
it is data size vs programmers sanity
depends
That's why i'd like to have some kind of rule of thumb
none
if you using structs then unpacking packing variables just for rpc seems redundant
if you using parameters and number of them grows over lets say 6 then pack them into struct
I think i have to rephrase my question here a bit with some code
// Calling an RPC which takes this struct as parameter even though that only Health and Stamina will be used vs having 2 RPC calls which takes the parameter individually. So "Server_TakeHealth(Health)" and `Server_TakeStamina(Stamina);`
struct FDefaultAttributes
{
int32 Health;
int32 Stamina;
int32 Mana;
};
If that makes more sense
i think i got it. are they reliable rpcs?
Ye
if they sent quite often i'd compact them to save on reliable rpc validation costs. since they probably have cost to check weither they were received by destination.
also search for "reliable buffer" here. may find references
if they sent quite often i'd compact them to save on reliable rpc validation costs.
What do you meant with "compact" here ? ^^"
also search for "reliable buffer" here. may find references
Yeah, i should really take a look into that
Server_TakeEffect(Health, Stamina)
so it will be single reliable rpc
(if it suits)
So that you'd use default values if you don't use Stamina e.g. or ?
Nvm, got it, i think
not sure 🙂 depends on design
still possible with smth like ServerUpdateStats(int32 ChangedStats, FStats Stats) where first is bitmask while second is container for values
quite wasteful on size as zeros are sent but multiple changes can be "compacted" into single rpc
and there seem to be better ways of making it
I see, think that's enough information for me now, thanks 😄
i avoid using RPCs for state changes
if i can't help it
replicated variables are far more reliable and they don't have the weird replay effect you get sometimes
plus, a reliable multicast RPC can fail to reach a target if the target is outside of network range for that client
GAS handles this rather well with their replicated gameplay effects
if you don't want to implement GAS, you can at least take a look at how they replicate gameplay effects to do state changes
basically, they use a FFastArraySerializer with a modifer, and when it's received by the client it sends a callback
this works better than an RPC because when an actor becomes relevant to a client, network variables are updated and the callback is called
Hello everyone quick question, i am working on a multiplayer game and i already have my widget persisted during joining the server (using the gameviewportclient in c++), however right when the client joins the server my loading widget blocks for a second. how can i make it smooth? is there any workaround? or i really have to go with modules and slate like its showing on this video from Unreal Engine https://www.youtube.com/watch?v=ON1_dEHoNDg
Thanks a lot!
This engineer-oriented talk about assets loading management for good performance and smooth transitions by Epic Games' Support Engineer Axel Riffard goes over different methods to craft beautiful and highly optimized loading pipelines for your game, be it single or multi player.
Learn more about Unreal Engine at http://www.unrealengine.com
What happens when an actor goes out of relevancy range? Does it cease to exist or does it just quit being updated?
It gets destroyed, and when you come back into relevancy it is spawned and then it calls OnRep functions and then BeginPlay on that machine that its coming back into relevancy
I'm working on a sub system that solves for hydraulic, electric, mechanical networks. Right now, my current thought is to have the components register themselves with the subsystem on begin play and deregister on end play. Should that auto magically play nice with relevancy?
The subsystem runs everywhere because I don't necessarily have the power networks replicated, just their end results and control inputs
And their topology graph
Yeah that honestly should just work cleanly
Has anybody had an issue where turning off RPC events on an actor(when I say turn off, I mean I changed a Multicast event to no be replicated cause I wanted to switch it to the OnRep) will cause inherited OnRep functions to not work on client machines and only be called on the server?
But if I enable the event to be any sort of RPC, then the variable's OnRep works in the parent class...
And these two are independent of each other btw, the RPC does not affect anything that the OnRep uses...
Are OnRep methods which are taking the old object as parameter more expensive than OnRep methods which doesn't take the old object as parameter ?
I would assume so, but would also be dependent on what your sending across the network. I tend to never use the OnRep with previous variable so I'm sorry if that's not accurate
Hi, I have an issue sometimes where a client will spawn into a lobby but fail to set their camera to one that already exists in the level. This only seems to happen occasionally. Any thoughts about what I might be doing wrong?
Replicated audio - I'm perplexed. I have a MC that spawns a particle effect and sound for a simulated bullet hit. The particle replicates to all clients, the sound only to the owning client. Can anyone help point me in the right direction?
Try outside of PIE
PIE runs single instance of audio for each window
I tried in PIE, stand alone, and even running the packaged game twice. I have a range on the sound so that I can get far enough away from each client so only the closest should hear it.
The only thing I haven't tried yet, is playing the game on two separate computers over LAN as I don't have a second rig handy at the moment.
I also have 'Create Audio Device for Every Player' checked
I have a grenade that gets thrown and explodes - that sound seems to work fine, and it's not rather through an custom events. Is it the custom events themselves that are killing the audio?
You should replicate the event and its payload data, not the sound and particles themselves
replicate the fact that the bullet hit happened, then on each machine, decide what to do and do it
Hi, if I change 2 replicated variable at the same time, is there a chance that at some point one of them will be updated and the other one not? Is there anything I can do to avoid that?
Can you give me a bit more information? From just that description alone it sounds like I would have to create a 'Play Audio' event on the PC that the information gets sent to rather than it happening in the multicast itself, also on the PC. EDIT: I did try that...no luck.
Create a BulletImpact event or actor
and in that event or actor, play the sound, spawn the particles, whatever
It's being played from an event now, but I'll give the actor a try. Thanks.
I'm an idiot - the audio HAS been playing the whole time, but the engine,m despite the checkmark, does not play audio in the BG from both windows when they are open. I have to shoot and quickly alt+tab to try and catch the tail end of it, but it's there..
I wish there was a better way to test it on a single machine..
@fossil merlinYou should make sure that if you're playing in PIE, that you have the checkbox set for each instance having it's own sound. And also consider adding this line to your project's default Engine.ini file.
[Audio]
UnfocusedVolumeMultiplier=1.0
@hollow bridge There is no promise that two properties will be replicated at the same time even if changed at the same time. If you need data to replicate at the same time, put it all in a Struct property and replicate that instead.
I'll keep that in mind @kindred widget, thanks
Anyone up for a challenge? I have a spectator system, and i'm trying to make it so when the player dies that im spectating, it'll switch to a new a player, I can dm some pics of my code
Just make a OnDeath dispatcher/delegate in Character and bind to it from the spectator pawn or controller. OnDeath, pick new character to spectate
Have anyone tried this in UE5?
What is the state of Network Prediction plugin on UE5?
The basis for networked vehicles and the next generation charachter movement component. Using fixed tick.
An Epic Mega Grants backed Master Thesis about creating the Next Generation (Multiplayer) FPS.
can you go a little more in depth
@hallow summithttps://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/EventDispatcher/
Allows a Blueprint Class to report on its state to the Level Blueprint.
delegate is the c++ equivelent
Hey!
I found the problem.
Event with "Run on Server" does not work from the client.
I created an actor and put it on stage. Then I call the server event from the client
What am I doing wrong?
This is empty project with actor.
The client needs to own that actor to be able to call RPC on it.
Bit confused why the CMC doesn't override Jump Data when Correcting the Client.
I know that the Velocity is enough to override if you are jumping or not, but if the variables that control the CanJump() function aren't updated, wouldn't it cause the player to get wrong results from it?
E.g. what if I can Triple Jump and the Server corrects my Second jump due to whatever reason. If the Variables aren't changed, I would still be thinking, locally, that I did a Double Jump, stripping me of one of my jumps.
An easy reason for the Second Jump being corrected would be that the "bWantsToJump" package got dropped, making me predict my jump but the Server not execute it, correcting my location (quite heavily)
hey guys, I have a problem. My replicated animation is playing twice on the client, how do I fix this? I'm really new btw xoxoxoxoxo
I want it to instantly play on the client as well, rather than having to wait to receive it from the server
I'm aware of the reason why it is happening but I don't know how to have one instance of the function on the client
Yeah needs some changes
The Multicast will always call on everyone when called on the Server
So you'll get a second call on owning Clients
You Multicast needs to filter Authority and Locally Controlled
Or maybe only Locally Controlled in your setup
I usually do this:
Event PrimaryAttack -> ExecuteAttack -> HasAuthority -> Multicast
-> DoesNotHaveAuthority -> IsLocallyControlled -> ServerRPC
Event ServerPrimaryAttack -> PrimaryAttack
Event MulticastPrimaryAttack -> DoesNotHaveAuthority and IsNotLocallyControlled -> PrimaryAttack
Server and Owning Client will thus call it via PrimaryAttack instantly. Then the replication happens. The Multicast is then only for Simulated Clients
No, re-read my post please
You need 3 Events
One that is not replicated called Primary Attack
One that is a Multicast and one that is a Server RPC
The last two you have already
Clients appear to be unable to see other players ID from player states, Can anyone confirm whether or not this is the case?
Anyone know how to fix "Native NetSerialize StructProperty [...] HitResult failed." ? Owning actor's cull distance doesn't seem to have an effect
Possibly trying to serialize a hit result for a non-network addressable component or actor
E.g, the hit is against something local to that instance only.
it doesn't happen close to the level's origin though
same thing happens for "Native NetSerialize StructProperty /Script/Engine.PlayerController:ServerUpdateCamera:CamLoc"
Possibly trying to serialize a NAN vector?
How would you go about making a key-value struct that has FVariant values support replication? I assume that with setup like below changing Key would trigger replication but since Value is not UPROPERTY nothing would change upon modifying it?
USTRUCT()
struct FRPGAttribute
{
GENERATED_BODY()
UPROPERTY()
int Key;
FVariant Value;
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar << Key;
Ar << Value;
bOutSuccess = true;
return true;
}
};
template<>
struct TStructOpsTypeTraits<FRPGAttribute> : public TStructOpsTypeTraitsBase2<FRPGAttribute>
{
enum
{
WithNetSerializer = true
};
};
not sure that would work tbh
If you want to replicate generic values you will, as you do, need to write custom replication.
If I replicate generic types I add a type hint, like a simple enum, or ID or what ever, sure this increaes package size but otherwise you won't know what you've received
(also don't know the FVariant struct, so no Idea, what its serialzation does^^)
does the attribute really need to be FVariant tho?
i mean float should be fine for an attribute
and you can convert that to bool/int using simple conversions
if you don't mine storing these values "somewhere" you also could use a template. or well depending on size maybe still a template but in a union or smth
GAS's attributes are just floats
yeah, more for general and not this specific use case^^
but then again, what is an attribute in this context ?
I wanted to use FVariant to make a sort of generic system for attributes for RPG games that I could reuse for different games. That way I could have for example an array of attributes [Health: int, ArmorRating: float, ...] for one game and for other game a different array, but all that with one generic system like this. I wanted to make a small toy GAS, if you like 🙂
But if I make it a template I couldn't then declare TArray<FRPGAttribute> Arr and then somewhere else in code do Arr.Add({ AttributeTypes::Health, 100 }) and elsewhere Arr.Add({ AttributeTypes::ArmorRating, 5.5f }) because Arr would have to be declared like TArray<FRPGAttribute<int>> Arr for example and would only take ints, right?
Depends, if you want your attributes to be different type in a game you would either need ptrs or a Union/Varian, true.
But in a game I suggest to use the same base type for an attribute, makes stuff waaaaay easier
of course you can also play with raw memory if you want. sooo many possibilities :3
But some ints don't have float representation, won't I run into issues where I, say, assign Level attribute to 15 and it saves it as 14.99999999999 and have comparison/int conversion problems because of it later?
they will for sure, if you know the type you have stored at a specific address replication is not an issue
That is good to know, I only remembered that not everything was represented. 😄 So you think it would be safer to just use GAS and just do all attributes as floats then? Maybe I could create some convenience functions to convert attributes from floats to enums and ints
aside from that, Variants should work:
Variant types can be used to store a range of different built-in types, as well as user defined types. The values are internally serialized into a byte array, which means that only FArchive serializable types are supported at this time.
even if a bit overkill
and if serialization works internally I don't see a reason why replication shouldn't
Hi! Are WAN multiplayer games supported out of the box, or only LAN? It seems my server list is empty when playing over WAN, but when playing over LAN i can see the server
No idea what you are doing, but if I run my server on my dedicated server I can connect to it without issue
well then you might need to forward some ports
no idea^^
@twin juniper Google it, but I remember UDP 7777-7779
but how do other games solve this issue?
ah
Like steam, Xbox, PSN, EOS, etc
It's very easy to test in WAN tho, just make sure the ports are forwarded to your server and you're in business.
Anyone have any idea why on the client in a listen server setup with 2 players, the client playerID is -1? Is there a good way to assign like a unified number to a player or am I missing something simple here? ControllerID doesn't seem to be the answer.
Basically I am trying to simply spawn the server player at spawn point 0 and client at spawn point 1. Figured I could easily just do it based off of controller ID but I seem to be missing something I think rather basic.
hey guys i have a boolean in a function and the function works standalone but when i do it on client the boolean keeps returning false even though i set it to true inside the function. how do i fix this?
For anyone that already knows this, if players are disconnected by the server (because say that the host ended the connection), what EndplayReason do they get?
LevelTransition/Destroyed?
Asking because I'm implementing a leave game early feature, so I just want to "punish" players that leave the game before the match ends; however, if the host leaves, I don't want to punish everyone.
they dont get a end play message
well they do just the normal destroyed one
but the same one if they click quit
Endplay does have a Quit Reason though... does it not apply?
I have custom leave logic if they leave through the game menu; just trying to also cover sudden app quitting
hard to do really
most games have a buffer for X time allowed to rejoin
else they mark you as quitter
Hi Guys, i have built a Server and trying to run it as a dedicated. However it just shuts down.
When i debug it it is stopping on this line
/**
* Dereference operator returns a reference to the object this shared pointer points to
*
* @return Reference to the object
*/
FORCEINLINE typename FMakeReferenceTo<ObjectType>::Type operator*() const
{
check( IsValid() ); //-> SERVER FAILING AT THIS LINE Ln:1063
return *Object;
}
Any ideas -> Assertion failed: IsValid()
MMO game company use the default Server&Networking in UE, or do they mostly build their own Server?
if built their own Server is better and popular, how to deal with the inside special declaration by UE, eg. in ACharacter
UPROPERTY(Replicated)
float ReplicatedServerLastTransformUpdateTimeStamp;
UPROPERTY(ReplicatedUsing=OnRep_ReplayLastTransformUpdateTimeStamp)
float ReplayLastTransformUpdateTimeStamp;
@tender badger Your question cannot be answered without the crucial information of what kind of game you're talking about. MMO is a vague term. So, yes and no.
FPS
So like.. match based games like counterstrike or huge openworld game with hundreds of people in the same map?
yep
so what's the main limitation of using the UE default server and networking?
ppl count cannot be too larger?
and how about VR game, which has less count of player, but more data, like the HMD & Hands are moving/rotating all the times.
you'll hit a massive block at around 80 players, at which point you'll essentially need an engineering team just to optimize/handle that (push model, rep graph, etc). Your next block is at around 110-130 players... and to solve that, you essentially need millions of budget 🙂
Usually player count will be your problem. Each new player causes more and more computational requirements for the server, and usually at a larger scaling factor per player. IE, going from 60 to 61 players causes more stress on a server than going from 4 to 5. More and more relevancy to be considered etc.
And let's not forget the more important elephant in the room before we start considering the engine's limitations :
Whether your systems are actually optimized / properly built for handling multiplayer frameworks
So the bottom part happens first and sets the player controller as a variable (spectated player controller). Then on the top when I try to use that variable it gives me an error that says accessed none on that variable. Anyone know why?
Where is the execution coming from?
in the character bp
the bottom happens first, then when another player dies it goes to the top (true)
You can absolutely confirm the top never happens first? Because if both of those are null, it'll still be true.
Also, your naming conventions are odd. You have a ServerRPC named HandleLocalDeath. Which is calling another ServerRPC. O.o
Has anyone here had success putting a dedicated server onto an amazon ec2 instance? I am trying to create a lambda function triggered by a Rest or http ApiGateway but the describeInstances function never seems to execute. I want to vaRest Inot that gateway in order to request a list of elastic IPs at which my servers reside.
And use the response to populate a list in UMG
that hmm variable before the branch doesn't happen till later in the code, so there's no value for it yet, so i figured it'd go to false, because the killed variable has something. And yeah i followed a youtube tutorial that told me to do those serverRpcs, but i am fairly new so
are there any good tutorials on how to set up a server for ue4 and save/load data from & to that server ?
i put print strings after true and false, and it is going to the bottom first every time
Or is there an easier or better way to list the ips of the instsnces?
Maybe for now I cam just hardcode it into the http response but I would like to let the player know the status of the servers and not list any that are down etc.
Thanks. how about a VR FPS with less than 10 players
Could this cause a dedicated server crash?
Make a request to this https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
Because your instance metadata is available from your running instance, you do not need to use the Amazon EC2 console or the AWS CLI. This can be helpful when you're writing scripts to run from your instance. For example, you can access the local IP address of your instance from instance metadata to manage a connection to an external application.
You can get ur ec2 id and public ip of it this way.
Have the ue4 server.exe update its status to a data table(I use dynamodb).
Make a lambda that loops through the table, this way you can give players list of servers and its status.
And don't ever hardcode the ip, the ip of the ec2 instance will change after shutdown.
Anyone know why my UObject is garbage collected even if I have a reference to it and I changed its outer so it's not destroyed when its old outer is ?
I might not have done one of these things correctly, maybe someone has some experience with this ?
How do you know it's GC, and is the pointer from the referencing UObject UPROPERTY
I mean not GC, destroyed when outer is, it's in a TArray inside an ActorComp
when my Actor is destroyed, it also destroys the UObject, even though the UObject's outer is another actor
Here:
I rename the UObject on the server and multicast
Does the other actor hold an UPROPERTY pointer to this UObject ?
I guess actors might actually destroy sub UObjects on destroy, anyway
yeah
the UObject is still referenced in CreateSubObjects
How do I remove if from there
How did you create the object ?
NewObject in a comp of the actor
Weird, I thought objects would only become subobjects when using the dedicated constructor syntax
Anybody know if there's any sort of debug views for rep graph? Particularly would be nice to view 2D Spatialization with some kinda chunking / lines and update rate / dormancy
Only thing I know of is AReplicationGraphDebugActor
@chrome bay Hey man, I read your https://jambax.co.uk/replicating-uobjects/, could you take a look at what I said just above, pls ?
I think I did everything you said but even though I change the item's outer it's destroyed with the previous outer
I mean I don't know if the UObject is destroyed but it's marked as pending kill
Not sure what you mean exactly, you're changing the outer at runtime?
Unless it is an elastic IP
Thank you so much! I didnt think anyone would be able to help but you delivered!
I don't think that's particularly well supported tbh
how do you transfer uobjects between actors ?
Usually you don't
works fine for me besides the destroying part
You'll probably have the same issue trying to move an actor component to a different actor
I won't do that
How do you get unreal to talk to the data table?
Ultimately it's the same thing really, components are replicated the same way
I thought your tutorial implied you'd do transfers
I use actors for the actual items themselves, the UObjects are just slots in that tutorial which are fixed
so no game at all uses uobjects for multiplayer items ?
using actors doesn't sound optimal
Probably not AFAIK
you spawn them at 0,0,0 and then teleport ?
Well if anything it can be more optimal, it uses a channel, but you can control relevancy and update rate per-actor.
If you have an actor with lots of replicated child object, they will all replicate at the same time, at the actors' frequency
In every game I've done so far a weapon for e.g. has always been it's own independant actor
And inventory slots are either a simple struct/array or a fixed object
okay
How can instigator be missing on clients on server-side spawned actors.
On server I have actors spawned (turrets) passing valid Owner (tower actor) and Instigator (player pawn) during deferred spawn, but on clients the Owner is valid but Instigator is null
instigators (player pawns ) replicated and exist on client
ATurretObject* Turret = GetWorld()->SpawnActorDeferred<ATurretObject>(TurretClass, SpawnTM);
if (Turret )
{
Turret->SetOwner(TowerBase);
Turret->SetInstigator(OwningPlayerPawn);
...
Turret->FinishSpawning(SpawnTM);
}
didn't seem to be different from
GetWorld()->SpawnActorDeferred<ATurretObject>(TurretClass, SpawnTM, TowerBase, OwningPlayerPawn);
Does anyone have a resource that properly explain the dedicated server pipeline?...
I'm working on a game that work similar to Valorant
where there are many players who split to different games
- How do I appreciate it?
- Do I need to run a a server for each game instance or only 1 game instance which will handle all of the games?
- Do I need to use sessions?
:clock2: Stryke#8490 was muted for 10 minutes.
You need 1 dedicated server instance per game, you would likely use sessions yes. Beacons also.
Yes 1 session per game
party sessions != Game sessions
and game mode base already creating the session for me correct?
wait so the client connect to the server and then look for sessions, since the server start new game instance when there arent any available the client will find all of the sessions of all the instances
basically the sessions wont collide even if they are running from different game instances
right?
(btw i wasnt sure where to post this...)
no
depending on your game, and OSS
you create a lobby (for you and your friends to join)
then again, depending on the game, you either show a list of servers or you search for a match
searching for a match will get the dedicated servers, check if there is space, etc, and put you in a game. If no server is found, it spools up a server or connects you to an empty server,ec
there is a lot involved.
by game instance i mean the dedicated server version thingy
all of those dedicated servers use the same ip as the server?
or do they need to run of separate servers
where each server run 1 dedicated server
same server can run multiple instances on different ports
its up to your matchmaking system to handle that
and the matchmacking system isnt a part of unreal right?
or is it the session thing?..
also depends on what CPU hardware your server is running, as it may experience a degradation in performance if you try to make the server instance handle too many of your game servers at once.
Some Online Subsystems have matchmaking, EOS does. Most of them don't afaik, I don't think Steam does. If you want scalability of your servers, to meet the player demand, then AWS Gamelift or PlayFab are your best out of the box options. PlayFab is much more suited for those not very familiar with the AWS ecosystem and AWS's documentation is written in a way that you should already understand how to use AWS.
I'm still confused as to how the matchmacking system knows what to do....
