#multiplayer
1 messages ยท Page 143 of 1
Doesn't mean it can't be used though?
its meant for split screen
If it's not a split screen game the index is always 0
could u offer one then in this case :/=?
I'm aware, this does least modifications to his code though
The widget should already have a reference to the player controller
So you get that and then get the controlled pawn
Something like Get Owning Player or w/e
as long as the widget was setup properly yes
And if it wasn't - go back and do that.
well my parent widget dose never get created so how can i get that then
Yeah it does. It's not like widgets just come out of thin air.
Somehow, somewhere, you are telling Unreal to construct it
well im guessing its being created when the first child of that parent is created somewhere
Your child widget IS the parent, plus extras
Make sure to plug the player controller to the Owning Player pin when creating the widget
Yes that would avoid it
You don't need to create a refrence variable for the controller as that node already provides a reference
true
Unless you want to keep the casted reference though
This one did the job just fine
wehen im creating the widget its on an event "owning player" so it should give the right owning player right ?
You already got a controller reference in the Start event, you can pass that to Owning Player
yes
or get a reference to "self", that will also do.
sign now i broke it even more
Can you show the widget again
Do the same thing on this with the delay
Possessing takes more than a frame apparently
Ideal way would be to use a notify to fire when it has done possessing but this will do for now
you shouldnt be constructing UI from an RPC though
you have many places where you can construct the UI locally
without needing an RPC
wait isn't it done locally here?
this is an RPC
Oh here, this event doesnt need to be replicated
Would it be better to call it as a seperate event from the RPC?
the HUD should just be constructed, regardless, server doesnt need to tell the client to create the HUD
thats why its so weird
make a AHUD class, set it, and create your widgets inside it.
this way its all local
aye im using custom widgets only
yeah i mean but your taling about the one in the game mode right ?
Never heard of AHUD, what's it exactly?
its a local only actor
that controls HUD elements
you can use its beginplay to create your widgets, knowing they are all local
(as widgets are not replicated)
ok how would i do that
just create the parent one in begin play on controller right ?
oh it's the C++ parent of the HUD I see
make a new actor derived from HUD
new Blueprint*
set it in the gamemode
open it up, and on its beginplay, create your HUD widget, passing in Get Owning Player
yeah saw that
ofc there is also additional setup if you require the player character to be set locally
What advantage does using HUD gives? is it like a best-practice thing or?
Asking because I never had to use it, if I'm missing something I want to know
its to make sure all your widgets are local only
where they should be
its a simple way to do, i have a more advanced way which involves delegates, callbacks, etc so i can avoid the need to poll for certain things (widgets are created when things are ready)
hm okey
but this requires C++
ok but for the sake of solving my issue
is it not solved already? what went wrong
i have no clue whats wrong apart from i saw a bunch of errors
likely cause player is not ready when widget created, etc
so it works? but you have errors? Then you need to check if variables are valid before using them
they need to do some polling to make sure stuff is valid
no aint working at all :/ not on standard either
What's the issue
i dont know >.>
What is not working as expected?
yeah im looking trying to find where the issue is
ok
the player character is set from this
wicth is created from this
can u se what causing it :/?
@dire cradle@meager spade
The ServerTravel method wants a URL as an FString. The Open Level method takes a World object pointer. How do I convert World Object Pointer to URL?
I don't want to manually type in strings that is awful
I just want to drop a reference to the level and code it to convert to the URL
But I can't figure out a way to do so 
perhaps this
testing
check your binds in widgets
those run on tick
possibly there are bind functions that try to access your variables before they're properly set
hmm i have to sleep on this im just digging a bigger hole
ty for help ill probabaly pm u 2morrow .;)
This worked. The split is needed to remove extension 
There was a good discussion around server migration back in 2022: #multiplayer message
It seemingly ended with the OP going on to do some research and it doesn't look like they ever got back with their findings. We're attempting something very similar: namely we want to pack servers at opportune times both as a means to save server cost but also improve the player experience (more players on a server = more immersion) and we want to do this in a way where the player doesn't know it's happening (meaning we don't take control away from them...ever).
We're to a point where we've got a Sea of Thieves like experience (no loading screen) with a small pop as replicated actors are respawned. We did this by NOT creating a new UWorld at the time of performing a hard travel and while there are obviously a lot of things to consider with this approach, the key was an overridden implementation of UEngine::LoadMap.
Assuming the implementation details of how/when the back-end decides to do a server migration can be abstracted away, I'm curious as to whether anyone has been able to bend Unreal to do a Destiny/Division style of server migration when traveling to/from the same map yet? Any thoughts would be much appreciated.
~~Something that just came to me, Lego Fortnite just dropped not too long ago and I'd be shocked if it's not using some kind of seamless server migration under the covers especially since I'm assuming their servers are long-lived.~~Just fired up Lego Fortnite for the first time, looks like the worlds are client hosted (listen server). The large map size isn't an issue since UE5 uses streaming via world partition. In other words, Lego Fortnite doesn't necessitate truly seamless server migration and therefore Epic / Unreal Engine still doesn't either ๐ฆ
I don't think what you have is a great solution - in order for it to work correctly the level has to already be loaded into memory.
If you use the below conversion, then it's reading the path from the soft reference and not needing to have the asset loaded.
Hey all, so I'm wondering if someone can help me with this issue im having. So basically the player has a default spawn weapon to spawn with and so it works when a client is looking at another client, the client can clearly see the other player's 3rd person mesh is holding a weapon. However when the Listen Server joins , which is pretty immediate, I believe what is happening is that the current weapon isn't updated so it causes an out of sync moment and the client views the Listen Server as not holding a weapon. When in fact it should. Here is relavent code for when we join the server.
void AFPSMMOGameModeBase::RestartPlayer(AController* NewPlayer)
{
if (NewPlayer && HasAuthority())
{
APlayerInfoState* PlayerInfoState = NewPlayer->GetPlayerState<APlayerInfoState>();
if (PlayerInfoState) {
FVector SpawnLocation = DetermineRespawnLocation(PlayerInfoState->TeamId);
FActorSpawnParameters SpawnParameters;
SpawnParameters.Owner = NewPlayer;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
AFPSCharacter* NewCharacter = GetWorld()->SpawnActor<AFPSCharacter>(BP_PlayerClass, SpawnLocation, FRotator(0.0f), SpawnParameters);
if (NewCharacter)
{
NewPlayer->Possess(NewCharacter);
NewCharacter->OnPlayerReady.AddDynamic(this, &AFPSMMOGameModeBase::OnPlayerReadyForInitialization);
NewCharacter->PrepareForInitialization();
//i also tried a lambda function , 1 second didnt work and what if i have multiple players, i need to delay this until all players connect???
FTimerHandle TimerHandle;
GetWorld()->GetTimerManager().SetTimer(TimerHandle, [NewCharacter]() {
NewCharacter->PrepareForInitialization();
}, 1.0f, false);
}
}
return;
}
Super::RestartPlayer(NewPlayer);
}```
this is driving my mind bonkers because its very inconsistent. sometimes the listen server has a weapon, sometimes it doesnt. If more information is needed please lmk.
EDIT: It also works flawlessly when I debug the process and set break points, so i believe it is a replication timing issue.
Here is some more relavent code showing what does what, so NewCharacter->PrepareForInitialization(); calls OnPlayerReady.Broadcast(this)
which calls this.
{
if (NewCharacter && !NewCharacter->GetCurrentWeapon() && NewCharacter->SpawningWeapon) {
AWeapon* Weapon = GetWorld()->SpawnActor<AWeapon>(NewCharacter->SpawningWeapon);
Weapon->SetActorLocation(NewCharacter->GetActorLocation());
Weapon->SetOwner(NewCharacter);
NewCharacter->EquipWeapon(Weapon);
Weapon->SetPickUp(true);
}
}```
```void AFPSCharacter::EquipWeapon(AWeapon* WeaponToEquip)
{
if (WeaponToEquip != nullptr && HasAuthority()) {
if (WeaponToEquip->GetSpawnPoint())
{
WeaponToEquip->GetSpawnPoint()->OnWeaponPickedUp();
}
// If we have less than 2 weapons, just add the new weapon to the array
if (EquippedWeapons.Num() < 2)
{
EquippedWeapons.Add(WeaponToEquip);
}
else
{
// We already have two weapons. Drop the current one and replace it with the new one.
int32 CurrentWeaponIndex = EquippedWeapons.IndexOfByKey(CurrentWeapon);
//if we already have 2 weapons we drop the current weapon.
if (HasAuthority()) {
DropWeapon(CurrentWeapon);
}
else
{
ServerDropWeapon(CurrentWeapon);
}
// Replace the current weapon in the array with the new weapon
EquippedWeapons[CurrentWeaponIndex] = WeaponToEquip;
}
//previous weapon is now the current weapon and the current weapon is the new weapon we are trying to equip.
PreviousWeapon = CurrentWeapon;
UseWeapon(WeaponToEquip);
OnWeaponEquipped(WeaponToEquip);
}
}```
@sinful tree ๐
for my rts game, where should i keep all my functions to spawn / destroy buildings?
you could make a building manager to manage destruction creation etc
i have a building component on the player controller would that work?
or should i use game mode for it?
atm the player controller chooses the building they want to place, it spawns one locally as a "ghost" to set position, then when they place it im calling a server function on the player controller to spawn it and destroy the local actor. That starts a timer for "constructing" and once thats done i want to destroy the constructing bp and spawn the actual building bp, just not sure where to put that last little bit from swapping from constructing to the actual building
the construction bp wont be able to call a server function itself can it?
@hollow swallow player controller doesn't exist on sim proxy so the other players won't see it. Game state exists on all but of course it's not tied to a specific player. Player state exists on all and tied to a specific player and will persist after disconnection for 5 minutes so probably the right place
Thankyou, I think gamestate should work fine then as the player just places it, and then the server does the rest, all i need to pass through is the owning player controller and thats it then it just sits there forever
That should make saving and loading easier yeah if its on gamestate? (ive never made a save system before))
Well game state won't disappear when a player disconnects so it could be correct dependent on your needs. You can always pass a player state to tie it to a player
Hey guys, Do ClientTravel requires a map reload on clientside?
Can i just reload replicated objects?
I want it to be seamless, i have already the code to transfer user data from one server to another on dedicated server
But on client side do i need a full map reload if i don`t plan to change player position?
Do i need to edit engine source for that?
Any know anything about the PlayerState being invalid on seamless travel?
@sweet sage would need to edit the source. Doubt there is much info on what and how.
Connecting to a server is a hard travel by default
Do you think throne and liberty has custom netcode?
I will try to edit that but the code is hard, ty
"Yes, Throne and Liberty does have a phasing system in place. This system manages the number of players actively experiencing the same area in the open world to ensure smooth performance and prevent overcrowding. Here's how it works:
Multiple phases: The same area exists in multiple "phases," essentially copies of the world with overlapping boundaries. Players are automatically assigned to a phase based on various factors like location, party composition, and server load.
Seamless phasing: When you move between phases, the transition is designed to be seamless and undetectable. You might briefly see other players teleport or disappear as you cross phase boundaries, but the overall experience should be smooth and uninterrupted.
"
This is what i plan to do
No idea
But I see you found your answers
Yes, NCSoft has a custom net code that they reuse frequently. It's probably the same one they used for Blade and Soul and Lineage.
The macro's function is described in a comment.
I have a question. Does PlayerState spawn in the server first, for example in this 2 players - Listen Server game, would it spawn 2 Player State in the server, then replicate down? Or it would spawn 2 Player State, 1 for the real player in client side, and 1 for the real player in server side? Then spawn the other 2? What's the order?
Or maybe the game spawn all 4 at once?
I have another question, what is the equivalent function of IsLocalController() on the PlayerState? Because in BeginPlay of PlayerState on the client side, PlayerController is not available yet, i can't call IsLocalController. Was i suppose not to call it?
I don't think there is. For each player there is a player state on their local machine and a copy on the server. Other players don't have access to everyone else's state
I'm not sure but the IsServer node might work in playerstate and be what you're looking for
Nevermind I was thinking of player controller, there is a copy for each on every client
I see, then i will do better
Bump??
yep, you mistaken there
Is there overhead for using push model with a replicated property that is changed every tick? Or just no reason to since it's always changing?
I have two clients: Control Panel and Screen
The control panel is a widget/menu where I can trigger what happens on Screen.
However, widgets do not replicate and are client-specific I believe? So when I press a button (widget) on the Control Panel-client, how can I ensure it only executes on Screen-client?
do I need to tie this up to player controller? I'm curently differentiating the camera on each client by using the Character. However it's just 2x spawn of the same character (not sure how to make player/client 1 spawn CharacterA and player/client2 spawn CharacterB)
i know nothing on networking so looking through a few videos to get a grasp of how this ties together. would appreciate if there's any recommendations for specific guides/documentation/videos. There's no actual playing here, only a Control Panel (Client #1) that executes events on Client #2
Ok got it working by: Widget gets player controller(1), cast to PlayerController -> call event
player controller executes Play Sequence. Now it successfully only happens on the Screen
@dire cradlehey m 8 u there ?
#level-design message so atm i have to send an rpc from server to client every instance of the instanced static mesh component so there clearly must be a better solution, add to data about the instance to some array, replicate all data with all instanced static meshes to the client with one big rpc ?
In my new to Unreal c++ adventure, today I learned that you need to DOREPLIFETIME onrep properties ๐ no idea why I had in my head only regular replicated properties needed that...
Hi. Does anyone know a good MP performance solution for SetActorRotation in top down game scenario? SetActorRotation is happening in a timer by following cursor. Due to additonal WASD movement not using controller set rotation, even though it's nicely replicated.
just macro overhead; but if its being dirtied every tick, probably that one prop isn't a good candidate for push model, since it will need to be marked always to be checked-against (legacy)
maybe this helps? https://vorixo.github.io/devtricks/data-stream/
Actors persisted during Server Travel (with SeamlessTravelActorList), are they serialized/deserialized or anything like this? 
https://cedric-neukirchen.net/docs/multiplayer-compendium/traveling-in-multiplayer/ this doesn't really detail it
Non-/Seamless Travel
Nor do the proper docs
they're not serialized, they just get moved to the new world
which involves notifying them that they're being moved, then "renaming" them (which changes their outer to the new world).
You can see exactly what happens in FSeamlessTravelHandler::Tick
The bulk of it is in the ProcessActor lambda and iteration over the ActuallyKeptActors array further down.
interesting
Do UObjects with a Kept Actor as their Outer also get persisted?
Something ain't making it over
Hmm yeah that seems to be the issue
UObjects attached to my Actor all poof

As expected Google is utterly useless at answering this 
How do I persist the UObjects for which my Kept Actor is Outer?
- called on server during seamless level transitions to get the list of Actors that should be moved into the new level
- PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list
- (i.e. Object.Outer == Actor in the list)
- are all automatically moved regardless of whether they're included here
Comment on GetSeamlessTravelActorList suggests that UObjects should persist with their Outer
but mine are not
persisted actors call begin play again
They shouldn't, it means they are not persisting
Maybe gamemode is calling StartPlay again
And replacing my persisted actor with a new one
UObjects outered to a persistent actor should simply persist
I can even go a step further and tell you that it's not just a persistent actor, but really any persistent object
Say for example Widgets by default get outered to GameInstance, they persist seamless travels
Yep
That's what it is
GameMode calls StartPlay again when you arrive at the new map

In StartPlay I initialize the actor that would be persisted
So it's replacing the persisted one
Hmm
Checking for the presence of the actor before initializing it fixed that problem, but now other problems are popping up with actors wanting to initialize
If everything just fires again when we get to the new map then it seems like it's more trouble than it's worth to persist anything 
I'll have to introduce all this logic for checking if we're persisted
Seems easier to just dispose and make new stuff
Like, OnPossess is getting called again...
It seems like it wants to take hte old PlayerState/Controller and attach them to a new Pawn, but... that's not trivial lol
If the Pawn/State/Controller are all persisting why would it need to call OnPossess again 
Is this the only way to travel to a new map and bring clients with you? This feels messy and I don't really need any of this.
The state that I need to persist is the same stuff that I already save/load to disk and RPC to the server from the client (i.e. client's character state)
This persisting actor thing is a can of worms I don't want to open 
https://cedric-neukirchen.net/docs/multiplayer-compendium/traveling-in-multiplayer/
Okay this sounds like I don't actually need to use seamless travel in order to use UWorld::ServerTravel
The Server will change level but if you dont enable seamless travel all Clients will be forcefully disconnected.
Can I remove things from persistent actor? I don't want playerstates to persist 
Easier to build anew than double code for two possibilities
You can override the function that causes them to be retained and just rewrite it so they arent
But the thing is
Ooh okay that might work better
They are only persisted to enable you to copy their properties
A new PlayerState is always created
Yes but they are easily identified
Since they are marked as being old
I forget where thats managed. Its likely a flag on the PlayerState itself
Which is set during a seamless travel transition
So like if I simply do not implement copy props then I have effectively stopped persistence of that actor right
No. It still persists. It just wont copy anything over and be subsequently removed
That's what I meant by 'effectively'. It still technically persists but only just long enough to go into the trash
Sure
If you care, PlayerStates can also persist for a ttime after a Client disconnects
okay thanks I'll play around with it and see
They persist in this instance so that you can recover on reconnect
Sure that makes sense
If it was due to a network error or something
They are thrown into a different list on the GameMode
So they are also separate
I cant remember how their lifetime is managed after that case
They maybe cleared on a level transition
Btw when I seamless travel in PIE I get a console error saying I can't server travel in PIE but then it executed the travel anyways...
Not error, warning
Is that just a mistake warning or is something actually failing
Im not on UE5 but it does support it. UE4 does not
So im not sure what nuance exists with it in 5
Yeah I'm in 5.3. I read that it's a new feature so I figured they forgot to remove the warning ๐ค
iirc it is and it requires a specific option to be enabled
net.AllowPIESeamlessTravel
if that isn't enabled you'll get a warning and it'll be a non-seamless travel
so... sounds like you're not seamless traveling

I haven't tested it myself but iirc it's somewhat broken. Easier to test with standalone.
Well that would explain some of the misbehaviors 
Okay um I guess I need to start over now that I know I was... not seamless at all 
You can still use an editor build, just launch client/server as separate processes instead of using PIE.
Yeah I already use separate process but I was running the listen in PIE so I'll just do both standalone
When I try to use same process it instantly crashes so god knows what same process means
I'm guessing it's some nightmarish local mp thing where static variables are shared or something 
uhh, that's the normal flow
and yes, it means everything is in one process
gameplay code largely should not be using static variables
not when associated with a world, anyway
it's not a "nightmarish local mp thing", it's standard practice for unreal. Static data is bad for multiple reasons, one of which is that it will break single-process PIE.
It's just a reference to an actor for convenient access. I guess I could stick the reference in GameState 
that is indeed a very bad thing to do. Game state would be fine.
It's not that bad 
it is
the GC can't see that you have a static reference so you have a dangling pointer when the actor is destroyed, and that pointer persists across multiple sessions of PIE.
not to mention the editor itself.
Oh. That explains the error that popped up when I started checking if the static variable was set prior to initializing it. It was sticking as set from previous PIE session after that, sounds like 
yes, do not use static or global variables to store data from game worlds unless you really know what you're doing.
Subsystems, gamestate, gamemode, etc all exist for this.
Huh so PIE is like... huh that's weird. I wouldn't expect anything to persist outside the session
What does this Actor do? Why do you need a persistent Actor at all?
nothing knows about the data you've stashed in a static
how is it going to reset it?
The actor is outer for all UItemData and UInventory objects. Any time an item or inventory is created it goes through the manager which ... manages them. I.e. when to dispose of them and so on
Ehh
in unity statics don't persist sessions so I just never imagined that could be a thing
The ItemManager doesn't really need to persist though
All the items and invs can just be serialized, like I do for save/load
I would expect an Inventory itself to manage the items it contains
Then what happens when you move an item to another inventory
My research led me to believe that changing the outer of an object was a messy and dangerous thing
unity is actively unloading and reloading the game assemblies. Unreal can do no such thing.
Furthermore even unity will leak data between scenes if you try to store something in a static and load another scene while in gameplay. Which is still an issue for you because you're holding a pointer to something that no longer exists.
Instead of having individual items outer to inventories, having a master outer made more sense. ALso helps with syncing stuff to other players
It did not seem like outer was meant to be used in that way
The item would just be outered to the world or something and you just manage ownership via some internal variable to the item itself
Yea I do that
It's just the outer is the manager not the world
The manager also provides functions for creating new items/inventories
Just centralizes the logic
It doesn't really need to persist at all though. I don't need ANYTHING to persist
I just need the clients to tag along ๐
Client is auth on the stuff they bring into the session already, so I can just save/load their state locally
Sounds like an unnecessary approach to me.
As opposed to what 
e.g. if player wants to equip an item, it uses an RPC on the PlayerController to ask the server. Server validates and multicasts from the item manager that the item was equipped and to whom and what slot
That multicast can't be on the PC (is my understanding) because the PC doesn't exist for all clients
So Im trying to replicate walls moving randomly, which is an event choosen by level blueprint and sent to wall blueprint, bul walls arent replicated. Whats the problem?
Level blueprint:
Inside of event chooser repnotify
Wall blueprint:
wall repnotify
I guess everything the item manager does could just be on the game state 
That's more obvious now that it's just a reference sitting there on the game state 
Is GameState privileged in any way in terms of replication order?
I understand actors will replicate in unpredictable order, but is GameState an exception to that rule?
I'm guessing no since I've literally had stuff replicate before the client even has their playercontroller 
Actors can define their "priority" over other Actors when replicating, but this only takes effect during network congestion.
Otherwise its non deterministic.
Same process PIE working now except one curiousity
In order to raycast from center of screen for interaction, I use
ScreenCenterPosition = GEngine->GameViewport->Viewport->GetSizeXY() / 2;
With any clients, if Server is PIE main viewport, it gets the center wrong 
GameState will have replicated when any Actor calls BeginPlay, that's a rule
But if server is in separate editor window (but still PIE) then it works fine
Ah ha! That's exactly what I was driving at! Thanks. I had a standalone actor as a manager for some game state stuff because using GameState had not previously occurred to me, and as a result it needed some logic for when the standalone actor syncs AFTER things that need it. Won't need that anymore if this is a rule 
By syncs I mean just its existence at all, rather than any values updating
I've moved all the standalone actor's stuff into game state
Yeah that's a super nice guarantee of the engine
Extremely
But of course by replicated is existence and any POD types that were set on the GameState at any frame no longer than the spawn frame
So usually it's the existence is what we care about in this rule
POD?
So stuff that was set in constructor
No, data types like ints, floats, doubles
So if there's a TArray on the game state will that not be initialized yet for the client? Is that what you mean? Since it's not a POD?
Well a TArray is a series of things? A TArray of what?
Well, UObjects in this case, but I'm just concerned with the array existing i.e. ready for stuff to be added
Not its contents
TArray usually replicates its size first and then the actual data
Ah then ofc not
UObjects are not PODs
They get their own NetworkGUID
They are uniquely identifiable on their own
Sorry let me clarify. If I have a TArray on my GameState and one of my other actors (say a pawn) wants to add stuff to that TArray when it (the pawn) does BeginPlay, I can rely on that TArray existing at all and being ready for additions by that point? Or no? 
Being ready in the sense of having all elements replicated from the server?
No just being ready for addition
Well, okay, you're right it's actually added to server side
but this is just a contrived example to understand what you meant 
Yeah yeah... there's no problem with that
If the GameState exists, then every property inside exists
But I suppose yeah... since it's actually just telling the server to do it, it's immaterial 
Okay tha'ts what I meant thanks. I was just clarifying to flesh out my understanding 
Initial statement was about GameState existing client-side, and what data you should expect to be there
But yeah GameState will usually spawn before a lot of other actors (player-related ones)
void UPlayerInteractComponent::OnViewportResized(FViewport* Viewport, uint32 Value)
{
ScreenCenterPosition = Viewport->GetSizeXY() / 2;
}
...
void UPlayerInteractComponent::BeginPlay()
{
Super::BeginPlay();
if (GetOwner<APawn>()->IsLocallyControlled())
{
FViewport::ViewportResizedEvent.AddUObject(this, &UPlayerInteractComponent::OnViewportResized);
if (!IsRunningDedicatedServer())
{
OnViewportResized(GEngine->GameViewport->Viewport, 0);
}
}
}
When running MP on same process, server gets wrong result for Center Position 
Clients work fine
OR if I run "PIE New Window" then server is correct
But when doing Viewport PIE, server is wrong 
void APlayerAgent::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
check(GetWorld()->GetGameState<AKlassikerGameState>())
this assertion just failed 
That means PlayerState's existence was synced to player before game state, or at least before game state was made available to that function? 
OnRep is not beginplay
Ah
Read carefully what i wrote
No I get you now, I inferred too much 
is there a way to check if FSocket is still connected? GetConnectionState always returns connected
@lucid badger didn't read everything but one nasty thing is that OnRep can call before BeginPlay
And some seemingly random stuff might fail if the Actor hasn't BegunPlay yet
In The Ascent I had to call the OnRep function by hand on BeginPlay and block the OnRep if HasActorBegunPlay wasn't true yet
Seemingly random stuff being really all kinds of things. I can't recall sadly but there was no clear reason for, I don't know, material colors to not be set or visibility not being changeable
I'm still having this question, and the other question too.
A controller may not exist for that PlayerState
Since controllers only exist on server and the client that owns it
the playerstate has a local role still though
and you could just get the netmode etc of the driver
if you run UpdateUI.Broadcast(); on RPC and bind the delegate in User Widget, will it updates User Widget for the owning client?
Hello. How can I make sure that the component is removed from the clients, but not from the local player?
@twin juniper GetOwner would be invalid for all sim clients.
But the owning client could still not have an Owner if the PlayerController hasn't replicated yet.
At least in theory.
The sanest things is to use OnRep_Owner or OnRep_Controller if it exists instead of BeginPlay
But that's C++ of course
If the RPC is a ClientRPC inside a Client Owned Actor, sure
Manually removing it via multicast and checking if the owner is locally controlled? Needs a bit more info
Hello, how would one replicate On Component Overlap Event ?
You usually don't need to do that
Well let's say I need it to be launched on the server ? and on the client at the same time
Usually you have an Actor with some sort of Collision Component.
I'm having an issue where my WeaponBP Overlaps on the client but not on the server
which sometimes results in a miss on server and hit on client
but not always
A Replicated Actor that is spawned on the Server, that has a Collision Component of sorts, will call Overlap on every instance, given that all instances have the same collision setup.
WeaponBP is what?
A sword?
Yes
Are you trying to enable Overlaps in some Attack Anim?
Well i'm doing it in a more scuffed way for now, where I On begin overlap the sword and check if owner has specific tag
then do trace
But this is during an Anim?
Listen
When the Trace fails on the Server, does the Server look at the client?
Because you probably need to change the Update Bones and Tick Pose setting on the Character Mesh if that's the case
That is set to only do the full update when rendered
If your Listen Server doesn't look at the Client, it might not update the bones etc.
It's a DropDown in the Character SkeletalMeshComponent
I'll have a look that can be it, I use a Collisionbox also
I need to remove a component from another player. I was only able to delete from a local player. I tried checking with Is local controlled, has authority, but they didnโt help
It's kinda redundanten to ServerRPC and then ClientRPC
Given you are already on the owning client to even call the ServerRPC
How can I remove components from other clients?
You would first need to ServerRPC in an Actor that initiating client owns
E.g. their own Character
And then pass the Server the Character you want to target
On which the Server can then call the ClientRPC
How to transfer the player to the server?
You're a god good sir
As a Reference/Pointer. That of course requires you to have a reference to the Character on your Client.
Idk how you are currently determing the Character that you want to remove the Component from
I donโt even define it, itโs just that thereโs no way to do it
I don't really know what your overall set up and goal is
With the little info you provided, that's all I can give you atm
Can you tell me what else I need to give?
You need to explain what you are trying to achieve and why. Not just that you want to remove a component.
Tell us what happens before and after that. What triggers all of this? Why even does this need to happen?
You are determined to remove a Comp from a Player. Which Player? How do you determine that Player?
And why even
I'm trying to remove the skeleton mesh component from a non-local player because only the local player should have it. Everything in event beginplay is deleted. I didnโt determine which player to delete from, I thought it would be possible simply by checking for a local player or through replicated events
The Character has an Event called "OnControlledChangedEvent" iirc
That calls if the Controller becomes valid (also invalid, but that's beside the point).
In theory, you could limit that to HasAuthority, call a Multicast and filter the Multicast via IsLocallyControlled to not remove the local one
However
If I get you correct, you want to have a Mesh that is only visible to the Local Player
So if we both join the game, we only see our own Mesh, not the other of the other Player, right?
If that's the case ,you could simply tick the "OwnerOnlySee" boolean on the Mesh Component.
Yes
Thanks, I didn't know this existed. It's my fault that I didn't say it completely, sorry
Iโm not used to asking for help, I usually look for everything on the Internet or at random, so I said how I figured out how to solve the problem. Thank you
No worries
Man still have the tracing issue, as the image shows one trace is client and the other the server one, they should be the same but they are a bit off, is it like a latency issue or something ? what should I be looking for
Hey there, is anybody familiar with the "Advanced (Steam) Sessions" plugin and knows why steam doesn't pop up when I start a standalone? I followed all the steps
You need to run it standalone but preferably packaged
I ran it in standalone
Did you set up the dev steam appid?
There is still no steam popup
Dunno what to tell you. Works on my machine
Hello everyone, Iโm looking for general advice on how to handle illegal events which occur due to latency. Here is one of my specific issues:
I have a game involving tiles. Player 1 is allowed to capture a tile by activating one of their pieces which then goes in cooldown. The only relevant rules they have to follow for this example is they must capture a tile which does not contain an enemy piece. The enemy is allowed to place a piece in an empty tile they own.
The conflict:
Player 1 asks the server to capture the tile and is allowed to.
Player 2 doesnโt see this yet and asks the server to place a piece on the tile, which is allowed.
The server then gives the tile to player one and kills the piece, or sometimes will put player 2โs piece on the tile and reject player 1โs capture but still put the piece on cooldown.
TLDR: how in general do I handle mismatches between players because of latency?
There is like no steam popup at all, like steam doesnt start when I start the standalone
Try packaging it
didnt you have to put a txt with the steamappid in your packaged folder when doing shipping build? idk been a while but there was something like that, might have changed since
Question if i set a value in my GameInstance on lets say "main menu(map)" witch uses a Mainmenu_Controller
then i load another map
and switches the controller to another one
if i still cast to same Gameinstance then it should contain the same stuff right
since its presisten ?
Check out the persistence compendium from wizard cell in the pins
@plucky prawn ok
@plucky prawn GameInstance and GameState exist on server and client, though the former isnโt replicated and the latter is.
i guess i could sum it upp with this
Should my possed by call two times when i have only one player ?
the game mode can access all clients right ?
but only the host can access the game mode since its only server side
@queen escarp Correct
@fossil spoke then why would this give null on the clients :/
it gives me 2 different controllers
and they both have different values in the game instance,
Why are you storing the GameInstance? Itโs accessible globally
Via GetGameInstance
aye true, its just occupational hazzard
the problem is on the clientยดs it gets access none,
and i dont get it why....
The GameInstance should never be null
Keep in mind that Clients only know about their own PlayerController.
You are also accessing the PlayerState incorrectly.
Never use GetPlayerState by Index
ยดsince it on owning client isent 0 the local one ?
The PlayerController knows about its own PlayerState
Not necessarily. There is no guarantee about what it is in a multiplayer context. Especially with PlayerStates and Controllers.
You must always try to access them in a deliberate way.
As i said before. If you are in the PlayerController BP, it has access to its own PlayerState
Yes
ah ok,
and if this is in controller, and begin play sets up game instances then how could it be null
since im from the "Gamemode" accessing the login players controllerยดs game instance..
or game instance dont inherits from player controller,
hey, im learning the basics of replication, and have a bit of simple code -
.h /
UFUNCTION()
void OnRep_ReplicatedHealth();
void HealthUpdates();
void ReduceHealth(float damage);
.cpp /
void ATPSMPCharacter::OnRep_ReplicatedHealth()
{
HealthUpdates();
}
void ATPSMPCharacter::HealthUpdates()
{
FString HealthMessage;
if (IsLocallyControlled())
{
HealthMessage = FString::Printf(TEXT("You now have %f health remaining."), Health);
}
else if (GetLocalRole() == ROLE_Authority)
{
HealthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetFName().ToString(), Health);
}
if (!HealthMessage.IsEmpty())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, HealthMessage);
}
}
void ATPSMPCharacter::ReduceHealth(float damage)
{
if (HasAuthority())
{
Health -= damage;
}
}```
In this case, my understanding is that OnRep function is called only on the client, and it does indeed work only when the ReduceHealth() is called on client, but not on the server, but, the debug message is shown on both Server and Client, and that makes it hard to understand what's going on and if things are working right, so is this how it is, or should it only appear in the Clients window? I hope this makes sense
@queen escarp You need to remove that Delay node
@hoary timber In C++ you need to call the OnRep manually yourself for the Server.
Seeing as you arent doing that, you should get a single call on the Client.
ah I think I see what my issue is actually
i just looked at the code again and I think since I add the debug message outside of if statements it does just get shown on both
yeah Ill tweak that too!
It shouldnt unless its been set to a value.
Since you guard it with IsEmpty
what would that do :/ ? isent a delay good if multiple joins
ok I just looked up some forums thread and apparently in editor the onscreen debug messages show up on every instance, regardless if its a client or server, or another client, so i guess solved..
No. The Delay will actually cause you to miss a Player if they join at the same time
Dont ise Delays if you can help it. They cause more problems than they solve.
Either or doesnt matter the effect is the same
but since im setting the reffs inside the controller and casting to controller On post login"
i need some time to let it set up ?
Did you remove the delay?
yeah
Ok well observe the results. What error specifically are you getting now
well now the ui dont spawn even for the host
its being created in the controller
so i have to make a actor that spawns the hud and put that actor as the HUD class ?
No
The HUD class is a special class created by the PC automatically
You override it on the GameMode
yeah i did but its not a widget its a actor or (Hud) class
Yeah
So you use the HUD class to spawn the widgets like normal
so its basicly a parent holding the widget right
Yeah
You dont need to?
huh, if i want to get functions from the player hud widget inside the HUD ?
If the HUD is creating the widget, it has access to it.
The PlayerController has a function to GetHUD
If you need the Widget, then store it in a variable on the HUD
yeah but look at my screenshot its giving error :/ ?
That tells me nothing lol
When expressing you have an error, dont just say you have an error. Actually copy and paste exactly what the error says.
We cant guess what errors you are having
Why are you getting a different class to call Start on the UI?
The HUD should do that after it creates it
Id like to help further but i have to bounce. Apologies.
Ill check back if i can.
Hey, how do we know what is the worst network conditions we should test our games in?
Think of this question as "how many players do I want to include/exclude". You can't support every condition (for most games... unless it's async turn based expected to be played over multiple days ๐ ). I'd say most gamers understand for a fast paced game anything over 100ms ping and they're going to have a worse experience and at 150-200 start to be unplayable. Packet loss I have no idea.
the "bad" network simulation preset is a good place to start.
and even a little bit of packet loss can cause havok. You're never going to have a good experience in a realtime game with a lot of packet loss, what you want to ensure is that the game doesn't break down entirely under those conditions.
Yea I thought they are good guiders for that.
But Unreal engine gives us the choice to make it exceedingly much worse, which made me think if there is any point from trying these harsher settings ๐
I would just make sure your state doesn't break
yea packet loss can neuter the RPC's ability to send information, unless it is reliable
thankfully I haven't failed to receive a reliable RPC yet but I've made the packet loss so bad it couldn't get to begin play, or it might need more time than I gave it
so in this case, do you recommend we do continuous checking that events are received to accommodate the bad network conditions?
I'm just a hobbysit who is learning myself I don't recommend anything ๐ I meant testing your current logic though not adding checks at runtime. A reliable rpc should in theory handle packet loss but does your state logic use them correctly even if out of sequence etc
I just observed this failure where my rpc to possess the pawn didn't pass with the bad network condition, so it is what has prompted me to ask the question
so now that reliable rpc has solved it, I should rely on it?
I understand that you are just a hobbyist, so are most of us.
What we need is the experience of the developers at the real multiplayer games to see what are their approaches ๐
reliable RPCs are for things that you absolutely must be received at some point.
the choice of whether to use it is the answer to the question: is it ok if this doesn't arrive?
It's not really more complicated than that. Reliable RPCs have an overhead, they aren't "free", so you should only use them on things that actually need it.
It's hard for me to picture an unreliable rpc. Can you give an example? The only thing I can think of being okay to be unreliable would be replication of variables since those will likely just try again shortly
But that's not an rpc of course
most reliable data from server -> client is going to be via replication rather than RPCs in the first place
Any "instantaneous" events that are purely visual/don't impact gameplay should almost always be unreliable.
Basic client movement input is generally unreliable - it is sent super often and if you end up dropping packets then movement is going to be impacted regardless.
There's very little that actually needs to be reliable, most things are covered by replication or aren't actually that important.
Is there any reason that a large FFastArraySerializer array (say 30 000 FFastArraySerializerItem item entries) would kick a connecting player?
logs should tell you the disconnect reason, but if I had to guess it's simply way too much data to send at once.
You may want to consider separate array buckets for that many elements
Have 3 TArrays with 10k elements instead of a single with all 30k for example.
Yeah ok, that makes sense
After doing some more testing, it apears to break at 3500 entries, approx, and the entries are AActor*'s
I can bucket it no problem, but 3500 seams odly small to me
They arn't replicated, just the stably named refrence is
(and that all technically works fine, it just boots connecting players if there are >3500 entries in the list)
Essentially static mesh actors
For what
In this example. they are "map chunks" which statically remain still and connecting players are fed a list of which ones to toggle on / off
Walls, pipes, ladders, fence,s etc.
The system works perfectly fine for connected players, and also works fine for late joiners, untill the Array gets to >3500 entries, at which point new connecting players successfully connect and then are removed
Im guessing this is some sort of procedural world generation?
These specificly are map placed actors, but yeah the analogy extends to procedural generation
So the level and all its Actors are prebaked. However you are replicating a list of all Actors in the level that need to "toggle on / off"
Yeah
Why
So that they can be toggled on / off during gameplay, and those map changes can be replicated to existing and late connectors
Hides the mesh / disables the physics (to emulate the map chunk being destroyed)
What Im trying to understand is why isnt this just managed by the Client entirely.
Based on proximity?
Why do you need the Server to tell the Client what to Toggle?
You arent explaining what the Toggling is FOR
Your telling me what toggling is doing.
Not what its for.
I dont think proximity based toggling is appropriate here, TLDR eventually a player is going to pick up an item, or destroy a chair, or a door, etc for example
that "destroy" action is stored in a list, the list is replicated and replayed on connected clients
Right
The system works perfectly fine, and at scale - but for some reason late joiners are kicked once that array of changes hits approx 3500 entries and Im wondering why
Ok well to me it sounds like you need something like the following instead.
You would need a per chunk manager
This is what im doing
but once the list of entries hits 3500, the connecting client crashes, and that confuses me
I would expect that way there is only going to be a few hundred at maximum Actors per chunk manager
I suppose thats possible, i just assumed it would be able to handle an initial replication of a bit higher then 3kish considering at runtime it can hit 30k+ without any problems
Cheers though, I was supposed to chunk it anyway I was just being lazy, but if i have to, then thats what ill do!
This is not a typical thing to do, which is why your running into issues.
Any idea how to make a simplified turn in plce?
Hello, noob question here. When I spawn a new replicated actor on my server there is a big delay before it becomes visible on the client. Even in PIE with zero latency. Any tips on why my replication is so delayed?
I am spawning an enemy NPC and it will "pop" into the screen after being alive for up to ~3 seconds.
Why would you get that from the controller anyway
i would want that specific players instance
Doesn't work like that. Game instances are local to that player and you won't be able to get anyones game instance
Just like how a client can't get the game mode
oh..
What are you trying to do?
Because the player controller seems like the appropriate thing anyway
hm can i get a player start point within player controller ?
You can't access any actor on that clients local game instance unless it was replicated by the Server or part of the map
hello, I have a question that I've been trying to figure out for a while and I don't know if I am doing something wrong, or if there's something I am missing. Server is top, Client is bottom.
On the video you can see how I press Start from the Server and it begins a ServerTravel when there are two players in the Lobby. Then, a UI appears still in the same Level. Then, the Server connects to the Level and I add another Loading Screen to the PlayerController on BeginPlay. The Client is still loading, and when it finally loads, it's just standing in the center of the world. Then after a while, it finally gets the info and spawns a PlayerController that plays the Loading screen, then after 3 seconds, the GameMode MatchState changes and it replicates to get rid of the LoadingScreens and the game countdown starts.
I do not understand how I am suppose to mask that time the Client has entered the level and is loading. There doesn't seem to be any way to add something on top to hide it, I tried also adding it in the Level BP, but that also played when the Loading was finished.
You can have a callback to check if the player succesfully possesed a pawn before removing the loading screen
It takes some time to call posses and call begin play in networked environment
Just hide the process with loading screen
I have a subsystem for my loading screen and i simply tell it to remove the loading screen from playercontroller::acknowledgepossesion
Level bp is the wrong place to even attempt it. The more delay there is, the longer it takes for begin play to get executed
If the playerstate is not to be used in the AI Pawn because the player state exists to be replicated... Then what should we use for an AI Pawn?
We need to identify who the pawn belongs to, and other characteristics, even if it is AI, right?
But it almost seems that no matter where I try putting a Loading screen it is not fast enough. What Subsystem do you use? How does it fire off when the Client joins?
Local Players are just that, Local to that game instance. You can't get local player subsystems from remote players.
Players need to set/manage their input contexts locally
Fast enough for what? There is no fast or slow, mine just fade the loading screen once the player have possesed a character. Im using game instance subsystem for my loading screen
If your loading screen is fake then its not gonna work. You need presistence loading screen that survive between level. That way you can get a ref to the loading screen and fade it away once the player is ready
@chrome bay this would be a workaround ?
- Presistence loading screen
- On acknowledgepossession (client rpc from the server) remove loading screen
OnControllerChangedEvent -> IsLocallyControlled -> HandleInputStuff
@thin stratus oh, would that basicly be the same as the image or a more efficient way ?
Better cause you save the RPC
It's a callback for when the Controller changes, including locally
Needs IsLocallyControlled though cause it also calls on the Server
Hi!! Actually I am trying to package the project for the server... initially when I built it, it was around 600mb which has reduced to around 100mb... should I be worried about that... coz all I changed was added a new map to the package list and changed the default gamemode, default server map and gameinstance๐๐ I tried uploading the build once but it failed
Failed to create????
No but stuck at cook project
Okay, so I made a Subsystem and I made two functions on it. When I start the match, the GameMode starts a function on the Controller to Show Loading screen and that's working, but when the Level loads, it removes the Loading Screen automatically. Does the Subsystem need to be called in some other way, rather than on the Controller?
I'm trying to replicate a UObject* inside a of struct (which is inside an AActor). The struct's primitive fields replicate fine, but not the UObject*. If I lift the UObject* up a level to the AActor, replication then also works.
This is roughly how I thought using "Registered Subobjects List" would work:
void AMyActor::CreateState()
{
MyStruct.MyInt = 5;
MyStruct.MyObj = NewObject<UMyObject>();
AddReplicatedSubObject(MyStruct.MyObj)
}
Is this paradigm supported?
Someone give me a link to the guild for dedicated servers without Lyra pls
How a dev enviroment should be set up when it comes to using dedicated servers ? Do you create installed builds from a source version and prepare one server/headless package for the server and one client build for the users ? Does any documentation exists on that issue ?
You need to set bReplicateUsingRegisteredSubObjectList to true on the actor
See also net.SubObjects.DefaultUseSubObjectReplicationList
Also make sure the object uses the actor as the outer
I have a question, OnRep_Controller only run on clients, right?
ye
I have a c++ question with an example inside UObjectBaseInit() but I've have seen this done in other functions.
{
... inside UObjectBaseInit func UObjectBase.cpp
void InitAsyncThread();
InitAsyncThread();
}
From my understanding inside the function it's defining the prototype right inside the function and then calling it. Because it's defined in the CPP its private. Where is this codes implementation? I only see it defined Inside AsyncPackageLoader.cpp. I assume this code is linked at compile time so that's the actual implementation used right? Side note this is used for creation of async for loading packages (uassets etc)
Ah, my outer wasn't set to the actor! It's a library that creates the UObject, so I'll see if I can pipe it through or set it. Thanks!
I'm having a super weird issue (C++).. I have a BeginPlay in my character actor triggering a LoadCharacter() function, which, as it is named, loads the character from a save. My saves are always client side, so it should reject the server from invoking it, but allow the client to run it. The problem is, it only ever runs on the server. I made sure that a separate server launches in the background, and that I'm in client mode, but it still only ever runs on the server. Any ideas?
I added a breakpoint in Rider in the LoadCharacter function but it only ever breaks on the server
Ahh nevermind, it's running on the client but only breaking on the server.. had to read my logs.
when doing sprint/stamina in multiplayer, when it comes to character movement speed would you want to set this variable on a specific server event? or is the character movement component already replicated where i can set it right off of the input action? i'd be doing server events to set addtional varaibles and doing the stamina but when it comes to simply setting/changing movement speed what is the proper way to set this?
@crisp shard you will need to switch the flag. Look up delgoodies character movement component video in youtube.
Sprinting in multiplayer required cpp because you cant switch the flag in bp
ahh , yes i have heard this before. i will check it out, but i dont know cpp at all
Hard travel kills widget. I preserve mine by making the uwidget a tsharedptr.
Some people say dont do it but lyra does it so ๐คท
Sprinting is one of the first wall people hit when doing multiplayer with bp only. Bp for multiplayer is very limited
im quite confident you could make it work, i mean i do already have something but i don't like the current way im doing it. esentially im setting the speed on server, and multicasting it, whcih i know isn't a good solve but it does work and replicates, but im sure the cpp would be best. not sure how in depth the coding is
Its not gonna work, you probably test it in a 0 latency environment. Add even a tiny ping and your game breaks
Put it simply you will get rubber banded
A lot of youtube tutorial doing bp sprint on multiplayer is a scam
do you think i could pull it off w zero cpp coding ?
i'd legit just copy it
pull it off, as in, do the custom cpp coding
How much delay should I expect between spawning a new NPC on the server and it's arrival on the client? I am seeing NPCs pop in super late on my client, even in PIE.
Copying is not zero.
Zero will not work
If you copy everything, then you should be able to sprint. Why not
yea that's what i meant
but im just not sure how i'd do it
i'd like to expose it to a plugin/node that i could use to do it
that would be sick
@chrome bay Fun little follow up on the RelevancyTimeout.
There is a hardcoded +1 second "timeout" above that. UE only checks IsNetRelevantFor after 1 second since last time relevant. Before that it always counts is irrelevant.
If one sets the RelevancyTimeout to < 1.0, it will cause ALL replicated Actors to flip between relevant (if relevant) and not.
Even GameState, WorldSettings and such :D
I will test tomorrow if I can alter that behavior in the Engine, at least for some Actors.
I have tried every possible combination i can think of and no matter what i do all options are dropped when doing an open host:port?opt1=a$opt2=b and it is just ?Name=mypcname. (i am printing the options in gamemode:Login override to validate) Im losing my sanity. Does anyone have a reference or link i can read that may explain the circumstances that would cause this?
Is there a consistent way to ID which player (number) you are in PIE/same instance multiplayer? Save Slots are shared between server and client which is a pain in the ass and I'm trying to think of the simplest way to split that up 
Local Role is no good as it would only work with 1 client
Actually even standalone will share the save game folder

