#multiplayer
1 messages · Page 682 of 1
How can I create a replicated shooting system? I tell the server to start and stop shooting from the client. The server grabs the socket position for the projectile. Which works fine when stationary, but while moving, it can result in drastic differences between when the vector and the client, and the server vector. For example, during a sweeping single shot. The red shot is the trajectory for the Server, where as the green one is what the client had.
You would spawn the projectile only on the server.
Why you do it on both client and server
generating a random password for a server, not sure that's the most optimized way of doing it but it works lol
I'm not trying to. I'm saying when moving or rotating, there can be a massive difference of the Client Muzzle Socket Location, and the Server Muzzle Socket Location
You would grab the socket location from client and send it to the server
So the green line is where the player was looking down the sights of the weapon when it was fired, but the red line is where the server saw it
That was my thought as well, with some server side checks to make sure it's relatively close to the server side position to negate most cheating
That’s how ShooterGame does
If u take a look at the project
I guess games like fortnite does it aswell
oh yeah? just does a check if within x amount of distance, then valid?
They grab location and rotation from client
I don’t think they check that
But you can check if the start location is close from the Owner Pawn
that's my idea as well
Also, how u planning to make it accurate to your screen center ?
With shooting from the muzzle
There’s a small amount of distance where shooting from the muzzle is not accurate
I don't want it screen centered all the time. I want the muzzle vector to be the vector it will spawn from
hello! I have a question about chat
I currently rework some parts of a released game, in this game we implemented a basic chat system using RPCs inside the PlayerController, but I wonder if there's more powerful/better ways of doing so ? I've read a bit about steam lobbies message and it seems interesting but I don't really know if this is adequate (we use Unreal's session system, no dedicated servers or connection by IP)
Could try using some kind of cloud database for a chat backend if your data needs to be persistent.
Then use the VaRest plugin to send and receive json
Hey! I just made 2 characters connect in the same Level. I can See both walking as the movement component is already replicated.
however I have a character who can run and walk on walls (all these action are animated), and none of those animations are replicated.
I search on Youtube but only found how to replicate Montages.
Is there a way to replicade the Animation BLuprint or something like that?
You don't replicate animation, you replicate what drives animation
so, should I replicate this variable for example? And every other responsible for the transitions?
You replicate whatever is required on the pawn to drive the animation.
But character movement gets weird and is absolutely NOT trivial in multiplayer so you'll have to really know what you're doing to make things behave butter smooth.
got it
For example the default 3pp character just uses velocity and bIsInAir to drive the animation. That's all replicated by the CMC
sorry, what is CMC?
Character movement component. If you have to ask that you're nowhere near getting a multiplayer wall run to behave.
But just keep in mind that the animation BP knows nothing about networking. Just replicate what it needs to drive the animations.
right
What about changing character's position via action animation.
I'm have some problems. (the client moves, but then its foced back to the initial place)
yo, so i was curious about level blueprints driving certain gamemode values(enemies spawning for example i guess), would level blueprints work for this in a multiplayer setting?
I'm using AWS gamelift to host servers for my game, I'm getting this issue where even when the AWS session is set to be 24 players max, it is still limited to 16 players by the engine, I checked the log when I tried to join a server that was at 16 players and it gave this error:
Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Server full.
how can I adjust this number to be higher than it's default which seems to be 16?
it depends on the game itself, but you could do it in the gamemode class, or also, I created an actor that's basically my "Gamemode controller" that controls various things related to events in the game etc
I think I will let people host their own servers but you didn't answer my question, if people could host their own servers, would console players be able to join servers if a put searchbar and stuff like that ?
AGameSession::MaxPlayers sets how many slots a Server has.
ah, yeah that was my second option, i suppose ill probably have to try it out and see too
um, can you explain this a little bit better? would I call this as a console command? or is it a setting somewhere?
We usually define the Player Count within the Command Line Args as a property that GameLift sets for the Server Instances
Its a property
Set its value
MaxPlayers = UGameplayStatics::GetIntOption(Options, SessionOptions::GLOPTION_MaxPlayerCount, MaxPlayers);
This is ours
Within InitOptions of our GameSession class.
hmm i'm using blueprints, i use a plugin to interface with AWS, i'm guessing that what you just described is done with c++?
MaxPlayers is also exposed as a Config variable
So you can set it via the .ini files
DefaultGame.ini
In your case your only option is to set it in the Config if you dont have access to C++
ok i see so I can just add "MaxPlayers=24" to defaultgame.ini?
MaxPlayers=16```
ah awesome ok ty so much this is exactly what I was looking for
my playerbase will be stoked i'm fixing this lol
👍
Create an array containing all desired characters the password could contain. Then just use a loop, requesting a random array element to generate it.
Anyone for my question above ? #multiplayer message
Please ping me if any answer
That's root motion. Just Google ue4 root motion replication.
If you have to ask the question, you won't be doing dedicated servers.
I don't understand ?
I'm gonna ask it differently to see if it helps :
If in my game, I let people be able to put the ip of their own servers (so not on their client but through a server provider so the session is always open and people could join), could consoles people join too through a search bar and typing the name of the server shows you the surver and you can join it (like in minecraft) ?
having players run their own servers doesn't prevent cheating in any way, shape or form, it just changes how they do it, slightly
and you either need a matchmaking service that will let public servers register, then provide their information to players, or your own custom matchmaking servers to allow cross platform play
@winged badger yeah sorry I know that allowing custom servers won't stop cheating (but that's ok in a way as my game isn't based on skill or other important stuff).
Do you have names of matchmaking services. I mean isn't something in Unreal to do that ? Also would people on consoles be able to find those hosted servers by people ?
anybody know some good multiplayer tutorials that actual build a working project
ping me if you know some
Hm I'm not sure that's the correct answer haha
AWS is mostly for hosting and not necessarily something to register sessions for matchmaking
Guess EOS in combination with AWS could do the thing, specifically if they want cross platform matchmaking
You'd need to ask the console developer you work with about whether they allow it.
And no, Unreal doesn't do matchmaking - your console does
That's how they see the subscription money
Correct me if I'm wrong, but I think Epic Online Services can be used to help with matchmaking. I imagine you'd have a server create a session when it starts up that people could join into. Clients could then look up the sessions and you can have the engine filter results as you wish (possibly including by name, if you use some regex magic). As far as cross-platform, that I don't know, but EOS does support consoles too.
Hello, I'm trying to implement a save/load system inside a multiplayer game. I don't know why my PlayersDB variable returns 0 when called from outside of PlayerJoined,RefreshPlayers or the LoadGame function. While getting the varibale inside those events/functions works, trying to call it from 1 Pressed doesn't work. Here is my blueprint.
Index 0 will always return the first player in the array when run on server
While if you use it on client it returns itself
what's the best way to destroy an actor that a client has "picked up"? I know there's running a multicast on the player controller but that doesn't feel like the best option.
Just destroy it server-side
gotcha, thanks! i feel kinda dumb i didnt think of that.
This is exactly how it is set up in the tutorial. Red returns 1, Green returns 0
You're reading Red from server, Green from client
So how to i solve it if I want the server to save the game?
RPC?
Run On Server
Sorry for the dumb questions, I'm pretty new to multiplayer. So you're saying that I should create a Custom Event thats set to Run On Server where i plug in theSaveGame function, then call that Custom Event from the key press?
Key 1 Pressed -> Custom Event with Run On Server -> SaveGame
Doesn't work
How do you save?
As I said, if i connect a Print String with the PlayersDB lenght anywhere here, it prints 1. So it works there.
RefreshPlayers is a multicast
It's weird to handle it in the ThirdPersonCharacter tho
Got any better tutorials? I would gladly follow them.
You many wanna have it in the GameMode / GameState iirc and have logic there for saving
Client should have nothing to do with saving if an online game
Server should handle it all
Pretty sure there's something in the logic too that's not going well
It's meant to be a Host-Join multiplayer.
Then the Host will be the server handling it in the GameMode, no real difference
You can hold custom data in GameState for saves if you want other players to know about states
GameMode saves -> calls refresh on GameState
Since everyone knows about the GameState all the time
And it holds an Array of all PlayerStates
For example I have in GameMode OnPostLogin logic that initializes a save slot for a player and loads character if they already have one, then it updates the GameState list to let everyone know that the player came online and such
It should not require too much hassle, just a normal save state and you can still use the data from the saves to do anything like store them in an array or update it
Think it in steps, for example
Player Logins -> Check if they already joined the server before -> If they do check if they have a character -> If they do load it, if they don't spawn them / character selection -> Let everyone know about the data if you need to through an Array in the GameState or such
For example if a player is logged on they will be present in the Array, if they are offline they will not
If you use any subsystem you can use their ID as identifiers and save slots
I do
I see... Tho you explained it pretty well, which i appreciate very much, any tutorials on this approach? I'm surely going to stumble upon many errors or thinks that i have no idea how to do...
Not sure if there are any tutorials tbh, I just did it all myself with JSON, but I imagine there should be?
My best advice is to just abstract it into smaller code and don't worry about letting other players know for know
Alright, I'll see what I can do. Thank you very much! If anything, I'll ask again here.
I see. Thanks.
The thing is I'm not working with Consoles devs as I'm a solo dev, so I need an answer to know if it's possible or not
Yeah I know about AWS, but it's not answering my question : If I let people be able to host their own servers (they purchases anywhere) to host a game, would console players be able to join ? YES or NO ?
And I'm telling you the only one to be able to answer is the console manufacturer - this information is private.
And as you might be aware, crossplay is a recent business
yeah but it's not only about crossplay, as crossplay usually the servers belong to the company making the game and in this case the servers are the player's ones
You're right, it's even worse, but the crossplay part alone is a problem so ask Sony and Microsoft once you're in business with them
I'm far away from that, but just need an answer to that
This information is private, no one can give it to you
It's the stuff you learn after signing a NDA
So if you want to know the crossplay policy for a console - which is probably something like "yes but here are our terms for it" - you have to get in touch, sign the NDA, etc
One leak from the Epic v Apple shitshow supposedly had crossplay be a paying option
Or plan for the answer to be no and at best you'll be pleasantly surprised later
Sneaky Kitty Gaming On YouTube as a 100+ video series on him making COD Nazi Zombies in UE4 with multiplayer.
Sneaky Kitty Game Dev is the channel name now. This is the playlist: https://youtube.com/playlist?list=PLnHeglBaPYu-H3Gqe_94oFkmn9amBXNZp
If it is a replicated object, it will never be a proxy on the server. The role will always have authority. Simulated and Autonomous proxy just differ in the way they are meant to replicate things. Simulated is pretty much controlled by values replicated from server. Autonomous usually relies on a client uploading values to the server to be replicated for other clients to simulate, though some values can still be server authoritive. Character is a good example of this as it is an autonomous proxy for the client possessing it. Their control rotation's pitch is sent to server, and other clients use this to drive their own local anim offsets. The character also relatively moves freely on the client except when it goes too far and server corrects it. This keeps the autonomous proxy from constantly overriding the client, which would make the user feel like they're always fighting against the server.
ROLE_Authority is pretty much 100% of all server-side objects
ROLE_Authority is on client for every unreplicated object
Because everything on the server is authority
100%
This check is about more than "are we on server"
It's "do we have no remote player and are on server"
Or single player
Good move
How do you make "specific player" work when running Execute console command node? typing quit and providing the controller doesnt make the client quit the game
HI Guys, sorry for the mess. I try in a Multiplayermatch to stop movement.. I call this from the Actor (a Capsule) which overlaps with the Player. It works alone ut when i try it in Editor 2 Players Listenserver, it crashes..
both players inherited from th ebase character
What is hooked into the "Enter" pin on your gate?
So you have something on your player controller or character that calls an interface that then triggers the event that feeds into the gate's "Enter" pin? Nothing is replicated from client to server? is there any specific cases in which it crashes? Like does it work once, or just not at all, or does it crash when you overlap, or when you trigger the interface?
install editor symbols for debugging, reproduce the crash and c/p the callstack
I'm having some trouble with sending data to the player controller
I'm trying to make it so the character, before it gets destroyed, it gives the inventory array to the player controller and so the next time the character gets spawned it will get the inventory from the player controller
Here is my code for updating and receiving inventory:
Should I use the player state instead?
Yes its just the Interface F and it works on doors ect. The thing is i am not sure how to replicate it. It crashes immediately after pressing the Interface Button while overlapping in Multiplayer. SP is normal
Oh install editor symbols? I google it. The callstack from the crashreport right?
I'm trying to debug an issue in my project regarding TearOff. When a character dies, they have TearOff called on them. Stepping through with debugger, TearOff only ever gets called once, but every time a client hits the now-dead, torn off character, it has TearOff called on it again for some reason. I traced back to UActorChannel::CleanUp, where bTornOff apparently doesn't hold its value of true, and so it keeps calling TearOff on the character. Does anybody know what might be going on here?
Are you only calling TearOff on the Server?
Only on the server, yeah
That is weird
What do you mean by "hits"?
This is the relevant call stack every time the client attacks the dead character
There's an attack gameplay ability. Does some melee hit detection and deals damage to the character that gets hit
And your death event isn't getting called again for the dead character? Where is TearOff getting called when a client hits the dead character? On the hitting client or the server?
Yeah that's what's really weird. When my client hits the dead character, the breakpoint for TearOff never gets hit
I've searched my entire codebase for calls to TearOff and they dont show up anywhere
Also while debugging this, remember that after tearing off an actor the client becomes the authority
Why do you think it's getting called multiple times then?
I have absolutely no idea, lol
I do a search for TearOff() on my entire project and the only hit is the one I have a breakpoint set on
I suppose it may be a complication caused by GAS?
The attack ability is local predicted, it may be related to that hitting a torn off actor
I am using an array in a player state to store item references for an inventory but the array just clears itself of all items in it after ~30 seconds. Is this normal behavior?
This is how I am setting the array :
And this is how I'm printing it:
Here's my initial output:
Then my output after picking an item up:
Then finally my output after ~30 seconds:
wow
just found out that you need to multiply PlayerState's Ping by four to get the correct value
because for some reasons the engine takes ExactPing, rounds it and divide it by 4 before sending it out 🤔
@pearl fog It does that so it can fit it into a uint8 for optimization purposes
Because by default FNames are 12 bytes. That size is excessive since they can quite literally usually be represented with nothing but a few bits. Internally FName is nothing but a couple of uint32. So they're packed down into those bits for networking.
Basic question . Is there more proper way to access PlayerState on Character creation than seconds delay in Event BeginPlay? Somehow whit OnRep:s inside the PlayerSate? Not managed to do that successfully.
You can override OnRep_PlayerState() in the player controller.
cd ..
That also exists in the Pawn/Character
Just keep in mind that the cpp version of OnRep doesn't call for the server. So you need to find a different call for that one
Is there a way to prevent no-spread, no-recoil cheats ? I could replicate it but it would be useless since this is the kind of value we only set one time
depends on how you do spread*
if its purely clientside then not really, if its serverside then definitely (but at the cost of very bad jank), if its somehow clientside (eliminate jank) and serverside (for extra validation) then its win win, but the implementation isn't trivial
recoil is done locally, adding value to yaw/pitch input
i don't have spread in my game for now
and i'm only planning to do it for hip fire so no need to add cheat verification on it
sorry I talked more about spread, no-recoil cheats are arguably impossible to prevent 100%
i could replicate recoil values, and start recoil before launching projectile (since projectile are done on server) and then checking before launching projectile on server if recoil values are good
or does the opposite
applying recoil after projectile but checking after projectile launched if recoil values are good before applying them
if not override or just ban the guy ?
I dont know, what if the user is counter acting that recoil with inputs?
Usually you aren't getting rotational updates from the client in-sync with their firing RPCs, so it's very hard to actually validate
How do you plan on validating that?
u mean macros ?
No just by moving their mouse
How do you tell what's a cheat and what's a legitimate input
and even if with macros, how can you the developer tell the difference?
it's impossible to do
No but it modifies where you're aiming
Which as far as server is concerned is the same thing
Depends on your implementation I guess
unless you've got a magic mouse hardware API that encrypts inputs to prevent macros
that is impossible to do
yep
but anti cheat does detect macros software
they generally hook mouse functions from win api
but anyway
Generally for detecting input hacks all you can do is run an anti-cheat software
yup but i was talking about modifying recoil values
at the beginning of the discussion*
yeah, or you can have some not-at-all-trivial validation layers in your game code that give player a trust score and solve the problem with a 'soft' solution, a bit like what Valve does
It depends how your recoil is implemented
If it's the usual way, I.e. just rotating the camera up, then you can't do anything to detect it because the player will just counteract it with the mouse anyway
And also those tiny rotations are way to sensitive to network error
(this is purely testing code dont take attention to naming)
Test is setting recoil value each time you fire and Turn is executed each frame cause it's a BindAxis callback
Be safer to tick it instead IMO
I couldn't to the first piece of my code then
i already tested by tick 😄
recoil for us is essentially "add some rotation to camera after firing"
And since bullets go where camera is facing, it directly affects where shots go
But the rub is, the players look direction is a) heavily quantized and b) sent by the character movement component
So it's not perfectly accurate or in-sync with the firing RPC's server-side
Well i could have just add rotation instead of adding value to inputs but again i couldn't do the first piece of the code
compensating player mouse movement
So while we do check the player is shooting from their location + rotation, we have to allow tolerances
yeah true
You also have to allow for players literally spinning on the spot
Players can turn some 60-90 degrees in a flash like it's nothing
Validating where they're looking is pretty impossible to do accurately
yeah, rotations aren't stateful, they are part of the input
so you cant do any over-time checks on them trivially, in my setup rotations are 100% client auth
So there's no safe way to check recoil
😐
Does games like PUBG and Fortnite prevent that ?
(taking them as example since recoil is important in those games.)
Unlikely IMO
best they are probably doing is their own version of anti cheat
slap that in and crossing fingers is likely the best approach 😄
Argh
anyway even if i tried to prevent that
there's macro
👍
so yeah impossible to prevent
im wondering if anti cheats does detect macros from "verified software" like razer and logitech
🤔
@twin juniper Things like this cannot be prevented by the server. It's too hard to do. Too much latency, not enough fresh data. That's likely one of the major reasons that Epic bought out Kamu. Client side cheat prevention is the only realistic way to handle that appropriately if it means that much to you.
hi guys i have a headache now can someone help me?!!!. I maybe at wrong direction but how do I replicate variables with COND_OwnerOnly if my pawns are simulated and my controller possess RTS camera?
@sinful tree Sorry for pinging. But i'd like to follow up on the question regarding the deleted pawns on disconnect.
After a lot of debugging and testing, we finally found the exact circumstance a pawn is still getting deleted despite all the overrides we made. **When a player crashes ** is when it happens. As long as a player disconnects, even with alt-f4, pulling internet cable, whatever won't cause deletion of the pawn. But when a player is possessing the pawn and then somehow crashes that's when the pawn still gets deleted.
We've also done some further investigation and saw some really strange stuff happening when a player crashes. For example, even logout in the gamemode which is normally always triggered is NOT triggered when a player crashes. Even more interesting, when a player crashes, his pawn's actor doesn't even trigger the destruction event which again in normal circumstances will always fire no matter what. It's almost as if there is a hidden overriding super delete that only gets used when a crash occurs on a connected client. Like the engine trying to aggressively delete everything the player was connected to without even using the regular deletion methods that are inherited down from AActor to APawn. it's like a delete that doesn't even exist in AActor.
Any idea what this strange behaviour is?
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/OwningConnections/
Essentially, as long as the player PlayerController is the most outer owner of the actor, then it will receive the OwnerOnly replicated data.
In my instance, I started with a fresh Third Person template, no other changes other than removing the PawnLeavingGame() call from the player controller in C++ as I had mentioned in my previous post about this.
The game wasn't packaged, but I wasn't running in editor - I ran the server and two clients from the command line.
All pawns were spawned on the server and were marked to replicate.
When testing I tried these methods:
- Forcing a crash using the console command "debug crash"
- ALT+F4
- Shutting down the console window for the client (which should be a graceful quit)
- Shutting down the process for the client in task manager.
In all test cases, my controlled pawns were not being destroyed when the client that was controlling them left the game. The pawns remained in the game and could be repossessed by the remaining client that was still connected to the server.
That's about all I know. :/
I don't really have the time to package a server and client build to test if that may make a difference, but I sort of doubt it would.
Hey thanks for the in-depth testing results! Much appreciated. This is very useful information for us 🙂
We're planning to do more testing today to get to the bottom of this. I'll def share the results of our upcoming tests and if and when we finally fix the issue.
Could you maybe share your .cpp and .h code for your adjusted controller?
Would love to compare with our own code
Perhaps we screwed something up
Also, another test that might be helpful is using the low entry extended library node called "crash"
I think this crash might be a bit more serious than the debug crash command
It's pretty much just completely overriding the existing PawnLeavingGame() function and just putting in an on-screen message.
.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "CPP_PlayerController.generated.h"
/**
*
*/
UCLASS()
class ANIMATIONASSETS_API ACPP_PlayerController : public APlayerController
{
GENERATED_BODY()
public:
// Server only
virtual void PawnLeavingGame() override;
};
.cpp
#include "CPP_PlayerController.h"
void ACPP_PlayerController::PawnLeavingGame() {
if (GEngine)
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("The player controller has a pawn, and it should still exist!"));
}
Thanks! 🙂
I have that plugin... lemme give it a go.
Your code looks pretty much 1/1 with our code except for the debugmessage
The thing is though that this code works as well. Just not when a player crashes.
Seems like the crash node with the low entry works fine on my end too.
Hmm ok very interesting
The thing is that the deletion happens on our dedicated servers
So maybe it's something linux build / package related
We haven't tried it in editor yet
We'll try that next
You're also sure your player controller is set in the game mode / your player controller class you're using inherits from your C++ player controller?
Blergh... Sounds super frustrating.
Yeah haha
It's one of the last remaining (but sadly very gamebreaking) bugs in our live game
But at least I'm happy we are able to recreate it now on our end. Because up to now our players reported the bug a few times per week as it doesn't happen THAT much, but enough for people to be annoyed by it
Is there a Steam Callback which is called when a user hits "Join" in Steams built-in Server Browser?
By default it launches the game with a command line option, but clicking it with the game open does nothing atm, so need to intercept it
There isn't
You need prediction/rollback/replay on owning client, and interpolation on spectating clients
Yes
is it possible to have smooth rotation with no lag when using üse Controller Roation YAW unchecked?
for some reason I keep jittering when rotating
this is the issue https://streamable.com/uw14n3
if its a limitation in unreal, like something in the movement component of engine is stopping it from working, can a c++ plugin fix it so it doesnt lag?
You probably don't want something to send RPCs on tick as reliable. You're asking for trouble if you do so as you can end up flooding the network fairly easily.
I think you need to change your OnReps so that you're not manipulating the turn of the character that sent the request.... Otherwise it's like:
Client1: Moves mouse changing rotation.
Client1: Sends to server "My Rotation is X"
Server: Ok, setting your rotation to X
Client1: Moves mouse a bit further, increasing their local rotation.
Client1: Sends to server "My rotation is now Y"
All Clients receive the FIRST replication, including Client1: Set rotation to X -> Client 1's rotation is now what it previously was, even though they've moved their mouse further and should be at position Y.
there is also no point in sending RPCs on Tick as reliable, as if the network stutters, Tick when it starts working again will send updated information before the RPC sender has any idea that original RPC failed and needs to be resent
hey everyone, I'm developing a simple multiplayer game that uses steam and p2p servers and I'm facing random glitches that seem to be caused by latency or packet loss (character rotation / sprite is sometimes not updated, or jittering movement). I'm trying to understand what can cause these gliches but I dont have much expertise when it comes to server optimization or multiplayer in general.
- What would be the right way to tackle these glitches ?
- Is there any documentation / tutorial that can help understand and optimize the numbers on the screenshot ?
- Am I even looking at the right numbers to try to fix latency issues ?
i have a bit of a weird issue, when i compile the server and try to add the "-log" to the end of the shortcut the console doesnt show when i open the server, any 1 seen this before?
i cant even see the server process in the task manager
nvm its actualy closing so fast the thing doesnt even have time to show up
is it heavy for clients to load Navigation? I assume there must be a reason since it's normally false
Server does all AI navigation usually, so you may not need it
I would be real interested in this aswell. I assume your best bet would be to use some sort of interpolation for movement but that’s my uneducated guess. Latency and packet loss isn’t something you can control besides brining the server closer to your clients. I would love to see someone maybe point towards a good resource for interpolation/fixing issues like this.
I'm pretty new to troubleshooting networking issues as well but I found this guide was a good start. https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/NetworkProfiler/
have anyone tried something like: TArray<FSlotArray> ? FSlotArray is subclass of FFastArraySerializer. I have tried this, but the function in FSlot PostReplicatedAdd or PostReplicatedChange never executed.
but If only replicate property FSlotArray in InventoryComponent, PostReplicatedAdd and PostReplicatedChange will work
When developing multiplayer is it better to use CPP or can you get away with using Blueprints?
Largely better using C++. Blueprints are okay for minor things, but the main issue with them is that they do some things strangely, like calling OnReps automatically on server. You also miss out on pretty much all control past replication type. You cannot custom netserialize for better data transfer. You cannot use FastArrays. Tou can't use PreReplication overrides, etc.
Is there a way to replicate playing an animation on an object in the world? So that the object is always in approximately the same state on all machines?
This is for a door opening, etc, so it's important that it's synced, and some of the animations may take some time.
I guess replicating the playtime and lerping towards that might work, but wondering if there's anything built in.
Hey there commutiny . I am replicating a stucture with user data such as Name and Image .When the game starts player downloads image from internet and sets it into structure .
In the server side it works absolutely fine . images gets set . but clients cant get that image , at the same time Name gets replicated absoluetly fine ! why is that happening?
Well, does the image data exist on clients ?
the stucture is replicated . it must automatically exist on clients , but its not . Thats the problem
Okay, I understand that, but that's not what I asked
What is the image? A texture asset in the content browser ?
structure got another variable . "Name" which is string . and i can get it absolutely fine
image is dynamic texture 2D
from "Download Image" node
Alright, then there's your problem : you have to replicate that data
When you replicate a texture you just replicate an identifier to it, because textures usually are on every client already in the game data
You should download the texture on every client instead
Just replicate the URL and download when the URL changes
Can you write the same network code for both dedicated and peer to peer ?
So it would work on both
ShooterGame does it
That was my guess.. event server validation bits ?
Just a matter of correctly decoupling "server or client" from "locally controlled or not"
Yep !
As long as you don't write your code assuming all machines have a local player controller, or assuming all players are remotely controlled, there's no huge trap
hey all, I want to create a virtual meeting space, which others can join e.g. from a browser, where should I start?
Hello, when doing rpcs in blueprints do i have to pass the controller from client to server so i can know who to reply to?
Why would an RPC imply any sort of reply?
Im doing a login system with rpcs, like when a player types username and password he sends them to server with rpc, am i doing it wrong?
i want the server to replay to client that the login failed or successeded
Hello, I encountered a strange "bug"
When it is called on the server, everything happens, but on the client it does not always work like this
The server needs to send a Client RPC to reply
No of course not
You can have variables replicate over multiple frames
Why does this work in half?
event 2 is not called
Maybe all of those received in that frame but in real world conditions if you change three variables on the server, you could get them over 3 frames
Yes I am
Replicated variables only guarantee that they will replicate A) correct values, B) at some point
There are no guarantees over A) order, B) intermediate values (1 2 3 could replicate as 1 then 3 without replicating 2) or C) consistency of different variables
Consistency can be enforced through an Atomic structure
The answer is also 7 years old so it's not exactly a great reference, but okay
yes, but how do you tell the server to which client it should rpc?, for example client1 requests login, when the server is done verifying how does it know which client it should rpc to tell it succeeded or failed? for me i pass the client controller thro the rpc so the server knows to which client it should reply to, what i want to is is this the correct way to do it?
Client RPC is to the owning client
So there is nothing to tell the server here
I still dont get it, lets say you want to start "exchange/trade" with another player, how does the server know which player you want to exchange/trade with? how does it know which client it should rpc to send the exchange/trade request?
RPCs are called on specific actors and Server/Client RPC can only ever happen between server & owning client
Read the doc
yes thats right
Does anyone know why when I try to call a RPC function from client to the server I get No owning connection for actor? Using C++
In other words a Server RPC is always from the client owning the actor to server, Client RPC always from server to client owning the actor
Actor isn't owned by the client
== can only RPC on Pawn, PlayerController, actors owned by those
but when you send a trade request to a specific player, you tell the server, and the server must know to which client it should rpc to send the trade request"a pop up UMG"
That problem is completely unrelated to RPCs, it's up to you to decide a protocol (probably by passing a player state pointer in your RPC)
thats what i do, i pass the object thro rpc, but is it the way to do it?
i mean is it a bad thing?
It's pretty much the best and most obvious way
You could pass the pawn instead but that's dumb
The player ID from player state maybe ?
Just use player state
I have a bunch of custom, non unreal engine, datatypes that I need to replicate. I thought I would just throw them all in a ustruct and use the NetSerialize function, but I am not able to find any documentation on how it is used? Does anyone happen to know of a good resource for figuring that out?
You can look at some the engine types that implement NetSerialize
Such as FHitResult for e.g
or FRepMovement
Ah ofc!
Is there a NetDeserialize as well?
How do I deserialize data after serializing it with NetSerialize?
So currently I have this:
USTRUCT()
struct FChessMoveReplicationData
{
GENERATED_BODY()
public:
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar.SerializeBits((void*)OriginSquare, sizeof(Caissa::Square));
Ar.SerializeBits((void*)TargetSquare, sizeof(Caissa::Square));
Ar.SerializeBits((void*)CapturePiece, sizeof(Caissa::Piece));
Ar.SerializeBits((void*)Type, sizeof(Caissa::MoveType));
bOutSuccess = true;
return true;
}
public:
Caissa::Square OriginSquare;
Caissa::Square TargetSquare;
Caissa::Piece CapturePiece;
Caissa::MoveType Type;
};```
How is this supposed to go both ways, am I missing something?
Oh, so SerializeBits deserializes as well?
Ah, right, that seems kinda misleading.
But thx!
Thx!
Struct access modifier is public by default. you don't need public:
I know, I like being a bit explicit with specifying access specifiers, one for functions and one for variables for each specifier. Just for clarity.
On my client I've got 2 cubes that are attached and welded to each other, however when moving the child jitters a lot. Any suggestions??
How are they welded?
I made a bp with 2 cubes, using Begin Play I "Attach component to component"
I did this in a fresh third person templated game just to make sure i didnt break something
have you checked the "is replicated" checkbox on the meshes of the cubes?
Yep
try untick it
I checked that box on my player character while testing networking and it caused ALOT of jitters
The issue with turning that off is that the objects are no longer in sync with the server
Because the server and client are simulating differently
How do you plan for the cubes to move? are they meant to be physics objects?
For testing I made the 2 cubes have an ice-like physics material so that players can push them by walking against them.
They jitter while being pushed and while not being pushed but still moving
*One jitters (the child)
They are physics objects yes
How to fix homing projectile glitchy movement on the client side ?
I am trying to send my newly created struct with custom NetSerialize function through a Server RPC, but the serialization/deserialization don't seem to work?
USTRUCT()
struct FChessMoveReplicationData
{
GENERATED_BODY()
public:
FChessMoveReplicationData(Caissa::Square originSquare, Caissa::Square targetSquare, Caissa::Piece capturePiece, Caissa::MoveType moveType)
: Move(Caissa::Move(originSquare, targetSquare, capturePiece, moveType))
{
}
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
UE_LOG(LogTemp, Warning, TEXT("Replicated, %i"), Move.Type);
Ar.SerializeBits(&Move.Type, sizeof(Caissa::MoveType));
bOutSuccess = true;
return true;
}
public:
Caissa::Move Move;
};
template<>
struct TStructOpsTypeTraits<FChessMoveReplicationData> : public TStructOpsTypeTraitsBase2<FChessMoveReplicationData>
{
enum
{
WithNetSerializer = true
};
};
Out:
...
LogTemp: Warning: Replicated, 4
...
LogTemp: Warning: Replicated, 0
...
repnotify. If you RPC them, then their state can go out of sync for anyone who joins after / is out of net culling range etc.
thank you mate
How do you handle transient stuff driven by Repnotify?
Like the door opening animation on onrep_ bDoorIsOpen, how do you detect the opening of the door vs the door just now becoming relevant or late joining?
It really would depend on the design of the level I suppose.... Like if the player is starting in a location far enough away from the door, or the net relevancy distance is great enough, it doesn't really matter if the animation plays on their end again as it probably wouldn't be seen or heard.
If you're that worried, I guess you could replicate the position of the door instead / the play time of the timeline controlling it, or whatever else you want so that it's more in sync with what is actually happening.
i do a multicast for door opening/closing
then the state keeps it open/closed
using a state here can also cause issues
i take the chest example: You multicast the chest opening (playing fx, etc), and you use a state to determine if its open/closed
another way for things which take a long time, is using a struct to represent to the current state, which gets updated by the server, but this is only if something takes a long time and its possible client will see door closed when its still opening cause they missed the multicast
Sorry to thread jack a bit, feel free to respond over me, but does anyone know the best practice for replicating responsive client side events?
I have a flashlight that I want to toggle, I would like the client to set its on/off state locally so it feels responsive no matter the connection. Right now, I have the client set their light state, then run a nep notify on the server to replicate the state to other players. The only issue is that with the "Bad" network simulation, since the client lags behind, the server sometimes overrides the player and flips the state causing a weird glitchy effect. Is there any way around this?
You're basically trying to predict the flashlight state.
For a flashlight you can just make it client auth if it doesn't really have any gameplay effects. That is, if it doesn't have an Ammo or Energy or whatever.
Howdy I had a question I was wondering if anybody knew of any ways to debug why my compressed flags from my FSavedMove weren't being sent from client to server?
Thanks, I tried looking more into the client auth but couldnt find anything, is there any documentation you could point me towards to set up the client auth?
Just skip the owning client when replicating bLightIsOn
Press button -> turn light on -> RPC to server
perfect thanks!
I'm creating multiplayer building system and I want to spawn preview mesh only locally but when call function from that mesh it comes visible and use collision to all
How do I make that?
Seperate actors. Same class.
Like when spawned it call spawn actor from class(server) self
Spawn local actor.
When ready to make it solid.
RPC to server.
Okay!
calling server travel is duplicating my ui
how do i fix this
my ui is fine prior to calling it
ui is duplicated
top fucking kek; I figured out why my flags weren't being replicated
Since it's a TSharedPtr I cannot make this variable replicated, how could I go about replicating it to clients?
Hey guys, I having a hard time trying to add force to a character.
As it depends on math equations and uses camera position to calculate some points, the client and the server are getting different values.
I just wanted to calculate everything on client and then send these values to the server to replicate down to other clients. (honestly, I do not think I should do this)
Any ideas?
Multiplayer movement via the Character Movement Controller is faaar more involved than that.
Is there a way to control which actors get replicated to which client when spawned on the server?
E.g. Server spawns Actor's A and B. Actor A is replicated to Client A only, Actor B is replicated to Client B only.
I see that SpawnActor ends up calling AddNetworkActor, which (I'm assuming) calls AddNetworkActor on all the connected NetDrivers so I'm not sure how I would prevent that from happening. For context I'm simply try to have individual loot drops similar to Borderlands, Diablo, Grim Dawn, etc. but I felt like spawning them directly on the client woulda been bad.
Individual in the sense each player has their own drops and it is not shared with other players.
network relevancy
either have the drops be owned by the player they're for and set bOnlyRelevantToOwner = true, or implement custom relevancy.
Ah, thank you.
After I enabled Nav for clients I'm having trouble making FNavPathQueryDelegate variable on client side. Works fine on server though.
Does anyone know how to solve this issue?
this line doesn't look like anything
is this a debuggame build?
and not really multiplayer related
It's not multiplayer related? It works fine on server, but not on client.
there's no networking involved with navmesh
I saw you repost it in #cpp with no additional info so 🤷
how to do basic networking
Most of you probably either started with the very limited native Blueprint Nodes or fell back to using Plugins like the Advanced Sessions one.
maybe use advanced sessions
Did anyone ever tried to change the default map at runtime? When you browse to a new server and it fails, you are brought back to that default map - but I'd like to change that during gameplay so that it's not the main menu, but the map previously on. Can't seem to find a way in engine source - UGameMapsSettings has a setter but the engine gets the default object, not an instance...
hey guys, i'm working on a multiplayer game. i have a character and a drone. i want to possess the drone and then unpossess . possessing the drone works fine but i cant unpossess drone. can you help me ?
also after possessing the drone, other clients can not see drone's movement
Just to make sure TEnumAsByte as a parameter is expected to don't work in RPC functions. Right?
Hello!! I need your help with an issue i have. I create a widget and add it to an actor let's say like a panel. It suppose to saw some images to the player from their folder. My problem is that i didn't manage to replicate this so every player could saw the same image on the panel when a player change the image. Could anyone help me?
ahah lol I know that come on ... nvm I'll find out why I can't get unique net ids to be valid ...
I'm having an issue where when 2 objects are welded together the child object jitters when the parent moves, I took a short video of it
This occurs in a fresh third person template too, so it's not my game
In the video i push the parent, and the 2 cubes slide because i changed their physical material to be more like ice. So the jitter isn't caused by the pushing.
@old knot Handling possession and unpossession of pawns should be the PlayerControllers responsibility.
Also whether or not other ppl can see the drones movement all depends on how you're moving it. You need to make sure the movement is replicated fine.
Hello
I understand very well that the gamemode is server only and can neither be fetched nor modified from the client directly
but I have a question - how does the client know which gamemode it's currently playing then ?
For example depending on if I'm playing Deathmatch or Onslaught or Assault, this will affect what actors the client spawns and handles (vehicles, flags, nodes etc), which is probably dictated by the server - but the client can also display gamemode specific UI, and so on, so surely the client has a barebones version of a gamemode it can access?
For a moment i thought this was the gamestate, but since you're not actually forced to have a different game state for each gamemode, i suppose it's not that
Game mode is kind of poorly named.
How does it work? Does the server simply dictate everything to the client, like every widget to display or hide and so so, or does it give to the client some metadata about the gamemode in some way ?
I would probably have a game State class for each actual game mode.
I wouldn't even bother making a separate game mode probably, either subclass a master game mode or just make it a enum. Depends on how different your modes are
Like if it's Conquest and Big Team Conquest, just parametrize that
Let's talk about the Unreal Tournament use case rather than about my personal project
I'd rather understand how it's "supposed to be done" rather than how i'm going to do it in my specific implementation 🙂
In unreal tournament you have deathmatch, capture the flag, many gamemodes and usually each map is gamemode specific. But some maps can have multiple gamemodes, so the client can not necessarily determine what gamemode is currently played from the map alone
Does that mean that they have an enumerator built in with every gamemode type and the server sends you the current enum so the client knows what to expect? It sounds unlikely to me but I don't know
The client doesn't need to know the actual game mode class, it just needs to know the name of the mode. Something like that.
GM_CTF would have a field Text GameModeText = "Capture the Flag" and pass that to GameState
They should have called it game controller and game state to parallel player controller and player state
I like that way of thinking about it.
This is a repost, but I still can't figure out why this happens?
I am trying to send my newly created struct with custom NetSerialize function through a Server RPC, but the serialization/deserialization don't seem to work?
USTRUCT()
struct FChessMoveReplicationData
{
GENERATED_BODY()
public:
FChessMoveReplicationData(Caissa::Square originSquare, Caissa::Square targetSquare, Caissa::Piece capturePiece, Caissa::MoveType moveType)
: Move(Caissa::Move(originSquare, targetSquare, capturePiece, moveType))
{
}
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
UE_LOG(LogTemp, Warning, TEXT("Replicated, %i"), Move.Type);
Ar.SerializeBits(&Move.Type, sizeof(Caissa::MoveType));
bOutSuccess = true;
return true;
}
public:
Caissa::Move Move;
};
template<>
struct TStructOpsTypeTraits<FChessMoveReplicationData> : public TStructOpsTypeTraitsBase2<FChessMoveReplicationData>
{
enum
{
WithNetSerializer = true
};
};
Out:
...
LogTemp: Warning: Replicated, 4
...
LogTemp: Warning: Replicated, 0
...
If Caissa::Move Move; is not a UPROPERTY it might not get replicated, isn't it that ?
you are only serializing, not unserializing tho
you need to check if the Ar is reading or writing
That would not make sense, the reson i am doing custom serialization is that i can't make it a UPROPERTY.
huh?
and serialize/unserialize
someone told me that it works both ways?
look at FHitResult::NetSerialize
@twin juniper
its an excellent example how to do it
i mean it might work, though i have never worked with "non UE4" types or standard prims before
though why are you not using the engine stuff? what is Caissa ?
would it not make more sense to use the engine rather than fight it? or is it an external lib?
It's a external lib for doing some of the computation.
I know, that's in a sense what this struct is.
It don't make sense to do a complete wrapper.
lol, true xD
i am pretty sure UE4 requires UPROP even with custom netserialize
FHitResult::NetSerialize's SerializeBits is just called in the function scope?
And uint8 is just a typedef of unsigned char
My Caissa::MoveType is typedef of uint8_t...
should be the same?
Yeah; but mine dose not work xD
??
What is this voodoo xD
ohhhhhhhhhhhh
I will need to use serializebits on other types right?
Like uint16_t
everything is bits xD
makes sense
like packing bools into a single byte instead of 1 byte per bool
right; i freaking hate this syntax xD
Is there any suggested tutorials for learning the Network Prediction plugin (other than digging through GAS)?
Hi! one question with maps on multiplayers.
I know that hey can't be replicated, but does that also mean that i can't use them only on the server side?
I want to do some math on server side using maps, the client doesn't need to know about this at all.
TMap<T> can be replicated
i'm using blueprints atm, i'm using a map of
<CustomType><Float> should that be okey?
i'm getting 0 lenght on the server side when i try to check on the map, but ok lenght when checking on client
There shouldn't be anything stopping you from using a Map variable on either client or server.
ok, i'm gonna check for the problem somewhere else then
Actually wtf. I could have swore they added basic TMap replication a while back but I'm still seeing a bunch of people saying they can't be replicated.
Actually i think it may be the map on my case
I was wrong. They still don't support TMap<T> replication more than 20 years later... lol
yeah, on my case is that the Map on the server side is empty, but not the same on the client
How are you populating the map?
okey, it's not the replication of the map problem on my side, i found the error.
not related to the map on itself, but how it's filled
yeah, this was the problem
They have examples in NetworkPredictionExamples
But remember a lot of it will change
I don't see an examples folder in the engine. Do you mean NetworkPredictionExtras?
There's some interesting stuff in there thats right up the alley of what I'm interested in
Hi everyone, not sure if this is the right room to ask or not but does anyone know how to pass a dynamic material instance from client to server? I keep getting null values. For context there is a widget slider that sets the material instance and a server call to spawn the actor. The user also selects the mesh and that part works but the materials do not. I have tried storing them in the game instance and the player state
you can not
you need to make them on the server
you should send the data to the server so the server can reconstruct the material
so send the slider values from the widget to server and build material there?
the intent is for each player to have their own color setup, how would I link it back to the player
when you load a map with options i.e. ?pancake=true, how do you access those options in the loaded map ?
or contruct the material locally and replicate the data required to contruct the material
you can then use a repNotify to watch the data for changes
Can you help me how to do that? I used different ways by run on server and multicast functions with checking authority but it does not work
is the drone just a regular actor ?
you could just turn on movement replication and move it server side
or implement your own method to interpolate between updates of the drones location i.e. an unreliable multicase every x seconds (idk about the performance of this though)
Does anyone know how you would go about handling multiple levels on one dedicated server?
Think Minecraft. Players can be in the overworld, nether, end, etc. I'm trying to achieve something like that but have run out of ideas.
Another problem is that my game has endless worlds with modifiable terrain so I think that rules out level streaming. Would UE even be viable for something like this?
When you say color setup, I'll assume you mean like being able to customize a visible color on their character in some way.
You should store the slider value somewhere that is pertinent to the player, so either the playercontroller, playerstate, or the player's character. Player's character only works so long as you're not destroying the player's pawn, otherwise you'll have to reset the colors every time you spawn a new pawn for the player. Playerstate works great in this case as the value will last so long as the player remains in the game, however, if you have it set up as a replicated variable, whenever the value changes, all players will always receive the updates unless you have some custom relevancy set up for the variables themselves, so it may be a bit more network traffic to have it on the playerstate vs. the character. Finally, on player controller it doesn't make a lot of sense since other client's can't read the value when they themselves need to reconstruct the material on their end as the playercontroller only exists on the owning client and the server, so you'd have to put it somewhere else anyway in order for others to see the value.
So when you've confirmed your colors on the client end, you send the slider value to the server VIA an RPC. The server can then set it in a replicated variable on the playerstate, or on the player character. If you have this variable set up as a RepNotify, then you can use that function to construct the material and set it on the player's character.
Thanks @sinful tree I will give that a try
There seems to be a HandleTravelError() in GameInstance:
Called from:
Idk how much that helps you (if at all lol)
When we set something to Replicate Movement, does that broadcast the location all the time as a tick or only when the actor changes location?
Is there an article where I can read more about this in detail?
Idk for sure but I assume it only replicates the location when the location is updated on the server.
I have a replicated FString that is made from a Json object, the FString is only replicated once since it only changes its value once during the game and is also a very small Json object, but I was told that having a big replicated FString could cause network issues, although I wasn't told why, anyone knows why it would be an issue? I could only think of a bandwidth issue
Hello! I am going through the Tom Looman tutorial and am on section 10. How should I choose whether to do replication via a RPC or via changing a replicated property? Tom used a Struct that was consumed by a function in the client, which seemed odd to me.
I'm a complete noob with game networking but I don't see how a single FString, regardless of reasonable size, being replicated could cause network issues. The CMC is replicating significantly more stuff and works just fine (to my knowledge, don't quote me).
Generally you use an RPC to inform clients or server of an event, and a replicated property to represent a change in state.
Isn't there a lot of overlap there?
yes, there is. there's a lot of times you could use either one
one thing to keep in mind is net relevance though. if someone becomes relevant 5 minutes from now, are the replicated properties enough for this new client to see the same game state as everyone else?
I'm making an exploding barrel right now. My initial instinct is to make a "Explode" function and RPC it.
you'd probably be better off using a replicated property and a RepNotify function, because if someone doesn't see the explosion, they should still see the barrel as "exploded" later on
I haven't gotten to net relevance yet. That's where it filters stuff that's too far from the local pawn, right?
Or you could just have a variable B is exploded, depends on if it's more important that whether or not the barrel is exploded is expressed or the action of exploding is more direct
Basically if the barrel exploded 10 seconds ago, would it matter at all? Would it change anything about the game's state
I see. bExploded is a more permanent change and is better handled that way?
If your barrel is despawn after exploding then sure, use an evenf
yeah, using a variable means that anyone who sees the barrel after the change will see that it has already exploded. if you used an rpc instead, then someone came along later they would see the barrel as un-exploded. if your barrel is going to disappear after the explosion, you could use the rpc though, since you wouldn't ahve to worry about what happens afterwards
There's a pretty smooth continuum along which you can think of something as being a state or an event. If you think about it, the change in state is an event.
So is it more important to say the door is open, or is it better suited to say the door just now opened
I tend to prefer state as much as possible
Ahh, so a player that joins after the explode event would not see the debris unless I used a replicated variable.
yeah, or someone who was not net relevant (like you said, the barrel was culled, so they wouldn't get the explosion rpc) at the time
Yes, it depends on how you were to implement whatever happens after the explosion. If, after exploding, you destroy the barrel actor, then a late joiner would just see the lack of a barrel, which is sort of the state. You would be replicating the lack of something, by destroying it
That helps me a lot. So if they only saw the aftermath and not the event, I would need a replicated function that only does the permanent changes (smoke, debris) instead of the instant effects.
The tutorial asks that I change the color rather than destroy the actor
yeah so in that case, since you want people to see the correct color whether they saw the explosion or not, you'd want it to be a replicated variable, since everyone will get the variable eventually, but the rpc only happens once and if they miss it they won't get it again later
"If they miss it they won't get it again later" this helps a lot.
It seems like in this case I'd need both?
well, have you learned about RepNotify yet?
RPC for playing the explosion particle on the client, the replication function for changing the color
Haven't learned RepNotify yet.
Just Replicated and ReplicatedUsing
UPROPERTY(ReplicatedUsing=OnRep_bIsExploded)
bool bIsExploded;
UFUNCTION()
void OnRep_bIsExploded()
{
if (bIsExploded)
{
//Play explosion, set color.
}
}
RepNotify is ReplicatedUsing
the snippet i posted does have an issue, but you could get around it by replicating the bIsExploded as a struct with an explosion time as well
the issue being that right now, anyone who comes in later would have the explosion play as soon as they saw the barrel
That's a thought. If the explosion happened more than XX seconds ago don't play the visuals
yeah
hmmm
I think so. All the other explosion effects like force will be on server.
no guarantee that they get there in the correct order if you do it that way tho
shouldnt matter much but something to keep in mind for other use cases
Order shouldn't matter in this case. They will happen close enough together
Thanks for the tip.
one thing that's nice about using replicated structs is that you know all the properties you change at the same time on the server will get there at the same time on the client
its useful for certain things that need that concurrency
Ah that's some good thinking.
I imagine a project will accumulate lots and lots of those special structs?
depends on what you're making. i've been building an ability system for a while and it does have a bunch of that going on, for example my casting state
USTRUCT()
struct FCastingState
{
GENERATED_BODY()
UPROPERTY()
bool bIsCasting;
UPROPERTY()
TSubclassOf<UCombatAbility> AbilityClass;
UPROPERTY()
int32 PredictionID;
UPROPERTY()
float CastStartTime;
UPROPERTY()
float CastEndTime;
}
In this case, any of this information arriving on its own (before some of the other fields) would be nonsense. I don't care what ability class is casting if i don't know whether i'm casting or not. I don't care whether i'm casting if i don't know when that cast starts and ends. In this case, i need the entire struct at the same time to make sense of it on the client.
mostly what clients do with that info is make a cast bar widget, which wouldn't really work without all of this info (except predictionID, thats used for other stuff)
You're making your own? Did you already decide not to use GAS?
i started on it before i heard about GAS
dang. Lots of people do that
then i tried to learn GAS and ran into a lot of stuff that i had either already implemented, or that I'd have to mess with internally to make GAS do what i wanted, or i just didnt need
plus its a great learning experience trying to implement it myself
i think the biggest one is that i wanted cooldowns to default to a charge system by default which was kind of a pain to setup in GAS since it wasn't supported by default
also calculations for certain things I had already worked out a specific way I wanted to do, and GAS had a totally different way of handling
A charge system like can use X times before cooldown? Makes sense
well, more like a rolling charge system, like wow uses. when you use an ability it uses x charges of it, and the cooldown starts, but you can keep using it until you run out of charges. when the cooldown finishes it restores x charges and then if you're not at max charges it rolls over and restarts the cooldown
using gameplay effects for that was more complicated than just writing the logic for it normally imo
@bitter oriole Hi, I just found out that Steam has an API to have dedicated servers (of course it costs money, but it's pretty cool)
Question about multicast rpc: I should be able to Mutlicast from a dedicated server with an RPC on my GameState, so that the clients all get the RPC, is that correct?
True
Hey guyzzz, i got a bit noob question !
I got a login page and registration widgets, when you register it saves all user data into save game , and when u login obviously gets and compares data from save game , but it only works for server side , on the client side i cant login even if data correct . Is it because i am loading and saving into savegame from Gamemode ?
Probably
You would have to RPC the data to the server
Not really how one would make any sort of login and registration system but I guess it would work
how u guys handle ur projectile on weapon, are u creating it on firing or creating it with weapon and just doing Activate() on the projectile component when firing ?
I know both are possible but what is the best approach actually
Hello, i was wondering, is there any way to make Unreal work with peer to peer multiplayer?
Yes and no. There is probably a way but not out of the box. You'd need to modify the engine quite a bit I would assume
Depends how many projectiles we are talking about. A handful of them can probably be spawned when firing. Overall if it's a lot more or you want to optimize, it doesn't hurt pooling them
Do you need actual peer to peer or just one player hosting the game ? Because that part is there
Well, i would like to players host their own rooms and let people join them, i thought a peer to peer would be great for that
Unreal doesn't do peer to peer but "have one player host the game" is just the listen server feature
The hosting player just acts as the authoritative server that other players connect to
Drawbacks include performance, easy cheating for the host, and everyone gets booted if the host alt+F4's
i see, thanks
hey guys . On play as listen server i got weird stuff.When i host a game its absoluetly fine . but when i join to hosted game, character spawns as default pawn , with all that flying movement . I have checked game mode , its all fine . So any ideas why it might happen ?
I made Drone as a pawn . And yes i checked replicated for floating pawn movement
I also changed it to character but nothing changed on other clients
Does anyone know of a way to replicate render targets?
No matter what way I seem to try, I can't get them to replicate, something is passing through, but it always seems to just be a blank render target.
by blank I mean, when the client tries to pass the render target to my player controller, there's nothing there...
It just becomes an invalid object
You don't replicate render targets. You replicate the things that the render target renders.
I'm kind of confused, isn't a rendertarget just a texture? So what does a texture render?
I know I use them in materials 😅
I think this needs context. What is your endgoal with trying to replicate it?
I have the player drawing on a notepad using this render target, the render target is used in a decal material that I overlay on a notepad mesh. I also use the render target on a widget that uses an image that uses a UI material.
So I want the player to have his drawing replicated on the notepad mesh to other players when they draw
The player uses the widget to draw onto
That's where I put the update notepads function
Is your notepad itself an actor?
Nope! It's just a mesh I have attached to the character they can pull out at any time
it looks like this, the white part is the note pad widget and the block is my notepad mesh
I draw onto that note pad widget, and I just want the decal material that's on the block to be replicated
Part of the issue with replicating a rendertarget texture is that textures are larger assets. They take a lot of data to represent. For instance if you have a 32x32 texture, you're already at 4,096 floats to represent that tiny texture. Before compression that's 16,384 bytes of data required to display that accurately.
wow, that will totally tank. Maybe there's some other solution to this
that sounds like a better solution!
I'll give it a shot
At the absolute least, compress the pixels that the player draws on into an array and redraw those on the other side if you want close to perfect. You can drop 25% of that off if you aren't using alpha, and you can probably compress all colors down to a byte or less if you're not using a color wheel and have specific colors to choose from.
It works but for some reason the lines that are drawn on the material are really dim. Also I cannot seem to get it to replicate from server to client, which is really weird, but I can get it to work from client to server.
Ah okay, let me give that a shot, I was doing it twice like this:
Yes so that only replicates to server from Client. You'd need to then run a multicast RPC to send it from server to all clients, which is where you'd have the logic
Owning client to server means Client->Server RPC works, but you are missing the part where you multicast send it from Server to all connected clients
I realized that I put the thickness incorrectly on the draw line size, that's why it was so dim 😅
Like this right? this is on my player controller, called from my widget blueprint
This is my widget blueprint:
the below is my server, but the above is my client, for some reason I still can't get it to replicate onto the client when I draw on server
I'm thinking it's correct, but it's not working. Following this graph, I'm starting at widgets/HUD -> going to player controller (depending on if I'm server or client I call different events) but have it running on server -> my pawn which is where I'm calling the functionality.
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhh I get it 😅
I don't need to call "all" on player controller, that's just where I run on server so that I can call multicast inside the actual class I want
You always want to call the "run on server" function. To reduce the headache, if it's executed on server it'll just run, if it's exectued from the owning client, it'll RPC to run it on the server
It's about keeping the logic clean
Thanks!
I can clear up my player controller by using a gameplay ability instead 😅
hello. what is the best approach to make opening doors in multiplayer, but with many states, not only open-closed? like in RDR2, but not on collision. I want a player can control the door angle via button. I was thinking about adding a bone and make this with animation, or controlling door mesh rotation.
Hi! Is there any event when actor is replicated to the client for first time? (Client only event)
@graceful mango BeginPlay will run when an actor is first initiated on a client.
Thanks
Reliable RPC will be trying to arrive until its done even if actor isnt yet replicated?
Not sure on that one. Possibly. I know normal non reliable multicasts won't, in fact those being sent at actor creation time pretty much never play on clients because they tend to arrive before the actor replicates. Reliable may act different.
If it's a state thing, it's probably better in an OnRep.
Thanks
Hello! i have a question is there a way to know the last replication timestamp of the UObject (i have a parent actor which handles the relication) in the sense i need to check (on client) if object was altered (some new values were replicated).
is there an easy way or i need to create my own "OnRep" to cover all possible changes? and write timestamp there
Not quite the way you imagine. If an RPC is done on an actor that isn't replicated yet it just fails. You can also have RPCs with params that haven't been fully replicated yet, in which case those params will be invalid on the receiving end. There is however a setting to change that behaviour, I just don't recall right now what it's called.
or is there an "global" (universal) OnRep event
Instead of bool bIsOpen you can have a float DoorOpenAngle and repnotify it.
Or just turn on replicate movement and just rotate the door mesh or a parent scene component of it.
Anybody know of a method to determine when a player has successfully loaded after a seamless travel?
(Currently I'm relying on delays to just give everyone enough time but of course this will always be a bad and unreliable method)
make a player send an event
if server got a event (rpc call from client) then hes loaded
- add some timeouts
I need to know the player has finished loading and is connected. I think you're suggesting something like a ready up system where a player can press a button to notify the server that their ready. That's impractical for me
It should be automatic :/
...
why should someone press a button?
you do it automatically according to your rules of "player is loaded"
for example
in playercontroller tick
you check some stuff if it's "true" you stop the check and send an rpc to server, or send the rpc until you got an response
which would be more reliable
but don't do logic on server which relies on all players to load or as i said, do a timeout for player
if player didn't load in a minute
kick him/do a fail w/e
Player Controller beginplay is not reliable, and neither is event on possessed. I understand the method you're suggesting but I'm worried it's possible for the player controller to send a packet to the server even if it hasn't finished loading everything
But that's probably a different problem, I'll go ahead and try your method and see if it works
just make sure what server doesnt crash from this
then it's not a problem, close potential abuses
i mean client can send at any time random data
my problem is which approach will be better for it. I know how to replicate door state, but I am not sure what to choose: opening via animation or via float, or maybe something else
@forest flint If it's an actor. You can just OnRep the float. Make the actor's tick move the door to the variable's server set state. Once at that state, disable tick on the actor. In the OnRep, enable tick. In fact you can probably optimize that further by just using a byte That gives 256 angles to use and most doors are under 180 degrees So you get 256 0.7 degrees difference between each. Which is more than enough for the state of a door opening and closing.
If it can halfway open then do it via float. The float can drive an animation time but there has to be some sort of state to represent how open the door is.
ok, thank you both 🙂
Does anyone know which one is generally quicker for players with bad ping?
Rep notify or A Server Reliable RPC ?
not sure but imo should be closely the same, if it's crucial you need to test it yourself.
Neither of those things are related really
For one thing a server RPC is going from client->server
A rep notify is client-only, and indicates a property replicating to the client from the server.
Then maybe I am not as familiar with the names as I thought. By RPC I was referring to server telling the client to run an event (marked as reliable)
And yeah it's pretty important to receive the information asap as it's running a time limit
That would be a client RPC
ping affects properties and RPC's the same way
If the change is stateful, it should be a property with a rep notify
If it's just an one-off event that doesn't change anything, it can be an RPC
GameMode has OnPostLogin. See if that works for you timing wise
TL;DR the implementation really depends on what is is, rather than what the players' connection condition might be in
That wouldn't be it, it's champion select. The gamestate decides when the countdown begins for how long players have to pick. I've got it nice and synced up and the server always makes sure everyone is ready before the countdown begins
for some reason rep notify is just not reliably notifying clients
The simple way is to replicate a single timestamp, with a timer that is roughly synchronised to all players. The engines' built-in "ServerWorldTimeSeconds" from the gamestate will do the trick
Players show the countdown in the UI, and so long as they locally think they have time, they send the RPC.
When the server receives it, it checks the time and allows for some minor tolerance (including the players' ping) + a "fudge" value to account for jitter
You can't time it perfectly, so there's no point trying
Just time it reasonably
by the rep notify not being reliable I mean it sometimes fires and sometimes it doesn't. So some clients never start the countdown
I've got the timer pretty reasonably synced, when it actually fires...
It would fire on two conditons:
a) the property isn't sent because there isn't enough bandwidth
b) the property has the same value on the client
A will self-recover after some time has passed (so long as the server actually thinks it has to send it ofc)
B will happen if the client is messing with the replicated value locally
Wouldn't fire I mean
So ping isn't the issue
It was B. That was the issue, you're the man 
You can resolve it another way in C++ using REPNOTIFY_Always which will call the OnRep even if the property has the same value currently.
but
The Server won't even send the property if it thinks that's the value the client has anyway, so just bear it in mind
An easy way to get around it is to make the property a struct and increment an internal counter
If I take a replicated actor and then attach it to another replicated actor should it still replicate?
Hi all, really hoping someone can help me with an issue getting a client to posses the spawned pawn when connecting to a multiplayer session. I've attached a few screenshots showing my SetupClass function that calls in Begin Play & the event definitions and one showing the issue I'm having. The correct pawn spawns however the client is not attaching. If someone is able to point me in the direction of what I'm doing wrong I'd be eternally grateful as this has been stumping me for a couple of weeks now.
Ur possessing on the client
That pawn doesn’t exist on the server
And generally I would recommend u look at some more tutorials/docs on replication and multiplayer
What @eternal canyon said. This there is a good giveaway that the function only runs on Server
so this works fine, now the client spawns the pawn twice?
You are still executing the spawning & possessing on client. That should happen on server only. Assuming generally, without having more context
So you get two spawns on client because your server spawn replicates to the client, and the client also spawns one
if i'm having server managed replicated components, when is a good time to initialize them - beginplay ?
post initialize components is probably even better, but it all depends on what you need in your initialization
i'm moving stuff like health off the character to a component so i can reuse it on other actors
so ideally asap
where was it initialized on the character?
constructor and rep var
how do you go about debuging random disconects?
i have an issue that might be related to a plugin but i am not 100% sure
any clues in the server log?
theres an error in the plugin right before i and the other player got kicked out
well did you see what in the plugin emits the error and if it's anything to do with networking?
the plugin was processing a heartbeat form the backend
and it failed
but i am not sure if that is suposed to kick players
both players timedout after that
ogPlayFabGSDK: Error: Failed to parse heartbeat [2021.12.23-23.01.41:420][312]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection..
i am assuming its a possibility
maybe it blocked a thread or something? i dont know enough to make an educated guess
well it's timing out not kicking
are you sure it's not an issue with the server itself?
well those 2 in quick succession isn't that encouraging
it's almost as if the server momentarily loses internet connectivity
PlayerState is a client-owned actor right?
thats what i was assuming
it's owned by the player controller it relates to
does it not exist in both places?
It does, but the question was who owns it
you can check GameModeBase.cpp for that
Yep, thanks!
doesn't look like it has an explicit owner but it's not particularly important for the game state
as you wouldn't really have a client/server RPC on it
my server log is throwing some warnings with splines, complains of a node, so i thought i would add an authority switch in the spline construction, but now the spline meshes dont show in the editor, is there a better way to do this?
Yep, I haven't found anything useful in GameModeBase.cpp, but I searched the internet and they only said it's server owned
"server" owned? it probably just has the world as its owner rather than another actor
and how isn't the GS initialisation code useful?
It has nothing owner related
Are world-owned actors server-owned?
yeah so it's probably owned by the uworld it's in then
though why are you so fussed about the owner of the GS? I understand for the PS as you might want RPCs on it
Haha no, it's simply for general knowledge
destroy sessions isnt workin
in c++ or blueprint
Everything works
It can be searched
And joined
but can’t be destroyed
No matter what settings
Ue4 4.27
creating and destroying the session in c++ didn’t change anything
oss is steam
Doesnt destroy in Pie or standalone or build
Says can’t destroy null online session despite clearing being in a working session
anyway u can print whats inside that session value?
just to make sure it is indeed null
or if ur just trying to destroy the wrong variable
just a wild guess, never worked with sessions
Is there a somewhat elegant way to replicate the position of a select few bones on skeletal meshes? All I can think of is to periodically multicast positions.
Running into an issue that I can't quite put my finger on. My weapons are dynamically created via the OnConstruction method in c++. It goes through some parts and then if it has a valid part, it'll spawn the appropriate mesh component for it. Upon spawning, it will also rotate the component by 90 on the Z axis. This is so that it aligns properly with the arms.
On the right side is the ListenServer and on the left side is the client. As you can see, it looks like the client is rotated a bit more than what it should be. Without rotating the weapons, the weapon faces completely to the left. So, I figured it was being replicated correctly, but when the weapon was being constructed on the client side, it was getting an extra rotation call. So I tried to just check if we are the server, if so, rotate the component, otherwise, don't. None if it worked. I have tried using IsServer() method from the UKismetSystemLibrary, tried checking HasAuthority(), GetLocalRole() == ROLE_SimulatedProxy, GetLocalRole() == ROLE_AutonomousProxy, GetRemoteRole() == ROLE_SimulatedProxy, GetRemoteRole() == ROLE_AutonomousProxy. None if it actually seemed to fix my issue. I have tried disabling the "Run under one process" flag in the settings menu as well. I'm drawing complete blanks here.
When I spawn the actor with the SpawnActor node in BP, on the server side, I pass in self for the Owner and Instigator pins as well.
Does anyone have any other things that I can try?
construction script might run before your have the values set
i normally set the modular parts up at beginplay or postnetrecieve
yeah construct script runs before replicated vars are set
Got PostNetInit too for a one-time initialization
The reason I was goin' with the construction script is so that I can still place the actor in the world and the parts are updated while building out the level. Does it work the same way with PostNetInit?
PostNetInit is later than construction script
Generally you need both paths, construction script for server, post net init for clients
@chrome bay i am hitting a weird issue with the built in CMC jump
and i cant work it out
Had a similar sort of experience recently trying to generate sub-objects from a replicated property
Hmm it's 2:15am so CMC might be above my mental capacity rn 😄
yeah i know, i am in the same timezone haha
Okay, so the flow is probably as such:
- Server spawns actor -> OnConstruction is ran on the server
- Client spawns in -> Receives the replicated weapon, but not its stats?
- Now that the client has the weapon actor, the server sends the stats, which adds to the stats of the weapon?
its sent in the initial bunch
The flow is:
-> Server spawns actor -> OnConstruction runs on Server
-> Client receives actor, spawns it, runs OnConstruction
-> Replicated properties are copied in
its just OnConstruction is called before the props are set
So if you are relying on replicated properties in construction script, it won't work
Hmm that vid is odd :/
UE5 mischief?
hmmf
Just the rotation of the mesh component. Which, is a replicated prop I guess, just natively.
it could be my GA, but its very very simple
{
if (HasAuthorityOrPredictionKey(ActorInfo, &ActivationInfo))
{
if (!CommitAbility(Handle, ActorInfo, ActivationInfo))
{
return;
}
ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get());
Character->Jump();
}
}
void UKaosGameplayAbility_Jump::InputReleased(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo)
{
if (ActorInfo != nullptr && ActorInfo->AvatarActor != nullptr)
{
CancelAbility(Handle, ActorInfo, ActivationInfo, true);
}
}```
{
if (!Super::CanActivateAbility(Handle, ActorInfo, SourceTags, TargetTags, OptionalRelevantTags))
{
return false;
}
const ACharacter* Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get(), ECastCheckedType::NullAllowed);
return (Character && Character->CanJump());
}
void UKaosGameplayAbility_Jump::CancelAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateCancelAbility)
{
if (ScopeLockCount > 0)
{
WaitingToExecute.Add(FPostLockDelegate::CreateUObject(this, &UKaosGameplayAbility_Jump::CancelAbility, Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility));
return;
}
Super::CancelAbility(Handle, ActorInfo, ActivationInfo, bReplicateCancelAbility);
ACharacter * Character = CastChecked<ACharacter>(ActorInfo->AvatarActor.Get());
Character->StopJumping();
}```
see really simple
hmmm
Is there an "EndAbility" where it stops jumping? I'm not super familiar with GAS
thats in the Cancel at the end
Maybe it gets caught out one time not calling StopJumping at just the right time?
ah kk
but ResetJumping is called
all the time
and that log prints
but the currentcount is always 1
hmmm
yeah.. no idea on that :/ the infrequency suggests possibly horrid race condition?
i tried to only call Jump locally
and it happens even quicker
and i know the ability ends
and StopJumping should call ResetJumpState
So, in the OnConstruction method, would I just do my server check there at the start and nope out if it is a client? Then in the PostNetInit, proceed only if client? But both functions would pretty much be running the same code otherwise?
essentially yah, PostNetInit only runs on client tho
didn't even think of that 😄 thought it was standalone
best to turn on cmc logging i assume
Hmm - it's even more prominent now 🤣
@chrome bay you got UDN?
https://udn.unrealengine.com/s/question/0D54z000071IG1SCAW/jumpcurrentcount-incorrect-on-air-correction found this.. seems this broke it
Hah. So it's a correction issue then?
man
wonder how long that's been broken in FN 😄
yh
Without my change the count is incorrect when you are corrected in the air. It would be 1 after correction, but it should be 0.
urgh :/
but it seems UE5 does not have this PR
..
// inside of OnConstruction/PostNetInit
if (Barrel != nullptr)
{
USkeletalMeshComponent* NewMesh = NewObject<USkeletalMeshComponent>(this);
SetupSkeletalPart(Barrel, NewMesh);
NonNullParts.Add(Barrel);
}
// this is the SetupSkeletalPart method
if (Part != nullptr)
{
SkeletalMeshComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
SkeletalMeshComponent->SetSkeletalMesh(Part->SkeletalMesh);
SkeletalMeshComponent->SetCollisionResponseToChannel(ECC_Interact, ECR_Block);
SkeletalMeshComponent->RegisterComponent();
SkeletalMeshComponent->SetWorldRotation(FRotator(0.0f, 90.0f, 0.0f));
}
So, the top one is the part that runs in the OnConstruction/PostNetInit methods. The bottom is actually configuring the part. The individual weapon's BP (say like, BP_AR15) has a bunch of the parts filled with Data Assets. I use those DA's to assign the parts. Is there anything here that jumps out at ya'll that can create my current issue?
Nope.
what is barrel
Just the actor as a whole and some ammo counts. But nothin' about transforms, other than what happens automagically
in my game, the server sets the "WeaponItemDefinition"
then in OnRep_ItemDefinition, i setup the gun
this is a pointer to the data asset
Barrel is of type UBaseBarrel which is a data asset
Hmmm - can't figure this out. Might just need to take a break, been at it for like 3 hours now.
I'm not relying on any replicated props, no custom ones at least. Just that SetWorldRotation call in the OnConstruction script.
I'm having this really strange behavior with this function for drawing onto a canvas. I can't get it to work on this multicast event. Here's what I've figured out so far using print strings:
- I know the arrays are passing through on this multicast event, they're not empty. (yes it's coming in through server only event on player controller)
- I know this draw canvas function works with two arrays like this (I used two dummy arrays and just drew something on it at begin play).
Anyone know what's going on here and why it doesn't work?
omllllllllll i see it, I have the same array connected to both the points 🤦♂️
This is what I get for working on a small monitor 🤦♂️, I was stuck here for like 30 minutes
Quick question can you use predict projectile path by objects on the client side and get hit info. For some reason it works perfectly on Server end. but get no info from the client
Hm, I wouldn't see why not
That should just be a series of line traces
I would suggest you look into the function to see why it could fail
Hard to tell
you definitely can, using that to calculate and draw the trajectory for the projectiles, clients included
Hi all, I packaged development server and launched in my local machine and when I join using open 127.0.0.1 from my editor then I can join the game hosted on the local machine. However when I built the development apk and try to connect using open 127.0.0.1 or 192.168.0.1, I cannot join the server from my android. My pc and android are connected over same wifi. Why I am not able to join?
2 different machines, 2 different steam accounts - I can see the server session and try to join, but then I get a ConnectionTimeout after 60 seconds.
can you see why in the logs? https://ghostbin.com/UZo4v
Ghostbin is a website where you can store and share text online.
is it maybe because I'm still using 480? i guess not
anyone?
I have a anim notify on my animation blueprint which calls a function a sprint FX function on my character blueprint. This sprint effect is just a camera shake. However, the function is called on all characters and all clients play the sprint FX. Any reason why that might be?
Hello! i asked yesterday but not sure i got an answer or a clue. is there a way to "hook" global OnRep_notify event for an object? the purpose of it is to know when any of the object attributes has changed, without needing to set every callback manually + it may interfere with the logic, so to make it good you would need be able to set 2 onrep_notify callbacks but i think this is not possible and i don't really want to.
yes it seems to be what i need thanks!
@chrome bay So, I returned to my issue a bit later and I still was unable to figure out the rotation issue. For refresher if needed: #multiplayer message
This screenshot is after putting the weapon building inside of PostNetInit and putting the execution of OnConstruction behind an authority check. I've tried not rotating the components at all, instead rotating the entire actor as well, on spawn from the Spawn Actor node. That didn't work either. Do you have any other possible things that I could try? I'm completely out of ideas here.
The part that I'm still confused on is the order of execution in this case. It doesn't rely on any onrep variables, so step 3 shouldn't come into play. Unless UE considers the initial rotation of a component an onrep thing.
What's the console command to see position error corrections?
@cyan bane p.NetShowCorrections 1
@jolly siren you on 4.27 with splitg?
Essentially yes, we work off of master
you got hit with the jump bug where you get corrected whilst jumping?
or do you not use default "jump"
Did the change in that thread fix it? We use the default jump
According to what Kaos said last night, yeah it fixed it. #multiplayer message
ah okay thanks for the link
Hope Epic are gonna hotfix that tbh
np, just weird.
Pretty debilitating
It looks like the suggested fix has issues as well
It would be great if we can have a better fix for this as the JumpCurrentCount value with this workaround gets bugged if you get corrected in the air, but at least the CanJump function returns true to let the Gameplay Ability activate.
yeah but it still allows jump to function correctly after correction
which is better than hard locking
comment on it, get them to acknowledge, and maybe they will find a proper fix
Or we can just fix it 🙂
problem is when you get AirCorrected, client just ends up with 1 in the jump current count
if we can force client to set that to 0 during correction
its all good
or decrement it
We could do that in UCharacterMovementComponent::ClientAdjustPosition_Implementation
does "p.netshowcorrections 1" not show physics object corrections?
in a multiplayer game, what are my goals for these numbers here
like what should i be aiming for in a game with 4 players?
listen server with 3 clients
sometimes frame and GPU hit like 70
and screenpercentage set to 10 or 100 make little to no difference
in the numbers...visually it makes things look like poop
on gpu and frame?
i wish i understood the profiler better...i doubt the GPU is actually the issue its a RTX 2080 Ti..going to check the numbers with ray tracing turned off
😆 rtx 2080 ti is a 1718$ card...i asked here because running standalone as a single player doesnt have these spikes...its only happening when i have multiple players
so was wondering what the acceptable numbers were that i should be aiming for in my case
thanks, have a nice day
Thanks turns out I forgot to replicate the the components on character mesh
I have a function that "spawns" the inventory of the player on the server, and I have a delegate to broadcast the event so that the UI can update the inventory, however the broadcast event happens only on server not on clients
I tried creating a Multicast function that specifically broadcasts the event to the clients, however that doesn't work either
{
if (Projectile && GetLocalRole() == ROLE_Authority)
{
Inventory.AddUnique(Projectile);
}
BroadcastProjectileAdded(Projectile);
}
void ARPGCharacter::BroadcastProjectileAdded_Implementation(TSubclassOf<ARPGProjectile> Projectile)
{
OnProjectileAdded.Broadcast(LoadProjectileDataFromClass(Projectile));
}
meaning, once on the blueprint side of things, I print Hello, it only gets printed on server and not clients
/**
* [server] adds a projectile to inventory
* @param ProjectileClass Projectile to add
*/
void AddProjectile(TSubclassOf<ARPGProjectile> Projectile);
/**
* [client] used exclusively to broadcast Projectile Addition to Inventory
* @param ProjectileClass Projectile to add
*/
UFUNCTION(NetMulticast, Reliable)
void BroadcastProjectileAdded(TSubclassOf<ARPGProjectile> Projectile);
Anyone know if RepNotifies are called for events that happened leading up to a player joining a session?
its how they work
if property was changed repnotify triggers
during initial replication
I mean if someone opens a chest and then 5 minutes later a new player joins the server. Will a repnotify be invoked to notify of the update that happened 5 minutes prior to joining the server?
