#multiplayer

1 messages · Page 94 of 1

runic plover
#

if i try triggering it only on the Client it never runs the Ammo Set Function

#
void AWeapon::AddAmmo(int32 Amount)
{
    if (GetWorld()->GetNetMode() == NM_Client)
    {
        UE_LOG(LogTemp, Warning, TEXT("Fired on Client"))
    }
    if (GetWorld()->GetNetMode() == NM_ListenServer)
    {
        UE_LOG(LogTemp, Warning, TEXT("Fired on Server"))
    }
        Ammo = FMath::Clamp(Ammo - Amount, 0 , MagCapacity);
    
}
``` prints Fire On Server and only if there is a Server Player
pure elm
#

this is what I put in my DefaulEngine.ini ```
[URL]
GameName=FiveNightsAtIvans

[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/ThirdPersonBP/Maps/Menu.Menu
GameDefaultMap=/Game/ThirdPersonBP/Maps/Menu.Menu
TransitionMap=
bUseSplitscreen=True
TwoPlayerSplitscreenLayout=Horizontal
ThreePlayerSplitscreenLayout=FavorTop
GlobalDefaultGameMode=/Game/ThirdPersonBP/Blueprints/ThirdPersonGameMode.ThirdPersonGameMode_C
GlobalDefaultServerGameMode=None
GameInstanceClass=/Game/ThirdPersonBP/Blueprints/Game_Inst.Game_Inst_C

[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
MinimumiOSVersion=IOS_12

[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop

#
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum

[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPersonBP",NewGameName="/Script/FiveNightsAtIvans")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_ThirdPersonBP",NewGameName="/Script/FiveNightsAtIvans")

[/Script/Engine.RendererSettings]
r.CustomDepth=3

[/Script/Engine.PhysicsSettings]
PhysicErrorCorrection=(PingExtrapolation=0.100000,PingLimit=100.000000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,MaxLinearHardSnapDistance=400.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000)
DefaultDegreesOfFreedom=Full3D
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableKinematicStaticPairs=False
bDisableKinematicKinematicPairs=False
bDisableCCD=False
bEnableEnhancedDeterminism=False
AnimPhysicsMinDeltaTime=0.000000
bSimulateAnimPhysicsAfterReset=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.016667
MaxSubsteps=6
#
InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10
+PhysicalSurfaces=(Type=SurfaceType1,Name="Grass")
+PhysicalSurfaces=(Type=SurfaceType2,Name="Solid")
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,bUseMBPOuterBounds=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPOuterBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2)
MinDeltaVelocityForHitEvents=0.000000
ChaosSettings=(DefaultThreadingModel=TaskGraph,DedicatedThreadTickMode=VariableCappedWithTarget,DedicatedThreadBufferMode=Double)

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

bInitServerOnClient=true

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

#

Sorry for long message, but I have no idea where I might have messed this up

latent heart
#

Is that the only place ammo is changed?

runic plover
#

that and a function that decreases it

latent heart
#

Well check that function too.

runic plover
#
// decrease Ammo
void AWeapon::SpendRound()
{
    if (GetWorld()->GetNetMode() != NM_Client)
    {
        UE_LOG(LogTemp, Warning, TEXT("Spend Ammo Print on Server!"));
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("Spend Ammo Print on Client!"));
    }
    if (GetWorld()->GetNetMode() != NM_Client)
    {
        UE_LOG(LogTemp, Warning, TEXT(" Spend Ammo Should run on Server!"));
        Ammo = FMath::Clamp(Ammo - 1, 0, MagCapacity);
        SetHUDAmmo();
    }
}

// increase Ammo

void AWeapon::AddAmmo(int32 Amount)
{
    if (GetWorld()->GetNetMode() != NM_Client)
    {
        UE_LOG(LogTemp, Warning, TEXT("Add Ammo Print on Server!"));
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("Add Ammo Print on Client!"));
    }
    if (GetWorld()->GetNetMode() != NM_Client)
    {
        UE_LOG(LogTemp, Warning, TEXT(" Add Ammo Should run on Server!"));
        Ammo = FMath::Clamp(Ammo - Amount, 0 , MagCapacity);
        SetHUDAmmo();
    }
}
``` Result: LogTemp: Warning: Add Ammo Print on Server!
LogTemp: Warning:  Add Ammo Should run on Server!
pure elm
#

wtf does this mean

#

UATHelper: Packaging (Windows (64-bit)): LogAssetRegistry: Error: Package ../../../../../../Users/Holografic/Documents/Unreal Projects/FiveNightsAtIvans/Content/InfinityBladeWarriors/Character/CompleteCharacters/Textures_Materials/CharM_Robo/M_Char_Robo1.uasset is too old

#

on build

runic plover
# pure elm UATHelper: Packaging (Windows (64-bit)): LogAssetRegistry: Error: Package ../....
The error message "Package is too old" typically occurs when you are trying to package or build your project with outdated or incompatible asset files. It indicates that one or more assets in your project are using an older file format that is not compatible with the current version of the Unreal Engine.

To resolve this issue, you can try the following steps:

Update Unreal Engine: Ensure that you are using the latest version of Unreal Engine. Update your engine version to match the version used when creating the project or the version compatible with the asset files.

Reimport Assets: Open your project in the Unreal Editor and locate the problematic asset(s) mentioned in the error message. Right-click on each asset and choose "Reimport" to force the engine to update and convert the asset files to the current format.

Verify Asset Compatibility: If the asset(s) causing the error are from a marketplace or external source, ensure that they are compatible with your current version of Unreal Engine. Check the documentation or contact the asset's creator for any specific compatibility information.

Clear Intermediate and Saved Folders: Sometimes, outdated intermediate or saved files can cause issues. Try deleting the contents of the "Intermediate" and "Saved" folders in your project's directory. These folders will be regenerated when you reopen the project.

Clean and Rebuild: Use the "Clean" and "Build" options in the Unreal Editor to perform a clean build of your project. This process helps ensure that all assets are properly recompiled and synchronized.

By following these steps, you should be able to resolve the "Package is too old" error and successfully package your project.
``` i asked ChatGPT :D
pure elm
#

thanks

#

Im tryna build it rn perhaps it will work

pure elm
#

If anyone has any idea on how to fix it. please ping me

soft flare
#

Hello dudes can someone help me? im trying to replicate my aim offset but it stutters whenever i replicate is for both ends. Can someone help pls?

meager spade
#

aim should be automatically replicated

#

use Character->GetBaseAimRotation().Yaw/Pitch

#

for the yaw and pitch

pure elm
#

I do not really see the issue

meager spade
#

i am not familar with advanced sessions

#

but i do know steam dev id 480 is super bugged with session finding

#

and you should use SteamSockets

#

not SteamNetDriver

#
bEnabled=true
SteamDevAppId=480
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
P2PCleanupTimeout=1.5

[/Script/SteamSockets.SteamSocketsNetDriver]
NetConnectionClassName=/Script/SteamSockets.SteamSocketsNetConnection
ConnectionTimeout=80.0
bNeverApplyNetworkEmulationSettings=true
InitialConnectTimeout=120.0
NetServerMaxTickRate=60
bClampListenServerTickRate=true
MaxNetTickRate=60
KeepAliveTime=0.2
MaxClientRate=120000
MaxInternetClientRate=120000
RelevantTimeout=5.0
SpawnPrioritySeconds=2.0
ServerTravelPause=4.0

[/Script/Engine.Player]
ConfiguredInternetSpeed=60000
ConfiguredLanSpeed=60000

[OnlineSubsystem]
DefaultPlatformService=Steam

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")
#

@pure elm

pure elm
#

So I paste that it DefaultEngine.ini

#

Thanks

meager spade
#

and you cant test 2 copies of the game on the same computer

#

so if your hosting, you would need to load your game on another pc to find sessions

#

with another steam account

pure elm
#

Ooh

#

That must be the problem

#

I was testing 2 game instances

soft flare
meager spade
#

you don't need to do any of that