Uggggh
What a tremendous pain in the ass. I can't imagine why they did it this way.
Each player should have a totally separate folder 
Now I have to have my save game code be completely different for development versus shipped build
need help with the physicalanimation component during server travel. how do i disable the component
Unfortunately, setting the outer didn't seem to help. the UObject still wont replicate if inside the replicated struct.
Okay after 20 minutes of doing this:
I finally thought of the simplest solution. I was going to have to implement a concept of 'player profiles' soon anyways. So I'll just write that up and then have the server assign a profile name to each player as they join. Then the profile name assignment is the only bit of code I have to remove from build 
Actually I misspoke. it is replicating, just not in a single bunch. Thanks @chrome bay !
@queen escarp An Actor that doesnt have a NetOwningConnection cannot send an RPC to the Server.
It seems this is an interactable door.
yeah
Ideally you would have a generic "interaction" system that the Player manages. When the Player interacts with an interactable, the Server would be notified of that interaction by the Player (via the PlayerController, which is the NetOwningConnection).
This would then lead to the interactable, in this case the door, being opened on the Client via replication.
You can also "predict" the opening of the door on the Client by allowing the Client to set its open state locally
So you dont have to wait the latency time for it to open via replication.
Obviously that would involve implementing correction incase the Server rejected the opening for whatever reason. But thats all likely a bit complicated for you at this stage.
So I would focus on implementing a generic interaction system instead.
There are plenty of examples online.
The Host is the Server
A Pawn that is possessed by a PlayerController does, because the Owner of the Pawn is the PlayerController and the PlayerController is the NetOwningConnection.
ah ok
Any Actor that is Owned by a NetOwningConnection (PlayerController or another Actor owned by a PlayerController) can send RPCs
and making the player "possess" the pawn and rpc is that an option ?
You can setup an "Open Door" RPC on the PlayerController if you like
And route that action that way.
But thats not very generic as if you want more types of interaction actions later, you would either need a generic system or add more and more specific RPCs to each action.
hm.
kinda weird i never had this issue before >_>
but i kinda get what your saying i suppose
If you have a simple, limited scope game, you might not need a generic interaction system.
But thats unlikely.
If you start to need more than 2 or 3 unique interactions, then you need a generic extendable system to handle all cases.
I have problem with testing multiplayer game with SpaceWar ID, if there are 3 players connected to the server, the server can't be found by anyone else. Is it limitation of SpaceWar or I am doing something wrong? I'm using UE 5.3
Sounds like it might be full, in that you have reached the max player count for the session?
Only sessions with open slots will be returned.
By default AFAIK.
I have NumPublicConnections set to 10 so it shouldn't be a problem?
Yeah not sure then
Hi, I have local multiplayer / split screen project and I want to change switch between players in runtime. project uses one keyboard and when user press a specific key it should start to control other player. Is there any suggestion for that ? Project is not a game project. I want to achieve like 3Ds Max's grid layout.
For a multiplayer mounting system is there any cons having the horse on same actor as the player?
Is using multiple actors better?
(The mount is an item that will never have a world version outside of a mounted character)
Like a WoW mount?
yes
If its that simple then probably creating its Skeletal Mesh on the Players Pawn would be enough.
Probably doesnt need to be its own Actor
Can i have any problem?
Since it would only really be increasing base speed and possibly allowing you to fly
Which is all doable with a single Pawn
Sure if you need it to, thats also possible.
The Crouch function does that for example.
So resizing the Capsule for the CMC is doable.
Good luck ๐
@sweet sage You can see how to add additional movement functionality that changes capsule size based on the implementation of prone in this plugin: https://github.com/Vaei/PredictedMovement/tree/main/Source/PredictedMovement/Private/Prone
I am having an attach to component error where in the server I equip my weapon and it attaches but its very inconsistent but I basically spawn my players with a default weapon and attach it to my weapon slot component on the 3rd person mesh. Sometimes its correct but other times its in the middle of the air but still attached! i know its attached because it is doing the idle animation as if it is.
I figured it out, basically you cannot have component replicates on the replicated actor. Coming from this post:
https://forums.unrealengine.com/t/child-actor-not-replicating-correctly-with-attachtocomponent/420585/4
how do you set target view with blend in mp?
I have tried every possible combination i can think of and no matter what i do all options are dropped when doing an open host:port?opt1=a$opt2=b and it is just ?Name=mypcname. (i am printing the options in gamemode:Login override to validate) Im losing my sanity. Does anyone have a reference or link i can read that may explain the circumstances that would cause this?
Why are you using a console command?
Could use an assist on GameInstance.
I have an api call that returns a sessionID, that ID is stored as a variable on the GameInstance before the player opens a level and connects to a dedicated server.
On the GameMode for the dedicated server, I try to read this sessionID during Event Handle Starting New Player.
For reasons that I do not understand, the GameMode cannot find that variable on the GameInstance. What am I doing wrong?
The GameInstance has a per process lifetime.
Meaning.
Only 1 GameInstance exists for every machine.
Which also means that you cannot reference a GameInstance across processes.
So you storing a value on a Client, wont be accessible by a Server.
Because the Client and Server are entirely separate processes on entirely different machines
If you want to pass information to the Server about a connecting Client, use the Options string.
Its available when you call OpenLevel for example
Which is how you generally connect to a Server
It takes the form Option1=Value1?Option2=Value2...
You can parse this in the GameMode
For a connecting Client
That's helpful. Can you point me to any documentation on parsing options? Or help me with the syntax to pass and store a variable?
There are helper functions in Blueprint for this AFAIK
You should be able to reference them for assistance with C++
As far as other documentation goes, Im not sure if any exists.
But its pretty straight forward.
Haha okay, any idea what one of those helper functions might be called? I'ma C++ noob, but I'll give it a try.
PlayerName=Sandwyn?SessionId=1237912409?SomeOtherData=SomeValue?
This is what it might look like
Just do a search my dude, I dont know off the top of my head.
It will be somehting like ParseOptions
Excellent, really appreciate the assist!
๐
Wrong channel... Sry
hiya! i have one developer running a source version of engine 5.3.2 and another stock 5.3.2 from epic launcher. it seems like they are "incompatible" due to different network versions. we want to be able to connect to eachother via the editor.
if i make a binary build of the editor, will they have the same version?
I finally managed to get the Loading Screen working with a BlueprintFunctionLibrary
I found this thread that explained how to do it and it works great https://forums.unrealengine.com/t/multiplayer-how-to-set-a-persistent-loading-screen-while-connecting/371222/16
I tried doing something similar with the Subsystem afterwards to see if works, but maybe my code for removing wasn't great, so it didn't do that properly.
But in any case, I understood tha tthe whole issue was with persistant Loading screens being needed, and all I was doing was setting things to controllers and whatnot. Thanks for your help!
For anyone who comes to this I had to edit @Vanoricโs answer a bit. Source/MyProject/Public/DynamicFunctionLibrary.h #pragma once #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "DynamicFunctionLibrary.generated.h" class MyProject UDynamicFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() ...
What about hard travel tho? Will it work for hard travel?
what's hard travel? Sorry, I am not familiar with some of the terms
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Travelling/
None seamless travel. It has to occur at least once (when connecting to the server for the first time)
That's what I used it for, yeah
It spawns a Widget on the screen of each player and on certain conditions I remove it(in this case when both players are ready, with a possessed pawn and controller)
How do i use current pawn rotation for movement instead of input?
Testing with low rotation rate
But moving on input diretion is not realistic for a mount anyway
"It is said that the white lion is the messenger of a higher power."
Love it ๐๐ฆ
#newworld #newworldmmo
This is what i want to do
The lion don`t move baaws on player input but on lion forward
I don't understand, why are u testing with low rotation rate?
does the orient to rotations un check or check make a difference?
No, but i did it with custom c++
Look
It works for what i need
but not finished
The movement is using mount forward vector
Toying around with custom values for some actors for how fast NetRelevancy applies and while it's almost instant, I could swear there is still some random delay.
And the delay doesn't get bigger when higher ping fwiw (which I think makes sense).
I don't really want to predict that Actors become non-relevant
The Valorant post isn't really clear on if they use NetRelevancy directly, if they did their own thing and modified the engine or what they are doing.
They do say the sent some "Hide" and "Unhide" "commands", which makes me believe they just hide the actor until the 5 seconds are over and if the actor becomes relevant again before actually despawning they unhide the actor.
Not sure if that's an RPC though or locally predicted. Locally predicting this is kinda shite, cause I don't even have all the info due to ping at the right time if I'm unlucky.
And an RPC is also still somewhat delayed. Will test it anyway but well.
Maybe this causes the problem if I go back and forth too often
// if it is relevant then mark the channel as relevant for a short amount of time
if ( bIsRelevant )
{
Channel->RelevantTime = ElapsedTime + 0.5 * UpdateDelayRandomStream.FRand();
}
AHA
Had to put the hardcoded value that was previously 1 to -1 (or -0.5 I guess) and now it's instant
LoL Cedric have problems too. I have only seen you solving people's problems.
hey everyone, I have this mechanic that uses the Thumbstick input to calculate a curve.
void ACluckCharacter::RotateCharacter(const FInputActionValue& Value)
{
if (bDisableInput) return;
const FVector2d ThumbstickInput = Value.Get<FVector2d>().GetSafeNormal();
StickVector = FVector(ThumbstickInput.Y, ThumbstickInput.X, 0.f).GetSafeNormal();```
That Vector is set to be Replicated. Then I use in a Component that I use to do all my calculations for combat and send it to the projectile I am shooting. The problem is that it seems to work only for the Server, and doesn't replicate to the Client. I think this is the only time I use a parameter from the character and it doesn't seem to work, like I said, all the rest of the stuff is done in a component. I am wondering if anyone has had an issue with trying to replicate something like this? For the setting I do it like this:
```c++
FORCEINLINE FVector GetStickVector() const {return StickVector;}```
```c++
void UCombatComponent::CalculateCurveShot()
{
FVector StickVector = Character->GetStickVector();
UE_LOG(LogTemp, Warning, TEXT("StickVector length On_Rep, %f"), StickVector.Length());```
and when checking the Log, I can see it always gives me a 0 value on the Client.
What happens in a dedicated server scenario, would ACluckCharacter::RotateCharacter get called on the server? That feels like an input function, meaning it wouldn't get called on the server and therefore any replicated properties it sets won't get replicated to clients.
Hello! Tell me why the cursor does not turn off in multiplayer, but in single player everything is fine
i have tried that and client travel via player controller. I am not using steam or epic online services so i dont need / have an online service to connect through, and simply need to pass the users unique id from my auth system when connecting
I see, yes it is an input function. Exactly why I was wondering how to handle this. How do I replicate values that I need from input?
IMO there's no right answer here as there are a lot of things to consider. But to unblock yourself you could start with making ACluckCharacter::RotateCharacter a server-side RPC meaning that method will run server-side only. StickVector will then replicate down to all the clients. You can use a rep notify on that replicated variable as a means to inform your client that the value has been changed server-side and do what you need to do from there. You'll likely run into other issues, but this may be a good starting point.
Possibly because the server is running the code vs. the client. There's not enough information in these screenshots to fully diagnose - I'd say check your logs see if there are any errors or warnings and put some print strings in to see where the code is executing.
Hm, okay. I saw that just changing it to a Server function made it impossible to rotate the character on the Client, so I guess I will need to think about how I replicate that as well
Any multiplayer experts know if its possible and how to replicate this? Using this in abp, and its not auto replicated since its from pawn movement
Runs on all clients
Create a replicated "Vector" variable with replication enabled on your pawn.
Create a Run On Server event with a vector input.
Event Tick on Pawn > Run On Server Event, feed in the "Get Last Input Vector" value.
Run On Server Event > set the Vector variable you created to the value passed in from the event.
You now have a replicated variable on all clients that contains the value from Get Last Input Vector on the client that's controlling the pawn.
My guess would be then that you're creating UI on begin play of Third Person Character.
Yes
Instead of doing this on tick you could do it on movement input for significantly less calls, no?
I have the exact same requirement and my vector is only rpced on a movement input (i.e. when the vector changes)
Like this--make sure you include the second zero-out on Completed or the last value will linger after movement stops. Also just ignore the other nodes ๐
Begin Play fires on all clients, so if you're creating and adding widgets there on begin play, that means each time a player joins the game, you could be adding UI to the local client when you don't need to be.
You're better off creating it in your HUD class or in your Player Controller.
I'm HUD in Player Controller and creating
Sorry for the delayed reply, only just caught this.
I'm having trouble wrapping my head around this response. If I have some crucial event, like a player has equipped an item in his inventory, there's several things a client has to do in response to this event (i.e. update equipment component's equipped items list, update equipped item's "OwningEquipmentComponent" and "EquippedInSlot" variables, moving/destroying/creating UI widgets to represent the change in state, any effects, etc.). That screams multicast RPC to me--I can sync it as one atomic event, with all the needed info as parameters to the multicast, all at once.
How would you do that via replication instead? And why? Mark the equipped items list, and the two variables on the item itself as replicating? Then I'd also need to replicate the itemslist of the inventory the item came out of, and the variables on the item for OwningInventory and InventoryPosX and InventoryPosY, and only after ALL of these various things have replicated to the new state can I react and update UI elements? 
none of that screams RPC at all
Stately things = use a replicated variable.
equipping an item probably means putting an item in a replicated variable in an array or some other structure
every other event can key off of that
It can't though
sure it can
I Just explained, did you read what I said
It was very long and you responded instantly
because I've built inventory systems plenty of times before
nothing you're doing is unique
If I move an item to an inventory slot then I need to know what slot, and if it's rotated
I need 4 variables to move an item to an inventory slot
and that information has to be stored somewhere
and that somewhere can be replicated
But replication is chaotic and unpredictable order
He got the muscle memory
I did solve it by using RPCs 
It works great and I can't understand why I would break it up into this complex system
it's not complex
why can't all of this information be held in a single struct that you OnRep
you can even guarantee atomicity
no
the actual storage of the item
can store this information
and be replicated
it isn't some separate data storage
it's all one place
Every time someonem oves an item, create a struct to represent the action, add this to a list of actions and those are replicated, okay that works but why
no
what is storing the item
where is it being stored
what owns that information
and why can't that information be replicated
If it's in an inventory, it's position is defined in:
Inventory's ItemList
Item's GridX, GridY, Rotated, OwningInventory
so why isn't the item list replicated
and why isn't the item itself replicated
this data already exists
Why does itm ake more sense to replicate the whole item than to just announce the whole change that happened? 
And what happens if GridX replicates before ItemList
I have to code in a 4-way wait-and-go
For all 4 things to replicate?
Then I can react?

