LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = NetDriverListenFailure, ErrorString = , Driver = GameNetDriver IpNe
Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
Warning: Could not create socket for bind address 76561198394590028, got error SteamSockets: setsockopt SO_BROADCAST failed```
#multiplayer
1 messages ยท Page 10 of 1
What have you added to your DefaultEngine.ini ?
I just had a progress, I removed ?listen from the url of ServerTravel and now I can host just fine, but FindSessions doesn't find the hosted session
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
; If using Sessions
; bInitServerOnClient=true
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"```
this is what I have added to it
I'm following a tutorial and I've done as instructed in it
seems correct
Are you running in standalone to find the sessions? Are you getting the steam overlay working?
if (m_SearchSettings)
{
m_SearchSettings->bIsLanQuery = true;
m_SearchSettings->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
m_SearchSettings->MaxSearchResults = 1000;
m_SessionInterface->FindSessions(0, m_SearchSettings.ToSharedRef());
}``` this is my Find Session functionality btw
yea I'm running the game through cmd
but I dunno what u mean by steam overlay
Do you get the popup in the bottom right when you connect to steam? can you shift + tab to get the steam window?
I'm not sure about your session search, I use the advanced sessions plugin so it takes care of that part
what about SpaceWar
did you also build and run that first as well ?
I wasn't able
to build it
isn't that the problem ?
maybe because of the headers that I couldn't include in that spacewar
maybe it's using the same one, like dx3d9
sth like that
no
Do you also have [PacketHandlerComponents] +Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface in DefaultEngine.ini as shown here: https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Online/Steam/
no it doesn't seem like to be part of it
when I run the project through cmd, my steam overlays shows that I'm in spacewar
wtf
yea because you are using the default 480 id
It only changes once you spend the $100 to list your game on steam and they provide you with a real app ID
Are you using lobbies to host?
Next time use #online-subsystems btw, for anything session/subsystem
I don't need to make a big system just one that works for ppl over wan
What do you get now?
friends and folks
Well there is no easier way than this :P
Except using blueprints is less set up, download plugin and drag some nodes
If you find this a lot of setup, wait until you have to actually network your gameplay
Show your log when trying to find session, does it show the steam sessions?
I'm using Hamachi, when I host a session on my laptop I can find it but I cannot join
using the advanced session plugin. I get this error when trying to join with the JoinSession function
LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.00, Real: 20.00, Good: 20.00, DriverTime: 20.03, Threshold: 20.00,
[UNetConnection] RemoteAddr: X92.X68.X.XXX:7777, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
but if i type in console open X92.X68.X.XXX:7777 it works...
any idea why that is happening?
Or does it not find anything at all
World->ServerTravel("/Game/Maps/LobbyMap?listen"); is this how I should servertravel when hosting ?
if I remove ?listen I can host
like this I cannot do it
That ?listen marks the host as a listen server
Meaning they will act as the server when other people join
But your hosting is fine you said
you can simply open level with listen option
I think this part of log is all that goes wrong about it
too bad you can't see the colors..
when I was creating without ?listen, I think the findSession wouldn't actually find any available sessions because the game was running in singleplayer mode maybe
not the standalone you play using the editor, I use CMD
to play the game
... -game -log
As long as you have steam overlay
when the game is running I get the overlay, if you mean the one coming under my name saying im playing spacefar
spaceWar*
and can inv friends and stuff..
Yeah I'm not sure where these socket errors come from ๐ค
I think I gotta post on Gamedevtv
thats where the course is from I guess
Sam Pettuzi if I spell his name correctly is the tutor
It's same no matter who made the tutorial however
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
engine.ini
FOnlineSessionSettings sessionSettings{};
sessionSettings.bIsLANMatch = IOnlineSubsystem::Get()->GetSubsystemName() == "NULL";
sessionSettings.bIsDedicated = false;
sessionSettings.bAntiCheatProtected = false;
sessionSettings.bAllowInvites = true;
sessionSettings.bAllowJoinInProgress = true;
sessionSettings.bUsesPresence = true;
sessionSettings.bAllowJoinViaPresence = true;
sessionSettings.bShouldAdvertise = true;
sessionSettings.NumPublicConnections = 4;
sessionSettings.bUseLobbiesIfAvailable = true;
UE_LOG(LogTemp, Warning, TEXT("Creating session..."));
SessionInterface->CreateSession(0, SessionName, sessionSettings);
creating session
No matter who made the tutorial it will always be the exact same :P
ye..
is there any other plugins I need to activate other than Steam Socket and Steam Online Subsystem ?
"OnlineSubsystem", "OnlineSubsystemSteam"
And includes would be:
#include "Engine/World.h"
#include "Kismet/Gameplaystatics.h"
#include "OnlineSubsystem.h"
#include "OnlineSessionSettings.h"
I don't even have sockets on btw
OnlineSubsystemSteam, SteamSharedModule, OnlineBase, OnlineServices, OnlineSubsystem, OnlineSubsystemNULL, OnlineSubsystemUtils
I have those on
But only the steam ones might not be enabled by default
yea mine was also not enabled so I thought maybe enabling it would solve it
the rest are the same for me too
it seems like I will not be able to sleep at ease tonight xd
refund while you can #ue5-general message
To be fair, is yet one of the unique courses that covers movement prediction decently. Don't be so harsh with Sam ๐
there is a series of videos in YouTube that I believe uses the FRepMovement pattern for their vehicle replication
https://www.youtube.com/watch?v=RQbLUko5mSU
Take a closer look at one of the most important behind-the-scenes systems in online games: The Network Prediction Interface.
In this video, you are gonna take an introduction to the system, you will be able to understand how does this works, and get ready to implement it yourself in the following class.
Video mentioned:
PBS Space Time - The S...
haven't checked myself, just skimmed, so take with a grain of salt ๐
in general should I RPC functions in BP or c++? pros/cons of each?
Is there a way to store variables with steam? Or do I need to make a sql database for it. Should also mention im using bp
https://docs.unrealengine.com/4.27/en-US/Resources/SampleGames/ARPG/BalancingBlueprintAndCPP/
That's in general and they talk about network replication. It's not really a matter of RPCs and what not. It's a matter of knowing how to balance the two
Hello, I have a problem, im trying to apply damage in multiplayer, I have it so that whenever it gets to a certain notify in the animation it plays the "Do Damage" custom events and spawn a circle in front of the charaacter which decides if we do damage or not, ive tried many different thing like switch has authority, run on owning client, etc and it will just not work, it will either spawn the circle on both players, damaging both of them, or make it so that only Client 1/authority can do damage, does anyone know a fix to this, it would be greatly appreciated.
also the server is being ran in a different process dont know if that info is relevent or not'
(FYI im a complete beginner to multiplayer and replication) im trying to get a particle system to show up for everyone, i cant seem to get it working any help is appreciated.
here is what i have
Particle system is an object thus not replicable
And it shouldn't be
Multicast it instead
so just switch it to multicast, anything else need to be done
shows up on client side, not on the other side
That's because you are firing it from client
You fire multicasts from server
So you should do another Server event
That calls it
so a custom event run on server
And the server event is the one called from client
that calls the event thats multicast
Correct
should the multicast be in the actor or should i put it in something else
i just mean should both events be in the actor
or is it better practice to put one in another blueprint
What class is this whole logic in?
actor blueprint
Ok then that's the reason
It has to be from an actor that is client owned
I mean isn't your weapon owned by the character when spawned?
it is
When you spawn your weapon you can specify an owner
i have this script running as "run on owning client"
because otherwise the other players weapons wouldnt spawn in
this script is in the character
I know
where should it be
It should stay in character
But you are spawning the weapon on client
That way other clients won't see it
Also the server won't know about it
that was the problem the other players couldnt see me holding a weapon
Unless you have a valid reason, you are doing stuff the wrong way
so i shouldnt replicate the weapon spawn at all?
That's not how you solve it though ๐
Nope
You don't use a multicast either
You spawn it on server and make sure the weapon is set to replicate
how do i do that
You can't call RPCs on actors that are not replicated and spawned by the server
You can even set the owner the client
Won't have an effect
You read the compendium
so i made the event to spawn the weapon non replicated
oh lord whats that
ive survived so far by youtube tutorials and willpower
Also found in this channel pinned messages
Please no
Use them with a grain of salt
Not all of them are reliable
and shortcuts that will hurt you later
That's why you should take the time to read the compendium and ask here for any vague points and then resume working on your game
Worth the read
Multiplayer isn't easy, there's a lot of new concepts and terminology all at once. It just takes some reading, trial & error and a few ah-ha moments until everything clicks.
as ive learned with most things game related, its super hard at first and once you understand it a bit everything seems to click
atleast thats been my experience
on page 7 it says to basically says to avoid cheating run ammo checks on the server and things like that
hopefully its just as simple to make the event run on server
You are still at the very beginning. Take the time
And then you realize it's not, unless you like waiting ping ms every time you shoot
Then you go down the prediction rabbit hole
multiplayer is HARD
itd be nice to just download a finished game to use as reference, that way i could see good examples
We should talk about prediction more
We should have #prediciton
It's like an ever evolving thing I have to keep chasing, I don't have a solid reuseable format because I'm having to predict different things
wouldnt it be better to just leave ammo and anything that is constantly being referneced stay client side and implement an anticheat instead
easier said than done ofc
but itd remove the ping issues
For example the way I'm handling prediction for some of my stuff is that I'm using a combination of custom events (so things change visually on the client for instant feedback), server events to set replicated values (with repnotify so that other stuff happens securely) and then a multicast for some visual stuff that other players see.
For my projectile prediction I'm basically spawning two. The first runs using a custom event but doesn't deal damage and is only visible for the owner and then another projectile is spawned server side that does deal damage and is visible for everyone except for the owner who fired the shot.
This is probably going to result in a scenario where a client thinks it was a hit but the real projectile on the server misses, but meh I don't know how else to make it seem to shoot instantly without a delay when testing with simulated network lag.
You could correct the projectile path from server to client, but idk it's worth the effort
Because the player's steam name doesnt show when i test it
Why are you using index 1?
so i can get the player info eg steam name
This is in UMG widget right?
yea
Ok how's that related?

its just some text on a widget
it should show the steam name of a player in the slot 1
index 1 is unknown to the client
That's the node you use instead
If you used it with index 0 then yes
Though that's a bad practice
It's in the compendium btw
Which I pointed you towards but you keep ignoring
But dude I don't get the idea of how referencing the player controller of said slot doesnt work
Widgets are local
get owning player would only get the local player?
Only player knows of his own widgets only
Would get the controller associated with this widget
so i need to cast to the player then get the controller ?
Saying index 1 means you don't know that widgets are local
If you want your custom controller? sure
I can only repeat
Widgets are local, thus they can reference only the player that owns them
so whats the workaround of referencing other players for a leaderboard of some sort
You have a leaderboard, that is most probably a vertical box that you add to it widgets that represent players. Each widget has a property of player name and it set the player that owns it
You have GameState.PlayerArray
Which is on both server and clients
You can traverse it and fill that leaderboards widget accordingly
That's why you already have a PlayerName property in PlayerState
so, im trying to implement a rotate character on click but it looks like its only working on the first client
heres rotate character
It's not something new to you: #multiplayer message
Start applying concepts you learn here
This isn't the channel of help me make my own game. It's literally concpets
I can't get my head around it
In my brain referencing the player controller n.2 should work
Again this is my last tip
Try with this node instead of SetActorRotation (this is replicated and can be called on client directly)
I don't get why PlayerName is part of PlayerController
That way clients won't know the name of other clients
PlayerController exists on server and owning client
It is the steam user id(player nickname) from the advanced sessions plugin
Doesnt player state has the name already?
It is
I think we're talking at cross purposes
It has GetPlayerName() which seems to be the steam name (if using steam)
If it was on PlayerController then no one would know the name of the other players
Apart from the listen server
Which is ughhh
Read that compendium (11th time)
can you (re)link this compendium please?
You are setting the name multiple times to the same widget
Compendium my balls bro
@fresh chasm when i use this it only "works" on the second client and not the first. also, it only seems to add yaw input not move it to the location under the cursor
It's in the pinned messages along with a hell other good resources
Yes the problem is that it is adding rotation and not setting it, idk if there is a node for that thought, I will do some tests
Which page on the compendium sir ๐ค
Set control rotation depending on your impementation
All of them
heres what happens on the second client: it rotates, but resets https://gyazo.com/62f4600ad40bd0e09e444266b8a46f9f
Specifically for referencing other players via widgets
There is nothing like that. You don't find examples you search for. Though you learn concepts the right way which you lack
MP is hard. If you don't take the time to learn it right, you will find yourself lost quite easily
So are you trying to rotate all the characters on the same window?
no, just the owning client
Hmm your pawns use character move ent component right
If you use a move to, you can just check "Orient Rotation to Movement" in character movement
And uncheck "Use Controller Rotation Yaw" in Character Class defaults
(assuming they are Characters)
It would work also I think
Else, like @open quail said, you can try with GetPlayerController>SetControlRotation instead
oh, thanks
Idk if it can be called directly on client though
Set control? Yeah its what i tend to use cuz it can be used on clients
I'm having some trouble understanding why the Actors i've added to a map don't get destroyed for the remote client. I marked the Actor with bReplicates = true;
When I destroy the actor (with GetLocalRole() == ROLE_Authority) on the server I'm expecting the propogation to happen to the clients.
But I wonder if it's because I added these actors to a map and so perhaps each client is getting it's own copy of the actor
I suppose another way to ask the question is. Have pickups (Actors) automatically get destroyed on collision in multiplayer, do the pickups need to be spawned explicitly?
TMaps don't replicate
Why do you add actors to them
OnBeginOverlap->HasAuthority->Destroy(self)
@fathom aspen Thanks for responding. I'
I'm trying to do a basic map with 3 pickups. I was assuming I could just do this in editor
however the destroy only seems to work on the local client. So I'm not sure if I'm trying to do something wrong in the map or wrong in the collision handler
Use an array if you want some type of container that supports replication
Though that has nothing to do with why the actor is not being destroyed
I'm wondering how you spawned these actors
How I spawned them: I just dragged the actor class onto the map
As long as they are server spawned and replicated you're good
So they are preplaced
If they are replicated then yes there shouldn't be an issue
Do this and debug it
Ok thanks for that reassurance. I'll go look more carefully at the collision code
See if it's executing the destroy function
I figured it out, thanks. I was accidentally running with Number of Players: 2 in "Play Standalone" and meant to be in "Play as Listen Server" And so I guess that's why the replication wasn't working.
I realized something was up when I noticed only one pawn was present in each window.
A silly mistake. But thanks again.
Hello, I have a problem, im trying to apply damage in multiplayer, I have it so that whenever it gets to a certain notify in the animation it plays the "Do Damage" custom events and spawn a circle in front of the charaacter which decides if we do damage or not, ive tried many different thing like switch has authority, run on owning client, etc and it will just not work, it will either spawn the circle on both players, damaging both of them, or make it so that only Client 1/authority can do damage, does anyone know a fix to this, it would be greatly appreciated.
also the server is being ran in a different process dont know if that info is relevent or not'
When you get the notify, is it on server or client?
Itโs running both events client and server events on the notify in the anim bp
Do you mean that you are calling a server and client event after the notify ?
Yes
Ok so, to call a client event, you must be on server
but what you need is a multicast event, it will be sent from server to everyone relevant
Ok I will try that rn
but you have to be on server to call a multicast, try to place a print right after the notify to see if you are on server or client (it should print "server: hello" or "client: hello"
oh, Ive done that before im playing as client
Ok so the unsafe method is to call a server event from the client, that will then call a multicast
The safe method would be to make the server also play the animation, so it will receive the notify, and directly call the multicast after a SwitchHasAuthority
It might be resources heavy for the server if you have a lot of players
Another method would be to use a timer on server
Right, I will try the unsafe method you stated, may be a decent amount of players in future
so you mean call a server event from a client like this right, or should it be owning client instead of on all
Right after the notify, you call a server event, then in the server event you ApplyDamage and you call the multicast "SpawnCircles"
So that ApplyDamage is only executed on server, and SpawnCircles is executed on everyone
So it goes like this : Client>Server>All
Ok will try right now
hm still doesnt seem to work it continues to spawn the circle on the other players instead of only the causer/attacker
so every players spawn a circle in front of them rn ?
yes, I only want it to spawn on whoever is playing the animation/attacking
can you post a screen of the nodes after the multicast please
Hmm I don't see where the circle is spawned in the code but it's wrong
its the sphere overlap actors
DoDamageClient1 is the event called right after the notify ?
Oh I thought that the circles was UX effects
oh no lol
You only need to do the trace on the server, then apply damage on the server
so everything on server?
So remove DoDamageClient1
ok
and apply damage should stay on sever aswell?
yes always
if you see the small computer icon at the top right of the node, it must be called on server
Isnโt there already a network replicated applydamage function
But you can remove the ApplyDamageServer event, since DoDamage is now a server event
Ok,
it still spawn on both players, here are my multiplayer setting by the way not sure if its relevant or not
add a "is locally controlled" between the notify and the call to DoDamage
ok
So DoDamage is only called by the player that plays the animation
so its saying that client 1 and client 2 are local but server is not local, did a branch with print strings
owning player controller right
it indeed did work, damage and everything, thank you alot, i was stuck w this problem all day ๐
Np ๐ The important part is to understand why it works now lol
So you can reproduce if you get stuck later
Exactly, thank you ๐
Does anyone know why my animations could be running slower from client onto server but not the other way around (server -> client or client -> client is fine) framerate is fixed, and roughly the same on all instances as seen in screenshot but the rays on server are way less. I've done some additional testing and every location and amount of calls is the same as well.
The animations themselves are replicated montages, started and stopped using multicast on server
Ok even more testing shows me if client FPS is lower it becomes worse ๐ค
(I'm just drawing the rays on client for debug, server is the one actually responsible)
Well, a lower framerate means the animation is obviously going to play slower. If you're raycasts are not framerate independent then you will get fewer of them.
Most of the time, this stuff is not actually driven directly from animation.
Oh nvm, I misunderstood. Are you using the character class for pawns? The character movement component by default only updates character animations when the server receives a movement packet from clients, otherwise animation can be out of sync with actual movement. You need to disable that behaviour to prevent the FPS issue in this case.
In a real world connection, the effects will be much worse
But the original point stands, don't drive gameplay-critical collision from animations.
Good Morning, I was asking in here yesterday about replicating a variable (a float seed) to a client joining. The seed is needed for a lot of procedural construction. Everything I've tried, and I've spent way too long on this, results in the seed variable not being replicated to the client. Any ideas?
I expect my explanation was a bit wonky
UPROPERTY(Replicated) float Seed;
If you need more details, you probably need to show what you've done
that's exactly what I've done but the replication does not work
I've added ReplicationUsing but the function isn't fired
you can also send in reliable client rpc
No, that's terrible design
yeah, I wondered if a rpc was needed for timing reasons
The opposite
oh
Did you add the property to the lifetime getter
why not he said its important for procudral stuff
RPCs should never be used for state
yes, it's for terrain, layouts, structures.....
I really have been asking myself why I want to make everything procedural, it's a nightmare
hehe
I added bReplicates = true to the constructor and setup the GetLifetimeReplicatedProps function
Show your code.
sorry to be discord naive here - what's the best way of pasting code here?
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME( ATheSeedMaker,TheWorldVariables);
DOREPLIFETIME( ATheSeedMaker,TheSeed);
//DOREPLIFETIME_CONDITION( ATheSeedMaker,TheWorldVariables, COND_InitialOnly);
//DOREPLIFETIME_CONDITION( ATheSeedMaker,TheSeed, COND_InitialOnly);
}```
oh god
Show the constructor, class declaration, upropertys
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
RootComp = CreateDefaultSubobject<USceneComponent>("Root");
SetRootComponent(RootComp);
RootComp->SetMobility(EComponentMobility::Static);
static ConstructorHelpers::FObjectFinder<UMaterialParameterCollection> FoundMatParamColl(TEXT("MaterialParameterCollection'/Game/TheMaterials/TerrainParams.TerrainParams'"));
if (FoundMatParamColl.Succeeded())
{
TheMatParams = FoundMatParamColl.Object;
}
static ConstructorHelpers::FObjectFinder<UBlueprint> TerrainBlueprint(TEXT("Blueprint'/Game/Blueprints/BP_CreateTerrain2.BP_CreateTerrain2'"));
if (TerrainBlueprint.Object){
CreateTerrainBP = TerrainBlueprint.Object->GeneratedClass;
}
//MakeWorldVariables();
UE_LOG(LogTemp, Warning, TEXT("ATheSeedMaker::ATheSeedMaker()"));
bReplicates = true;
}```
I've also tried replicating a float (the above replicates a ustruct for other variables)
Where and when do you set the seed
Constructor helpers usage spotted (dis bad)
oh
Also ConstructorHelpers is bad and should never be used, yes
But that's not the issue
ok, I'll check that once my nightmare is over
Yeah it's a character indeed, was already thinking that had something to do with it.
I wasn't planning on keeping the current collision in the end, it's for testing purposes currently.
How would I go about achieving similar collisions for actual shipping, letting the server start delays and doing some traces there in the animation shape (without actually using the animation/anim notifies)?
IMO, it's best to pre-set the parameters required for the traces, and just play through that sequence of traces independently and time it with the animation
I've tried making the seed and other variables in PreRegisterAllComponents() and PostInitializeComponents() and BeginPlay()
Yep that's basically what I meant, thanks for clarifying ๐
You could make a utility to bake that information out too, to make it a little easier to edit when anims change etc.
BeginPlay happens everywhere so your client is also calling it, erasing the server value
oh, I've been using (HasAuthority())
Hmm that could definitely be a good idea, I'll write that one down cheers!
but not in PreReg
FWorldVariables TheWorldVariables;```
void OnRep_WorldVarsSet();```
I've put a UELOG in the OnRep function but I don't see it so I guess the replication just isn't happening
it seems like something that should be simple and yet I can't work out what's wrong
I've also tried creating the variables in GameMode, grabbing them GameState and then casting from the actor to get the values
Show FWorldVariables
I mean replication is normally fairly simple so something you are doing does not work and there is no way to guess what it is without having the code
You keep not showing any code that actually uses the replicated var - writing it or reading it
maybe it's best to go simple and just work with the seed value (float variable)
#include "CoreMinimal.h"
#include "WorldVariables.generated.h"
USTRUCT()
struct FWorldVariables
{
GENERATED_BODY()
//FVector TheMainDimensions;
int32 GridVerts;
int32 Levels;
float Scale;
float MaxHeight;
float SeaLevel;
float Frequency;
int32 NumOctaves;
float FloatSeed;
int32 FBMType;
float GridLength;
};```
that's worldvariables
Well this is wrong
None of this can be replicated
Because they don't have UPROPERTY tags
yikes, of course
(I would also strongly suggest to rename this to FMyProjectWorldVariables to avoid conflicts with engine code)
Yeah, if you can reproduce the issue with a simple code where the server writes a float replicated value different from the constructor default and your client code never get the replication event after a few seconds, that would help
float TheSeed;```
Show the constructor, setter, and event
If a property isn't replicating.
Check that the actor is replicated and arrives on client.
Check that the actor is spawned solely on Server.
Check that you have Replicated or ReplicateUsing specifiers.
Check that you have added a DOREPLIFETIME macro for the property in the class.
Check that all replicated state has a UPROPERTY and is not marked NotReplicated.
Check that you have correctly set the property on the server.
Check that the actor is relevant to the client.
And based on your constructor and what this is. It's probable that relevancy is your issue. Use AlwaysRelevant = True.
Forgot "check that the value is set to anything else than the constructor value"
ok, I'll just have a quick fiddle and brb
Right, as soon as you post the code I'll be sure to look
yes, trimming out some UELOGS and such like to clean it up
I made a fresh actor and have managed to replicate the seed, but only in the tick
is this normal?
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SeedMaker2.generated.h"
UCLASS()
class ROYWORLD_API ASeedMaker2 : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASeedMaker2();
UPROPERTY(VisibleAnywhere,BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
USceneComponent* RootComp;
UPROPERTY()
FRandomStream RandStream;
UPROPERTY(ReplicatedUsing=OnRep_WorldSeedSet, VisibleAnywhere)
float TheSeed;
protected:
virtual void PreRegisterAllComponents() override;
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION()
void OnRep_WorldSeedSet();
UFUNCTION(BlueprintCallable)
float GetWorldSeed();
};
#include "SeedMaker2.h"
#include "Net/UnrealNetwork.h"
// Sets default values
ASeedMaker2::ASeedMaker2()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
RootComp = CreateDefaultSubobject<USceneComponent>("Root");
SetRootComponent(RootComp);
RootComp->SetMobility(EComponentMobility::Static);
bAlwaysRelevant = true;
bReplicates = true;
}
void ASeedMaker2::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME( ASeedMaker2,TheSeed);
}
void ASeedMaker2::OnRep_WorldSeedSet()
{
UE_LOG(LogTemp, Warning, TEXT("ASeedMaker2::OnRep_WorldSeedSet() --- TheSeed == %f"),TheSeed);
}
float ASeedMaker2::GetWorldSeed()
{
return TheSeed;
}
void ASeedMaker2::PreRegisterAllComponents()
{
Super::PreRegisterAllComponents();
FRandomStream RandForSeed;
RandForSeed.GenerateNewSeed();
//FWorldVariables TempVars;
if(GetWorld()->GetAuthGameMode())
{
TheSeed = RandForSeed.FRandRange(1.f,10.f);
}
}
// Called when the game starts or when spawned
void ASeedMaker2::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("ASeedMaker2::BeginPlay() --- TheSeed == %f"),TheSeed);
}
// Called every frame
void ASeedMaker2::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
Like I said before, your value can only replicate if the server changes the value vs the constructor one
Specifically the value on the server needs to be different from the client value and from the initial constructor value
You can change the value on BeginPlay on the server
Then the updated (!= ctor value) value will replicate to the client eventually
Could be 50ms, 5 seconds
If that value is different fro mthe client value, the event will fire
a UE_LOG on begin play replicates but again, I only see the value in the tick
Specifically there is zero guarantee that SeedMaker2::BeginPlay on client will fire before or after the value replicates
That's probably what you're missing
yeah, that's what I thought
I've done a lot of my world building before begin play so it looks like I need a major rethink
and also change all those construction helpers
In my experience what most games need is something like this - keep the screen black, or the UI on top blocking the view, until a bunch of preconditions are met
build everything once it's certain the client has joined- makes sense
Like pawn replicated, and all client-side data has a valid state
No, not that
The server can and should do stuff as soon as possible
But then the client should wait for a valid game state before displaying the game
For example your seed can initialize to -1 in constructor
As long as it's <0 you simply don't show the level, and keep waiting for a valid state
Once the seed replicates five seconds later, you can initialize and then show
using procedural meshes, don't I have to build on the client as well? - I've read the procedural mesh comp doesn't replicate
Sure
You do that as soon as it replicates
But you can't use BeginPlay for anything multiplayer related on clients
is PostInitializeComponents more useful?
No idea, but that sounds too early
My go-to strategy is BeginPlay on server, and then have clients update themselves on tick based on state
right, I understand. that's nice and clear
thank you very much for your help here
as you can tell, I'm still learning
and network stuff has been somewhat tricky after a year of single player stuff
Where can I find info regarding network connection to be used in game (no commands)?
Or would I have to send something back and forth to calculate ping and packet loss etc?
Nvm, found out you can get ping in milliseconds through playerstate
Hello, I placed a spline mesh that players can walk on. The problem is, when two players walk on this mesh, the Client Sees the server player as in falling state.
I'm sure it has to have something to do with replication so I checked "replicates" both on the actor and components, and it works, but it generates other problems.
The client also sees a second instance of the same spline mesh that has buggy generation and no collision. How can I solve this problem?
I need some help or advise. I try to reduce jitter when player character move on the ship. Seem fix about BasedUpdateMovement or something.
but I try to tweak many things seem not help. So any topic or tutorial ?
Seem lack about movement on base in unreal engine document.
Like this thread.
https://forums.unrealengine.com/t/multiplayer-how-to-get-smooth-character-interpolation-on-moving-platforms-without-jittering/108500/2
Unreal Engine Forums
Try increasing the server tickrate and see if that helps. https://answers.unrealengine.com/queโฆtick-rate.html It wonโt get rid of stuttering completely but should smooth it noticeably.
Anyone suggest for document / tutorial / or course ? , I need where to start ,I'm intermediate in C++ but need to know in-depth concept for modify CharacterMovementComponent with right way.
try gaffer on games
Does anyone know if push model works with pointers?
Currently thinking of a notification/message system, but can't grasp how to make it due to localization.
Player wants to open a box > interacts to server to open it > its locked > send client a message that it's locked.
This won't work since the server will send the server's local language, right?
Don't send the message, just send a generic response that the client translates. As I'm not sure how FText replicates, you might just create some sort of lookup table and send just a message ID. or have explicit RPCs
Ah, so a DataTable with bunch of responses that the client then reads?
for example, yes
anytime^^
Thank you, but i try to fix issue for UpdateBasedMovement on CharacterMovementComponent , any tutorial or in-depth detail document about this class. I found official one from epic but lack of detail.
Now I see. Sadly i don't know of any such source - but I would appreciate if you pinged me in case you found one ๐
Does it make sense to learn GAS before diving into mp stuff?
GAS is huge, but yeah
You should at least know how the multiplayer basics work tho
To realize what GAS even gives you.
I'm on UE4 and yes but my game just simple mechanic on action and skill. Right now just find the way to smooth when player character move on the ship.
Whats the best practice way from sending lobby-character customization info to the actual gameplay-level?
Current example RPCs the info to the server, writes it to disk and loads it once it loads a new map but that seems wrong? (Maybe it is the best way?)
I have replicated UProperties that are within a function that does some math and returns a float(damage), which then calls ApplyDamage. Should this function be RPCd?
If damage is being calculated (and applied) on the server and the variables are replicated you shouldn't need to RPC
if you're calculating client-side you will need to RPC it to the server
This is a bit important but does anyone know the state of multiplayer physics?
Can I drive gameplay events with it and not just cosmetic stuff like destruction rubble?
Also, does chaos destruction with the pre baked fracturing work in multiplayer
Should I calculate damage on the server instead of RPCing from client to server? It just does calculations based off replicated UProperties and then calls UEs ApplyDamage which is called only on server
Has anyone come across any resources/examples of spawning an actor client side for prediction, but once the server spawns the real actor, it "binds" to the client side predicted actor?
It looks like to achieve this, would rely on "stable naming" but still have not nailed down the exact requirements. Any suggestions?
hi, so apparently if I spawn a component on an actor on the server I can get it to replicate
can I spawn it on the client and call a RPC that'll also spawn it on the server and get them to sync?
I have an actor with a variable, an array of a custom actor. That actor has a variable string. All of these variables are set to replicate
When I create the actor on the server, it replicates to the client, which can see it, but the actor's replicated string is null
I can for loop over the first level of replicated variables, but the elements are null on the client
Is that level of 'recursive replication' not allowed?
That's dependent on how you want your game to behave/how you are determining if something is "hit"
(IE "up to you" but there's probably a "correct" way based on your specific game)
If you're making a "competitive" game that you need to ensure no-hacking, calculate damage on the server. (Otherwise how you are doing it is fine)
(FWIW I calculate damage locally as well)
To make it calculate only on the server, I would have to Implement this function as an RPC? So all the logic would be within the implementation?
Iโm using c++ by the way
RPC the params to the server -> execute damage -> have the variables replicate back to the clients
but sometimes it makes sense to calculate locally (IE if you want to locally predict knock-back + damage)
The variables should replicate automatically if they have the โreplicateโ tag right?
you could do something like just have the damage number appear on screen but than not change hp until the server actually calculates damage
You'll need to override "GetLifetimeReplicatedProps" as well
Does โApplyDamageโ have to be multicast so that if for example client 1 damages mob it replicates to all clients? Iโm going to be using UE library for ApplyDamage and AnyDamage
From what Iโve seen (at least on the BP side) ApplyDamage is executed on the server
I guess it wouldnโt matter, the only thing needed to be multicast is the actual health of the mob
And if the health is set to replicate(on the mob)
Kinda confusing differentiating โreplicateโ with RPCs
ApplyDamage can only execute on the server. You do not multicast state. Set the health variable to be a replicate w/ notify and then you'll have a function that gets called when the health changes - that function can then be used to update anything on the client side by using a Has Authority (Remote) node.
Could you expand further on โYou do not multicast stateโ? Iโm not understanding that part fully
Can anyone explain nested replication? Or point me towards some reading?
I'm surprised my replicated objects aren't also replicating their data
Multicasts can fail when there's too many RPCs at once. Also anything set by a multicast won't happen for players who join the game after the multicast has already happened.
Bad: A server event which calls a multicast event that changes a boolean variable from false to true.
Better: A server event that changes a replicated boolean variable from false to true.
Best: A server event that changes a replicated boolean variable from false to true which also uses repnotify to then call a follow up function which changes something else.
If you have variables on an actor that are marked to replicate, the "state" of those variables will be replicated. If you're running a multicast and passing through a variable it's very similar, but it's not the way to handle it - multicast is like a fire and forget event but if an actor is outside of relevancy range, the client wouldn't receive the notification and they wouldn't receive the state of the variable.
As an example, lets say I was outside of relevancy range, and you damaged an enemy, and that enemy doesn't have a replicated health variable. If you multicast the change in health, you could set it up so that any clients that received that multicast would see that the health value of that enemy is decreased in a widget above the enemy's head. Now lets say I came into relevancy range, I wouldn't see that the enemy was damaged as I never received the multicast and they would still be at full health.
So your best bet to replicate state is through a replicated variable as the new variable will be received on the client. Having it set up as an OnRep variable then also gives you the functionality to execute something on the client side when that value changes, just as if you executed a multicast where you then get an event to execute something client side.
I'm following a tutorial about how to make a replicated light switch, and was wondering if :
- It's safe to pass an argument from the server to the client (Like in the image)
- How do Interfaces behave on server ? Like does the server has its own version of the interface and the client does have its own version ?
"Circuit" input is just an int being a unique identifier which links a switch to a specific light if they have the same identifier
So instead of having Switch on Client event you can instead do the logic directly on the Switch on Server event so long that the variables being changed are replicated.
You can pass data to the server, but doing so allows the client to send whatever data they want to send. So if you're expecting the client to send only a 1 or a 2, they could actually pass through a 35883 or -235883.
I know that but I'm more asking of the opposite, like is it safe to pass arguments from the server to the client ? And is the Interface node on the image on the client or on the server ?
And I've just answered that. You can pass through arguments, it's how you communicate selections from the client to the server. The difficult part is knowing if whether that data is valid or not.
You can press F9 on a node and run your game and step through the code to see the flow of logic. It tells you if its currently the server or client.
An interface acts like an event. Calling one can happen while running on the client or on the server, but it is not something that replicates itself.
No you answered for "When the **client **sends data to the **server **through an argument" but I'm asking the opposite "When the server sends data to the **client **through an argument"
Oh sorry. Well, anything you send from the server to the client should hopefully be just fine ๐
When the server sets a replicated variable, that's the final value. Server is the authority.
Your screenshot shows the opposite.. Client -> Server.
If a client changes a replicated value the server will overwrite it with whatever it thinks the correct value should be.
Awesome thank you ๐ Yeah that's why I keep finding bad stuff on tutorials and I'm glad that I learned to not reproduce bad codes ๐
And yeah generally speaking, you probably wouldn't want to use RPCs to send data to clients. Replicated variables are usually best. OnRep if you need that variable change to do something on the client.
BUT if you let the client choose the value of a parameter and pass it to the server so it can apply that value you SHOULD PROBABLY also do some sort of validation on the server event depending on the significance of the value and if it affects gameplay or not.
If I was really concerned about the client only being allowed to turn on a specific light swtich, I'd make them pass through a reference to the light switch they're interacting with, and on the server line trace from that switch to the player, making sure they're within range and then turning it on and off if they are.
Yeah because it might be some material emissive value or something that just makes stuff brighter than it normally should be or whatever.
Definetly
One should always consider the significance of the data recieved and validate accordingly
Sometimes it's not really the tutorial that's the issue, but the misunderstanding of the systems from the viewer and lack of concepts that need to be considered for your own project and environment. Not every tutorial is going to teach you all steps and angles, most will assume you have basic knowledge of the concepts being worked on.
Just like cooking - You can learn a new recipe from someone, but chances are they're not gonna teach you how to run your stove. So burning the meal doesn't mean the recipe is bad. ๐คฃ
Duuuude. Speaking of, I am still trying to solve the issue of looting a player when he ragdolls too far away down a cliff
Physics not being replicated is proving to be a problem for me
How do you tell the server you want to loot a body when physics places both actors in two entirely different locations
You can create constraints in the physics asset, or you can add a constraint component to your BP and set the constrained bones accordingly. E.g, limit the pelvis bone or whichever is the root simulated bone with a soft linear constraint
Dude that's awesome thank you so much
Then I can just check if the player is looting the dead body within the constraints max distance
Ez
When I search eos for a session without joining, I get a timeout error:
NetworkFailure: ConnectionTimeout, Error: 'UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.01, Real: 20.01, Good: 20.01, DriverTime: 20.02, Threshold: 20.00, [UNetConnection] RemoteAddr: 127.0.0.1:7777, Name: EOSIpNetConnection_2147482349, Driver: PendingNetDriver EOSNetDriver_2147482350, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID'
What could be causing this? The error makes my game restart to the intro screen
need help quite badly with something
I have a spaceship game, with a parent class for all spaceships, then children of that class. currently adding the 2nd spaceship to the game and the components of it (like wings, engines, and stuff) which are child actors, keep getting destroyed on startup, but only on clients, not on the server
I can't figure out what's going on and it's driving me crazy
Campaign stores an array of 'objectives', containing information about the state of each objective. On the client I can see the objectives, but the values inside objective data aren't replicating. Any advice please?
Are the child actor's classes marked to replicate? I'd guess they could be replicating and overriding any client-side spawned versions.
they are marked to replicate, should they not be?
What is the best way to separate the FPS and and non local views of a character in a Multiplayer Shooter game?
I'm not sure as I haven't really worked with child actors myself and I don't know what you may need replicated about them. The way the messages are reading, it sounds like it could be something where the clients have a separately spawned copy of the actor that is getting overridden by the server's copy.
but in that example i was using a dedicated server, so there shouldn't be a server copy? (as the server doesn't have a spaceship)
Unless i'm underestanding it all wrong
If you're using replicated actors, the server has a copy of everything.
Server spawns the actors & replicates them.
I have a question, is there a way to tell if a character is the players character, or one of the 'multiplayer characters' I need a begin play event to trigger on your character when you join the game, but not on all the characters for the other people playing with you.
I was thinking a begin play > isthischaracterbptheplayerscharacter > if its your character bp it does the event > if its one of the character bp's representing a 'friend' on the server it won't
Is this possible?
Is Locally Controlled
(possibly relevant) "IsPlayerControlled"
How can i get a variable within a player with a trace by channel
So it traces from the camera to 10 metres in front
You won't get the variable with a trace, that makes no sense.
Do you mean "How can I use a variable on the (Pawn?) and use it to drive the length of a trace?"?
If the camera is on the pawn, just trace from Camera.Location to Camera.Location + 1000 x Camera.ForwardVector
Like get forward vector
Yeah
got a strange multiplayer issue. i have a steerable charge ability, where it locks the players input forward, forcing you to move, but you can still turn with the mouse. however, i do limit the turn rate so you can't steer it too much. this works fine in the editor even with a lot of lag. but in a packaged build/standalone game, even though their turn rate is lowered, the player can still turn much more sharply than they can in the editor. i've verified that all the values (move input, yaw, etc.) are the same in both scenarios. any ideas of what else could be changing in a packaged build to cause this?
So in the standalone build are you connecting to a server and running the test while playing as a client?
If not, then you're playing as a listen server and not actually as a client so the code logic is most likely different than what you think should be happening.
framerate?
Show your code
in all cases it's a dedicated server, so i'm always the client
will try to get the basics for the code, it's spread across a few areas
@weak fogSpecifically show how you're handling turn rate
I smell a framerate dependence
that is my intuition too
well, there is more than you need here bc i have a few more things we have to account for but:
in the PlayerController on the input axis event, this scales the axis value and passes it to AddControllerYawInput or AddControllerPitchInput
but it prints the same in all cases. client/server in the editor, and client/server in the standalone/packaged game. i even went all the way down to the exact C++ function and printed it there and got the same thing too
basically all you care about most likely is that final false branch. GetSensitivityScalar is just reading your mouse sens setting
Show where turn rate is used.
Yeah that looks fine, so how are you changing MaxTurnRate when charging? Have you debugged that value to confirm it's correct?
Wait a second, found it. You don't want to clamp by MaxTurnRate, you want to clamp by MaxTurnRate x DeltaSeconds
None of this is really a rate besides MaxTurnRate
it's an amount per frame
Axis value means "turn X degrees this frame"
as does add controller yaw input
oh snap. gonna try that
so you're not "rate-ifying" it at all. Convert MaxTurnRate into a max amount per frame and it should work.
Rate = Amount/Time so Amount = Rate x Time
sir, you are a genius
totally right. i was misinterpreting it is a rate (and then printing it out and "confirming" it). but it says it right there. value
ty so much, this one was killing me. always good to get a second set of eyes
is there an extended Has Authority node where I can tell a server from a listenserver? ๐ค
I don't want to spawn cosmetic particles on my server but if it is a listenserver then the particles must be there ๐ค ๐ค ๐ค
IsDedicatedServer
Should be able to put it in to a macro library based on actor or actor component, just not object.
yep, based on actor worked:
I wouldn't say your logic is entirely accurate. If a client spawns something locally, it can have authority over it.
ow ๐ฆ
If you change HasAuthority to IsServer, then it would be accurate.
Why do you need is server and is dedicated server?
Surely just is dedicated server will do?
Hello I have a really quick question, with multiplayer, lets say I want to send my game to a friend and 1v1 him, can they just join off of my ip or not
Yeah. Your router has to allow outside connections though.
ok
:triangular_flag_on_post: Xer0#2892 received strike 1. As a result, they were muted for 10 minutes.
if i have client authority is it ok to use get player controller index function?
:triangular_flag_on_post: AmanSrivastava#0086 received strike 1. As a result, they were muted for 10 minutes.
Does NetMulticast makes the owning actor relevant forcefully?
If an Actor isnt relevant at the time it should receive an RPC, it wont do anything.
are you 100% sure ? can I read about it somewhere in the docs?
Yes, because on the remote machine, when it is no longer relevant it despawns the actor so it physically does not exist to receive RPC's
not trying to sound smartass , but isn't it possible for server to make it relevant again just for the reliable RPC.
Not that I want it
just want to make suer
The Server can do anything.
If you NEED an RPC to go through, you likely dont want an RPC.
You probably want a RepNotify
check this out
You can set actors to be always relevant, also typically in that case you would use a replicated rep notify variable because the rep notify functions are called when the actor re-enter relevancy. Here's some documentation
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/ReplicationFlow/
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/Relevancy/
I don't "NEED" it , I just wonder if I should send state change via netmulticast or onRep
won't that consume more cycles checking the rep var on sever if it its rarely gonna change , compared to a multicast which will only be sent when things actually change?
If you are concerned about that, then use Push Model.
That's when you go into dormancy... Which is super undocumented... But it's pretty useful and they do document it in the code
I think he means CPU cycles on the Server
Which is fixed with Push Model.
When you need to domancy it's hard to do in blueprint.
Ah yeah
wasn't thinking for a moment lol
Full of bugs so code that do things about dormancy shouldbe in C++ only.
in any case , back to the issue
https://issues.unrealengine.com/issue/UE-36139
Is that true ^
It could be ๐คท
But i doubt it
They most likely marked it off for house keeping.
Instead of actually because its not something they will fix.
Or its also likely just a misunderstanding on the person who reported it.
No . It's force domant to "always" not relevant
if actor no releveant it not call any RPC on unrelevant clients.
I'll try to test it the way that report mentions , lets see what happens
Why are you concerned if the issue exists? It already sounds like you want a RepNotify anyway?
I rpc should use when really need such as send data from owning client to server.
most of case I use simple replicated variable and some of them use OnRep_Nofity
OCD maybe? is there a significant delay in OnRep compared to netmulticast?
VR multiplayer in ur 5 tutorial suggestion please!!!๐ซ
OCD and the need to find out the truth!
Replicated variables are governed by the Actors NetFrequency.
But again, using Push Model avoids that
ForceNetUpdate() also exists
separate topic
I've seen that net frequency often doesn't translate to exact values.
If I set it to 0.5 it takes a few seconds to send the update sometimes instead of every half a second
NetFrequency is also governed by the Actors Net Priority.
Lower priority Actors will replicate slower over higher priority ones in saturated circumstances
So uhh this might sound weird, but is there a reliable-ish way to make an MMO without a central server? If not, how much would a good-enough central server cost?
Define what you mean by reliable and central server. And MMO while you're at it... MMO can mean many things.
Basically "Would it be possible to make a multiplayer game (a bit of like WoT, War Thunder...) P2P?"
No.
- P2P is not something that UE supports by default, so you'd have to code an entirely different networking system to be able to properly support it, especially if you wanted it to be seamless/mostly seamless if a "hosting" player leaves.
- You cannot have databases exposed for public use, otherwise anyone could write whatever data wherever they wanted. If you had publicly accessible databases then you'd have cheaters and people who just want to make other player's lives hell by erasing their data. Without databases, then there's no "central" repository for data, which means no MMO, and then your player data only exists on the particular server you connect to.
Ah... well my goal is mainly to not pay much for server infrastructure... would it perhaps be viable to store the player's data on a server and then have matches be P2P?
No - I just answered that. Publicly accessible databases == players will cheat and can erase other people's data.
What do you mean by "Publicly accessible DBs"?
Investigate how CoD did P2P MP
I mean like have the database and stuff on a central server and then have matches be P2P
That had a centralised "character" system as well as P2P servers.
If the matches are P2P that means a player is hosting the match.
That player would have to tell the databases what data to write.
Which means, that's a place where someone could inject erroneous data.
Eg. If you had an API that you call to save data, that means I could potentially just open web browser and make a request without even running your game.
So that basically translates to "If you manage to solve secure comms with the server, sure"
And how would you do that? You can't provide a password or a public key with the game, because that just means people will be able to figure it out and do it anyway. At that point you're getting into the realm of having a specialized hosting service that people would request a server from, in other words, dedicated server hosting.
Isn't it like that with everything tho?
Best you can do in this situation is provide some level of encryption so the majority of people can't do it.
And just keep an eye on people obviously cheating.
If the system isn't even exposed to the public, then it can't be hacked - or, at least, it would require even more specialised hacking.
Giving that system out to the public basically guarantees it.
I've played a game where server player data was able to be written to by players as it was a "session" based P2P FPS game where one player was the host. After several hundreds of hours of gameplay I had defeated someone who was severely lacking in skill and they sent in the chat "Say goodbye to your account". When I finished the match, I logged out. Came back in much later, and my character data was gone. Stopped playing the game after that.
Yk, my mind works the way that when someone tells me something is impossible, I get more motivation to try it
hey tried run on server but wouldnt let me open doors, is MC the one i need? perhaps ROS then MC?
You could store player data locally on the client machine, and that would actually be favorable vs. having a public database, as at least your character data is your own. That still makes it susceptible to cheating, but at least other players can't destroy another player's work.
Though they may railroad them...
I'll prob consult with my dad, since he's got some experience in handling user data
update: tested both and neither work. really need to fix this issue so please help if you can
Is it opening for the server at least?
hey, if I want to dynamically spawn a replicated component on my player character, should I just spawn it on the server side and make it replicated, or do I also have to manually spawn it on the client side?
if it's the former, if I despawn a component, then immediately spawn another one, will this be done in order on the client's side?
Its only opening for the client?? lmao that's weird. Which one is opening the door then? Because I see you have a multicast and a server rpc earlier. Which one is actually working?
client 1 opens door. client 2 nothing happens on their screen tho they can see client 1 walking through what is on c2s screen, a closed door
i can stream in vc
Pretty sure you can just add a replicated component on the server and then the client should have it to.
okay, will adding/removing of said components be done in order on the client side?
No I understand. If you disconnect the multicast call execution, does it do the same things?
MC one dosent work, but let me try running it on server and then MCing
ill try this
You can only run "Run on Server" events when the client is the owner of the actor. As this is a door, I don't suspect the client owns it.
what would GetLocalRole() answer when run in a client but from their own pawn? ๐ค
If it's a pawn that is replicated from the server that they possess, it would be ROLE_AutonomousProxy.
This is what was a little confusing for me, since it looks like they're calling two events, one of which would already be on the server by the time it gets there, having been replicated in the player bp. But I'm not familiar with those events, I'd have done this using an interface, so it might not be what I thought
seems just spawning it on the server worked
- If you need to replicate state, then the variables should be set to "Replicated w/ Notify" you can then use the provided OnRep function to drive the Niagara visibility. No need to multicast. No need to constantly check the boolean on tick.
- You shouldn't need to use multiple RPCs to perform relatively repetitive tasks that are just different basic values. Example:
Has anyone here implemented team-based "always relevant" behavior in replication graph? Have a few questions...
A simple way to do it would be to keep team objects on PCs and then they're always only replicated to their owning client and thus somebody's own team.
Or do you mean less the team object, but more objects used by the team?
I think there's a NetRelevantFor or some such method
how do i change the server tick rate for testing purposes
Anyone using AGR PRO Combat System for melee hit detection? How is it?
I have a problem with a multiplayer packaged game with a specific type of replication.
I have a function triggered by some actor in the client, but I want it to be called on the same actor on the server. My brain told me: Well if exists in both server and client (and it does), I can just call it from the player pawn which can call the server. So I call it from my client actor's pawn reference and use a self target.
(I think this is what might be the problem, since it is referencing a client instance on the server)
The thing is: it works on editor's PIE, in all run modes and both Listen Server and standalone net modes.
But after packaging, only those same functions don't work anymore. I did test it with some text elements and I think my theory of the empty reference is quite solid: the event flow is working but the reference, when called on server, is empty.
What do I do to amend that? I mean, how do I do this? What am I missing?
Hi, can anyone tell me why this isn't working properly? the door opens when the server players does it and replicates to clients but when the client does it, the door plays the open/close animation but the server doesn't see it so its not actually open/closed
The BP is set to replicates and opening & closing doors are multicasts, then set with rep notifies for relevancy so im not sure why it isn't working properly when the client opens/closes the door
idk if i can do multiplayer ๐
nvm i fixed it, i wasn't doing my interaction input event on the server
I have
What do you want to know
I guess generally speaking, what is the "pattern" that you followed? My current train of thought was as follows:
- Have a replication graph node for each team.
- When the replication graph receives notice that a player has changed teams, it will check to see if a node already exists for that team, or if it needs to create a new one.
- Once the appropriate node has been selected, the player will be added to that node's list of relevant actors for that specific team.
- Then the node is added to the player/connection's list of nodes.
Does that sound about right? Or did you end up going a different route?
- Have a replication graph node for each team.
Yep- When the replication graph receives notice that a player has changed teams, it will check to see if a node already exists for that team, or if it needs to create a new one.
Nah, I created them in the init global graph nodes function. I kept them in aTMap<ETeamEnum, URepGraphTeamNode*>. Each node held their assigned team. Making them connection based could work though, but I wanted simplicity.- Once the appropriate node has been selected, the player will be added to that node's list of relevant actors for that specific team.
I generally add all team based relevancy actors to the nodes. In the gather function, I just check if the connection's owner (the PC) is in that team, and if so, add all actors in the node to the replication list.
@shadow aurora
When testing in editor using net mode listen server with 2 players the controlled pawn on the listen server has no owning connection, and just in general all the ownership of pawns seems off in editor. Is this known/normal that testing multiplayer in editor makes network ownership wonky?
Hi, I have a class which is my Interaction Base class, inside it has a couple of overlaps and a couple of widgets, when the player walks into the sphere overlap it displays some circles which indicates to the player that this object can be interacted with, then inside the sphere overlap is a box overlap which hides the circles and shows the E key to indicate that the player can now interact with the object.. essentially the idea is that all of my interactable actors will inherit from this class so they all have this set up rather than having to do it for each interactable actor bp
However, my issue is that if any player (server or client) goes into the overlap, all other players can see the interaction indicator widgets, how can i make it so only the player who's inside the overlaps are the ones seeing the widgets?
How do I replicate a parameter in a sound cue? I have an audio cue component on a vehicle and the clients only hear the server's vehicle, but clients' vehicles aren't heard by other clients, I noticed because the RPM parameter in the sound cue that determines things like the volume is always read as zero from clients' vehicles
tryna setup a cosmetic component. finished everything besides the modular mesh functions all is replicated besides these 3 functions. i removed the replicated set skeletal mesh event i have setup because it was throwing errors on server. works fine client side until there is more than 1 player with or without replicated sk mesh event. was curious if anyone could point me in the right direction, trying to add sk mesh components to a component map, and using that map ref set skeletal mesh/set master pose/destroy component when new data is loaded. Also noticed client side the master pose component works as it should however from server pov or another clients pov it isnt being set. Heres a few screens of the functions im referring to. Any help would be greatly appreciated im kinda stumped on this one.
Thanks, that's sorted it!
So it sounds like your 3 functions here need to be replicated and that you want late joiners to also see the changes. This would be a good use case for repnotify. If you setup a replicated boolean using repnotify then whenever you set the boolean's value on the server you can use the onRep callback to run those three functions.
ill try thanks. at first i had set sk mesh replicated an was using the event for that within the functions
your boolean isn't replicated
It also only needs to be set to true on the server, without using a multicast
click the variable, then find where it says replication in the details panel and use Replicated as the value
you can replicate the variable as well, selecting it and selecting replicate
Then, when it's changed on the server, it will change in all clients for the same value
Select the "Notes 1" node there and try to find the replicate dropbopx
yea
Yes, if you choose repnotify, it will create a function that will be called on all instances everytime this value changes on the server.
Replicated will just update this value to all instances
They're slightly different. Replicated means this variable will be kept in sync, but RepNotify does the same PLUS comes with an event that runs whenever the value changes.
Say you have a dark room with a single light switch in it and a player spawns into that room. The player interacts with the light switch (linetrace, walks up to it, presses a button on their keyboard...whatever) which then triggers: Server Event --> set light_switch true (replicated). Next Player 2 spawns into the room and sees the light is on because the light_switch variable is true because its being replicated to player 2 automatically. Your light in the scene controls itself with light_switch true or false.
The Replication Condition stuff is useful when you've got some complex replicated situations going on and you want only some players to see the changes under certain conditions or scenarios.
what didn't work?
I think its because of your flipflop, the server comes through first and uses path A but ends early because it can't add widgets (only client can) then when it runs again (because its a multicast) the first client uses flipflop path b, which removes (nothing), then when client 2 runs the multicast it reaches the flipflop and has the correct path A which adds the UI.
Has anyone seen any examples/resources on doing client side prediction of spawning actors? The only example I've come across are projectiles from the abandoned UT project from 2016. That appraoch seemed kina hacky/brittle.
@oak prawn Try using two events instead of flipflop. Event to add the widget and another to remove the widget.
Can anyone send me in the right direction?
My player character seems to be entirely server side...?
Any time I use a Switch Authority, it only executes the Authority side
For instance this is on my player character
Does anyone know of anything I could check or diagnose? I'm very new to network n such
Do you just need to see the static mesh before it loads from the server? or does it need to actually run some BP?
which netmode are you running?
Listen server if that's what you mean
The specific case I'm working on now, just Skel Mesh and animation. But curious to hear your thoughts on either?
okay then can you just have it hidden away and reveal it whenever you need to
If you place the SK with animation into the level and toggle visibility, then server toggles it back off after loading the real character, would that work?
hello, I want to spawn some effects only for the locally controlled pawn but the isLocallyControlled node says false on listenservers and standalones! ๐ฅฒ
what node am I looking for?
Not really. 1) The spawning is dynamic, 2) once the server spawns the real copy, how does the client know which actor on its side to hide once the server spawned version is replicated to the client.
this one works
You can add a replciated (with repnotify) bool for each of your toggling SK meshes. Then when you change it with a server event the repnotify handles the visibility of the mesh via reference, or interface, or dispatch, or tag...etc
So that means whatever netmode you were running in, the target was not locally controlled.
the comment says that this is exactly what I am looking for, to use it for VFX
You could use the owner see / no see settings.
it's a material parameter set ๐
ahh okay that's also similar
I'm not sure I follow. If the client locally predicted and spawned an object, how does it ever know to hide itself. The server spawned object will replicate to the client and sure it would repnotify when its visibility is changed....
Yes listen server player is always authority. It's completely server side
bump on this, I cannot figure it out, the problem seems to be the parameter not properly replicating since if i do it like this it glitches out, constantly switching between the intended input and zero. How does one replicate audio curve components???
Ahhh, that makes sense. So the hosting player (server), this player is just the 'serverside' whereas every client joining the game as a seperate client and server version?
That will stuff harder for sure...
Yes every other client has both sides
Hmm... so how is possible to do something clientside? Say you have a has authority switch, goes onto the remote and does it's thing, this wont work for the hoster, it will have to go down the authority route too, but this will mess things up for the clients... That's a tricky one :/
But thank you for clearing that up for me ๐
The client never spawns anything. You run a custom event to toggle visibility of the mesh (instant feedback, player is happy something changed without lag). Then you call the server event to spawn the real thing, then once the real thing has spawned in you dispatch an event, (or call an interface event, or something else...) so that the client toggles the visibility of the SK mesh again.
That one you provided is an input key. It's tied to whoever presses that key. Instead, say you have BeginPlay and you want to spawn a umg widget. You do that locally. That's why you use IsLocallyControlled or IsLocalController
Depending where you are
Pawn/Controller
Ok I think I get you. In my case I cannot rely on this fixed cardinality. I was looking more into stable-ly naming or at least consistently assigning NetIDs the NetDriver uses to replicate spawning to clients.
Oh that makes sense, instead of checking if it is remote or authoritive, you check if it's actually being controlled, which would only be true if it was clientside for clients, or serverside for the server. That makes alot of sense, thank you ๐
It takes a bit of time to wrap your head around it, but once you get that stuff like HUD/widgets, input, etc. is done locally, you understand that is server-side for the listen server and client-side for every other client
You shouldn't need the client to tell the server what the value is. The server should already have those values as they're both marked as replicated. That being said, you shouldn't need to constantly replicate them on tick. Have those two variables set up as OnReps, and when their value changes have their generated function change the parameter.
I've read through the netcode bible, and this bit of information I was missing, that's a massive link, it really does make alot more sense now
That's why saying widgets are client side, which keeps going over and and over again here, is misleading ๐
I don't really understand what you just said, but if you're looking to have instant feedback for the player for a few frames before the server does it thing that's how I'd do it. You could also try spawning the SK mesh with the animation running instead of toggling the visibility of an always loaded mesh.
Spawn the mesh directly on the client, then destroy from a run on owning client event sent by the server after it spawns the real character.
i do plan to take this off of on-tick in the future, i have it on on-tick right now for testing, problem is, even with the variables replicated, the sound isn't heard properly on clients
I'll send footage of the issue in a second
As you can see, the server can't hear the client, even though the client can hear the server and himself properly
https://streamable.com/6uq6v3
My guess would be you're not setting the Thrust and Current max thrust while running on the server and only doing it locally?
they're both replicated, though
Marking as replicated doesn't mean that you send the value to the server.
Replicated variables usually go one way, from server -> client. If you set the value on a client, the server won't know about it.
Oh. I didn't know that. How would I go about fixing something like this, then?
You'd have to either let the client tell the server those values through a Run On Server event, or, you use a Run On Server event when the client is supposed to be increasing their speed and then let the server calculate and set the values.
I'm sorry- I don't think I underestand
replication was never my strength and it's my first time messing with sounds whatsoever
if i run this command on server instead of multicast the client doesn't have the parameter changed and any thrust changes on the client play through the server's ship
Player Input > Run On Server Event > Calculate what needs to be calculated on the server's side > Set replicated (w/ notify!) variables > OnRep Function Performs action
So if you're increasing thrust on the client, you're telling the server that you want to increase speed, the server then replicates what your new speed should be, then clients can set the parameter in the onrep.
But I'm not setting the variables here, i'm just drawing from them
Then let's keep looping back. If you set variables while running on the client, the server doesn't know about them. The only way the server can know values is if you tell the server what those values are. Ideally you don't let the client tell the server what values are (especailly for things like speed) as the server should already be calculating speed. Therefore, the server should already know about the speed variables whenever your client is asking to speed up. When you're changing the speed variables and they are set to be w/notify, the onrep can then be used to drive the parameter.
so all i gotta do is set this in w/notify and it'd work?
Well I don't know because I have no idea how you calculate speed or how you increase speed. The OnRep can be used to drive the parameter.
When you say "drive the parameter" what exactly do you mean?
To perform this:
Oh
that actually got an interesting result. the sound plays on (and from) both the client and server, but only seems to replicate the parameter from server to client, not from client to server
is the closest to working it's been so far I think
I'm sorry if i'm just being very dumb but i'm still completely lost at what's going on. like i make exactly what you have there and i still get one of the two players' parameters not syncing right
please show the blueprint so we can see what might be wrong
Here
the blueprint was posted there
OH! I think I fixed it
I passed the parameter through the events and also changed it from tick to repnotify change speed
and that fixed it
Just to reiterate, replicated variables only replicate from server -> client. So unless you set it while running on the server, no one else will get the value if you set it on client.
Ideally you wouldn't have your client tell the server what your "speed" values are as the server should already know what your speed is - your client can tell the server it wants to speed up, and the server would set the replicated values appropriately for how much they should be sped up, and then the variables replicate to all other clients. It's probably harmless in this kind of set up if all you're doing is playing a sound, but if you're allowing the client to tell the server values it's a potential place where people could cheat or send invalid data, and it's also a bit of wasted bandwidth if the server would already know the value without the client directly having to tell the server just so it gets replicated to everyone else.
Glad you got it working ๐
Thank you for the help, even if i had a hard time underestanding it xD
And i'm sorry for being so incompetent
Probably i'm not doing it the best way but i struggle so much with replication that if it works, it's good enough, at least for now xD
any advice on debugging something that sometimes works and sometimes doesnโt? I am equipping an item to a socket and half the time it appears properly attached for other clients, and the other half it appears strangely rotated. It equips properly to the owning client 100 percent of the time.
Have you tried setting breakpoints and stepping through the nodes to see where things go wrong?
how do i return a value from a server tagged RPC?
for example, if i want something to be calculated on the server, i would create something like this?
//Calculate base damage
UFUNCTION(BlueprintCallable, Server, Reliable, Category = "Combat")
void SERVER_CalculateBaseDamageApplication(AEnemyCharacter* Enemy);
float CalculateBaseDamageApplication(AEnemyCharacter* Enemy);
then in SERVER_CalculateBaseDamageApplication_Implementation I would call CalculateBaseDamageApplication?
With a ClientRPC if it's a one off thing or via an OnRep variable if it's state related
RPCs don't have return values
well, this function is called when the PC auto attacks, so im assuming it'll be an RPC? the problem is rpcs cant return values, but im trying to calculate "damage" only on the server to prevent hacking
Calculating damage is not the problem of hacking
Allowing the client to set health base on damage they calculated however is
You can calculate it locally if you want
It the better approach is only to run the rpc to tell the server that you attack
And then let it run on the server
Don't tell the server what you attacked
At least not in a first naive Implementation
why not tell the server what i attacked?
Cause then the client just tells the server that it attacked someone across the map
Never trust the client
Whatever determines the target should run on the server
The only things you usually replicated are the initial key presses that instigated the attack
As in, PressAttack -> Server_Attack -> FindTarget -> DealDamage
Only press attack is clientside
You can then think about what parts you wish to predict. E.g. animations sounds VFX etc
That stuff can run locally
Alongside the rpc
my current workflow is that a character needs to be selected to attack in the first place and i send an rpc that a enemy was selected
then i do the rest, without FindTarget, because it was already found
how can I temporarily remove player control over a pawn and force it to move in a certain direction? ๐ค
(for example a fear effect or an attraction effect ๐ค )
(diable input is giving me problems with network, that's why I ask here ๐ )
Easiest would be with RootMotionSource
But the code is currently only really available through Gameplay Abilities
You can expose it yourself though with a normal async task if you know cpp
It's basically faked root motion that the CMC processes
Means all your animations will also work just fine
I am already using GAS ๐ค
Good then use RootMotionSource :D
Which cloud service do you guys use for MMO game?
Yes, read the compendium found in the pinned messages
I'm struggling with this mess
ListenServer and 1 Client start a Map,
Logs show that ListenServer creates Pawn and PController, at BeginPlay Pawn is not possessed, but PossessedBy called
Client creates PController and Pawn and at BeginPlay Pawn have PController and PossessedBy never called
I need to do some Pawn setup based on PController and only way I see is to have duplicate code, or am I doing it wrong?
hi , anyone using aws gamelift ? i am receiving this error while i'm trying to login with email / password .. aws cognito setup
We already talked about this a few days ago. Your pawn isn't guaranteed to be possessed when BeginPlay is called
That's why there is an event called Possessed. Use it
This is not the question
I don't see any other
last line
I still don't see any
I have to duplicate code for Pawn setup, is this the right way to do things?
well there is no single point where I can do it
it is not my code that the issue, the Client possesses the Pawn without calling PossessedBy
PossessedBy is only called on Server iirc
It's called on the server. If you are looking client-side, then that's normal
so I have to "catch" Controller ether in BeginPlay or PossessedBy
You have OnRep_Pawn and AcknowledgePawn for client
What are you trying to do?
OnRep_Controller
๐คทโโ๏ธ
but it will trigger only on the Client?
PossessedBy on the server is also guaranteed to have a valid Controller
Put your code in both functions if it needs to be executed on server and client
again it 2 places where I need to have same code
And ?
and I thought DRY is our every thing
I'm pretty sure you didn't try this though: #multiplayer message
You did so many wrong things there, which shows you haven't read that compendium. That's why I will keep pointing you towards
I watched the video but I don't understand exactly how to use it in boolean
Isn't there a video that uses replicated and repnotify for exactly boolean?
That means you didn't understand correctly. You are using replication and multicasts in the same go. It's either this or that.
A golden rule about multiplayer says:
- Use property replication for stateful events.
- Use RPCs for transient events.
Hi guys. I'm still trying to figure out how rpcs works.
I have a Niagara which I want to show only on the client (It doesn't need for all the clients to see this) but currently only on the server is working (The server also see the client's ns) and on clients it doesn't show at all.
Also that multicast RPC is called on the pawn that fired it. So it's called on the server, the autonomous proxy, the simulated proxies (in case they are relevant to the other connections). That means, you are still talking about the "same" pawn. You are wondering why it's not true for a pawn that isn't yours @oak prawn
That's why you don't check for such state on client but on server.
Don't rush things, enjoy the learning process. That's my tip
Is ADragonPawn a replicated actor?
Yes. It's a pawn so I had to replicate all the movements.
It's a niagara component attached
Those are some speeding lines and with increasing the speed, I change the opacity, so it's only a cosmetic which I want to show only on the specific client
Well if it's for a specific client (your owning client specifically) then consider using Client RPC instead
Is the niagara component attached at runtime? or compile time?
Did you try to debug? What if the values inside the if check there are false for clients?
I've tried with Client,Reliable,WithValidation but still not working, only on server
Well nothing work for me too. Unless I debug.
Nothing knows better than the debugger what's happening there
That is just one possibility
A lot of other things that I could easily miss but the debugger won't
That video you watched is correct. You just didn't understand it well
Also that's not my job.
S_StartFlyingBoost_Implementation is Server,Reliable,WithValidation
Yeah iirc, you should activate it explicitly on the side where you want it used. You can't expect it to activate on client, if you're only activating it on server
Yes, if I change it to Client works, but not the boost doesn't work anymore on other clients/server. So I need to create a new function to activate the ns (which is for client only? )
Because the boost is server authoritative
Yes the activate needs to happen client side
Try putting it in the multicast itself but only if you're client side
i.e if(!HasAuthority())
Thank you!
I'll try it now.
What are you trying to achieve?
Inside the OnRep add the widget. Though it will be added to all relevant connections
Change the multicast to a server event
Correct. That's what I said
In the branch, check for IsLocallyControlled
And use the false pin
Well you already have it