soft flare
#

i am in lounge if u have a minute

meager spade
#

just get BaseAimRotation from the character

#

and the yaw/pitch will be replicated

soft flare
#

yea thats what i am dooing but

#

when i do that the character model jitters

meager spade
#

make sure your using control rotation also

#

what you mean jitters

#

check your dm

#

@soft flare

quasi tide
#

<@&213101288538374145>

woven bramble
#

Is it enough to write the level name in the URL of Seamless Travel? (Lobby to Next map). Btw I think Seamless Travel is healthier than other methods, do you agree with me on this?

boreal bison
#

Okay, thank you for this, it all makes sense to me. What doesn’t make sense to me is why the client is running the code when it’s the host’s Inventory variable that’s changing and therefore should be the host calling the OnRep, not the client. If it’s the host calling the OnRep, I would expect the host to be able to get their own player controller and run the code the way the client is able to when it’s the client’s playerstate running the OnRep

dark edge
#

Everyone that has that variable runs that onrep

boreal bison
#

Furthermore, if it runs everywhere, why is it not being successfully run by the host and updating his UI 🤦‍♂️

#

this shit is so confusing lol

queen escarp
#

Level Bp is run only on server right ?

#

or rather is rpced ?

latent heart
#

No?

queen escarp
#

oh ok , so im play a day/night cycle on the level Bp but its not being replicated i suppose

#

is that why ?

#

cuz on levle bp

latent heart
#

Actually I don't know for sure. I've always assumed it runs on server and client.

#

This is a good reason not to use the level bp!

queen escarp
#

hm true

nocturne quail
#

if I set the hold gun to null ptr on server, why the weapon is still sttached to the character?

runic plover
#

because you only changed the weapon variable you didnt detach it

nocturne quail
#

it still need to detach?

runic plover
#

i hope you destroyed the actor first and then set it to nullptr

nocturne quail
runic plover
#

wrong way mate

#

if you set CurrentWeapon to Null and then try destroy it, theres nothing to destroy

#

you cant destroy "nothing"

#

you basically deleted the Reference to your weapon and then try destroy it but you dont know your weapon anymore

latent heart
#

Tell that to Albert Einstein. He invented space!

nocturne quail
#

if this is nothing, I can still see it is connected to plyer

latent heart
#

You want CurrentWEapon->Destroy(); CurrentWeapon = nullptr;

runic plover
#

not the actor

nocturne quail
nocturne quail
runic plover
#

bad example but cant make a better one rn

nocturne quail
#

she is in my family list

runic plover
#

ok

nocturne quail
latent heart
runic plover
#

or like that

runic plover
latent heart
#

I still think you're overriding it on the client somehow.

sinful tree
latent heart
#

When I say overriding, I mean you're changing the value on the client so it doesn't match the server.

nocturne quail
#

this solved my issue: CurrentWeapon->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);

latent heart
nocturne quail
runic plover
# latent heart I still think you're overriding it on the client somehow.
void UCombatComponent::FinishReloading()
{
    if (Character == nullptr) return;
    bLocallyReloading = false;
    if(HasAuthority())
          {
            bCanFire = true;
            CombatState = ECombatState::ECS_Unoccupied;
            Character->EnableMovement();
            UpdateAmmoValues();
            EquippedWeapon->SetHUDAmmo();
          }
}

void UCombatComponent::UpdateAmmoValues()
{
    if (Character == nullptr || EquippedWeapon == nullptr) return;
    EquippedWeapon->AddAmmo(1);
}