why does it matter?
because 1. multicast reliable RPCs shouldn't be a thing, they're beyond expensive
2. this doesn't handle players who haven't joined a session yet - you'd have to listen for players joining and re-replicate all of that information manually
3. the engine already does all of this for you out of the box simply by marking the properties you care about as replicated
I already handle joiners by sending them the current state of all items when they join 
which is horrible
It's a load screen
you're going to have a fun time overflowing the reliable buffer that way
so why isn't that array of structs simply marked as replicated
The structs are serialized item data
UPROPERTY(Replicated)
TArray<FMyItem> Items;
They'd have to be deserialized
why are you serializing anything
Items are not structs
the engine already knows how to replicate objects
Because I was already serializing stuff to save to disk
So player can just send his save game to server and get his items loaded in as he joins
And server sends back saved item datas to unpack 
and you've created more work for yourself that way
you've apparently already done the work so that point is somewhat moot, but I'm not talking about the work you've already done
I'm telling you how such an inventory would be designed from the start.
I know and I'd like to understand because I do not currently
Yes but reacting to changes
Is not hard
is my concern
Once again: atomicity can be a guarantee you make if you really want.
and that assumes you even need it
So in the example of an inventory item being moved (potentially from one inventory to another), where exactly am I reacting to the change in state
does it really matter if two items overlap only on a client for a couple of frames?
OnRep
Yes whihc
OnRep the struct that contains positional data.
OnRep properties in the item object.
Anything you need to react to
Right but I need ALL the properties
So OnRep them all?
So I onrep every single one and mark some "ok this one is ready?" thing and then fire when all are ready?
That sounds like a lot more work 
why do you need to know that
once again: does it really matter if two items overlap only on a client for a couple of frames?
and also once again: you can guarantee atomicity with a struct + NetSerialize
so no, you don't need to check every property
atomicity even comes free with iris, but I won't tell a beginner to use that.
you need to know when every property changes, but you don't necessarily need to wait for every property.
and in fact with a struct containing most data you don't even need that - you just need to know when the struct itself has changes.
Furthermore you've locked yourself in a situation where it is difficult to replicate the items themselves. What if you have an item that needs unique logic that needs to replicate some info between client/server? Are you going to hardcode that as part of your player controller or character? Are you going to spawn an actor to act as a data channel (which you'd have to wait for on a client anyway)?
Hold on brain is cooking, putting the relevant variables on the item into a struct so it goes as one is making some sense 
but once again: you don't even need that for many of the fields you've mentioned
who cares if your grid positions are slightly wrong for a frame or two
I'm using GAS so any thing like that is just in an ability which just works