#multiplayer
1 messages Β· Page 258 of 1
Neat!
My problem remains solved, given i just want everything relevant all the time, but this will probably be relevant on a future project where net culling is something i want to happen. Some of this might actually be good info for my previous game where i wanted to net distance cull from a character, not the camera. Gonna jot that down.
Yeah I think your usecase is one where you don't have any good reason to cull things given it appears to be like a limited area of a board
rather than a giant open world survival game or something
So I just realised I had a lot of server -> server RPCs I was calling on server (before I realised event possessed was server only, too stupid to read the node comment), these server RPCs were sometimes unreliable but I'm guessing that even called from server, unreliable server RPCs can fail? And they were all very important. If that's true I suppose server -> server RPC is not totally useless if you have something on server side that's only of small importance
The purpose of Server RPCs is to allow clients to call the event. If you have Server RPCs calling Server RPCs, that means that a client could theoretically bypass the first RPC which may break the logic, cause bugs, or even allow them to cheat. It all depends on where these RPCs are and whether or not the client has ownership of the actors they are being called on of course.... It's pretty rare to not want server RPCs to be reliable too unless you're frequently sending the RPCs like on tick or something where a new update will be sent soon enough.
Well that was informative, the question was, if I do happen to have a server rpc (say event X) called on server, and X is unreliable, can X fail? Reason I am asking is that although I am fixing the incorrect server -> server RPC calls, it would be useful to know if this has been the cause of some of the bugs that seem to occur in my game especially as the load on the server increases.
Since unreliable calls will more likely be dropped as bandwidth becomes smaller
nah if a server calls a server RPC, it'll just act like a normal function
nothing being sent network wise so nothing to drop
unreliable RPCs getting dropped shouldn't cause bugs anyway
if something getting dropped can cause a bug, either rethink design or make it reliable
that's why they are called unreliable, they are cheaper at the price of potentially failing (although I don't think failure rate is very high in general)
Hey guys, what would be the best way to replicate an TArray of UObjects in a UObject ?
since UObjects aren't replicated by default, maybe finding an alternate way - like an Actor with an array of structs, if it's not very big
I'm really struggling with widgets.
I had widget components on each actor as their health bar. This worked perfectly for singleplayer.
Now I've added local split screen multiplayer, the widgets don't work as obviously they are screen space and only show for Player 1.
I've tried a few different approaches, but I can't work out the best way of getting every player to be able to see the health bars on their own screens
Has anybody got any advice?
My current attempt has been to spawn a new actor everytime a player joins that just contains the widget, and setting the new player controller as that actors owner, but this doesn't work. Widget "Set Owner Player" requires a local player reference, which you can't get either...
use a custom HUD class to create the health bar widgets. one will be spawned for each local player and you can access the owning player controller through the hud class PlayerOwner variable
So currently they work as a widget component, so that they hover over each NPC. If I use CreateWidget to use the HUD class, I'll have to constantly project them to the screen in the correct location?
oh i totally missed the part where it was a widget component.. i think you need to create multiple widget components on the actor, 1 for each local player and assign the owner to the related local player
there might be a better way but it seems you gotta loop through each local player and dynamically create the widget components
ownerPC = Cast<APlayerController>(GetOwner());
Can someone help me understand why is invalid for Proxy Player?
Im trying to get owner in Player Pawn which is spawned by default
PC is only on owning client and server
OnPossesed shows correctly controller 0 and 1
but in Begin play its a bit weird
What do you mean by proxy player?
are you trying to get Client 2's PC on Client 1's machine?
Local Client that owns
no, just on client side, connected to server
void APlayerCameraPawn::BeginPlay()
{
Super::BeginPlay();
//YASIULOG_SERVER_FUNC(YasiuPlayerLog, Log, "Builder pawn Begin Play is called. Authority: {0}", HasAuthority());
APlayerController* ownerPC;
ownerPC = Cast<APlayerController>(GetOwner());
FString text = ownerPC->IsValidLowLevel() ? ownerPC->GetName() : "Invalid PC";
YASIULOG_AUTHORITY_FNAME(YasiuPlayerLog, Log, "Player pawn has started playing. Controller {0}", text);
my print in BeginPlay
I don't see any gating here
If you have 2 clients and a server that begin play will run 3 times
1 server 1 client
Listen server or dedicated?
Yeah so the listen servers pawn will have no PC on the clients instance
but client has no PC :<
I wanted to spawn another actor for my Pawn with ownership π€ , maybe I should just use Pawn as owner ?
This is 2 pawns beginning play on client, one has a PC, one doesnt
Which is as expected
for some reason, this pawn does not have owner even on server, so maybe it is too early π€ , im gonna make funciton to print it later
I log if function was called server/client on left side
ok, I call it solved with "Too early" π
I wanted lazy solution to grab PC and reuse it later
Yeah unfortunately that's the issue I'm coming up against, cause there is no way to access the local player reference object you need to use set owner on the component widget, it seems
Same goes for trying to spawn the actors as a widget holder. Although the second player is the owner of the actor, the widget still doesn't belong to them
I was talking to someone about this earlier this week. What I dscovered was that widget components 1:1 relationship to the instance of the widget that gets added to the viewport. The widget component itself has a "Local Player" owner (not the player controller, a literal ULocalPlayer owner) and this is what determines what player screen it appears on. It appears that in order to facilitate this correctly, you'd have to dynamically create the widget components for each player and assign them the appropriate Local Player owner in order for them to appear on the correct screen.
Ooh oops, saw you just figured that out too XD
It's easy enough to expose the local player to blueprints if that's what you're having trouble with:
ULocalPlayer* UYourBlueprintFunctionLibrary::GetLocalPlayerFromController(APlayerController* PlayerController)
{
if (!PlayerController)
return nullptr;
return PlayerController->GetLocalPlayer();
}
does rpc _Validate are executed locally, on server? or both?
So when testing this over steam using advanced sessions and advanced steam sessions, the client seems to get connected to the hosts lobby, but they never leave the menu and get transferred to the lobby map where the host is waiting.
I've setup my app id in config, i open level with "listen" option, use LAN is not checked etc.. It seems as if its just not properly loading into the correct map after joining the session, has anyone had this issue? I'm using UE 5.6
Server when the RPC is received but before the _Implementation is executed.
is there any good tutorial on async loading in multiplayer?
I have no idea when to async load, if it should be done on both server and the client and what should be async loaded in general
Thanks for the C++ blueprint exposure, that was what I was looking for, but unfortunately didn't fix it as easily as I'd hoped.
I can set the owning player, but it doesn't actually make the bars visible to my split screen local players.
I'll keep playing with it, perhaps I will need to make a HUD for each player and constantly scan for Pawns to project their location to the screen and add the health bar
I don't think there's anything multiplayer related in loading assets, you'd do it pretty much the same
the way multiplayer and loading things interact depends on settings and what you send
If you send a path to an asset, should it be loaded when received? Sometimes yes
It is universal to not want to spam main thread loads though. You should avoid hard loads on the main thread for things that are expensive to load
So the ideal is to avoid creating hard references to things that don't need them in the first place
and then async loading in art and animation things when you can get away with it
Sometimes you must load sync as the game must know about something immediately or it is just very annoying to work around
and yeah I agree with this, networking does change when assets appear to the client but it's ultimately the same exact situation for you
depends on the game
It's a very big subject but generally speaking the ideal is that you can avoid keeping things loaded that don't need to be and you can avoid expensive main thread loads if they affect your bottom line perf
If you have to spend a second loading the core game stuff that stays around in each level whatever, but if users get a 1 second frame hitch from a new enemy loading in they will probably be sad
It's also possible to create things that try to gather certain kinds of assets ahead of time and go "okay, you guys load now just in case because I assume you will appear later"
but that's not really mp related
did you create multiple widget components on the actor you're trying to display the health bars for? you need 1 for each local player.. so basically in that actors begin play you need to get an array of the local players and loop through them, creating a widget component and setting its owner for each local player.. in c++ you can get an array of ULocalPlay objects from the GameInstance's GetLocalPlayers(); function... but thats not exposed to blueprints and i dont really see any other good way to get it in blueprints so you might need a blueprint function library function to expose it
doesn't really seem like a fun thing to do in blueprints
I've been going through the GASShooter sample project to look at handling weapon spread/recoil over networked game but I was wondering about this. In their TargetActor GSGATA_Trace's AImWithPlayerController(...) at the end of the functionwhen they are handling weapon spread they use:
const float CurrentSpread = GetCurrentSpread();
const float ConeHalfAngle = FMath::DegreesToRadians(CurrentSpread * 0.5f);
const int32 RandomSeed = FMath::Rand();
FRandomStream WeaponRandomStream(RandomSeed);
const FVector ShootDir = WeaponRandomStream.VRandCone(AdjustedAimDir, ConeHalfAngle, ConeHalfAngle);
OutTraceEnd = TraceStart + (ShootDir * MaxRange);
But with the FRandomStream, wouldn't passing in FMath::Rand() negate the whole deterministic part of using FRandomStream for the bullet spread/recoil?
If it's called AImWithPlayerController that seems like it runs on authority only
a bit pointless to seed on random though... yeah
Hi,
My replicated projectile actor seems to start movement at wrong location, just as if it was falling before being launched, after being detached (from hand socket). How can I ensure the movement is originating from the place actor was detached?
void AArrow::Fire(FVector Direction)
{
float Speed = 5000.0f;
FVector Velocity = Speed * Direction;
FVector CurrentLocation = GetActorLocation();
EnableProjectileSimulation();
DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
GetProjectileMovement()->OnProjectileStop.AddUniqueDynamic(this, &AArrow::OnArrowStopped);
SetActorLocation(CurrentLocation, false, nullptr, ETeleportType::ResetPhysics);
GetProjectileMovement()->Velocity = Velocity;
}
edit: it's just positons not replicated properly
add ```cpp and ``` after code to highlight syntax
I can't start the editro
/// Header
UPROPERTY(Transient, BlueprintReadOnly)
//UPROPERTY()
TObjectPtr<class AGhostBuildingActor> GhostActor;
/// CPP
void APlayerCameraPawn::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(APlayerCameraPawn, GhostActor);
//DOREPLIFETIME_CONDITION(APlayerCameraPawn, GhostActor, COND_OwnerOnly);
}
it compiles but does not start
lol answer in output? hat was not tagged to replicate! Please use 'Replicated' or 'ReplicatedUsing' keyword in the UPROPERTY() declaration.
hey are you still using this paragon sample code? every github i find is empty
I want to test if sound is replicated on multiplayer. I want to run listen server and client, but i want to mute one of them to see if the sound is picked up by the other. Is there a command i could write that mutes client or listenserver?
au.3dVisualize.Enabled ?
i enabled these options in the project settings, which was what i was looking for.
quick question, does this table shows all possible combination of roles? π€
which is 4
Check the enum of roles?
you can just look at ENetRole in the IDE
Hi!
I'm working on a moving platform in multiplayer. The main goal is to prevent the character from getting corrected while moving on it (running, sliding, etc.). To achieve this, I decided to make everything deterministic. Both the server and the client move the platform based on the server time.
However, since the CharacterMovementComponent uses prediction, I figured the platform should also do some form of prediction. So on the client, I use this formula: ServerTime + Ping * 0.5.
It works fine with normal ping, but if the ping is high and the platform moves fast, its position on the client ends up too far ahead.
Has anyone dealt with this kind of situation before?
I know I can
welcome back π
but what does this combination mean?
Local role : ROLE_Authority, Remote role : ROLE_SimulatedProxy
is this client owner?
its not server π€·ββοΈ
Depend on who's calling the code
Local role just mean the local role of the actor of the machine that is calling the code.
So if your computer is the one calling the function, if it says local role is authority then you are the server (99% of the time except when you spawn the actor locally(
well that implies either server or owning client,
but from table it means server is only when remote is autonomus proxy
But for other machines (remote role) that actor is simulated proxy, since they dont own it.
@fallen fossil easiest way to visualise it is to display the role over the actor
And play with 1 server and 2 clients.
FString ReadAuthority(AActor* actor)
{
UE_LOGFMT(YasiuDebugLog, Log, "Reading roles: Local role : {1}, Remote role : {2}",
StaticEnum<ENetRole>()->GetNameStringByValue(actor->GetLocalRole()),
StaticEnum<ENetRole>()->GetNameStringByValue(actor->GetRemoteRole())
);
switch ( actor->GetLocalRole() ) {
case ROLE_Authority: {
if ( actor->GetRemoteRole() == ROLE_AutonomousProxy ) {
return "Server";
} else {
if ( actor->GetRemoteRole() == ROLE_None ) {
return "NonRep";
} else {
return "Owner";
}
}
break;
}
case ROLE_AutonomousProxy: {
return "L:Client";
break;
}
case ROLE_SimulatedProxy: {
return "L:Other";
break;
}
default:
ensureAlways(false);
break;
}
return FString("Empty");
}
Well I did
but then as I posted here again. There is combination I don't understand.
Authority with Remote Simlated proxy π
If you are the server you have authority over every replicated actor
But authorithy also has Client that owns actor
Client doesn't have authority over replicated actor (local role)
At best its autonomous proxy if they own the actor
While the one they dont possess is simulated proxy
yes?
the only exception is if a client spawns an actor
since they're obviously going to be authority over something spawned locally that doesn't exist on the server
Unless you spawn an actor locally as client. That client will have authority over it. But at the same time it cannot be replicated out of the box and other players will never know about it.
ok I don't know when did I came up with this fake info
<@&213101288538374145>
dunno why it suggested some random ass user instead of the moderator tag
Woah woah woah swires - maybe it is legit
but oh well
They seem trustworthy
really, an anime avatar?
Only the most reliable of people use anime profiles
π
Backed by science
That person is most likely a victim of the scam too.
Real bots dont normally have an avatar
yeah but who still falls for the steancommunlty thing
for some reason I also though
that HasAuthority() can be executed on owned actor
he probably clicked some link
? HasAuthority() just checks the role value
simply clicking a link isn't going to make you spam on Discord
True! now I clearly understand it
Sure did 
probably an infostealer malware or logging into a phishing page
It does, my friend fell to this scam before.
Clicked a link and he start spaming steam gift cards
how do they get into the account?
yeah that's not really how it works
I'd be very surprised if there was an active exploit in the wild that could spam Discord from simply clicking a link
Well yeah certainly shouldn't lose credential over clicking a link.
Unless the link tells you to enter username and password
maybe he wanted hacks, or free gift card
this is why a lot of big companies will run phishing simulations now to see how many would blindly paste their credentials into something that looks like a login form
okey, thanks for help im gonna go
Back in the day we dont have oAuth2.0 or the likes
Also if an actor isn't replicated you can have authority of it as a client
yes I was told that, thanks
it's absolutely been like that in the past
browser exploit that stole cookies iirc
Doesn't matter if replicated. Spawned locally is enough.
oh true!
Hey guys, I'm using the new Instanced Actors PCG Interop to spawn actors representing trees in a multiplayer environment. The tree actors are replicated. The tree actor can take damage and after a threshold it will call Destroy on self. However when this happens, the tree actor gets destroyed, but instantly spawns back.
I have a feeling there might be a special way to remove an instanced actor instead of a Destroy call, but haven't figured out.
If anyone has had success with this please help me out.
@thin stratus https://www.youtube.com/watch?v=u-KXeeXE7kE new video on the multiserverreplication plugin if you're interested π apparently GAS wont work with the current setup without a bit of modifications
In this video I show results of my testing of the new MMO server in Unreal Engine 5.6. What works, what doesn't and where do we go from here.
Open World Server 2 & Hub World MMO Discord: https://discord.gg/qZ76Cmxcgp
π¦
what does NetLoadOnClient = true mean in the context of a world partition spatially loaded actor? Does the actor not spawn in initially if the cell isn't loaded? And if the cell is loaded it will load?
What if it's false, and the cell is loaded - i guess it won't load?
From what I understand NetLoadOnClient = true makes the client spawn a local copy of the actor during map loading. If set false, the actor won't automatically be spawned by the client but the actor can still be replicated to the client if marked to replicate.
yeah thatβs how it works with no streaming. Not sure if itβs the same with streaming
If it's an actor with replication turned off, you would need NetLoadOnClient = true in order for the client to load it when the level is loaded.
If it's a replicated actor, then it should get replicated regardless if the server has spawned it and it becomes relevant to that client.
If both are true, then it won't matter, the client will still load it during the map loading process, and it will "connect" to the replicated version from the server, and then use the relevancy from the server to determine if that actor should still be there or not on the client's end.
Kinda sad that all new network toys fail at GAS haha. Thanks for sharing.
GAS still works but some edge cases between RPC communications kinda dont work due to the proxy server from what i gathered from that video
For Sure!
π«‘
in my game I have ive made a bool to prevent the player from using an autoclicker/spam clicking to exceed the fire rate of a gun. This has worked (mostly), however it prevents the client player from firing more than one shot, while working perfectly on the listen server player. The bool is set to rep notify and is instance editable. The blueprint this is inside of it also replicated. Any ideas on whats wrong? I can provide more of my blueprints if needed.
These are the only times the variable is set or referenced btw
replication does not send every time the boolean changes but the most recent value
also if you are setting the replicated value on the local client
it will fight the incoming server value from replication
These are the events that first set it
pretty sure they are server side
It is kind of hard to read this
if this runs on the client
this is fighting over the server to change a replicated value
no bueno
the first custom event?
I think my screenshot is pretty clear here
I am talking about if the client sets this replicated boolean locally
or not
if the screenshot didn't load my b
if you have a replicated property it is not great to set it locally on the client because now you lose information
if you want the client to have local state that's good, but I think you don't want to fight over replication with who changes the value
ah ok I thought I wasnt doing that since the events that set the variable are rpc's
you replicate an rpc to the server and then right after play a sound then set the bool on the client
the execution pins after are still executed on the client
ohhhh ok
Hey just wondering if anyone has had weird behaviour with SetActorLocation? I can't seem to understand why its doing this for me. I'm attaching an actor to my character when I pick up the actor and then dropping it in front when I drop it on the client and server from their pov it looks completely normal however when the server does it and the client sees on the client side the actor sweeps from the location it was picked up from and then goes to the drop location instead of a straight forward teleport. PlayerInventory[SlotIndex]->SetActorLocation( DropLocation, false, nullptr, ETeleportType::ResetPhysics); this is what I'm doing so if anyone has any ideas please let me know. I'm very new to this so don't assume I've done the obvious as I could be missing something simple haha
better?
that should help because now it's actually doing what you want at least
I still kind of think this is going to feel bad for clients with bad ping if the timer is very low because ping will make them actually fire slower, if you need to prevent cheating then validate them sending too many fire inputs quickly over time
it might not matter if it's a fairly long timer
yeah cheating isnt an issue its coop so idc really
yeah it works but its causing a new issue so might have to think of a new fix
#multiplayer message Sorry just bumping this message incase someone pops in and has an idea
you say you attach it but what happens after you attach it?
it appears that you also hide the object
yes I do, I have a function that sets actor hidden in game and changes it to overlap all ``` int32 FreeSlotIndex = GetFreeSlotIndex();
if (FreeSlotIndex != INDEX_NONE)
{
PlayerInventory[FreeSlotIndex] = Item;
constexpr bool bShouldHide = true;
Item->StaticMesh->SetSimulatePhysics(false);
Item->SetItemHidden(bShouldHide);
// Attach to character for relevancy
PlayerInventory[FreeSlotIndex]->AttachToActor(this, FAttachmentTransformRules::SnapToTargetNotIncludingScale);``` this is the Add to inventory function and then the drop is here ``` FVector DropLocation = Camera->GetComponentLocation() + (DropForwardVector * 200);
PlayerInventory[SlotIndex]->DetachFromActor(FDetachmentTransformRules::KeepRelativeTransform);
PlayerInventory[SlotIndex]->SetActorLocation(
DropLocation, false, nullptr, ETeleportType::ResetPhysics);
PlayerInventory[SlotIndex]->SetActorRotation(FRotator::ZeroRotator);
PlayerInventory[SlotIndex]->SetItemHidden(false);
PlayerInventory[SlotIndex]->StaticMesh->SetSimulatePhysics(true);
PlayerInventory[SlotIndex] = nullptr;```
If you don't hide the object where does it actually move?
Also I don't know in which context this code runs
Well that's the first clip I sent, I just wanted to check it was actually attaching correctly and it was for the server and from what I know attaching to actor is replicated but I could be mistaken
the first is in my ServerAddToInventory_Implementation and then for second its in the ServerDropItem_Implementation
I don't see how the second one describes which context it runs in
which is why I have to ask you to describe what actually happens here
Essentially what I do when I pick up an item is hide the item actor that is picked up and then attach it to the character picking it up and when dropped I just drop it in front of the player. The drop item is just a Keybind to drop it, sorry I've only been doing this 2 weeks so I'm really clueless as to what context you need haha
also would be interesting to see where the position is with Net.RepMovement.DrawDebug
the code in the computer runs on different machines... I am asking which machines these run on
the first one you seem to call server which implies it is an rpc from clients to authority
the second one I assume is similar
Yeah precisely, both are RPC's from clients, I do have a local one in order to make it less ugly for the player but the local just calls the server implementation then does a check GetNetMode() != ENetMode::NM_Client and then just does the server side stuff also on the client to a degree so it doesnt look all rubber bandy for the client
going to say it would be interesting to see what happens if you don't hide it
also are you using any fixed or async physics options?
there are not many things that try to interpolate positions in this manner
I'll get a clip now and for async physics options I'll be 100% honest I have no idea, I don't think so as I've not gone out of my way to do that
If you don't simulate physics does it still interpolate the visual change?
aha I think you may be onto something, turning that off completely actually makes it behave
So this is with simulate physics on to start but not hiding the actor at all
As you can see for the client it works but not for the server
Is the server not attaching it?
it is locally but not like for the clients
I wonder why disabling simulate physics does do it correctly though
it's all good I've taken up enough of your time I'll keep trying some stuff, I appreciate it though
Hey, why is it that on listen servers the animation updates are dependent on the framerate of the clients?
So for example, let's say the server runs with 60 fps and the client with 5 fps, the animations on the server for that non locally controlled pawn become super janky (this is true for packaged games as well).
Does anyone know how to fix this?
im unsure if this can fix your issue (the usually problem is the client sending to much data on server because of high frame rate) but maybe try to look out the used cvars and see what they do
https://notes.hzfishy.fr/Unreal-Engine/Networking/Character-Movement-Component#client-to-listen-server-animation-issues
@nocturne glacier
is p.NetEnableListenServerSmoothing enabled?
also 5fps is crazy low here as its getting just so much less information imo
the rpcs are coming in very slowly
what does this do ?
allow server to smooth the animation ?
yes but it is on by default
it's for the mesh position smoothing
the animation is not something the cmc cares about
is there an option for smoothing the anims ?
it just changes the velocity and transform, the cmc doesn't animate your skeletal mesh except I guess respond to root motion stuff
feels weird its not played locally ?
what part of your anim graph is the cmc smoothing? (rhetorical questiom, the point is here that the cmc only changes velocity and trasnform etc so the anim graph is distinct afaik)
anims should be at the local screen frame rate
i think so too, but they are not?
Animations are ticked in sync with cmc if i remember correctly. Which means that on listen server animations are gonna be ticked in sync with received moves. If moves arrive at a lower frame rate, animations look choppy
wuah, do you know of an option on how to decouple the animation ticking from that, so that the server sees the animations normally, no matter the fps on the client?
No. You would have to dig into cmc and find where the animation ticking happens.
Tho i do not necessarily think it is a good idea to have it ticking separately, since then animations might miss-match movements
Im facing issue where my actor is not replicated.
I found out that its treated as SimulatedProxy on server, which means there is no player connected π€
is this because I spawned actor with wrong owner?
as owner I pass PlayerPawn and not controller itself π€
i know it might not be best practice maybe, to couple game logic to anim notifies, but this issue absolutly makes it even more impossible for listen server projects
you could possibly lower MaxSimulationTimeStep on the character motion component to make the server split up the client move into steps, but that might cause issues with the low fps client
You sure you're spawning it on the server?
yes
nvm
tick does not fire
YasiuPlayerLog: (Client:Other || f:GhostBuildingActor1) Showing ghost, material is valid: false
nah, still no replication
I think
my main pawn is wrong ? π€
do I need to set owner on posses?
void APlayerCameraPawn::PossessedBy(AController* NewController)
{
YASIULOG_AUTHORITY_FNAME(YasiuPlayerLog, Log, "Pawn is now possessed by: {0}", NewController->GetActorNameOrLabel());
Super::PossessedBy(NewController);
}
altho I not sure, I see both movements
Before joining a session, I want clients to be able to choose from an Enumerator what type of character they want to use (think of them like archers, warriors, etc.). When clients join the session they should spawn with the pawn of the selected previously selected. I can't find any information about how to handle this. The closest to be is the player state but seems to me that the clients can't modify playerstate?
There are a few ways to handle it, with the most common (because it is the most straight forward) probably being to let them join and when they connect, then have them select the class/character. They can also join with additional URL params that could represent what they previously selected.
Then the GM would read from those params and just assign them.
You're probably right. Choosing the class character before joining, although it does make sense (game design), it creates extra steps. 
If you have them join the session first then I'd imagine you'll want the enum on the player state, you wont really want clients to modify the player state at this point anyways you want the server to update a clients character selection and then have your game mode spawn them.. but if you want them to select a character before they join a session like a 'preferred character' you can prob save it in the game instance but then you have to make sure its saved and loaded when closing/opening your game
No, let them join and THEN let them pick the character.
as in sending a data struct to be added to an array
Why does a client need to do anything here?
What is the actual thing you're trying to do?
im storing a controller ref and steam id ref so every time you open the pause menu you see a list of other players in the game. The data struct needs the controller ref so the host can use the steam api's kick function
the list being the other players steam avatars and user name
So why the client does anything is upon login it casts the data to the gamestate so everyone can access it
This is log out thought
well yeah i have it remove from event logout but i also add it on event begin play
removing the information
Anyways no this won't work. The rpc has to be a property of something the client owns.
Make an rpc in the PlayerController, then the server side PlayerController can talk to the gamestate.
Run on server events in Gamestate don't really make sense since no client is gonna own Gamestate.
even if the data struct array is set to be replicated?
That has nothing to do with what Adriel is saying
yes let me add a rebuttal and elabroate on nothing
nothing to elaborate
Well, if you read and understood the network compendium, my response would make sense. But because you apparently have reading comprehension issues, let me break it down barney style for you - a variable being set to be replicated or not has nothing to do with RPCs. They are two different concepts. Adriel was trying to explain to you that your RPC wouldn't work because the client doesn't have network ownership of the gamestate. And server rpcs only get processed on things that clients have network ownership of.
Being a turd doesn't help anything. No reason to be one.
idk dont be high an mighty with your perceived superiority in a help community when im trying to ask question and learn. maybe this isnt the place and you should use your supeior skills to be programing instead of throwing smug remarks to my questions that give me no clearer undestanding to what im trying to work through.
I wasn't acting all high and mighty. I answered your question. It was you who, instead of just replying, "how so?" decided to respond in a sarcastically negative way.
Based on that, I then responded in kind.
i just wanted to know if i needed to multicast since the varible is already replicated
or if its fine that my function is just set to "Run on server" sinces i cannot quickly interate on Steams Api since i must packages and move my entire game on a flash drive between two computers to test anything
Multicasting was never brought up as a solution, 'nor a question from you. So I don't think anyone could deduce that is all that you wanted to know.
As for using it in this case, wouldn't be needed. I'd put it in an onrep before a multicast because it is stateful. And stateful things should be onrep'd and not RPC'd. RPC is for fire & forget or client -> server communication. Stateful things are things that affect the "state" of the game. No matter how big or small. Explosion - not stateful. Doesn't matter if a later joiner or someone misses it. The destruction of a building due to the explosion, that is stateful however, as it changes the level - potentially in game balance ways.
having 30 play types example: flying, knocked, crouch, prone, weaponcrouch, weaponprone, and more.... likely 30 types.
so having an enum with 30 types is best way to go or 30 bools?
keep in mind i will be doing some bit compression with state variables
so even using enum will be fine i guess
enum class EPlayState : uint8 {
None = 0,
Flying = 1 << 0, //// 1.
Knocked = 1 << 1, //// 2.
Crouch = 1 << 2, //// 4.
Prone = 1 << 3, //// 8.
WeaponCrouch = 1 << 4, //// 16.
WeaponProne = 1 << 5, //// 32.
};
/** used to set/update state*/
void SetPlayState(EPlayState NewState) {
CurrentState |= static_cast<uint8>(NewState);
}
/** used to clear a state*/
void ClearPlayState(EPlayState StateToRemove) {
CurrentState &= ~static_cast<uint8>(StateToRemove);
}
/** used to check state*/
bool HasPlayState(EPlayState CheckState) {
return (CurrentState & static_cast<uint8>(CheckState)) != 0;
}
private:
uint8 CurrentState = static_cast<uint8>(EPlayState::None);
}
Jesus, just go with gameplay tags or something
Theyβre extremely fast to replicate
I'm modifying the default character movement component
and this every state have its own predefined speed mapped with the state name
i probably wouldn't use any tags or enums at all and use different movement modes instead
movement modes are defined in the enum under default cmc
lol ok
crouch, prone, weaponcrouch, weaponprone
If you are using combinational enums, you've probably made a mistake somewhere.
i have two enums for the character state in the default cmc, aka my custom cmc derived from default cmc
EPlayMode
-UnArmed
-Armed
-Vehicle
EPlayState
-Crouch
-Prone
-Stand
-Knocked
...more
and then speeds are mapped using both enums
UnArmed_Crouch = 200
Armed_Crouch = 180
and for other states the same logic with different speeds mapped
and these enums are also used in the animation blueprint to blend different sets of animations
i don't see any mistake in my setup
Ah, so you're using two different enums and comparing them?
Combinational enum is like having one enum with the values chocolate, vanilla, chocolate with sprinkles, vanilla with sprinkles, chocolate and vanilla with sprinkles and so on.
yes, I'm mapping both and then getting the required speed based on the current mode and state
hello C
Awesome. Best bet is to make a struct that has one of each variable, and use that struct as the key of a TMap.
That way you can put in two enums and get out a float.
or whatver.
yeah i have one FMovementSpeed
MovementSpeed.SpeedMap.Add(TPair<EMovementType, EMovementState>(EMovementType::Stand, EMovementState::Walk_Forward), 200);
float USurviveMovementComponent::GetUnarmedMovementSpeed() const
{
if(ActiveMovementType == EMovementType::Knocked)
{
return MovementSpeed.GetSpeed(ActiveMovementType, EMovementState::Walk_Forward);
}
EMovementState CurrentState = EMovementState();
if (!bRightLeft)
{
if (bWalkPressed)
{
CurrentState = (bMoveForward) ? EMovementState::Walk_Forward : EMovementState::Walk_Backward;
}
else if (bSprinting)
{
CurrentState = (bMoveForward) ? EMovementState::Run_Forward : EMovementState::Run_Backward;
}
else
{
CurrentState = (bMoveForward) ? EMovementState::Jog_Forward : EMovementState::Jog_Backward;
}
}
else
{
if (bWalkPressed)
{
CurrentState = (bMoveForward) ? EMovementState::Walk_Other : EMovementState::Walk_BackOther;
}
else if (bSprinting)
{
CurrentState = (bMoveForward) ? EMovementState::Run_Other : EMovementState::Run_BackOther;
}
else
{
CurrentState = (bMoveForward) ? EMovementState::Jog_Other : EMovementState::Jog_BackOther;
}
}
return MovementSpeed.GetSpeed(ActiveMovementType, CurrentState);
}```
Bitflags, go!
Can material instance dynamic be evem replicated? π€
I would say even if it can be that is not a great thing to replicate anyways
Like... what exactly would you send about it?
Materials can be sent as they are stable named assets
a new object is a new object and if you need to change something about it you should send that instead of trying to make an entire new object replicated
I'd treat MIDs like widgets.
yeah, that's a good description
Have them based on some other state that is replicated.
I just spawn c++ actor (not BP ) and it has no reference to material so I have to assign it from parent actor, and then somehow replicate it π€
Right
it just has nullptr on spawn
Elon mandated!
I am not asking what you are doing now, I am asking why it must be the X/Y./Z material
is it different based on something else on the server?
BECASUE IT HAS NO MATERIAL
its null
which material should it be? I am asking what you WANT to do
any really
same for all
I could make BP Actor Class and assign default asset ref, but thats not what I want :<
I think in that case you could replicate the material asset then when it is received create the MID
I don't recall saying anything about actors
ok
a dynamic instance should be local only, but which material it uses can be sent any way you want I think'
I could replicate SoftClass and onRepnotify load it per client
yeaa, I realised this a bit too late, I was fighting to replicate it for 2 days xD
I though I messed some replication properties
Material instance would also work ?
no, I am referring to an asset object
I do not think you want to replicate an entirely new object for this
ah, right, it replicates whole variable
Another thing to consider is how you send the information for what to change on the instance if you need to
Which is tough to say as it depends
there are a LOT of ways to use mids lol
Looking for some guidance to get me out of a block...
I've got a replicated actor (A) which itself spawns a handful of replicated actors (B) on the server. Actor A keeps an array of all actor B's on the server. I need access to that array on the clients. I'm between the following implementations...
- Just replicate the array and move on with my life
- Have all of the actor B's "register" themselves with actor A on the client on beginplay
There's maybe 30 of these actor B's so not crazy but I feel implementation 2 is more efficient but comes with a few more implementation details.
Choice 2 is a better approach.
Doesnt add additional bandwidth, also ensures that the Actors are actually available when they exist on the Client.
That's what I thought....appreciate the validation and getting me past that.
hey folks anyone here have played with GameplayCameras? i trying to make it work when simulted as client..on standalone and listenserver, it works fine but on client, it gave me this error which it cant find the controller
it just a simple setup which just activate the camera which right now, i just supplied the normal playercontroller
and in the director, i just activate the thirdpersonrig and normal attach the camera to the pawn,set the boomarm position and do some dampening offset
this is the eeror when playin as client
on standalone and listenserver, it works as intended, just not client
what could be the issues here
figure somethign out, so in playercontroller, when disabled Auto Manage Active Camera Target, the camera is at the correct spot but i lose the input for IA_Look input action
Is there a way to kick the host player of a listen server during the AGameMode::InitGame step?
Context: I have a login screen with a server browser which allows the player to create a server with restrictions (e.g. auth required, whitelist enabled, max players, etc.). There are a few instances where the 'host' (i.e. the player who created the listen server) should be rejected entry into their own server (and resultedly the server is shut down). I could validate before creating the server, however I'm still wondering if I can kick them after the server creation process has started.
AGameSession::KickPlayer can not be used yet because in AGameMode::InitGame, where I am performing server config validations, the PlayerController does not yet exist, so it can not be kicked. But surely there must be a way to reject their own connection and cause them to be kicked back to whatever the 'default' map is.. right?
A Host cant be kicked, the Host is the Server.
Kicking the ListenServer? That's diabolical π€£
Yeah I know it sounds silly. Thanks for the response though. I'll just validate and prevent the creation like a normal person.
nvm, its a initialization issue, did a delay for 1 second and it fixes it. most likely the playercontroller is not registered yet
anyone know how to find good documentation for the advanced session steam plugin?
void AKhaiCharacter::PawnClientRestart()
{
Super::PawnClientRestart();
//Make sure to do it here as this is where Input Component is being registered
//If we didnt do it here, the InputAction in InputBindingAxis2D will not being registered
if (CameraComponent && InputComponent)
{
APlayerController* PC = Cast<APlayerController>(GetController());
CameraComponent->ActivateCameraForPlayerController(PC);
}
}
if anyone interested, try do it in APawn::PawnClientRestart, this way, we would have PlayerController that have its inputcomponent registered
tried in beginplay, possesses,onrep_controllerchanged and its either you early for PC to registered or InputComponent doesnt registered yet with PC when initialization
i should probably just RPC it ngl lol
looking at GameAnimationSample, they do an owning client event to setup that
Does anyone know why the get steam persona and get steam friends avatar functions dont seem to work on clients?
Why does FFastArraySerializer keep a raw ptr to a UObject? Doesn't seem so safe π
is this standard workflow for networking?
write UFUCNTION(Server, BlueprintCallable ...)
write function _Implementation
write UFUNCITON(NetMulticast .. ) for clients
write function _Implementation
or there should be just plain UFUNCTION(BlueprintCallable)
which calls RPC to server?
well you'll need to spell "FUNCTION" correctly, but there's no reason why an RPC can't be BPC
though I don't quite know what you mean by "standard workflow"
just general question, if its good common good practice to design it this way
I'm gonna make a PR to the engine so that we can have UFONCTIONs
Hi, when it comes to high ping and packet loss I would need to implement a system that forces the player to disconnect if they're consistently hitting high pings/packet loss, I can get the players pings through player state but is it possible to detect a players level of packet loss? I assume it won't be enough to just detect high ping since that doesn't account for low ping high packet loss situations and vice versa
Hey! Wondering what is your best alternative to Steam leaderboards. Firestore? PlayFab? EOS? SOmething I'm missing in the list.
I just need a place that can add more than an entry per 10 min (Steam limit if I'm not wrong) and can have metadata and other fields added to the entry, etc.
And/Or Sorting.
I like to make the BP func a separate one because you never know
<@&213101288538374145>
Has anyone here done a network bandwidth test? I have a question about the size your gameplay tags were over the network.
I have fast replication on for gameplay tag which is supposed to reduce them down to uint16 however my wireshark readings are a bit higher than expected for that to be the case.. Maybe I'm doing it wrong.
Also its documented that Network Insights does not show the packed results meaning its not reliable for knowing the true bandwidth costs.
Why would you use wireshark? Use UE's built in Unreal Insights profiler with the Net channel
Also its documented that Network Insights does not show the packed results meaning its not reliable for knowing the true bandwidth costs.
It doesn't show the packed costs. So if you have custom net serialize functions that are packing bits and compressing things the values in insights wont reflect that. I was told that wire shark is accurate in that case
I can't confirm that. I have used it extensively to profile npp and mover and the bits where 100% what I was expecting.
Every single property was exactly reflected in the bit count in insights the way they were serialized
Also I seem to somehow have skipped you last paragraph, sorry about that. Reply remains the same though
Yea thats what I was hoping. The docs say that the reported size is before compression
https://dev.epicgames.com/documentation/en-us/unreal-engine/networking-insights-in-unreal-engine
I was thinking same, but more like I would forget and use multicast because it has defaul name π€
It may be smaller. That's probably not significantly smaller though. You can't really rely on that either. The only thing you can measure is what each property translates to in bits and optimize around that. If there is more compression on everything at once afterwards then that's just an additional win.
True. I'm trying to do some math to create a budget for server costs based on the data I have. I just have to narrow down where my hotspots are. I'm gonna run a test soon where I send nothing but gameplay tags just to make sure its not them causing the bloat.
The difference between 2 bytes for a uint16 and 12 for the full gameplay tag is substantial especially how frequently I use them lol
Right now I'm doing a pass that changes all FGuid (16bytes) in my system to uint16. Gotta crunch that data. Thats a ton of bits saved per update.
Jap, especially since the uint16 can be packed
I gotta look into that.
In theory all ints are packable to the lowest byte that still can represent it. Iirc it uses the last bit to indicate if the int is bigger or not. The gain is not that high for 16 vs 8, but for 64 or 32 bit, it can be saving some bits if the numbers is a lot smaller
also almost all sent numbers are on the lower end
has anyone ever experienced CMC movement corrections when running an ARM64 linux server? Even using a basic spiral staircase, I get very consistent rollbacks (windows client vs arm server) when climbing it
my suspicion is floating point math differences on the platforms, but it's just a wild guess
I'm not knowledgeable about this specific scenario but I think it would be very unlikely. A small difference in floating point won't usually be very noticeable for players because Unreal units are comparatively big
Is there a way to get the platform that a client is on from the server like Win or Mac etc..
ok, after playing a bit more with replication.
Can someone explain to me, why role for Actors (not pawns) is SimulatedProxy and AutonousProxy? Does Autoproxy is only for controlled pawns?
I though I can use it to distinguish locally owned actors, but apparently no.
My child actors are SimualtedProxy, but owned in chain by local controller so replication works fine π€ .
You might have the answer right here: #multiplayer message
I had the same question a while ago with my pickups
<@&213101288538374145> can 1 of you guys please delete/deal with this
same thing in #online-subsystems and more
thx :)
Hey all, I have this issue where an actor's owner is **sometimes **null for client on begin play when the actor is spawned on the server.
Server:
Actor B:
void BeginPlay()
{
GetOwner() // this returns Actor "A"
}```
Client:
```Actor B:
void BeginPlay()
{
GetOwner() // this sometimes returns null
}```
Is this a known issue for UE?
turns out Owner is a replicated property, so I'll just use override OnRep_Owner() instead
Hello, does anyone know what function might be called when an actor becomes relevant? I have a pre-existing door in the world, and I'm trying to correct its rotation once player gets close enough
Event begin play?
Pre-placed actors don't get destroyed when they become irrelevant, unlike those that are spawned on runtime
Since they don't get destroyed due to relevancy, they don't get created except when the level is loaded
Ahh interesting. I mentioned cause i notice a characters begin play will fire when going from irrelevant to relevant
Not sure what the issue is but couldnβt you just add itβs rotation as an onrep?
And when the player gets in relevancy* range that variable should be about to handle updating the doors rotation
Characters are usually not pre-placed in the world, unlike doors
Right, I typically just have an βopened?β on rep variable that handles my door opening / closing
But my doors are quite simple. Just a bool and have two states (open / closed*)
My door can be opened in and out, I have 2 bools -- bIsOpen and bShouldOpenIn. If the door becomes irrelevant while it's opened in, then someone closes it, and opens out, and the door becomes relevant again, it'll be still considered as open, but I needed to make sure that it's opened in the right direction. I ended up doing that from bShouldOpenIn's OnRep. It works, but I just don't like how it's structured
Yea that does seem like it could have some unique use cases
Maybe make it a Enum instead, but youβre essntially still doing the same logic but at least it can only be in 1 state at once
I'm dealing with an issue where I am running a listen server. I have an NPC standing on a ramp. For the host the NPC looks fine, but for the client the NPC is vibrating up and down super fast. I'm also seeing the vibration if I eject while in PIE, but not when possessed. It's a long shot, but has anyone experienced something like this before?
Use a Struct, put an int into it. Increment the int every time the door state is changed.
However, that won#t tell you which direction the door is opened in.
So you kinda have to replicate the direction either way.
Could you use an enum for all of the possible combinations?
i would just use an enum with 3 states
and the onrep drives animation
Anyone have any tips for common pitfalls with seamless travel? I have a lobby level that I am trying to travel from to the actual game itself but the client gets booted due to some error.
I have ensured that the lobby game mode and the actual gamemode both use the same player controller and pawn. Anything else that I am missing?
A bit of a multiplayer beginner here -- Is there really a difference other than developer preference with the following options?
A: game score is updated on GameState and replicated to all players, on each update GameMode checks the new score and determines if the game was won or not yet (All server variables are on GameMode and GameState must alert GameMode to check whenever events happen)
B: game score is updated on GameState and replicated to all players, and GameState is also in charge of checking the score requirements server side (GameState holds all server side variables like match info and requirements instead of communicating with GameMode)
It seems like the end result would be the same? They both have the ability to run code server side only so it just is a matter of dealing with back and forth, or with dealing with lots of variables in one single component. Like timers for example, those could be ticked in the GameMode server side and sent to GameState to replicate to clients, or it could just be done fully in the GameState server & client side.
imo game state shouldn't hold much logic. it should be just that, the game state
So everything should be done in Game Mode and then sent to Game State to replicate?
I'm just having a hard time grasping where things should belong. It all seems like preference to me, but so many things online seem to be very much "it must be this way"
that's always made the most sense to me. especially considering you can have multiple game modes that use the same game state
But you could also have a single mode choose from multiple different states when entering the level
maybe you have a death match and a team death match game mode with a game state that tracks your score. they both touch the same score, and something like UI on the client only cares about what the score is, not where it came from
not really
I guess you could use inheritance at that point but it feels hamfisted
Why not? The Game Mode could be completely empty and the Game State could literally hold all of the server side logic without referencing the Game Mode at all
then your game mode is having to select what type of state it wants to use
Maybe I have a fundamental misunderstanding lol. From my perspective it just seems like you can put it anywhere that can run on the server and you'd have the same exact outcome in gameplay, it's just a matter of how you want to set up the code and variable management
you definitely could put all your logic in game state. you could also put all your logic in your level blueprint π
That's what I'm saying haha. I don't understand what should go in Game Mode vs Game State since you could get the same result either way π
Is it really just developer preference? I have asked multiple LLMs as well and some say timers should be in Game Mode while others say Game State. Some say the score should be updated in Game Mode and sent to Game State to replicate, while others say to just use Game Mode to get the base variables and then give them to Game State to handle all logic during gameplay, etc
if you would have more than one game state type, you'll almost definitely still have more than one game mode type
gamemode handles spawning and most other setup
so regardless you'll still have some logic in there
So you would suggest running all code for the match logic in GameMode and just using GameState to send updates to clients?
yes
but not even just to send data to clients. any general game state should be in... game state
So in a round based game it would be things like time remaining, current round, team score, current players per team, etc?
But are any calculations or functions relating to these handled in Game State or are the variables just stored in Game State and all logic is in Game Mode?
calculations ideally in gamemode
The problem with enum is that when I need to close it, I need to animate that. I do that deterministically: I have a function UpdateDoor(float AnimationProgress), which multiplies that by the angle limit and the direction of the door.
If I set the state to OpenedIn before the animation, I can animate the opening correctly. However, that also means the moment I close it, the state will immediately become Closed, and that function will have no idea what direction the door was opened.
If I change the enum after the animation, then I can't start animating the opening, as it's considered as "closed" while it's opening. Adding 4 more states for ClosingIn, ClosingOut, OpeningIn, OpeningOut sounds like an overkill.
I tried creating a PreviousState enum that would save know what enum it had before replication/change of state, but it gets over-complicated, and not that I like that solution either.
So Game State is basically a container for server values that players can reference easier, while Game Mode is the foundation that updates and controls all of those values server side?
game state is the state of your game π
it can just conveniently replicate said state to clients
the rest of your game (game mode actors components) mutate the state
Okay. Thanks for discussing with me π
in a very simple engine, game state would contain ALL current state and likely not contain any logic
thanks, It kinda explains ;d
if anyone has any good resources for seamless travel then that would be greatly appreciated since I am totally lost on what the issue is.
I'll take a look at cedric's guide now at least
Is there a way to set a breakpoint but only when running on the client instance?
Quick question if anyone happens to know. If I have a Parent->N Child Components nested replication layout can I have TFastArray<FParentStruct> then FParentStruct -> TFastArray<Child Data>. Are nested TFastArrays supported? or should I flatten it into a second TFastArray and hold an ID to its parent to mark it dirty?
So if a child data member gets changed marking it dirty will outer TFastArray container item to be replicated to outer container client.
One thing to note is these arrays are fixed. So the index will not change making easier to deal with and access
You can select the instance from the drop down at the top when the game is running.
What about in code
Anyone knows if motion matching is replicated in terms of just character walking and running?
By any chance, has anyone had luck with getting the "Snapshot Pose" command to work when running as a client? I'm seeing the node snapshot properly for server and as astandalone, but when running as a client specifically it only captures the bind pose.
Can any one help or point me in the direction of troubleshooting setting a var on an actor on the server via an input action.
Im casting to the actor in my player controller and using that reference to call an event on the actor.
Im pretty sure I want to keep the actor owned by the server but ideally id like to set a reference to the player controller that clicked on it in it so it can be used for something else
I have a hover bike actor placed in the level on the server, and I want to implement client-side movement for the owning client only to eliminate input lag. Iβm using SetPhysicsLinearVelocity on the client when IsLocallyControlled is true, and have disabled Replicate Movement, while keeping Replicates enabled.
Despite this, the owning client cannot move the bike properly it twitches or gets stuck, as if the server is still overriding the movement. Physics is only simulated on the owning client, and I verified possession and IsLocallyControlled. The bike is meant to be synced later via RPC (client β server β multicast).
How can I prevent the server from interfering with movement and allow full client-side physics control for the owning client, even though the bike is placed on the server?
Thanks in advance!
Server is Dedicated and I want smooth movement for owning client later transform will be updated for other clients as Lag on other clients is acceptable
Does fortnite multicast their bullet trails?
you can set conditional breakpoints
usually you right click the breakpoint?
can compare netmode at that point
Netmode? Got it. thanks.
The input action happens locally on the client, the client can only RPC to the server on replicated actors it owns, so you'd have to do it through something like the player controller, its possessed pawn, its playerstate, or a replicated component attached to one of these actors. Once running on the server, you can then set the replicated variable as needed and it'll replicate out.
managed to figuree it out but yes, through the PlayerController and using RunOnServer then calling another run on server within the desired actor to set the var
You don't need 2 run on server btw
trying to wrap head around OnRep Notifies in C++. If a value is changed on the server, it will trigger OnRep Notify on the client. But when does that value change on the client?
Does the value on the client change before or after OnRep Notifies is called on the client?
Also OnRep Notify is not called on the server?
I've just found it so much simpler using Server and Multicast calls as I can see the flow of values happen, and have control when things change.
But on rep notifies are nice for mid joining clients and seems to remove the need for multicast
Hi, i'm looking to make a space co-op game where players can be on different (proc gen) star systems at once similar to Stellaris and they can jump to different systems at any time. What's the best way to do this? World Partitions?
My idea is to have n system slots, one for each player all far away from each other and programatically create systems whenever a player arrives there for the first time.
So in essence one big world with everything
is it normal for his pawn to not appear anywhere if the client didn't have focus on the window?
Thanks, i'll try it out this evening after work.
OnRep functions are called after the value changes on the client so the function will have access to the latest value. Also they donβt get called for server (in c++)
thanks for confirmation
onreps would be pretty damn useless if it was before
they can optionally pass the previous value as a function parameter though
I've made an empty project now with two players and a seamless travel. And it still doesn't work. I have no idea what Im missing.
Gamemode is the same, controllers are the same, pawns are the same.
just a third person template with two players and the level bp triggering a seamless travel after 10 seconds
client is still kicked
and Im starting two standalone instances of the game to be clear
could it be a networking problem on my machine? Since I am at a loss here.
are you using server travel
Im just using open level. But the client has already connected before that.
is server travel only available in cpp?
seems like that is the case at least
from my understanding if the client is already connected and you run open level, it should bring clients with it
but Ive been searching like crazy so Im not sure where I even got that from
from what I recall "OpenLevel" should trigger the server travel logic
Im just gonna nuke this and start over at this point.
come back to it later
sucks to have wasted two days trying to get a lobby to work
I already have a main menu host/join button that works, but I wanted to implement a lobby between the main menu and the actual game level. But seamless travel just will not work on my machine for whatever reason.
Seeing some claim that OpenLevel does in fact not work with seamless travel. I wanted to avoid writing C++ for this project since I am just prototyping and I tend to get stuck in code when I start writing it. (Focusing too much on systems design etc) But seems like I may have to in this case?
welcome to the game
wait until something takes months...
Ive worked as a programmer in gamedev, I am plenty familiar unfortunately
I suppose I'll try to travel via C++ and see if that helps
yea part of the glory when it's solved. i dont know much about your issue so can't personally assist* but i hope for the best
has anyone tested advance steam session in 5.6?
In GetLifetimeReplicatedProps - I've never seen anyone use the TArray<FLifetimeProperty>& OutLifetimeProps param. What is this, what does it do, and when any why would anyone ever need/want to use it?
I would suggest looking at the DOREPLIFETIME macro first
I set up a minimal test example to use c++ servertravel. It still kicks the client when traveling. π«
void AMyGameModeBase::ServerTravel()
{
bUseSeamlessTravel = true;
UWorld* World = GetWorld();
if (World)
{
World->ServerTravel("Lvl_ThirdPerson1", false, true);
}
}
Literally just this in a gamemode on the cpp side and then I call it in a blueprint
absolutely cursed
Ah well, this is just killing my productivity in terms of progressing with my prototype and it isnt essential so at this point I should just give this up
hopefully I can fix it in the future since well.. travel is kinda important
So if I understand correctly: OutLifetimeProps is an array of FLifetimeProperty, and FLifetimeProperty simply tracks a UPROPERTY that is supposed to be replicated. DOREPLIFETIME simply designates a UPROPERTY variable to be replicated, meaning the macro results in the creation of an FLifetimeProperty for it, and adds that to the array. Is that right?
Hey folks, I'm working on an inventory system that has UObject item stacks which in turn have UObject item instances stored in a TArray. I'm currently setting up ReplicateSubobjects and am wondering: Can subobjects replicate their own subobjects in a cascading manner, or does the root component (in my case InventoryComponent) have to replicate all of them directly?
if an actor is replicated and the same time it is checked to be loaded on clients, will it be loaded multiple times?
If I don't run the event on the player controller as an RPC Run On Server the var doesn't carry over when executed from a client. Am I missing something obvious?
I guess I wont be able to let this one go until I figure it out. Even if I shouldnt at this point. Is there a way to figure out the true cause for a client being disconnected?
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = FailureReceived, ErrorString = Host closed the connection., Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_8
LogNet: Warning: Network Failure: GameNetDriver[FailureReceived]: Host closed the connection.
LogNet: NetworkFailure: FailureReceived, Error: 'Host closed the connection.'
...
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_8
The logs dont exactly tell me much.
I mainly meant that you shouldn't need to run TWO RPCs.
The initial one is enough. You wrote you ran another from within the first one.
through the PlayerController and using RunOnServer then calling another run on server within the desired actor to set the var
That "another run on server within the desired actor" is redundant. You already are on the Server.
holy shit I think I just fixed it
AT LAST
I CAN SERVER TRAVEL
I am the greatest programmer to have ever lived
despite my best efforts to avoid C++ I need a tiny bit of it for this
again for context I do prefer writing cpp in reality but I keep getting bogged down in things that dont help me figure out if my game idea is actually fun
Apologies, I mistook it for the controller. Yes you are right thank you for the input if I'm honest it was from reverse engineering the attached image which i got from the forums in relation to 'Commanding'a server AI so was under the impression they all needed to be
Does running an RPC for On server whilst on the server effect performance?
Don't think so. They run as normal functions basically. But you are basically adding "wrong" clutter to your code
That RPC can't even really be executed by clients either, as they won't own that actor in your scene.
yeah the forums said for the image that the client couldnt own it anyway
same principle for the spawn tile its more commanding than owning
Doe's any one have an idea on where or what I am looking for when using rep notify. I currently have a select based off a bool for bIsSelected? which changes between red/white depending if it is selected. However If I wanted the player controller that clicked the actor to have a 3rd color (Yellow) Im thinking along the lines that the player controller could just set the color locally for him?
technically "yes" but not significantly. It basically means you have to take the more bloated RPC find function, invoke path rather than just calling the function directly.
this could also result in different behaviors if you've not overrode the RPC implementation correctly. I've seen that cause some fun bugs
what do you mean exactly? What are you looking for?
@cursive herald I am trying to make a spawn tile, however theres X people that can see the tile but only one who can click to spawn there
ive got the click interaction and i believe a working ref to the player controller that clicked
this also updates a rep notify which changes color depending on if it has a ref/claimed controller or not
however with 3 or more people all seeing red tiles it wasnt clear which tile you clicked
you can only click your one to unset
but as there all red i was hoping to use something to set the color on the local controller for the one they clicked
but now im thinking i just spawn an indicator above the tile for the client only
as it seems to go aghainst the point of the rep notify to begin with...
I';m about to just give up on having host migration be a feature
thought itd be soooo nice to have but idk if its worth the trouble anymore
What i ended up doing was set up an interface for UObjects to supply their own subobjects to the root component recursively
seems to be working cherry
Is it normal for a character on a slope to have a different position on client than on server? They are just standing still.
The position is quantized when replicated, so it can differ by a small amount.
By a whole 5 centimeters?
When the character is on flat ground the values are identical
Potentially.
Because of the slope and the X and Y being different, it might just be different by that much.
Hmm. Okay. thanks.
I'm dealing with a bug where the character can get into a state where the difference keeps changing and they vibrate on the client.
server spawning an flying actor which is using projectile movement component
actor configs on constructor
FlightProjectileMovement->InitialSpeed = 15000.f;
FlightProjectileMovement->MaxSpeed = 15000.f;
and it gives different velocities
on client it gives correct, on server wrong
They are both right, in theory. You just need to ensure that they are in the right space. Both of those are 15.000 in length
Server is setting the speed for a replicated Actor, by default the actor is in a local space.
How is Mover in 5.6?
I'm planning to implement some custom movement like edge climbing at some point
Setting the velocity using multicast fixed the issue
seems like the velocity var is not replicated and setting by server only will not be sended to clients
Yeah it's not replicated. You need to replicate it through your actor.
When using the ProjectileMovementComponent you are required to implement a few functions and call some stuff on the component (like setting the interpolated component) to make it work properly
Thanks very much, its all working now π
Hello, does anyone know how to deal with net correction when walking into moving doors? I open/close it using a simple timeline that I play locally when the door state changes, so the client is only rotating the door once the server replicates the new door state making it be a little bit behind compared to server. It's annoying how much minor corrections there are, and I'd like to get rid of them, or at least smooth them out
just disable collision of the door when it is animating and enable it again when animation finished
I was thinking about it, but I feel like it's going to create other problems down the road
yes/no depending on the situation, for me its not an issue
before timeline start, disable collision and when tl finished anable it again
Does that really stop correction? Wont the client be ahead of the server and get corrected anyway since the player trying to get thru a door that isnt really opened yet in server.
I assume they want to disable it on both ends
yes it works smoothly this way
That's actually pretty difficult to solve. The door isn't at all in sync with the CMC and you might have two players using the door at the same time.
The corrections should already be somewhat smoothed. Maybe increase the smoothing distance a bit.
So like allowing the player to go through the door when its not fully opened yet?
Not suggesting anything btw, just curious on how im gonma deal with door my self later.
Disabling collision solved this issue as well, since no interaction trace will work once the door was interacted untill it finished animation
There can't be simultaneous interactions with the door. So, if it's opening, another player can't close it. It's all server authoritative. I'll try increasing the smoothing distance
yes, and not feelable since door opens quickly
That's the main concert kinda, the camera would clip into the door, and others will see people walking through the door
It's not that quick though
even if the door opens in 2sec, it still not feelable
Are you referring NetworkmaxSmoothUpdateDistance or NetworkNoSmoothUpdateDistance?
I actually already tried doing that in another game a while ago, and I personally felt it. Maybe that's just me that knows about that hack
I assumed this kind of problem always exist. I mean does any of you actually resolve correction when a player bumps into another? There's always correction on my end and changing the tolerance doesnt really help.
Perhaps its unavoidable?
If anyone have ever played stirnova, the player actually always get corrected when bumping into another player. The effect is soo noticeable.
Well, in case of something more dynamic like player walking into you it's one thing, but a door that you know that is about to start opening a certain direction is another thing. There might be a good way of working around it
True
I even thought about disabling corrections for 0.5s when there's an opening door in 50cm away from the player, but, again, it sounds like it can go very wrong
I stopped disabling correction for my end because evrytime i toggle it backγthe player snaps somewhere
If you just onrep the rotation do you get correction?
Let server be ahead
Oh, I also meant "client authoritative movement", forgot to mention it
It is ahead
Never work with a door but maybe that's what I would try
The opening is not predictive, it's completely authoritative
So the client gets teleport forward, into the door
I tried using exponential and linear smoothing, and it might be just me, but isn't linear smoothing better in this case? First is exponential, second is linear
Doors are really difficult in Singleplayer already
The problem is that the door isn't the same amount open on server and client in the same timestamp. The only way you can solve that for one specific client is by tying it to the CMC
I get that will be always de-synced to a certain degree. What do you mean by tying it to the CMC?
that's the reason I am using the old-fashoned way from quake, goldsrc, src etc. for ~~animating ~~ moving doors
Can you measure client server delay? maybe don't play animation on client from start, but rather delay / x2 delay π€ to end
You mean round trip time?
I guess, just ping time ;d
You can send a server rpc and calculate the time it takes to receive an answer.
And if you need to know approximately the time it takes from client to server, then just RTT / 2
There's a tutorial on how to do a network clock, that should give you insight
well, I was thinking if there is dedicated function ;d
Also why do you want to delay playing anim?
There's already get ping in ms
I don't, I was thinking of Tony's door problem
Knowing how to use network clock is probably useful for things like timer.
Doors are not that bad really, i mean a lot of MP games have doors
including our game, no issues with them tbh
not sure if we did anything fancy either
ah yeah we disable collisions with the interactors capsule during movement
whilst the door is opening
but not whilst closing, closing pushes the pawn
So you set them to ignore each other?
That's how it looks like when I set player to ignore the door when it's being opened by them
Yeah I assume that's expected. At least the second video.
The first one suggests you initially only did the ignoring on the server
Sorry, I forgot to label them. First one is dedicated server, I ignore on both client and server when it opens. The second one is standalone, it's there just for the sake of showing that it heavily affects it
I have a couple of questions about how structs are synced over the network when sent via RPCs:
- Let's say I have two arrays in my struct. One array is IDs, another is whatever other property. Can I rely on the array order, if sending through reliable RPC?
- If send the struct with the arrays empty, I imagine there will be at least a bit of overhead, right?
arrays will replicate with their contents ordered. or are you asking about the order in which two properties of a struct will replicate?
there would be an utterly minimal amount of overhead yeah
imo if you have two arrays that have tightly coupled data, just make an array of structs that hold both the ID and property
there can be weird cases where the whole struct doesnt replicate at once leading to those two arrays being out of sync on a client
Hi guys, kind of banging my head against a wall, I'm working in 5.0.3 which is unfortunately bugged with advanced sessions. I'm using normal steam sessions but I want to hide sessions from the 'find session' function once they are full. Unfortunately this is not exposed to blueprint with regular steam sessions, but I know exactly where to put it in my blueprints so I want to create a blueprintable C++ function that hides sessions. Unfortunately the syntax of C++ is kind of a barrier to entry to me, does anyone have any pointers e.g. forum posts covering this issue or whatnot? I'm at a very late stage in my project, I could upgrade to 5.1 but don't really want to at this stage due to potential issues.
Could you not just skip the entry when adding it to the results when it's full?
Doesn't necessarily need c++
Like, just don't add it to the UI
yeah but I dont think client can get number of players in a session
Only max num players
supposedly but doesnt return
Also would kind of be hacky solution because sessions might change while still listed, of course I can refresh the list every so often, but I have no guarantee of a timeframe for how long the list takes to generate
But it was my original plan too
you could check if the game is full before they attempt to join
and show some ui
i think regardless of sessions changing you'll have to poll them at a set interval to get updated information?
That can always happen
You can't guarantee that you won't have a session returned that will be full a second later
its same issue basically i can only access the num players of a session i am in. so currently i just eject players after they join session, but its very jarring, and if im lucky enough to get large playerbase, would be extra bad
ok
also if they join while session is travelling to map, takes like 30 seconds to join and get booted lol
Sessions are just database entries after all. If you request sessions it will return a snapshot. If someone else joins the session before you or if you spend a minute looking through the session to decide and it's full until then, then that's how it is
I know it has to do with the bShouldAdvertise bool
It makes no difference if you filter the session via the backend or when you add it to your UI in that case
And the session result returns both Max and current players
I use that in my Lobby kit after all
Current players just never seemed to work for me
i even have it displayed on a UI and it always says 1 current player no matter how many in lobby
If you don't want players to join if a session is full even though it wasn't full when they got it returned from the backend then you are deep in c++ land
Cause then you gotta use beacons to first query the session and potentially reserve the slot
What subsystem are you using?
not advanced sessions because doesn't seem to work with 5.0.3
idk actually i just followed a tutorial and i think it uses null and steam both
Steam?
It can't use both
So I assume steam then
Is it using the old implementation or the SteamSockets one?
yeah
That info should be visible via your ini changes
yeah
I don't have instructions at hand. Please look for SteamSockets plugin/NetDriver on Google to see how to change to the newer one
And see if that provides you with the right numbers
That should for example fix the 9999 ping
sure thing I'll try that, I think there maybe is a way to get advanced sessions working with another tutorial i found for 5.0.3 so I will try and follow this tutorial first (on a copy) since the ping display isn't that important to me
The ping stuff isn't important, I know. That was mainly to confirm what you are using
its fine thanks for help
have 2 options now hopefully
I just understood it so poorly i was terrified to deviate from this tutorial lol
update on this: this is 100% an ARM issue. I rebuilt the same CL on x86 and got 0% repro (vs 100% on ARM). There were no system issues on both tests. CPU/mem/bandwidth were all way below limit
whats the process to report an issue? anyone have docs?
Bug report form. Can probably Google it
thanks for the heads up, that's what I thought. I'll then probably make an array of structs instead
On the documentation for steam sockets it says I need to configure the WindowsEngine.ini file which I have done, but does this mean it won't work outside of a build packaged for windows, i.e. not in standalone?
guess i need to test lol
DefaultEngine.ini should make it work for Standalone just fine.
ah yeah i figured i had to copy paste the same into there
can't seem to join sessions though XD
If I wanted to replicate a ship using the parent of Actor landing on the ground, carrying players with it, then what would be the best approach at a high level? Isn't there a new movement component of some kind that I could use for that?
We're talking at most 4 real players in the session at once.
Is it possible to have the yaw from GetBaseAimRotation replicate to simulated proxies?
A lot of stuff is possible. If you can use C++ and the method is virtual, you can do it similar to the pitch value fwiw.
Yeah it is virtual
Heya all - do I need to be using a c++ project for Advanced sessions and steam integration to work? I've spent two days trying to figure out wtf is going on - The p2p lobby's are found, and I get a success when triggering the join function - but then nothing happens.
I've asked my question a couple of times over the course of a couple of weeks... does no one here really have any suggestions for movement replication outside of using Character / CMC?
I'm not even looking for code. Just some threads to pull on.
Is Playfab a good source for starting multiplayer in ue?
I got actor following mouse pointer.
If I send to server updated positon, will server send update also to my client (owner) ? π€
I saw Remote Specifier, but im on 5.3, would this solve my problem? :d
I want it only to replicate to server and other clients but does not to re send same position ( and avoids jitter if mouse moves), multicast sends to all
Aaaaa dummy, i can just check owner and reject update cause im using server + multicasr
But still, it would be nice If knew how to reduce unnecessary traffic
I have a Physics Based Hover Bike. It works smooth on a PIE Dedicated Server. But on a standalone Dedicated Server as soon as I posses Hover Bike the Game FPS Seems to drop suddenly Bike moves with a low FPS seems it stutters, as soon as I unposses Bike bike rest of the game works smooth but bike Moves with low FPS/Stutters idk if its a good explanation. But please do help me if you get it or please let me know if need any further explanation
what kind of architecture and system do you want to follow? I understand this is kind of client-authoritative, meaning that the client performs the movement and sends "periodic" results to the server?
PS: Bike is Placed on Server map i.e server owned. I have Disabled Simulate Physics for Clients and Enabled it for Server. When I enable it for clients Bike Mesh Detaches from Root on clients and moves invisibly but stays at same position for server.
Not sure what you would like to get as an answer for this one.
Just looking for things to research. I think there is a new movement component of some kind, and there might be better solutions
UE has a very limited set of "movement replication".
- Character Movement Component
- Client or Server Auth
- Client Prediction
- Reconciliation
- Smoothing
- Root Motion (Sources)
- Some anti-cheat stuff
- And some other minor features and QOL things
- Projectile Movement Component
- Server Auth
- Smoothing
- Clicking "Replicate Movement"
- Server Auth
- No Smoothing
- Mover
- Features kinda depend on the backend used
- Standalone/Singleplayer
- Has some multithreading stuff
- Chaos
- Pretty much WIP, no clue what the feature level is, but could at some point tie into the remaining Chaos physics sim
- NPP
- Multiplayer/Standalone/Singleplayer
- As WIP as Mover, lots of bugs, missing feature, false promises
- Does offer Client Prediction, Smoothing and Reconciliation fwiw
- Standalone/Singleplayer
- Root Motion (although I think it's not fully implemented, no matter what Epic says)
- Lacks tons of features and QOL stuff that CMC offers
- A bit more modular, but nothing that can't be achieved with the CMC
- Features kinda depend on the backend used
- GMC
- "Expensive" Marketplace Plugin
- Basically the CMC but in "better", whatever that means. I never used it and probs never will.
@crystal crag That's kinda all there is. If you are able to use C++ and you are happy with altering the Engine, or at least pulling NPP and Mover to your project level and modifying it there, try it out. Otherwise, use the CMC. It's the best you can get and will get for a while.
Or the PMC if you need some simple fake projectile or ball physics.
UE has built in Multiplayer support. PlayFab is not required and is only needed if you actively need the features they offer on top of just the multiplayer stuff of UE. And PlayFab is probably shit expensive once you actually need it to perform.
Replicated variables have the SkipOwner option.
That should exist since probably even 4.0.
Probably want to talk to @dark edge . They did some hover car stuff before. FPS shouldn't drop though. If you actually get FPS drops then you might need to do some #profiling . I assume, however, that you aren't getting FPS drops, but the vehicle is just desyncing. You are probably not testing with latency in the editor.
yes by FPS drop i mean vehicle was stuttering
No, C++ is not needed if you use that plugin. In theory even without the plugin you don't need it. You would just be lacking all the little extra settings it exposes on the XYZ Session nodes.
Ah, bummer. I was hoping the new mover was just not efficient, but would move the flying ship on a predefined path from point a to b
@dark edge can you please help out? I will upload a video of problem on yt and share it here if you ask
I am ok with C++.
I want to have the players load into the ship and then the ship will land, carrying them with it as it does
Mover doesn't fix that. Mover with NPP (not sure about the future with Chaos) doesn't really support communication between 2 Mover Components. The way NPP works will cause out of band updates to either Component. It works somewhat if you have a platform, but for that simple platform that CMC can also support, you would be trading years of battle testing and features.
People have done ships that players can stand on before.
I could never get the players to be able to stand on the ship when it was a player. It's a fully closed off ship with a door
That's basically based movement, which the CMC should support.
The characters just keep skipping if I force them on it, bouncing around. That was with the ship just statically on the ground and not moving
If the ship was absolutely static, then that shouldn't happen.
Maybe you had collision around the whole ship and it was fighting with the capsule
Can't really say what it could be of course. Have no clue about your project.
I started off by just trying to make a rectangle - 6 boxes to make a "ship" and each had collision
But that was required to not let the players walk right out of the ship by walking through the walls
In this exact case its pure cosmetic display. When player moves it just moves preview actor and when its decided, location it will be checked on server but now I just want to send transformation to update actor location π€
I replicate actor location.
@dark edge here's the link of video of problem. Stutter is lot worse on a packaged shipping build. Bike is already placed on server map so its owned by server. I'm enabling Simulate Physics for Bike Mesh on Server and disabling it for clients
Does the built in support have cross platform ability between PC and Xbox?
anyone can explain to me what moverblackboard does
i see them everywhere being used in layeredmoves and movement effects
MoverBlackboard: this is a simple generic map that can store any type, used as a way for decoupled systems to
* store calculations or transient state data that isn't necessary to reconstitute the movement simulation.
* It has support for invalidation, which could occur, for example, when a rollback is triggered.
* Values submitted are copy-in, copy-out.
* Unlike a traditional blackboard pattern, there is no support for subscribing to changes.
* TODO: expand invalidation rules attached to BBObjs, for instance if we wanted some to invalidate upon rollback. Some might expire over time or after a number of simulation frames. Or an item could be tagged with a predicted sim frame #, and become cleared once that frame is finalized/confirmed.
from the class comment, it seems to only being used to store temporary data?
EOS does
What you're asking isn't really engine specific
In my multiplayer lobby, the correct loadout was set for each playerstate. But seamless travel into game level somehow resets the TArray values in playerstate. The game mode in both levels use the same player state. Any clue as to why it happens?
PlayerStates are Actors, they are recreated when a new Level is loaded.
If you have information in them you want to retain across level transitions, you need to set that up in the appropriate function as an override.
You can do this by overriding void APlayerState::CopyProperties(APlayerState* PlayerState)
thankyou! i thought seamless travel would preserve playerstate and playercontroller by default, including all member variable data
Very few Actors are retained, PlayerState is one of them, however it is still recreated.
CopyProperties is passed the old PlayerState as the input param.
Which is what enables you to retain the data you want to keep.
If you inspect the engines version of this functions implementation, you will see what I mean.
thanks for the explanation! I really appreciate it
Depends on what part. The actual connection and multiplayer part, yes. The online subsystem would require you to use EOS, which is free.
Neither handle server hosting for you though. So if you plan to have dedicated servers hosted for players then that would be extra. That's also freaking expensive fwiw
My unreal app
stops after a while
the Gladiators.sh
After a while like 1 h
Is that something of unreal
that could be of unreal ?
Or google cloud any idea I want it 24/7
Please help
24 h everyfsy server please
for the ppl
Any help good practice or whatever
??
this is the server
No idea why it would stop after an hour. You'd need to check the logs of the cloud server and the UE server.
I can tell you, however, that you'll need to restart that server eventually, preferably once a day. There are counters in the code that otherwise count too high and run out of precision.
Also, you aren't by any chance running the project or the client as a ListenServer in the cloud, or?
You are supposed to build a Dedicated Server for that.
Which then doesn't need the ?listen and nullrhi parts.
Ok restart each day
Dedicated Linux server
No listen as it does not fit our needs
I just discovered the network physics component, as I've been working on a project revolving around space flight. When do you use this component? Does it interact with the movement component? Is there more information on it? I've been looking through google and it seems pretty sparse. My next step is to ask an LLM about it :x
The first hit on google:
https://vorixo.github.io/devtricks/phys-prediction-use/
Seems pretty good and informative. I was just hoping to go back and forth with someone about it
@dark edge Just pinging you since we were talking about very relevant stuff the other day
The LLMs won't know a thing about it right now
From what I can see, the network physics component is used for the 2 new physics replication techniques. Dunno much about them though
how has physics replication been for you in your projects? I watched that youtube video you made, but it didn't do anything regarding collisions (or multiplayer?)
Works great, but I am not doing any prediction whatsoever
the sim runs the "same" on all machines, and the drift between client and server is fixed up by the old physics replication system
Hello all...
I have downloaded the 5.6 version, opened the base project. But when wants to do a multiplayer test as I normally did in the earlier version, both screens looses the mouse look, or 1 screen have and 2 screen lose the mouse look - Or not show any players, or the players navigation totally freshes what is up with all this? I also converted a 5.5 project to 5.6, and same story?
Update:
Disabled Physics Substepping and disbled spring arm's camera lag. The movement has got alot better but still theres noticeable rough movement
It's probably frame rate
your server is probably defaulting to 30
and your math that cooks up the forces probably is not quite formulated right to not blow up
Framerate for other vehicles on server is smooth as if they are at 60
When I unposses the hover it hover's back to ground a mechanism I have implemented. And its visible I can see Bike's mesh only moves with low fps everything else on server has smooth movements. probably your right theres something I need to check in maths ig
is the mesh component on the bike replicated?
it should not be
maybe that's the difference
yes its replicated, and if I uncheck replicate mesh. I simply cannot move bike as for movement I'm Setting Physics Linear Velocity.
using Server->Multicast RPC for MoveForward/backward Logic
show code
you shouldn't use multicasts to add force though, use them to set values (or replicate) which are used on tick to add force
This is the general form which works great for my project.
Input -> RPC
RPC -> set replicated variable
Tick -> use replicated variable to calculate force
Actor replicates, actor movement is replicated, component is NOT replicated (since component replication clobbers the actor movement replication)
let me try this
that's because component replication naively just directly sets position and rotation, it sucks
it bypasses all the physics replication stuff
or rather, fights it
got it, thanks!
Protip I learned from eXi, put a draw debug box somewhere on tick and have it draw one color for authority and another for non-authority. Then you can see what the server is doing at the same time
it'll work in PIE, you'll see both boxes
got you thanks for this It will be a lot helpful
When using a breakpoint on an actor in visual studio how can I find the current NetMode?
hey i was checking the doc about RPCs and i saw that there is a new type of RPC since 5.5 that is Remote and i was wondering what is it used for. I can't find the usecase of this:
Here's the description of the Remote RPC
The RPC is executed on the remote side of the connection.
The remote side of the connection can be either the server or the client, but the RPC must be called on an actor that is owned by a client. The RPC behaves like both a Client and a Server RPC, but is never executed on the local side of the connection, only the remote side.
It sounds like if the server call the rpc, the client will execute the function.
And vice versa.
Why dont you test it.
@dark parcel It behaves like a Server or Client RPC depending on who calls it.
And on top of that it won't run on the local machine. E.g. if you run a Server RPC on a Server owned actor, it will run locally. But the Remote one won't. It only works if there is a logical option to call on the "other side", aka remote.
I don't have an example for a use case though
Hi, i'm using copyproperties() override to transfer data from old playerstate to new playerstate during seamless travel in cpp. I get this weird result where one client gets all the correct values transferred but the other client gets the wrong values (value of old playerstate is wrong). Is there a thing where unreal matches the wrong oldplayerstate to the new one during seamless travel handoff?
It is highly highly unlikely to be an issue with Unreal.
Its more going to be the case that you have done something wrong unintentionally.
oh ok thanks! I'll double check again
Its also a good idea when asking for help, to be as specific as possible, providing detailed reference to your issue.
The more information you provide, the easier it is for people to help you resolve your problem
ok, i'll try to rephrase the problem
Setup:
Multiplayer dedicated server 1v1 simulated with PIE standalone 2 players.
- Transition map not set.
- Launch separate server ON
- Run on single process OFF
Goal:
Transfer TArray<FPieceLoadoutEntry> in APS_ChessPlayer (player state) from lobby level to game level through seamless travel.
Observations:
- Both Lobby game mode and Game Level game mode uses the same playerstate
- Starting Match and Taskforce Setup both have delays to avoid race conditions
- CopyProperties() override is implemented for transferrring custom variable data
- PlayerState Constructor and Beginplay() called before CopyProperties()
Problem:
One client gets the correct Loadout values, the other did not
What about the Header?
Is it meant to be not replicated?
How are you filling it with data?
PlayerStatePieceLoadout i mean.
maybe it eventually should, but for now i didn't bother replicating it because i'm trying to move server-sided playerstate data from one level to server-sided playerstate in another level through seamless travel.
this should be the part that moves data from old loadout to new loadout
this is the code on PC_Lobby(controller) that moves data from local game instance to multiplayer lobby player state. The debug prints are all correct values
i just added more logs and found that old playerstate and new playersate have same unique ID, so UE should be matching the player states correctly. I guess somewhere in my code the values got reset somehow, and for some reason only 1 of the 2 clients got reset
i want to ask, if i want to ask sprinting with mover, i first need to make a custom FCharacterDefaultInputs right to delcare variable like bWantTo Sprint similiar to cmc and then make either a sprinting layeredmove that while active change the current speed/max speed to 1000 for example and have a transition that checking is movingonground and out inputcmd wanttosprint right
if now how would you implement sprinting
im thinking my InputAction just calling the bool by setting it to true and then on tick, it will check the bool on simulationtick? (viewing this from moverexamples where they registered custom input n blueprint by binding to mover OnPreSimulationTick and on tick, have a handlesprinting function equivalent that call queuelayeredmoved?
also referring this repo https://github.com/daftsoftware/DaftMover/tree/main/Source/Private/LayeredMoves on how their implementing crouching
I understood the purpose of it, i just couldn't find a use case
Ok ok thats what i was thinking as well i can't find any use case for the moment
found the problem: get player state index 0 targets the same player each time, replace it with self->get player state
Hey - this is my repo, donβt use it as a guide for how to do crouching, it was made before a time when mover had a good way to do this
ah bummer
infact iβd say outright donβt use it as a guide for how mover works at all, the api changed very significantly
i see
probably youβre better off looking at the MoverExamples plugin that comes in the engine
currently im thinking of implementing sprinting as an instantmovementeffect, trying rn to get the commonsharedsetting and setting the get maxspeed with the instanteffectmultiplier
yep that what im doing rn
and this is my instantmovementeffect:
#include "CustomLayeredMoves.h"
#include "MoverComponent.h"
#include "DefaultMovementSet/Settings/CommonLegacyMovementSettings.h"
#include "MoverDataModelTypes.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(CustomLayeredMoves)
FKhaiInstantMovementEffect_Sprint::FKhaiInstantMovementEffect_Sprint()
{
}
bool FKhaiInstantMovementEffect_Sprint::ApplyMovementEffect(FApplyMovementEffectParams& ApplyEffectParams, FMoverSyncState& OutputState)
{
FMoverDefaultSyncState& OutputSyncState = OutputState.SyncStateCollection.FindOrAddMutableDataByType<FMoverDefaultSyncState>();
if (const FMoverDefaultSyncState* StartingSyncState = ApplyEffectParams.StartState->SyncState.SyncStateCollection.FindDataByType<FMoverDefaultSyncState>())
{
if (UCommonLegacyMovementSettings* LegacySettings = ApplyEffectParams.MoverComp->FindSharedSettings_Mutable<UCommonLegacyMovementSettings>())
{
LegacySettings->MaxSpeed = LegacySettings->MaxSpeed * SpeedMultiplier;
}
return true;
}
return false;
}
FInstantMovementEffect* FKhaiInstantMovementEffect_Sprint::Clone() const
{
FKhaiInstantMovementEffect_Sprint* CopyPtr = new FKhaiInstantMovementEffect_Sprint(*this);
return CopyPtr;
}
void FKhaiInstantMovementEffect_Sprint::NetSerialize(FArchive& Ar)
{
Super::NetSerialize(Ar);
Ar << SpeedMultiplier;
}
UScriptStruct* FKhaiInstantMovementEffect_Sprint::GetScriptStruct() const
{
return FKhaiInstantMovementEffect_Sprint::StaticStruct();
}
FString FKhaiInstantMovementEffect_Sprint::ToSimpleString() const
{
return FString::Printf(TEXT("Sprint"));
}
void FKhaiInstantMovementEffect_Sprint::AddReferencedObjects(FReferenceCollector& Collector)
{
Super::AddReferencedObjects(Collector);
}
#pragma once
#include "CoreMinimal.h"
#include "InstantMovementEffect.h"
#include "CustomLayeredMoves.generated.h"
USTRUCT(BlueprintType)
struct KAIGAME_API FKhaiInstantMovementEffect_Sprint : public FInstantMovementEffect
{
GENERATED_BODY()
FKhaiInstantMovementEffect_Sprint();
UPROPERTY(BlueprintReadWrite)
float SpeedMultiplier = 0.0f;
virtual bool ApplyMovementEffect(FApplyMovementEffectParams& ApplyEffectParams, FMoverSyncState& OutputState) override;
virtual FInstantMovementEffect* Clone() const override;
virtual void NetSerialize(FArchive& Ar) override;
virtual UScriptStruct* GetScriptStruct() const override;
virtual FString ToSimpleString() const override;
virtual void AddReferencedObjects(class FReferenceCollector& Collector) override;
};
and i just followed the example on how they registered it
in onproduceinput i just add it to collection to the input command like this
then on presimulationtick, registered it and call handle sprinting event
which currently does this
its activating but doesnt work yet
WIP
πͺ
this works as sprinting but trying to consolidate it in one movementeffect
tested it on 400 pkt lag and got no corrections so far
i probably should do is as a movementmode lol
and just transition it
because at its core im just finding the maxspeed and set it to maxspeed * multiplier
How should I handle spawning a bullet on a client
and then spawning on on the server
and handle the hit detection on the client
because the bullet is spawned on the client
Its not the same actor as the one on the server
Is there any way to make the client actor "point" to the server one
or something like that
I could just add code on the player character to handle the server damage logic when the client bullet hits
its a coop game so cheating is not an issue
so server rollback hitboxes would'nt be worth it
Running a separate dedicated server in PIE doesn't set the UE_SERVER macro? Is the best way to actually debug dedicated servers to try to launch a debuggame server instance of the project in a separate vs instance?
using project launcher now, the steam audio plugin of all things causes an error for a missing package (a material darn it this isn't client side code why is a material missing causing an error)
(ok in fairness, the steam audio material isn't the same as a shader material, im guessing the steam audio plugin somehow didnt get packaged by the book)
Hey guys I'm missing something from my script and I can't quite figure it out. I want these materials to be seen the same by everyone. Here is what is currently happening and my script.
Would it be something like Spawn --> Set material ---> THEN send to everyone?
Yeah, if I understand your nodes correctly then what is essentially happening is that every player is selecting a random colour regardless of what the server is saying
If you want them to be the same, then treat the server as the authority and randomise them there
Then send the result back to the client
You could just send the number that came up (make sure to store the random value and then use the local as each call of the random node will give a new random number not just each new random node)
What might be happening as well is that the server is replicating the results, and then the client is overriding it when it receives the multicast
Hope that helps π
It does! Thank you. Just need to figure out how to do it. But one thing that's interesting that you said
When I have a tile already spawned in the level, its materials start blinking and changing rapidly.
Is that what you're talking about?
Or is that a separate issue?
Potentially, where else are you calling the randomise material?
How frequent does it blink and change? Does it only flip to one and then another?
Master hex tile and all 6 hexes are children of the master
If you send a video, I'll be able to help a bit more
This only happens to tiles that are placed in the level, not spawned after play
Stupid questions but need to be asked:
- Are there overlapping tiles and this is z fighting?
- Can tiles call the randomise function on it's neighbours?
I noticed that the tile by itself doesn't seem to have this problem
Don't use multicast for stateful behavior btw
Does it happen with the listen server by itself? Or does it only happen with clients involved
that certainly looked like another mesh overlapping another mesh
probably mistake on the spawning part, you may possibly spawn multiple of it.
e.g spawning in the client but also spawning in the server which replicate to client so you end up with 2.
You should practice outside your tiles.
Just make a box that takes a random color. Have server decide the random number and assign the material.
Client simply OnRep the material variable and apply it.
I just realized. For some reason, when I place the map tile in the world then hit the play button, it does in fact duplicate the hex meshes
When I spawn in game, it doesn't duplicate anything and is fine
So in this case, would I place the Var and rep notify when I set the material in my custom event or would I need to rearrange?
As in move the custom event logic to beginplay etc.
Hey, my friend has issue with Animations on dedicated server.
It can't detect collision due animation not playing. Characters are always in TPose, is there solution to that? :d
repnotify the random int
BeginPlay -> authority? -> set ReplicatedRandomInt
OnRep_ReplicatedRandomInt -> switch -> do whatever (I'd use select instead of switch)
If I have a repnotify variable on an actor that I am using to set the color of a mesh on the server to act as an indicator for when it has been clicked (URL below).
As there is multiple of these in the level it can get easily confusing figuring out which one you selected amongst the rest. Is there a way or what way would you recommend for setting a different color for the player that clicked (e.g. yellow) The following URL is the blueprint on rep function. I cant currently seem to override the color as set by the server on an event in the player controller after its been selected
https://blueprintue.com/blueprint/xg8yss9p/
In Summary I want to show an actor as white for non selected and red for selected which everyone else will see. This i currently have working however ideally id like yellow to show for the player who did interact /click
instead of bIsSelected, try a Whatever* PlayerSelectedBy
then you have 3 states, either its void (not selected), equal to the local player (make it yellow), or not equal to the local player (make it red)
@dark edge I get the enum and having the 3 options however as the actor is on the server and even if i pass it a select using multiple options within an enum im still not getting a different color for the controller and this would be for all not the individual? So on the below they all appear as yellow.
So only the interacting controller should see yellow for the cube they selected but all others should see it as red. So whilst the above is correct for others the controller that selected should have yellow. so if player 1 selects actor 1 then 2 and 3 should be red but if player 2 selects actor 2 then actors 1 and 3 should be red
I have a line trace that gets the end locaiton. I then have a projectile fire at that location. It works on the firing client but not the other client. It fires but in a random direction I have it set to fire on a multicast. Is there something I should hcange?
@latent nest are you setting its forward vector in addition to the location?
Sry Im still learning and misread your first post
No your good, im still learning too lmao
And you are doing all of this on the server?
Cause you can't change replicated variables locally after all
@thin stratus unfortunatley atm as its the only way I understood of being able to do this
im not changing a replicated variable however i am using that variable to set the color
its almost as if i need another event within the function to run on that specific controller but i could be very wrong
not an enum
a player reference (playerstate, pawn, whatever)
something that denotes which player has it highlighted, either none, the local one, or a different one (from the perspective of each machine)
if a cube says Adriel is the selector then Smartay's computer would see it and see that Adriel (the ref) != Smartay (the local player) so make it red
My computer would see that Adriel (the ref) = Adriel (the local player) and make it yellow
@dark edge I do have a selected player controller variable but I cant see how it can go from being on the server setting its color to changing it to yellow for the controller reference from your reply so far Unless its not even in the rep notify function?. Appologies
other people's Playercontroller doesn't exist on your machine
use PlayerState or Pawn
and check if it's a local playerstate or locally controlled pawn
@dark edge this doesnt run on a local machine it runs on the server
so there isnt a local anything
this is for local highlighting
you want to know if the local player is what's highlighting the thing vs another player, right?
not entirely. I want the local tto have a different color so they can identify there selection
yes
what I've been laying out here will do that
you care if the replicated repnotify variable in the actor is void, the local player, or some other player
Then apologies as I dont understand as its currently written
if void, not hightlighted. If local player, it's red. If other player, it's yellow
Read this again
#multiplayer message
I have a number a of times and from my understanding this still isnt lining up with what im trying to say so maybe im not explaining myself correctly
instead of replicating a boolean bIsHighlighted, you replicate WHO is highlighting it
then on each machine, you can check if WhoeverIsHighlightingIt is the local player or not
That I understand, thank you and apologies
you can't use a PlayerController since that doesn't replicate to other machines, you need to use a pawn ref and check if locally controlled, or a playerstate ref and do whatever the equivelent is to check if it's the local players playerstate
it will have to be a playerstate for me and my situation but thats great thank you
@dark edge would you have 2 mins for a voice call as I have a question and it may just be for me and sanity to just make sure but am also hoping i can skip any confusion on my end this way to
if not then thank you for your help anyway (It just for me this method still is same color regardless of if the interacting or not after switching)
You should share your code tbh
This is just guess work at this point
What you want to do is relatively simple, so you must be doing something wrong somewhere which we can't see without you sharing all involved code in this setup
can happily share project if easier
I didnt get the chance to update the event names whilst testing
easiest explanation for something similar would be as a replicated spawn tile
You are way overcomplicating this.
??? -> make sure you're on server -> set InteractingPlayerState (replicated, repnotify)
Onrep_InteractingPlayerState -> do stuff
@dark edge I have to go, but will try after thank you for the reply
Need Help: ActorChannelFailure 5 on Dedicated Server Spawn
Hi everyone, Iβm testing a mobile game using a dedicated server setup. Here's how Iβm running my testing:
- The server is packaged and running on Windows.
- The client runs in the Editor (Standalone mode, two Editor instances).
- Players successfully connect and trigger OnPostLogin correctly.
- The issue happens right after the GameMode tries to spawn the player character.
Does anyone know what causes ActorChannelFailure 5 during spawn on dedicated servers? Could this be due to replication issues or asset loading problems on the server side?
Thanks in advance!
Editor only data?