void AWeapon::AddAmmo(int32 Amount)
{
    Ammo = FMath::Clamp(Ammo + Amount, 0, MagCapacity);
    SetHUDAmmo();
    ClientAddAmmo(Amount);
    //MulticastAddAmmo(Amount);
}
// UFUNCTION(Client, Reliable)
void AWeapon::ClientAddAmmo_Implementation(int32 AmmoToAdd)
{
    if (HasAuthority()) return;
    Ammo = FMath::Clamp(Ammo + AmmoToAdd, 0, MagCapacity);
    UE_LOG(LogTemp, Warning, TEXT("Add Ammo Client Amount: %d"), Ammo);
    SetHUDAmmo();
}
``` here you got the called functions in their order
#

What i just thought about: FinishReloading gets called by a AnimNotify, could that be the Problem why its not setting Ammo correctly?

latent heart
#

And that's every place the the Ammo variable is touched by any class?

runic plover
#

yes

#

except one function where it just returns a bool if Ammo == 0

latent heart
#

Why are you adding ammo via an rpc instead of relying on replication?

runic plover
latent heart
#

You should probably "predict" that that's going to happen (I assume there is a reload animation?)

runic plover
#

well the first time i had set up replication but that didnt work either

latent heart
#

And just let the client assume the reload worked and still fire. If it didn't work, the server won't let them shoot anyway.

runic plover
latent heart
#

Put a log into AddAmmo. Make sure you output the value of Amount as well. In the other method too.

#

Just outputting the final result doesn't account for erroneous input.

runic plover
#

UE_LOG(LogTemp, Warning, TEXT("Add Ammo Client Amount: %d"), Ammo); this prints "1" for me but afterwards its back to 0

latent heart
#

Do you have an onrep? Add logs in that too.

#

Plus I don't see anywhere you actualyl change the ammo when firing your gun.

runic plover
latent heart
#

Maybe you're somehow firing again ?

#

How do you know what your code is doing?

#

More logs. Log everything and everywhere.

runic plover
#

i have a check that if i press fire, it checks for ammo and if i dont have any it does nothing

latent heart
#

Include an "Is server?" option (GetWorld()->GetNetMode() == NM_Client ? 0 : 1) part.

#

Everywhere any part of it is changed by anything for any reason.

#

Not just "this is where it should be changed".

runic plover
sinful tree
#

The issue lies here. The "add" to the inventory doesn't trigger the OnRep on the server.

sinful tree
#

None.

latent heart
sinful tree
#

You need to change the logic a bit in your set up. Promote your "inventory" to a local variable. Add the new 2DWordArray value to the local variable. Set the Inventory to the local variable.

#

Something like this.

#

Alternatively, you could've called the event dispatcher on the particular playerstate after this bit (as well as in the OnRep)

boreal bison
#

I can just call the custom event in the playerstate here, no?

#

and then for stealing I can do the same for the stolen players inventory earlier on in the logic when stealing happens

#

that works for the host but not remote clients

#

:/

sinful tree
#

You must use the OnRep too if you're not.

boreal bison
#

So call it from the gamestate and do onrep which calls the same function?

sinful tree
#

No...

#

Your Inventory OnRep in your playerstate... You need to use that.

#

The problem with having your UI being forced updated by the playerstate is that you'd have to constantly keep updating what is updating in the playerstate which doesn't make a lot of sense.

#

If you use event dispatchers, then the UI that is being displayed can hook into when the change happens so it can update it when it needs to.

boreal bison
#

So having the event dispatcher be bound to an event on the UI?

sinful tree
#

The UI binds to the event dispatcher that you call in the playerstate.

#

The bind would execute a function/event in the UI and the UI can then do what it needs to do based on when that event dispatcher is called.

boreal bison
#

and then call it here?

sinful tree
#

Yep

#

And call it too in your OnRep of Inventory in your PlayerState.

boreal bison
#

boom

#

okay lets see

#

awww yeeeeeeeee

boreal bison
#

LOL

#

so OnRep is mostly for having the clients act on changes to replicated variables

#

for the host, you call it from the server?

sinful tree
#

It's supposed to handle server stuff too (in blueprint) but "Add" in the inventory is one of those quirky things where it's not really setting the variable so it doesn't processes it as an OnRep.

boreal bison
#

ahhh

#

leave it to quirky things

sinful tree
#

It goes under the radar with Dedicated Servers as usually you don't need to care much about OnReps on server in that case. With listen servers you do since they may need to do similar things as clients.

boreal bison
#

Right, that makes sense

sinful tree
#

In C++, OnReps aren't called on servers at all, so you have to manually call it if you need it 😛

boreal bison
#

ahh yeah

#

C++ game dev not super in my repertoire, maybe some day

#

but anyway for the umpteenth time, thank you for your patience and knowledge

sinful tree
#

Glad I could help and that we got it figured out 😄

boreal bison
#

me too! everything is not quit bugless yet but the UI is now updating so I can use that to help me figure out what game logic is messed up lol

wanton bear
#

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_MainGameState_C_0. Function AddCrystal will not be processed.

I'm calling the function add crystal in main game state from an actor blueprint when it overlaps to add one to a variable in gamestate, it appears to be doing everything correctly but i keep getting this warning

#

nevermind i see what i've done, the function is being called from a multicast

thin stratus
#

Servers RPCs require the calling client to own the actor which isn't true for the GameState

cedar lagoon
#

Hi guys, how I could show/hide a widget inside an actor in multiplayer listen server model only for the player that entered a zone inside that actor.
I tried several things but cant get it working.
For instance: As the host player when I enter the zone it shows for all player (which i dont want)

kindred widget
cedar lagoon
#

@kindred widget Well I did already and yes it works. But I found one case where it does not work.
My actor have the ability to be "upgraded" which is basically asking the server to destroy the current actor then spawn a new upgraded one, and then since this upgraded actor is an instance of the old actor BP class, the logic for handling the overlap and hide/show the widget is the same.
Now when I upgrade this actor as a Client, the player is still in the zone, so the overlap logic triggers, and there the visibility for some reason is showing for the host as well which should not

kindred widget
#

You're using an IsLocallyControlled check?

cedar lagoon
#

@kindred widget Here is my BP, the 'Update Interactio Widget' is basically setting the visibility to true + formatting text.

worthy wasp
#

Is there any cost difference in bandwidth/processor for having a delegate fired that remote clients would bind to - instead of an interation of GameState::PlayerArray & RPCing a client-side funct?

quasi tide
#

Delegates are local only

#

Remote client can't connect to the delegate on the server

worthy wasp
#

well that sums that up! got it

nocturne quail
#

how to refresh character bones where the weapon was attached?

#

the problem is the skeletal mesh remains in the character hands after destroying the weapon actor

#

the actor is 100% destroyed, it has no issue

tame quarry
#

Im using a lot of FMath::RandRange to calculate who kills and who dies during combat.
Like i have units that are stronger with higher probability of killing enemies.
A friend of mine told me this will be a mess when making it multiplayer.
Because then one machine will have a different random value than the other
Is this true?

sinful tree
pallid gorge
#

Why 'armor' doesn't work? What's wrong?

sinful tree
pallid gorge
#

It doesn't take damage for the armor. But if i change in 'take dmg hp' the 'cur hp' and 'max hp' to the armor ones that are in the secs pics then it works

#

Only the first event works

#

If I replace them in the "TakeDamage" event then it works, TakeDamageArmor doesn't

sinful tree
#

Are you sure that you're even calling the event? Like did you try putting print strings in and see if there's values coming out or that it indeed is executing?

pallid gorge
#

How?

#

If i set it like this, with cur hp and max hp, then it works

#

the same event

sinful tree
#

How do you know the Armor values don't work? What are you doing to check that they are not working?

tame quarry
# sinful tree If you're using replicated variables to represent the values and are setting the...

Thanks. Yeah but these are calculation that happen quite often. So they need to be sent to the clients.
I dont have yet much experience in multiplayer. But from what i can tell from other projects. Sending a lot of stuff over is not good.
One my friends told me that i can use randomizations for combat. But they need to be deterministic so that they happen the same way in every machine. That way i dont have to send the randomizations everytime

sinful tree
sinful tree
tame quarry
sinful tree
sinful tree
# pallid gorge Yes

Is it just that the values are not being received or the event dispatcher bind in your HUD isn't firing?

pallid gorge
sinful tree
#

What is in those functions?

pallid gorge
sinful tree
# pallid gorge

Ok and what are your default values for Armor Class and Max Armor Class (or are you setting them anywhere else before they're being used?)

pallid gorge
#

i think this

#

?

#

But it just save stats into the db

sinful tree
#

Do you populate any values into Armor Class and Max Armor Class anywhere, including in the variable defaults?

#

What I'm getting at, is if they're both at 0 to begin with when you're triggering the TakeDamageArmor event, you're clamping the value to be 0, so that means your ArmorClass remains at 0 which means there would be no change so no dispatch is fired as the OnRep wouldn't trigger.

pallid gorge
sinful tree
#

Your events are functionally the same, just the variable being changed is different. There should be nothing different about how they funciton except for initial values.

pallid gorge
#

If I take the first event, and i replace 'cur hp' to armor class and max hp to max armor class, it works for armor

#

:///

#

but i need both hp and armor

sinful tree
#

Then that again leads me to believe that you're not appropriately calling TakeDamageArmor - put some print strings into it, see if you get them to print something.

pallid gorge
#

At the other side, if I take takedamagearmor event and i replace armor to hp, it does work with hp xDD

sinful tree
#

Do you have any replication settings on the variables themselves? Should be in the same spot where you define the replication type for the variables themselves.

pallid gorge
#

Yes

#

RepNotify

sinful tree
#

Can you show how you are calling TakeDamage and TakeDamageArmor?

pallid gorge
sinful tree
#

You're probably overriding the timer handles.

pallid gorge
sinful tree
#

These two events are in the same actor/component, yea?

pallid gorge
#

Yes

sinful tree
#

So when you're setting the timer handles and calling to clear them, you're using the same handle variable for both damage and armordamage. They would need their own variables in order to be handled separately

#

A little more clearly here... Both events are clearing The "Regen Tick Timer".

#

So either they both should be executing on the same timer, or if you want to use separate timers, then you need to create and use new timer handle variables for the damagearmor timers.

pallid gorge
#

I just want that the armor decrease with time. What is the best way to do it?

sinful tree
#

A timer is a good way to do that.

pallid gorge
sinful tree
#

How about trying to call it separately and see what happens - forget all this timer stuff. What happens when you just call it?

pallid gorge
#

Idk I give up

#

Thank you

left geyser
#

Hello everyone. I have manager objects (derived from AInfo). I want these manager objects to be spawned by my custom GameMode and for them to be replicated to the clients. What's the proper setup in order to achieve this? I tried copying what the folks at Epic did with the GameState, but it seems my manager objects are missing on the clients. In other words, what is the proper way to create an Actor on the server and replicate it on the clients?

rich locust
#

but maybe untick netload on client, if it is something you already setup in the level before hand

#

that bool spawns the managers both sides

#

you want it only on to be server side

left geyser
#

Hello, thanks for answering. My question is a bit vague. I will summarize what I need to achieve.

latent heart
#

You simply need to set the replicates bool to true in your actor constructor, I believe.

#

And potentially bAlwaysRelevant.

unkempt tiger
#

anyone else just setting bAlwaysRelevant on literally everything? 😄

quasi tide
#

God no

latent heart
unkempt tiger
#

i am guilty

#

though ive yet to see a problem surface

#

just going to ignore the yellowstone-tier technical debt explosion waiting to happen for now 😄

nocturne quail
#

when we need to use DestroyNetworkActorHandled();

thin stratus
nocturne quail
# thin stratus Unless you have an actual reason, probably never

I have this issue, The item weapon is generated and attached to the character in the first image, and destroyed in the destroyed on server and spawned in level.
Logically when destroyed, its mean deleted from Character, but the ghost instance is still remain attach to the character

#

Attachment is done on server->multicast and drop/destroyed is done on server only

#

I have only one option to setvisibility(false); but this make no sense, if the actor is destroyed , it should go away

thin stratus
#

Just has to e done on the server

steady cape
#

Okay, so, I've stumbled on a century old issue

#

I need to replicate my weapon inventory to the client on BeginPlay, but, because weapons are still not created on clients, it just ends up replicating a bunch of nullptrs

#

What do I do?

thin stratus
steady cape
#

Using OnRep_ would mean I have to check what weapon was added/removed, which I consider a lot of overhead

#

I mean, I could use both RPCs and OnRep_s, but that's just a bandwidth waste

real ridge
#

I have question I know game instance is persistent and if I am in offline part of my game means menu lobby login, and then from lobby I am joining dedicated game server with its own map my game instance still persist, but I wanna use player state and I know player state being deleted after joining dedicated server, so I got idea when I join dedicated server does PlayerState run again begin play or not ? or it will just get erased

#

I wanna use Begin play of player state but I am not sure if it will be called again after joining server

steady cape
#

Yes, if it's your first time joiningactually, it's called always on join

real ridge
#

as name , team etc
right?

nocturne quail
# thin stratus You'd need to show the code. Also Attachment of Actors doesn't need a Multicast....

ItemWeapon.cpp

WeaponMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("WeaponMesh"));
WeaponMesh->SetupAttachment(NewScene);

MyCharacter.cpp "" Event generate and attach weapon to character pressing 1

MyCharacter::GenerateAttachWeapon()
{
    AItemWeapon* NewWeaponItem = GetWorld()->SpawnActor<AItemWeapon>(ItemWeaponClass, Transform, SpawnParams);
    if (MyPlayerStateRef && NewWeaponItem)
    {
        WeaponItem->WeaponMesh->SetSkeletalMesh(WeaponDatas.SkeletalMesh);
        NewWeaponItem->FinishSpawning(Transform);
    }
    WeaponItem->SetActorTransform(PlayerMesh->GetSocketTransform(WeaponSocket, ERelativeTransformSpace::RTS_World), false, false);
    WeaponItem->AttachToComponent(PlayerMesh, FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::KeepWorld, EAttachmentRule::KeepRelative, true), WeaponSocket);
}

MyCharacter.cpp "" Event Destroy the attached actor from character pressing 2

MyCharacter::DestroyWeaponActor()
{
    WeaponItem->WeaponMesh->SetSkeletalMesh(nullptr);
    WeaponItem->Destroy(true, true);
}
real ridge
thin stratus
#

@steady cape The OnRep would solve your issue though :p

#

It's meant for this kind of problem

thin stratus
#

Both spawning and destroying should only happen on the Server if the actor is replicated

steady cape
#

Well, considering the most of it's capacity is 2 weapons, I guess looping over entirety of it to figure out what is added and what is removed isn't going to be much of a burden on CPU

thin stratus
#

There you get a callback per item

steady cape
steady cape
#

Because it's crutial

thin stratus
#

Eh, would need to check, but I think so

#

It's what you use for Inventories

steady cape
#

Alright, I'll try to use all this info tomorrow

thin stratus
#

It's a wrapper for a TArray

#

But it allows for delta serialization

#

C++ only of course

#

(the implementation of it)

thin stratus
steady cape
#

It does trigger OnRep_ correctly, doesn't it?

nocturne quail
thin stratus
steady cape
#

Just, in general

thin stratus
steady cape
#

Afraid it'd trigger in chunks

thin stratus
steady cape
#

But I suspect not

#

Still want to confirm it though

thin stratus
#

You mean the FastArray stuff?

steady cape
#

Ye

thin stratus
#

It has callbacks on the FastArray Items

#

Per Item

#

Which you can then route back to your owning object

#

The FastArraySerialization Header has a lot of info in it

#

with example implementations

steady cape
#

Yeah, definitely tomorrow

#

Cheers

thin stratus
#

It's not the traditional OnRep in that case

#

If that was your question

steady cape
#

I figured. I'll give it a read

nocturne quail
thin stratus
#

And check what calls when

nocturne quail
#

by logging everything is working fine

thin stratus
#

So you get only 2 calls?

#

One for Create, one for Destroy?

#

Cause that's all you should get

nocturne quail
#

yes One for Create, one for Destroy by different keys

real ridge
#

guys what is loaded earlier player controller or player state?

nocturne quail
#

1 and 2

thin stratus
real ridge
#

if I have in begin play of player state setting of TEAM AND NAME can I already in begin play of his controller load it ?

#

or it will be not successful

thin stratus
#

Not sure the order of BeginPlay is fixed

real ridge
#

eh so I should use game instance in controller

#

still 😦

nocturne quail
#

as you can see in here, the actor is destroyed and deleted from the this list

real ridge
#

or I Will just call that function from player state and done

nocturne quail
#

but still the mesh ghost is attached to the character

#

when I generate actor, it attached correctly to the character

real ridge
#

but theoreticaly its fine for me as my server is dedicated

#

I just need clients to work

thin stratus
#

And the order of BeginPlay is probably not guaranteed in any way

real ridge
#

okay

#

then rather will use game instance

#

bcs I have spawn logic in player controller

#

so I need know his team there

#

wanted use player state here

#

but okay

#

😄

thin stratus
#

@nocturne quail So if I get you right, the Actor is destroyed on server and client, but the SkeletalMesh is still visible (on everyone?)?

thin stratus
#

Are you doing anything special with that MeshComp? can you show the whole Constructor, without editing things out?

real ridge
#

just quick question I see you have good talk here, is fine to spawn actor via controller?

#

😄

#

I am using own spawn points etc

quasi tide
#

Sure. Only requirement is the server spawns it really. (At least for the most part)

real ridge
#

just asking if I should refactor or not

nocturne quail
real ridge
#

only thing I dont like I am using game instance 😦 I wanna use player state but I have no idea if it will be loaded before this

thin stratus
#

On the Server it is valid when you need to spawn

#

If you are coming from a Lobby, so you are already connected, then you can also put the stuff on the PlayerController

#

The GameMode should have a function that allows you to move the data between previous and new PlayerController.

real ridge
#

😄 so

#

its bit complicated

real ridge
#

max game state and instance for team and nick

thin stratus
#

Hm okay

real ridge
#

this is how I am trying to store name and team in game state

#

as my server is dedicated I except i dont need authority node

#

I hope it will be stored for everyone so everyone can check team and nick based on player state

thin stratus
#

You write GameState

nocturne quail
# thin stratus Are you doing anything special with that MeshComp? can you show the whole Constr...
#include "Items/ItemWeapon.h"
#include "Components/SkeletalMeshComponent.h"
#include "Engine/SkeletalMeshSocket.h"

AItemWeapon::AItemWeapon() {
    SkeletalMesh = CreateDefaultSubobject<USkeletalMeshComponent>("SkeletalMesh");
    SkeletalMesh->SetupAttachment(Scene);
    ItemWeaponTablePath = TEXT("/Game/Datas/DT_ItemWeapon");
    ItemWeaponTableObject = Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), nullptr, *ItemWeaponTablePath));
}

void AItemWeapon::OnConstruction(const FTransform& Transform) {

    FSTR_ItemWeapon* ItemWeaponRow = nullptr;
    ItemWeaponRow = ItemWeaponTableObject->FindRow<FSTR_ItemWeapon>(ID, TEXT(""));

    if (ItemWeaponRow) {
        Datas = ItemWeaponRow;
        Datas1.Name = Datas->Name;
        Datas1.Thumbnail = Datas->Thumbnail;
        Datas1.UseAmmoID = Datas->UseAmmoID;
        Init(EItemType::EIT_Weapon,ItemWeaponRow->Name);
        SkeletalMesh->SetSkeletalMesh(ItemWeaponRow->SkeletalMesh);
}
thin stratus
#

But this code is in the PlayerState

thin stratus
thin stratus
#

Cause I can't say that I ever used OnConstruction in C++, outside of maybe trying to mimic ConstructionScript stuff

#

Just sanity check would probably be good

nocturne quail
#

I can move the code to BeginPlay now to check if it solve it

real ridge
thin stratus
#

this is how I am trying to store name and team in game state

real ridge
#

oh just one typoo other time I used player state sryy

#

😄

thin stratus
#

Ah okay

real ridge
thin stratus
#

Yeah the issue is also that you call the RPC on everyone anyway

#

So every other player will drop this

#

Does the RPC not work at all?

thin stratus
#

No, to you

real ridge
#

Its stored but it seems I cant read values as client just server

#

its on begin play because everyone who join need to load name and team

thin stratus
#

Sure

real ridge
nocturne quail
thin stratus
nocturne quail
#

I doubt the sockets on character are not updated

#

they store ghost mesh

thin stratus
thin stratus
#

There is no reason for it keep "ghost meshes" around

#

Unless you are somewhere doing something funky

thin stratus
#

Yeah

nocturne quail
#

I think this is a bug in the engine

real ridge
#

it was empty heh

thin stratus
real ridge
#

😄 idk if these delays are good to use

real ridge
#

I need execute some events after TEST function F

thin stratus
#

Use your brain please

#

You are calling a ServerRPC

real ridge
thin stratus
#

And you set a Replicated Variable

nocturne quail
thin stratus
#

And then you wonder why the variable is still not set and you need a delay

#

Have you ever heard the word "ping"?

real ridge
thin stratus
#

If you need it to be valid locally instantly, then set it locally too

real ridge
#

SHould I use is valid?

thin stratus
#

Team can't be instantyl valid if all you do is ServerRPC and set it on the Server

#

Cause the client would need to wait on the replication

real ridge
thin stratus
#

Yeah but then it's normal that it takes time

#

And you can't use a delay for this

#

If you need a function to call from that Team replicated, make Team OnRep/Repnotify

thin stratus
#

What happens if you remove the whole SkeletalMeshComponent?

#

Like, completely, for testing

#

Cause, like, it should not remain in anyway

#

The only times that could happen is if attachment would be wrong or buggy, or if someone spawned the Actor locally too

#

Or stuff like that

nocturne quail
#

I can test it now to remove the SkeletalMeshComponent in runtime

real ridge
thin stratus
real ridge
#

u can see

crystal palm
#

is there anyway to get free game server hosting in ue5?

thin stratus
real ridge
#

Last question when I do respawn of player so he dies and I take his controller etc and respawn him, does his player state execute begin play again or not?

#

or I should call it somehow so it will set his name, team again?

shy gust
thin stratus
#

Dedicated Servers hosting is paid

#

Everywhere

#

Unless shady

#

If you can't pay for whatever reason, make a ListenServer game or let user host the Servers

quasi tide
#

Stick it to the man. Make your own server. Just get a computer and open it up to the world wide web. Now you're off to the races!

thin stratus
#

If you need Servers to be hosted due to whatever competitive online play, think about a different game or pay

shy gust
#

with steam from what ive heard you just pay 100usd to use their servers ? but thats also if you really want your game on steam.

quasi tide
#

You pay $100 to get an app token. You can use that app token to upload a game, a piece of software, etc...

thin stratus
#

You can use their Servers in terms of the data they provide

#

Session Info, User Data.

#

Achievments and crap like that

#

Game Server hosting is not part of it

#

The actual physical or cloud Server that a Dedicated Server runs on is not provided by Steam

#

neither be Epic/EOS

#

Or anyone else for free :D

shy gust
#

thats interesting , i havent heard anything about needing to find a new server provider when watching/reading tutorials on steam networking , they just say you need to make a new app number and not use the dev one , and networking will work as it does on the dev id , just specifically for your game.

thin stratus
#

Yeah

#

ListenServer

#

And the general idea of Sessions

#

That#s about it

real ridge
#

guys pls 😄 how I can cast to my player which is owner of this playerstate my cast is failing

#

its connected to Remote

#

I should get another object?

quasi tide
thin stratus
#

To be fair

#

The Pawn could just be invalid

#

If this is right after starting/spawning

#

Replication says hi

real ridge
#

its after I set name and team in state then I wanna call function dirrectly inside my pawn

#

and set its ui

#

calling this

shy gust
real ridge
quasi tide
#

Then the pawn is invalid, like Cedric said.

thin stratus
#

@real ridge The stuff you are trying to do requires a lot of OnRep stuff

#

And a lot of that is C++ only

real ridge
#

i will simplify it

thin stratus
#

If you can't use OnRep, then you have to do it from both ways

real ridge
#

I will just use game instance variables inside pawn

#

and f it

quasi tide
#

🤨

real ridge
thin stratus
#

Sure, this whole init stuff is a pain in UE

#

OnRep helps here but Epic doesn't expose the native ones

real ridge
thin stratus
#

And the only other way is to kinda ask from both sides

#

So Character tries to get it from PlayerState and other way round, idk

#

Still not ideal

real ridge
#

i just wanted to get rid of game instance because I was scared people can easily "hack" it

thin stratus
#

They can 100%

#

If you don't want hacking you can't do it like that at all

#

Then you need to ensure only the server has that info

shy gust
#

Does anyone here know any resource anywhere that would be good for networking a racing game, where vehicles are moving on average 5k-9k forward velocity ? its a major block ive been kind of avoiding , ive been using Smooth sync for my project so far but the results are either very inacuracy , tho i know positions will always be inaccurate to a degree in a racing game and most of it is smoke and mirrors ,
but exactly how to set something like that up goes way beyond my comprehension. id likely Commission someone to either teach me or set it up for me when i take the time to focus on it

thin stratus
#

Racing games I would just make the car client auth

#

F1 for example is also Client Auth

#

Just too much trouble otherwise

real ridge
#

ahhhh

shy gust
#

right thats what im doing , but the position that other players see has the issues mentioned

#

i havent really figured out what i need to do , i think in general from what ive researched you need client side prediction? but i have no real clue , like Hotwheels unleashed and KartRider:Drift were both made in unreal and have decently synced up vehicles so i know its possible to do , but iunno if its outside of the realm of possiblity for a solo dev

real ridge
#

Guys when I am setting something and I can see it fine but every new joined player cant see it because it was already loaded before he joined?

#

How I can load it also for him?

#

its in RPC

nocturne quail
#

everything works fine if I test the same logic in my other project with standalone mode

glass orchid
#

Does APlayerController's OnPossess not get called on the client?

quasi tide
#

No. Should tell you that on the comment for it.

#

In C++, they have a function (I think it's called like AcknowledgePossession) that does get called on the client though.

glass orchid
#

thanks though, ill look for it!

#

altough one more question, once the client Acknowledges possession, can i guarantee that Gamestate is valid on client, or do i need to account for it possibly not having replicated yet?

quasi tide
#

I wouldn't trust it personally. Only time I know GS is valid is when BeginPlay is called, as it needs to be present in order to even start calling BeginPlay on all actors.

crystal palm
#

?

shy gust
#

Ive only heard of UE having a listen server option thing similar to Steams. but i havent looked into myself , youll have to do some researching broski

quasi tide
#

UE supports Listen Server setup out of the box.

latent heart
#

That sounds like a nightmare.

#

What is the situation?

dark edge
#

I can't picture any situation where this would make sense

#

You're basically rate limiting mouse movement

latent heart
#

Nobody will l ike that.

dark edge
#

What do you do if some XxXNoScope gamer has his dpi turned up to 9000 and flicks his wrist, just not rotate very much?

#

hmm intredasting

#

1st or 3rd person?

#

I'd have Input -> camera always be a direct mapping

#

never ever breaking that

#

but you can of course have limits on camera -> character mapping

#

You'd probably have to incorporate some rotation data into the CMC to have it play perfectly nice, not sure how hard that'd be to do

#

basically have orientation be part of a move

#

That's where I'd go with it anyway if it was me

#

oh idk

#

I've never dove into the guts of CMC before

#

if it is then you can presumably make it predicted + corrected

#

I'd also ask the GMC guys if they can do it

#

arbitrary collision shapes I suppose

#

other improvements

nocturne quail
#

now it is working fine to destroy and regenerate

woven basin
#

Is there a PDF version of the new network compendium (to make it read offline)? Or just the website now?

nocturne quail
real ridge
#

guys why when I am setting name via repnotify its not nevwly joined dont see my name?

real ridge
#

also how I can cast to my playerpawn from player state this is not working

thin stratus
thin stratus
woven basin
real ridge
nocturne quail
thin stratus
#

But you might not be able to do that in BeginPlay, as the Pawn isn't possessed at that point

real ridge
#

custom event called on server

#

yea but if not at begin play then where 😦

thin stratus
#

OnControllerChanged for example

#

Limited to IsLocallyControlled

#

Cause it calls for server and client

thin stratus
#

Yeah I mean

#

That's basics of networking right?

#

Replicated variables have to be set on the Server

#

Pretty sure you should know this by now :D

real ridge
#

yea but I was confused when I used this approach because I Had to also set variables immediately localy because then it was not updated till first change of name

#

and I had empty nametag

thin stratus
#

Yeah, cause that's what Ping is about. If you tell the Server to set something it will take the full round trip time

#

If you need it instantly on the local client then you have to also set it locally

real ridge
#

idk

thin stratus
#

Well I also said that you can't RPC on BeginPlay cause the pawn is not possessed most likely

real ridge
#

yea I am watching it and it seems like first one who was spawned has not set name for second one

#

but as its repnotify it should

thin stratus
#

Just moev the call to OnControllerChanged

real ridge
#

I moved , but its still same first joined has like not working repnotify

#

strange

#

but as soon I kill player and he respawns I see correct names and healthbars

#

wtf I tried to just on every login reload names of all and its same wtf

queen escarp
#

changing bools should be enough playing on serverside right ?

#

dont have to multicast those :/?

drifting stirrup
#

what is state sync
is it sending inputs and correcting every now and then with state
or is it sending both at the same time

twin pendant
#

Hey, i am facing the following problem. Anim Montage seem to play with a much faster play rate on clients than on the listen server, even though they are 100% played both with a playrate of 1.0

sick egret
#

Hi, is it possible to re-use the currently loaded map when joining server?
The client discards the map, then travels to server map, which is likely the same one. That takes a while, and seems unnessecary.

chrome bay
#

It's generally more effort to cleanup than it is to re-travel to the same map tbh.

sick egret
#

understandable. but i'm running into connection timeouts, because the lobby map is pretty big

thin stratus
sick egret
#

Not yet. Is that how it goes? Client sends life signals between streaming levels?

thin stratus
#

Streaming Levels are generally used to solve performance and load time issues

#

Not sure what you mean with life signals

#

The persitent level would need everything crucial

#

And other stuff that just takes time to load goes into sub levels that you can load post travel

sick egret
#

It's that the client just time-outs after 120 seconds. When loading the mainmenu/lobby map locally, it's there in a fraction of the time

#

All concerns about map size and streaming levels aside, I'm confused about why there isn't a second thread on the client, giving a 'yep, still here, but still loading' every now and then

upbeat basin
#

If I were to set the capsule component of my character blueprint as ComponentReplicates and change the collision response channel on the server, the change isn't replicated to the clients. That means collision preset isn't a replicated variable (if it's a variable), right?

#

And if so, is multicasting the collision response change only way to do this?

nocturne quail
#

do variables in player controller ever need to be replicated?

upbeat basin
nocturne quail
#

Thank You for help )

upbeat basin
# nocturne quail I will never do it then

Well according to my possibly-wrong opinion, that could maybe be a way to indicate things to the client by using OnRep functions rather than RPCs, don't know if or what we would save though

chrome bay
#

Nothing wrong with having replicated vars in player controller

nocturne quail
nocturne quail
upbeat basin
#

Yeah it can be considered as replication condition to owner only by default

chrome bay
#

Exactly

nocturne quail
#

but while in development, the second client even don't have controller, can't even call a function from pc class on the second client, becasue the controller is always null

chrome bay
#

Put it in whatever place makes the most sense

#

If you need information about a player to be available to other players, it belongs in the player state

#

Controller relevancy doesn't change in packaged vs development

nocturne quail
#

in editor mode

chrome bay
#

No reason it should. Two players means two controllers.

nocturne quail
#

key action is binded in the character class

#

an event in character class is calling an event from controller class

#

the ref will always fail on second client

upbeat basin
#

Are you trying to get the controller of the other client through the simulated proxy of the character maybe?

nocturne quail
#

this print always fail on the client-2

upbeat basin
#

Well yes that's the expected result

#

You're working on listen server right?

nocturne quail
#

nope, I will build dedicated

upbeat basin
#

No I mean in the editor

nocturne quail
#

in editor I play as client

#

no listen

#

both windows are clients

upbeat basin
#

Hmm, then I would expect you to get nullptr from the first client as well

nocturne quail
#

nope, the first is not null

#

I can call functions from controller on first client

upbeat basin
#

Clients will only have their own PlayerController in their process/machine, unless it's a listen server

nocturne quail
#

I play as 2 clients

#

in the drop down list, it is set as client

#

not as listen

upbeat basin
#

So if you have 2 clients and 1 server, each client should have 2 characters (one for themselves and one for the other player) but only a single PlayerController (only theirs). So it's normal that you're getting null from trying to getting player controller from all characters

#

What's not normal for me is you should get nullptr from client 1 as well

#

Because client 1 also have the character of client2, but not their player controller, so that should also say GetController - Nullptr

nocturne quail
#

dunno, but it is working for first client

#

can you test it on your end

upbeat basin
#

Okay wait, how do you know which client prints the log?

nocturne quail
#

I am checking if the controller is null before calling the function with red color log

#

when I call from client one, it works and no red log

#

if called form client 2, it says controller is null

#

beside it the tick is also logging null controller in cyan color

upbeat basin
nocturne quail
#

yes

upbeat basin
#

How do you know from which client it does come from?

#

Can you open the log timestamps and send a section of the log like that?

nocturne quail
nocturne quail
upbeat basin
#

My guess is you're mixing the logs, otherwise I'm not sure what's going on or if my knowledge is enough to answer

nocturne quail
#

hope I will find it

nocturne quail
#

or maybe old

strange geode
meager spade
#

sounds like your trying to expose it to blueprint

#

which is not possible

strange geode
#

yes ty, it was the ufunction macro

winged wave
#

When you run your game with Net Mode "Play As Client", it basically creates a hidden dedicated server process right?

winged wave
nocturne quail
#

why do I have one controller when running two clients?

wanton bear
#

for something like a flashlight, wouldn't it make sense to replicate it only to the non owning clients to save a little bandwidth

quasi tide
pallid gorge
#

Hi guys, I have a bug. When the 'armor class' reach 0, it does 'die', but it keeps decrease. How can I fix it?

#

Once the player die, it should stays 0/200

latent heart
#

Check if they are <= 0 before changing.

#

And use clamp.

nocturne quail
nocturne quail
quasi tide
#

You can't look through both at the same time. You can switch the world outliner to the server though. I forget how.

#

But it is some button in that area of the editor when playing the game.

nocturne quail
#

hmm, I will now look for this button , will update if I found or !found

halcyon totem
#

is this the correct way to do an append? Level exists

upbeat basin
pallid gorge
#

I think I fixed like this?

latent heart
#

Well, no.

#

Ignore what I said earlier about clamp, use max instead.

#

That will work with just a 0.

#

For clamp you also need to specify the upper bound and you haven't.

pallid gorge
#

It does work

#

It's good?

latent heart
#

However

#

You character will now die every 1s repeatedly.

#

Unless you have some way of stopping that in the die method.

pallid gorge
#

Yes

#

It does die repeatedly

#

when reach 0

#

How can I fix?

latent heart
#

Add in a bool or something that checks whether Die has already been called.

#

"IsDead"

#

if it's false, you can call die. If it's not true, you can't.

#

Make it the first thing you check in Die

#

So you can call Die from anywhere and it will never happen more than once.

pallid gorge
#

I have 'isAlive'

latent heart
#

Use that then!

pallid gorge
#

but how?

nocturne quail
#

why the second client is not doing LineTraceSingleByChannel ?

pallid gorge
#

it should be a condition

#

im still learning sry for these basic question

latent heart
#

The power of paint.

nocturne quail
#

and the second client raycast is not detecting the valid items

pallid gorge
latent heart
#

You need to do that inside your Die function.

#

You don't know how to set variables?

wanton bear
#

how do you deal with simulated objects? im testing a ball that you can push around, on the client thats pushing around the ball, its very laggy with them jumping towards and away from the ball, while on any client watching it looks normal...

#

this is with average pings and no packet loss

latent heart
#

Probably because the client pushing the ball around is updating the server and then the server is updating the client back and they are getting desynced because of the ping.

#

Physics is very hard over networks. You've seen that in other games, right? Where things flip out and shoot off into the sky, etc.

pallid gorge
drifting stirrup
#

what is state sync
is it sending inputs and correcting every now and then with state or is it something else

boreal bison
half umbra
#

hi, where should I put player skills/attributes? (Variables)

#

Player Controller or Character Pawn?

pallid gorge
latent heart
green fjord
#

hey guys im currently develop a dodge ball game 1v1 (server vs client)
i want to spawn a ball on each near character (server and client).
i called this on BP_ThirdPersonCharacter at Event Begin Play.
the ball actor already replicates turn on.
but on the client side, the client didnt see his ball, only the server's character ball.

half umbra
#

I just don't know what to do
😄

#

'

#

@latent heart

#

where is the best place

latent heart
#

My house

green fjord
slender spruce
#

Hi, I am trying to add a multiple player controlled character in Lyra Sample Game. To better explain it imagine a three-headed Cerberus where each player controls a head and can use the respective different ability. Only one player can move the Cerberus. So far I have tried:

  • Creating a Master character with 3 child actor characters. On trying to possess assigning each player to a different child actor. The problem is, because as a client I do not directly possess the Master character, when I try to activate the ability as a client it fails, because it has the NetRole=ROLE_SimulatedProxy.

  • Principle the same as the solution above, but the players activate abilities on their own pawn, and the Abilities/montages play on the master character. Problem is when trying to move the Master character as a Client I found no way to do it.

  • Tried going around the engine’s Pawn<->Controller 1To1 relationship, adding multiple controllers possessing one pawn, but it looks like a bad solution.

  • Thought about using fully different characters without a master one, but I can’t think of a way to attach the meshes with blending them so they don’t look like separate parts

I want to keep GAS prediction, so I am trying to find a solution without sending input RPC’s to the server. I do not have any more ideas how to approach this , so maybe someone could give me ideas or any help on how to solve this?

latent heart
#

Which one owns the skills?

half umbra
#

I want the player not to lose these statistics, so the best place for it would be PlayerController, but I don't think it should even be stored there, but somewhere in GameMode, so that after loading the game, the server has all the information about the player.

#

the pawn will have skills

latent heart
#

Not the PC, maybe the PS.

#

You can transfer PSs between levels.

#

Or you can mirror the information on the server's GI.

half umbra
#

and where would YOU put information about what player has how much strength, dexterity, etc.?

#

@latent heart

latent heart
#

It depends on who owns them. If they are properties of the player, on their PS.

#

You might have both - properties of the player which then inform properties about the pawn, so you can have different stats in both places.

#

In general, put variables on the things which actually own the data.

steep ledge
latent heart
#

Correct

#

The answer is not "here is the best", it's "it depends" and that's a very good example of that.

#

You might run into murky ground where they both have the same sort of stat, let's say your permanent upgrade is a stat like strength, but your character also has a strength value - it's fine to have that in both places.

#

Your character may just be "here's my base strength, now I'll add on my permanent bonus"

steep ledge
#

Hmm, yeah - that's interested too when you talk about things like resources/post mission rewards.

You might even have it stored on the character until the end of the mission - in which case it gets added to the player (since they win) or modifed somehow (50% is lost, or whateves) if they fail.

#

(If that's the type of game at least)

latent heart
#

Yeah, exactly.

#

And you can see the same logic about per-server and global account information.

steep ledge
#

Question then, is the engine assumption that the Pawn is not perpetual storage?

latent heart
#

You might have some bonuses that accumulate on your player based on what their character does and then, when they complete whatever they're doing, that information goes up to their global account.

#

And so on.

steep ledge
#

I assume so right? Since the pawn is built per-world/etc?

latent heart
#

Pawns are not even per-world permanent storage.

#

They are entirely ephemeral.

steep ledge
#

Apologies, I meant more of 'When the world disappears, so do all pawns on it'.

latent heart
#

I would say player state and controller are your "per world" stuff because they reset every map change, even though you can copy things over.

steep ledge
#

(Not that they were per-world storage)

latent heart
#

I'm sure you could carry over a pawn or whatever between levels, it'd just be silly.

#

It's not how it's meant to work.

steep ledge
latent heart
#

But is seamless travel really a map change in that instance? Or a continuation of the same "map".

steep ledge
#

Fairly sure its described as an actual map change

latent heart
#

Well, you know what I mean. The conceptualisation of a single level.

steep ledge
#

Ah, yeah. From a gameplay/play perspective, yes.

latent heart
#

Everything just falls back to "it depends".

#

Look at how your game works/will work and decide. 🙂

shadow hatch
#

so im not entirely sure how to explain my 'issue' but basically while working on my inventory system ive noticed that unless the player controller takes ownership of the loot container(actor that has the inventory component) the inventory component of the loot actor acts strangely when i try to create new uobjects within it using its inventory component(when working with stacking items overflowing in particular)

how could i circumvent that? i use my player controller as a PRC to manage the inventory components of my player and anything he might interact with that also has a lootable inventory component

quasi tide
#

Make sure any interaction you're doing is only on the server

shadow hatch
#

i do use the authority check so it should be doing it on server only

quasi tide
#
  1. Client interacts with chest -> Send a server RPC that you want to interact with this chest
  2. Show UI of the inventory on the client
  3. Client clicks a slot in the UI to grab an item -> Send a server RPC that you want to interact with this item
pallid gorge
boreal bison
pallid gorge
#

It's not death logic

boreal bison
#

what is it?

ocean halo
#

Can someone help me figure out why my Add Impulse node doesn't work in multiplayer? To clarify... If I just add an impulse with a click, it works. My issue is its not working when I add the impulse in the camera direction

half umbra
#

in blueprints can check what player has what Ping?

thin stratus
#

Not sure if they still pack it. You would need to hover the variable/node to check and if so multiply it by 4 to get the correct one.
But maybe they have a function for that already.

#

Been a while

twin pendant
ocean halo
#

It seems when I add an impulse in the camera direction it only uses the server's camera direction not the remote clients. There must be some way around this I don't know about

sinful tree
ocean halo
novel bison
#

looking for a good overview of the right way to set up a multiplayer match (timers, scoring, spawning, etc) and what to put where (gamestate, playerstate, gamemode, etc)

#

anyone have any recommendations?

#

OR -- are there any assets you recommend buying and studying the architecture of?

kindred widget
#

Lyra is always free. 😄

twin pendant
novel bison
quasi tide
kindred widget
#

Blah. Just start at the data assets. Really easy to pull apart if you just follow the data.

ocean halo
#

Can someone help get the impulse working... if I set it up like this when clicking it adds impulse to remote client in the servers camera direction not the remote clients

#

The print string sees the correct camera direction but it doesn't apply impulse

dark edge
#

pass the direction in the first RPC

#

That's a goofy ass setup tho, why do you have so many rpcs

latent heart
#

Maybe they're making Remote Procedure Call of Duty?!

ocean halo
dark edge
#

I'd start with doing the bare minimum

#

Client tells server which way they want the ball yeeted

#

Server yeets it

#

You presumably have physics replication turned on so it should just work

#

Hell I'd start by testing something like this:

Ball:
Begin Play -> delay -> has authority? -> some impulse

#

Test that the ball is moving on all screens the same

drifting stirrup
half umbra
#

without Advanced Session, can I somehow remember a player who left the game?

#

and when he returns, I will restore his stats

twin pendant
#

It is just the default implementation of Epic for listen server setups as it seems.

twin pendant
ember vine
#

whats the delta array net serializer called again ?

hollow eagle
#

fast array serializer

ember vine
#

ah yes, its as ugly as i remember, thanks epic

half umbra
#

hi, can i communicate with gamemode using player controller on client?

#

with Event RunOnServer

#

?

#

this is correct?

quasi tide
#

No.

#

Well - it depends on what you mean

#

You need to do a RunOnServer on the PlayerController, and then in there, you would communicate with the GameMode

#

(I initially read it as trying to get a reference to the GameMode on the client and then trying to do a server rpc)

green fjord
#

does anyone here ever work with multiplayer replicating hand tracking VR?

untold rose
#

Hi everyone. Any tips for replicating (Or not) inventories? I currently use an Actor Component on the player character that stores the relevant data. Is there any point the AC being on the client side? From my understanding the server would hold the data and perform any modifications?

real ridge
#

I know this is very very stupid question but How to replicate names above players... I am failing in this they are replicated but sometimes when new player join he has not loaded names of already joined

#

I treid everything

#

Names should be stored in playerstate if is this approach right

chrome bay
untold rose
untold rose
#

Is there any tricks to replicate a map var? The options to replicate the variable is greyed out but wondering if theres anyway I could still send the data from the server to the clients?

woeful ferry
untold rose
real ridge
#

is it right to do this stuff in multicast node?

#

getting variable etc?

#

or I need pass variable via server call node

#

because I am not sure

chrome bay
#

@rancid scarab Post in Job Board, not here

latent heart
#

Is it really even a job? He needs to get banned, not have his post change location.

grand kestrel
#

What are the correct settings for "you are a player with ~200ms latency to the server"? Should I have the latency on client only/server only? Incoming only/outgoing only?

bitter robin
#

When talking about ping you are generally speaking about roundtrip so in + out

pallid gorge
#

Why the condition doesn't work? What did I do wrong?

bitter robin
#

wrong order

latent heart
#

It hasn't been executed before you use the output.

pallid gorge
#

Which order should I use?

latent heart
pallid gorge
#

Like this?

latent heart
#

Seems so

pallid gorge
#

The condition still doesn't work :/

untold rose
#

what would be the best way to make an object thats picked up show a UI for the person holding it? The pickup is handled accordingly on the server.

latent heart
#

Whatever 3 is meant to be.

#

Or your servertravel command isn't working.

pallid gorge
#

and I want the guild id to be 3 to execute the command

latent heart
#

If it's always executed then your guild id is always 3.

#

Or it's being execute somewhere else.

#

Or you just didn't compile your bp.

pallid gorge
#

I mean it does execute the command

latent heart
#

Then it's being called in some other place?

#

replace the comamnd with a debug string node.

sage light
#

can I use EOS voice chat if I'm not using subsystems and "sessions" but am connecting to dedicated servers through a 3rd party matchmaking service?

pallid gorge
latent heart
#

I meant your server travel.

pallid gorge
#

Nice

#

I'll send it later

unique cloak
#

does anyone know why is this rep notify never being called?

rocky kestrel
#

This is my swimming logic and problem is that when one client goes to swim all other clients also start swimming

nocturne quail
#

how to replicate the IK?

#

is this related to animation replication or how? I don't know where is the IK variable.... 🤔

nocturne quail
half umbra
#

i want to create and get playername from PlayerState, how should i do it correctly?

#

in GameMode i should create new structure with PlayerController and Name?

latent heart
#

Doesn't it already have a player name variable?

half umbra
#

the user, when joining the game, assigns himself a character name

#

by widget

#

then the name goes to GameMode

#

and with GameMode it seems to me that I should create a new variable (Sting) that will hold the replicated player name

#

and whenever a player joins or leaves a game I update this variable from GameMode to PlayerState

#

yest?

#

it will be ok?

latent heart
#

Sounds good.

half umbra
#

in PlayerState

#

but i want custom name

#

not komputer name 😄

#

or Steam or something....

#

just a custom name, what the user writes

half umbra
#

@latent heart unless you have any other tips?

#

are you sleeping? because you are available quite often? 😄

latent heart
#

What about SetPlayerName?

half umbra
#

I don't know

latent heart
#

Don't add new variables.

#

Just use the systems already present.

half umbra
#

i need create this

latent heart
#

Are you expecting it to be called on the server or client, RomiZ?

half umbra
#

wait, because each player has their own PlayerState?

#

so I don't need to create an array

#

just single string variable?

latent heart
#

I don't know what it's called in BP.

unkempt tiger
#

What's the best course of action if I want to send some data from a client to the server, but there is no 'one actor' that is right for the job to declare/implement the RTPCs in?

#

To be more specific, I have a world subsystem both on the client and the server. The one on the client wants to get stuff over to the one on the server

#

If I'm right, it means there needs to be a middleman actor to do the networking through, net-owned by the client

latent heart
#

Use the player controller as an intermediary.

unkempt tiger
#

I agree that it's probably the cleanest way to go

#

Perhaps preferably a component on the player controller, having to do just with that system

latent heart
#

There's literally nothing else you can really do without delving into unreal networking code to hook up some other stream.

#

A component would also work.

#

But it has to be replicated with the PC.

pallid gorge
#

@latent heart you are the best

real ridge
#

guys where I Am making problem when I am trying to replicate name always newly joined player doesnt see names of others

#

I am lost

#

but all names are stored in player state I am able to print them .... 😄

unkempt tiger
#

print them in a newly joined player as well?

latent heart
#

Just because a player has joined doesn't mean that the player states of every other person has been replicated yet.

#

And are you checking that they exist on the server or on the newly joined client?

real ridge
#

it should be updated for newly joined too 😦

latent heart
#

How are you using repnotify?

real ridge
#

should I show?

latent heart
#

Also I'm not sure exactly, but repnotify may not trigger for the initial replicated state of an object.

#

E.g. new player joins -> other players' player states are replicated -> no repnotify is triggered until a change is made after this.

#

You could also add in a BeginPlay for each player state to trigger a ui update.

real ridge
#

So I am going from begin play I get name I need and send it to server RPC and then set repnotify

#

inside repnotify I just set his name

latent heart
#

Yes. The RepNotify is probably not triggering because it's just the initial object state.

real ridge
#

sorry first photo should be like this

latent heart
#

Add a BeginPlay to the PlayerState and trigger the repnotify function there.

real ridge
#

then I have this function for TESTING when I press it it will print me all players connected it works fine so they are stored in good way

real ridge
#

its on player

grim dove
half umbra
#

do I even need GameState to display the list of players?

#

I think PlayerState is enough

latent heart
latent heart
real ridge
real ridge
#

on pawn?

#

so every time someone joined all get refreshed names

latent heart
#

Game mode is only on the server, so it'll only be called on teh server.

real ridge
#

but I can call in controller and from controller to pawns or not

#

bcs I can call from controller to server game mode

#

opposite I cant ?

latent heart
#

You can

#

But don't. Just get it working on the player state.

real ridge
#

OK

#

XD

#

but I am storing names and teams in playerstate on server can I use it as repnotify even its server?

twin juniper
#

How difficult is Multiplayer in UE?

#

Online* on PC

#

I've been working with Godot & Facepunch steamworks in VERY early prototyping & I'm wondering if I should skip the hassle & go to UE, but idk how UE is for multiplayer.

latent heart
#

Depends what you want to do.

real ridge
#

😄

latent heart
#

A lot of networking is built in if you want to do things that most games do.

#

Networking, all networking, requires asynchronous programming in some fashion. You can't escape it.

real ridge
#

so everyone can see it

twin juniper
#

If I wanted to make a Call of Duty Clone, would that be "fast?" to get something working?

If I wanted to sync certain other netcode things for a custom very different "non-standard" game, how easy is that?