#multiplayer

1 messages ยท Page 685 of 1

royal vault
#

they are all being set here

#

however

#

now for some odd reason

#

the server doesnt have physics being applied?

#

it doesnt change material or have physics

#

yet all clients somehow have correct information

#

ideas?

royal vault
#

anyone

winged badger
#

most of that is wrong

#

first SpawnActor is templated, so if you use template right, cast is redundant

#

for Impulse, you are substracting a unit vector from world location

#

thats never going to work properly

royal vault
#

it does

#

if i get rid of all replication

#

everything works perfect

winged badger
#

impulse is essentially the same with or without this bit - DamageCauser->GetActorLocation()).Rotation()).Vector()

#

so it doesn't work, unless the dearly departed is standing on 0,0,0

royal vault
#

what

sinful tree
#

Instead of storing each individual generated item's stats, you could instead generate a random seed and store that seed which you can then use to recreate the item and its stats when needed. You can then store additional details along with it if you want, like durability, or whether it's bound or not. It also make it a lot easier to transmit as you're not having to replicate or store every individual stat which takes up additional space, you just send the seed along which can be as simple as 4 bytes.
If you want to have every single possible combination of stats available though, then it gets a bit more complicated as you'll have to use a longer series of bytes that your generator can "consume" to generate your item.

winged badger
#

GetActorLocation will typically return values like 8000, -13000, 0

royal vault
#

yes

winged badger
#

and the vector you're substracting from it is of magnitude 1

#

which means, it doesn't really affect it

royal vault
#

wait

#

i thought getactorlocation

#

returned world location

winged badger
#

it does

#

but .Rotation().Vector() is magnitude 1

royal vault
#

so then u could subtract the vecotrs and get a vector pointing from the actor to the other actor

royal vault
#

u have to read the brackets

#

that gets applied after

#

the subtraction

#

then it gets converted to unit vector

winged badger
#

ah

royal vault
#

ye

winged badger
#

you have extra set of brackets you don't need

#

๐Ÿ˜„

royal vault
#

lol

winged badger
#

and GetSafeNormal() is typically used for that

royal vault
#

o

#

ok

#

ill fix those

#

but those r optimization stuff

#

i still need replciation working

winged badger
#

showing impulse on server generally won't do much

#

and network physics is notoriously bad

#

i do recommend watching this

#

they do talk about networking the ragdoll after death quite a bit

#

and its an excellent presentation

royal vault
#

alr

royal vault
#

ok

#

after 1 thousand years

#

i have gotten it to work

#

ty to every1

#

this was the code

#

f (GetLocalRole() == ROLE_Authority) {
            FActorSpawnParameters SpawnParams;
            SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

            if (DeathMeshTemplate) {
                AActor* DeathMesh = DamageCauser->GetWorld()->SpawnActor<AActor>(DeathMeshTemplate, GetActorLocation() + FVector(0, 0, 10), GetActorRotation(), SpawnParams);
                DeathMesh->SetOwner(DamageCauser);

                ASDeathMesh* SDeathMesh = Cast<ASDeathMesh>(DeathMesh);

                SDeathMesh->Server_Explode((((GetActorLocation() - DamageCauser->GetActorLocation()).Rotation()).Vector()) * DestroyImpulse, GetActorLocation(), SkeletalComp->GetMaterial(0));

                //Subtract our location from theirs to get vector that points in kb direction

                //optional, but set death material to be our slimes color material
        

                Destroy();
            }

        
        }```

```cpp
void ASDeathMesh::Server_Explode_Implementation(FVector Impulse, FVector Location, UMaterialInterface* NewMat)
{
    Client_Explode(Impulse, Location, NewMat);
}

void ASDeathMesh::Client_Explode_Implementation(FVector Impulse, FVector Location, UMaterialInterface* NewMat)
{
    DestructComp->ApplyDamage(100, Location, Impulse, Impulse.Size());
    DestructComp->AddImpulseAtLocation(Impulse, Location);
    DestructComp->SetMaterial(0, NewMat);
}
gleaming kite
#

Are widgets just unable to do any rpcs? I know theyre only owned by the client but I should be able to tell the widget function to run on the server right? It never seems to work for me.

hollow eagle
#

You can only RPC on an object that exists both on client(s) and the server. A widget is inherently something that should be client-only.

#

It makes no sense to RPC on a widget itself. You can, however, have a widget call an RPC on a different object that is replicated.

gleaming kite
#

oh im dumb. I was applying the reasoning that since player characters aren't replicated but work, then widgets should work too. Completely forgot that the player character exists on the owning client and server.

hollow eagle
#

Yeah... player characters absolutely should be replicated.

#

Player controllers are also replicated, but only between the owning client and server.

gleaming kite
#

yep, but not on other clients, right? Besides the movement, but the actually values themselves arent

#

for player characters

hollow eagle
#

Unless you've explicitly changed it, player characters should replicate to everyone.

#

How else would other clients see your character?

gleaming kite
#

sorry, variable values

#

hence why player state is a thing

hollow eagle
#

Values you specify to be replicated will be replicated.

#

where you divide things up between a character and player state is up to you

#

player state is meant to mimic the split between gamemode (which is server only) and gamestate (which replicates to everyone). With player controller somewhat mimicing gamemode (which is owning client and server only).

gleaming kite
#

hm gotcha, i was told here before that i needed to use playerstate to replicate variables

hollow eagle
#

I suggest reading the network compendium if you haven't already, second pin down in this channel.

gleaming kite
#

That is my bible lol. I read it constantly. Must of just never went over the player character part, thanks for your time though!

wanton estuary
#

Why is this event not being sent to the server? I feel like I'm missing something with how UE replicates widgets.

hollow eagle
#

UE doesn't replicate widgets.

#

It looks like the object you're calling the RPC on isn't a widget though. So the RPC is on this "player proxy" object - does the local client always own that object?

#

You can only call RPCs on objects that the client owns.

#

I'm guessing this is a replicated object that's owned by whatever player it represents. As such, you can't call RPCs on other player's objects.
The way you generally deal with this is you send an RPC with the appropriate parameters to an object you do own - for example, your player controller - and the server-side of things then calls whatever it needs because the server can do whatever it wants.

dense sundial
#

Let's say I have 3 clients, if I want each to randomly pick a color and make all the simulated proxies and themselves the color they generate (meaning that on client 1 all players would appear red, on 2 all green, etc etc) how could I achieve this generally speaking?

wanton estuary
hollow eagle
#

I'm confused as to how you've set things up - you have a server RPC on the widget itself?

#

Because again, that won't work.

#

Or are you calling a server RPC on another object from the widget?

wanton estuary
#

No the server RPC is set up on the player proxy object

meager spade
#

rpcs like that should be a server rpc on the player controller

hollow eagle
#

Ok, and that player proxy object is owned by the local client?

wanton estuary
#

Yes

#

Sorry for my ignorance I am so new to UE

hollow eagle
#

oh, that graph you posted won't work

#

I assume "check mod status" results in the server calling "receivemodinfo"

wanton estuary
#

Yeah

hollow eagle
#

RPCs don't wait for completion on the other end though

#

they're fire and forget

#

that's why you can't get a return value from them either

#

so what's going to happen is a client is going to call CheckModStatus, then immediately hit the branch even if ReceiveModInfo hasn't been called yet.

wanton estuary
#

Yeah it's a bad experience so I have to press the "scoreboardLeft" button twice c for it to work properly

#

I will probably end up just attaching the branch to the recieved server event

hollow eagle
#

For that kind of scenario you'd usually just have the "Is Mod" variable be replicated. Why even use RPCs there at all?

wanton estuary
hollow eagle
#

I suggest reading through the network compendium, second pin down in this channel. It goes over that and more.

wanton estuary
hollow eagle
#

I don't quite understand what the issue even is - if the object is owned by the local client and the function is a server rpc on the object then it shouldn't matter how you call it.

wanton estuary
#

oh weird

twin juniper
#

Crouch Character function need to be executed on server and client ? ๐Ÿค”

#

i saw most of people only do it on client is there a reason ?

hollow eagle
#

Most built-in character functions interact with CharacterMovementComponent, which handles replicating common actions already.

twin juniper
#

It checking server values, if you only execute it on client it only change them.. on client

hollow eagle
#

I have no idea what you're talking about with respect to "server values"

#

when you call ACharacter::Crouch it sets bWantsToCroush on CMC. Which is a flag that gets replicated as part of CMC's whole saved move system afaik.

twin juniper
#

so how you want it to be replicated ?

hollow eagle
#

yes... because CMC has other logic to send that to the server.

twin juniper
#

prediction logic ?

hollow eagle
#

yes

#

most of the code in CMC is related to prediction

#

which is part of why it's so complicated...

twin juniper
#

What function can i override on CMC for crouching that is executed on server and client ?

#

I would like to use them to give an native action tag to my player on server and client ๐Ÿค”

#

Crouch() and UnCrouch() should do it ?

#

nvm OnStartCrouch and OnEndCrouch does it fine

clear barn
#

this is my multiplayer working, left side if session browser, right side is hosting the session. Without Steam Running, even though I'm using the 480 app id. This works on the local network, even with separate machines.

#

However, if steam is running too and I try to host, it starts the session and goes to the level for a split second, and then comes back to the main menu?? That session must have broken.
Friends on an external the network can see the session! But when they connect it doesn't work ofc.

This is to do with Advance Steam Sessions.

I'm stuck here. The only way friends on other networks can see my session is if steam is running in the background.
But there's no use if the host session isn't working, such as in the gif.

I've seen a lot of people saying they have this "returns to menu after hitting host" issue. One person says disable Steam plugin in unreal? but that surely defeats the whole point?

#

TLDR; running steam for 480 network test. results in a hosted session, but immediately crashes and returns to main main

wanton estuary
#

@hollow eagle I fucking love you, this worked. Looked at the network compendium and made this

leaden atlas
#

is there a way to disable an AI controller without disabling replication for a pawn?

#

disable it without detaching it?

plush otter
#

Is there a way to modify this so that I can listen to multiple events like overlapping with several actors and apply effect to all?

plush otter
#

I tried to place a loop around this block. Instead of applying effect to multiple targets, the effect gets stacked on the same target.

#

Ahh this should be moved to gameplay ability channel.

gleaming kite
#

Do playstates get reset/switched when changing the server's map with seamless travel? If so, how can I keep the playerstate? (Trying to allow players to chose a character and have them spawn in as that character when they enter the game)

meager spade
#

you can't keep the playerstate

#

but look into CopyProperties on the PlayerState

gleaming kite
#

perfect thanks!

#

Does the event copy properties get called automatically on seamless travel? The docs are pretty vague, am I supposed to implement this function myself and add which variables i want to copy over?

#

Oh wait i think i get it, I would run the copy function before travel and then the override after right?

#

I cant call it from gamemode, feel like im really missing something

grim delta
#

Anyone a freelance dev who can help me with multiplayer network UE5 demo. I tried posting in jobs, but msg to Manny said something cryptic.

pearl moon
#

Can we not do RPC's from UGameInstance? If not, how do I run a function on the server's gamemode from the client outside an actor? My problem is, at beginplay I'm starting in an empty AActor derived class called MyDefaultPawn which is replicated, but not working when I try to call RPC's
(end result I want is for the server to spawn the pawn for my player to possess, so that the server and all clients will see it)

gleaming kite
#

99% precent sure GameInstances are unable to RPC as they're client owned only, the server has no idea of it. In the same vein, the client has no idea of GameMode. I would just handle spawning by the server only. Eg. OnStartingNewPlayer > Spawn Actor > Posses

pearl moon
#

ok thanks for the quick reply...i think that's why i was scratching my head so much, wasn't sure how to spawn the actor server side and have the client possess it

gleaming kite
#

Np, this is how I would handle it

#

you can throw more logic in-between like finding player starts and inputting that as your transform

pearl moon
#

i see, so the event handle starting new player, is that something that's part of GameMode?

gleaming kite
#

Yes, its even in gamemode base

pearl moon
#

okay awesome

gleaming kite
#

that just gets automatically called when a new player joins by switching map or just joining

pearl moon
#

oh thankfully i see it in c++ as well

gleaming kite
#

thats good to know

pearl moon
#

i'm guessing i'll have to bind a function to it, which i'll figure out or go to BP ๐Ÿ˜›

gleaming kite
#

goodluck :)

pearl moon
#

anyway thanks again for the info...something so basic was causing me a bit of grief

gleaming kite
#

of course!

gleaming kite
pearl moon
#

i'm kind of of the same mind on that though, most of the time things don't just work unless you specifically call or bind it, etc

pearl moon
#

so unfortunately that function is not virtual, so i can't override it, meaning i'll have to either use BP, or find some other way to call functions from it when it's executed on a player joining server

naive oar
#

I have an actor not updating for clients.

I have an AInfo with a dynamic multicast delegate:

UPROPERTY(BlueprintAssignable, Category="DoorManager")
FOnDoorSignature ActivateDoor_OnTrigger;

On the Actor class:
constructor: bReplicates = true;

void ADynamicMazeActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps)
const {
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    DOREPLIFETIME(ADynamicMazeActor, Ownera);

}

Then in editor BP subclass I have checked replicates and replicates movement

Am I missing something still?

#

Do I need this argument in the constructor?

AActor::AActor( const class FPostConstructInitializeProperties & PCIP ) : Super( PCIP )
violet sentinel
violet sentinel
naive oar
#

I think I just need to replicate the actor... The delegate is already a multicast wouldn't it not need to be replicated because it already does that?

violet sentinel
#

you misinterpreting words, it has nothing to do with replication

#

multicast delegate is just array of regular delegates with broadcast function

naive oar
#

The broadcast works fine for the host.

violet sentinel
#
  1. make sure you spawn your actor only on authority (server)
  2. you would need to add a UFUNCTION(NetMulticast,Reliable) void NotifyDoorTrigger();
  3. and inside do NotifyDoorTrigger_Implementation() { ActivateDoor_OnTrigger.Broadcast(); }
  4. call notify instead of broadcast directly on server (authority) only
#

this way you will have delegate triggered on all clients & server

naive oar
#

Ah. Thanks!

naive oar
#

I believe the BP actor which contains the code to do stuff is only running on server side. Could that be an issue? Which would perhaps mean the client-side actors don't even get registered.

(I tried your steps, still no go)

violet sentinel
#

all you need is to call it on server, since you set it to be replicating and it inherits AInfo so must work with no other changes

#

unless you doing it too early before clients connected

sly crow
#

recently I started exploring collab viewer template. i am trying to run build for windows 64.i am able to connect with other users on same LAN network but could not connect with users on internet. KINDLY GUIDE

bitter oriole
#

AI controllers are not replicated so they don't exist on client

#

Neither are player controllers, other than the owning client

lavish charm
#

Hi,
Is it possible to have ActorBeginOverlap only on clients ?
I know i can use isLocallyControlled nodes but its still executing on all client event if it dosent go far in the script, so it seem bad for bandwidth isn't it ?
My actors need to be replicated as they are "loot drops"

violet sentinel
oak oracle
#

Hey guys , i want to make a login system for my little game on listen server . Is it good to store userdata in sql database , or there is better way pf doing it? Cuz i have searched online about integrating db into ue4 , and there is not much of it, i thought may it is not how its done in ue4

violet sentinel
#

so it is [game -> rest api] -> [web service- > database]

oak oracle
#

Okey , thanks for your answer .If you have time , can you please explain it a little more briefly , cuz i am really noob to all this .if possible step by step guide .

lavish charm
dense patrol
#

Hey guys! Question, when setting up your Unreal Dedicated Server, is there a commandline we can use to set the IP and Port we expect it accept connections on? Or does that need to be allconfigured in its Engine.ini ahead of time?

twin juniper
silent valley
dense patrol
median mirage
#

How can I get the server to Get MoveRight, it always reads it as zero.

kindred widget
#

@median mirage That is an input value. It's local only. Only a Listenserver would have that value and would only relate to that machine's player.

median mirage
kindred widget
#

Clients have one ability when it comes to networking. ServerRPC. In short you could probably start a local timer in the Controller's beginplay and ServerRPC that value to the server 10-20 times a second. If server needs it, then you can just use it there. If other clients need it, then you have to then set a replicated variable and let other clients use that.

median mirage
twin juniper
#
UATHelper: Packaging (Windows (64-bit)):     C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(396): error C2039: 'SetHeartbeatInterval': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(397): error C2039: 'EnableHeartbeats': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(398): error C2039: 'ForceHeartbeat': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(586): error C2039: 'EnableHeartbeats': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)):     C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
#

Can't find anything online about this issue I am having while trying to build my game

pure vigil
#

Is there any way to force a ReplicatedUsing function to also run on the server?

#

I know the server doesn't replicate things to the server so it doesn't make a whole lot of sense but it's a listen server and will run the same logic as clients when the value changes

bitter oriole
#

No, call it yourself when you change the value

pure vigil
#

Ok, that works well enough

twin juniper
#

Any clue why I am getting:

Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(396): error C2039: 'SetHeartbeatInterval': is not a member of 'ISteamGameServer'
pearl fog
#

Hello, I don't quite undestand how persistant actors work, I overrided GetSeamlessTravelActorList to add my actor (an AInfo that store some settings) but it seems it doesn't exist after the travel

bitter oriole
violet sentinel
bitter oriole
#

Should never happen if you're compiling a release

twin juniper
#

I can't seem to do this

#

Which I assume is why I'm getting the problem?

violet sentinel
#

why? you need different steam sdk version?

twin juniper
#

I've got the latest sdk version (153a)

#

I can't seem to find this folder/line

violet sentinel
#

then patch up engine if you want newer one

twin juniper
#

OnlineSubsystemSteamPrivatePCH.h is nowhere to be seen

#

unless I am in the wrong directory?

#

C:\UE4 Source\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private

violet sentinel
#

you looking at some ancient doc article which could be since 4.0

#

use text search

twin juniper
#

text search?

bitter oriole
#

Keep a pristine engine and don't change a thing

#

The doc mentions this in case you need to update, which you don't

twin juniper
#

Okay, I'm going to start with a clean, fresh version tomorrow and try again

#

thanks @bitter oriole

calm niche
#

Can you not call an RPC from a character class?

fading birch
dense patrol
#

You can if you are the owner of said character class

brazen dove
#

Hi, can anyone link me to a tutorial on how to make a proper online connection please? I'm using gas and would like to make a simple menu with "host" and "join random game" options

pure vigil
#

I'm trying to figure out how to persist data from a multiplayer lobby to multiplayer gameplay. My lobby has a distinct player controller and gamemode which has all my info saved on it. When the game launches, the gamemode and player controllers switch to the appropriate gameplay classes but the data I had setup is lost. Is it appropriate to store all the data in the server's gameinstance then re-apply everything once the new classes are loaded? Not sure how it's normally done

soft dawn
#

@pure vigil are you using seamless travel? You can copy playerstate with Event CopyProperties and Event OverrideWith in BP but there are c++ equivalent ways to do it too.

kindred widget
#

I personally like the idea of a super simple savegame file for this. Also allows you to easily save preferences to use for next games.

pure vigil
#

Yeah, seamless travel. Happy to do it in C++

soft dawn
#

I'm using the copy properties for things like character clothing - player chooses what their character is wearing in the lobby, those details are saved in playerstate, i copy playerstate over to new new level and rebuild their character from playerstate

pure vigil
#

Interesting, that sounds like a good place to keep that stuff. Are you using two different playerstates? You're making me wonder if the playerstate can persist a seamless travel

soft dawn
#

im using two different ones

#

since the lobby playerstate basically just has playername and clothing types but the actual game playerstate will have a lot more in it

pure vigil
#

Makes sense

soft dawn
#

Check pages 28+29 in network compendium for what i'm talking about

pure vigil
#

You know, I think I've actually used this before. Sweet, thanks!

soft dawn
#

What is a good way to handle multiple gamestates/playerstates inside a PlayerController? I have HUD elements that should be activated depending on GameState/PlayerState - like whether or not the game is in a "warmup" mode before the actual match starts. Some gamemodes will have warmup, some won't. Normally I'd cast to gamestate to access a warmup variable but since the controller can be used for multiple gamestates, the controller isn't aware of which gamestate to cast to. GetGameState node returns the actual gamestate object set in the game mode but i can't pull the GetWarmup variable off that node in the event graph.

#

Maybe an interface on the gamestate/playerstate class?

kindred widget
#

@soft dawn You need a MyGameStateBase class. Put whether there's a WarmUp there. Let your other GameState classes change that. Cast to MyGameStateBase class to access that game's current game state's value.

#

You shouldn't interface things when it can be done through hierarchy.

soft dawn
#

makes sense, thanks mate!

pure vigil
kindred widget
#

Because it's bad design. Interfaces are meant to process similar information from wildly different hierarchies, not information from similar hierarchies.

#

For example. Bajarno's case, he can simply modify the inherited state with some inheritance. But consider if he had a widget that displayed a timer. You could make a single widget that displays a timer from a value in the GameState. But then what if you needed a similar timer for some other actor that has nothing to do with the game State? You could make another widget to handle that specifically, but this is where you would consider having an interface. Have GameState return a time, and have this other actor unrelated to GameState return a time. Now you can add the same widget class to screen and pass in a non casted UObject pointer and instead of casting to 30 classes, just use an interface to get the timer to display.

#

You create less classes over all, you keep less things instantiated in memory through casting, you don't repeat your code. It's clean and easily extensible. Those are good designs.

soft dawn
#

thats exactly what i want to do ๐Ÿ™‚

pure vigil
#

Definitely something I've thought about a bit, some people say to avoid casting at all costs which I've always thought was a bit weird

#

Maybe "at all costs" is a bit of a dramatization

kindred widget
#

Absolutely not. Casting is perfectly fine. You just have to be aware of how you use it.

pure vigil
#

I'd love to read an article about that

bitter oriole
kindred widget
#

People cry about casting because someone derped and made a reddit post about how they screwed up and casted to half of their game. To really understand why they screwed up, you have to understand how Unreal's assets are handled and why SoftPtrs are important to use.

kindred widget
# pure vigil I'd love to read an article about that

Consider if you have a character who has equipment slots. These start off empty, nothing equipped. You have Head, Chest, Gloves, Leggings, Boots. That's only five slots. But now you have a datatable for each of these of meshes you can equip. You use a pointer to these datatables to look up meshes to set this character's meshes to. You make 20 items for each slot. You specify these in the datatable as pointers to mesh assets. Now, the moment you use that class of character anywhere, whether it's a pointer to the class, or a property of a pointer of the character type, you will load that character. When you load that character, you load those datatables, and because you have to load those datatables, you now have to load each and every one of those 5x20=100 mesh assets into memory just to load this single character class that doesn't even have anything set yet.

pure vigil
#

Unless it's a soft pointer .. ?

kindred widget
#

Changing the datatable to use SoftObjectPtrs to the meshes alone will cause you to still load all of the datatables, but not the meshes. A SoftObjectPtr is mostly a weakptr(doesn't stop garbage collection) and a path to the object on disk. Much less space than the mesh itself.

pure vigil
#

Interesting. I've attempted to use them in the past half heartedly. Encountered some issues and bailed. I'll have to start taking them more seriously

dense sundial
#

Still new to networking in UE4, am I doing something wrong by initializing a health variable this way?

dense sundial
#

Because for some reason in trying to initialize it this way I have the clients saying:

LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)

and

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_C_2. Function Set Name will not be processed.

Which results in the ui not being set initially on the clients but after another rep notify call it updates properly

calm niche
bright rain
#

Does anyone know how to fix client animations looking choppy from a listen server?

You can reproduce this from a third person template by enabling network emulation with emulation profile set to average and launching a listen server with one client.

I've found multiple search results of this issue that say you can fix this by doing the following:

ACharacter: override PossessedBy() and call Super::PossessedBy() then set Mesh()->bOnlyAllowAutonomousTickPose = false
UCharacterMovementComponent: go to MoveAutonomous() and comment out the call to TickCharacterPose()

But that doesn't work correctly for me on 4.27.2. It speeds up the client animation for the Listen Server and the client, and still looks choppy.

Any ideas are appreciated.

winged badger
plush otter
#

A question about collision detection on the server. I want the server to detect weapon hit collisions, but when I test the event, the server only detects the hit if itโ€™s watching the weapon as a listener server. As a dedicated server it fails most of the time.

#

I donโ€™t want the client to do RPC for handling the event .

#

The animation is fast and collision volume is narrow, so I think thatโ€™s why the server fails due to optimization.

bright rain
peak sentinel
meager crow
#

So I've been struggling with replication on this one weapon I have in game. My MachineGun works just fine, damages both client/server from client/server, etc...
But my Grenade Launcher doesn't really seem to be working out for me. It will only fire from the client if it is set to multicast....where my MachineGun fires with just RunonServer.

But my main issue is I can't get the Clients Grenades to damage...only the server's Grenades damage.

#

Any ideas or help would be appreciated.

#

Forgot this one...

tribal solstice
#

Hey ya'll - Open Level node is not working in my packaged build. I've verified that the map name is correct in the node, and that the correct map name is included in the build under 'Packaging'. When I execute, it just restarts the current map. Any ideas what could be causing this?

dark edge
#

@meager crowDon't drag pins all over the damn place, that's a good way to get problems where references don't exist etc.

#

Also I see nowhere in the grenades nodes where you're actually applying damage

meager crow
dark edge
#

I see nowhere in this where you actually call the damage application

meager crow
#

The second picture I shared.

dark edge
#

Show how that's being called

#

This whole setup seems spaghet as hell. It should be this simple.
Spawn grenade.
Grenade detonates.
Grenade calls some sort of Apply Damage on its targets

meager crow
#

Fairly new to this, doing my best.
One second as I get you a better picture.

#

Sequence isn't the best way to do this I'm sure.
But again, fairly new to this...so just trying to see if my weapons work etc...then I'll spend time optimizing.

sinful tree
# meager crow

Executes On All / Multicasts are only really meant to be called on the server, as it will then call the event on any relevant clients. If you do a multicast from a client, I believe it only executes on itself.

The event on your cannon grenade timer doesn't make sense to execute on server and is possibly where some of your problem comes from. As it is hopefully a replicated actor, any logic should only ever be firing on the server anyway. On the begin play use a Has Authority node connected to "Authority" to set up your timer, and remove the "Executes on Server" on the event hooked up to the timer.

UE4 has some built in nodes for dealing damage, see the screenshot below. Right now it looks like you're doing an overlap check in your character and then applying damage, which can work, but makes it a bit harder to manage as you then have your character needing to check every time there is an overlap and validating what did the damage before applying it. If you use these damage nodes instead, then you can let your thing that is meant to deal the damage check itself if it overlapped (if a single projectile) and deal damage, or in the case of an explosive type damage, use the radial damage nodes which can apply damage to anything around the indicated spot and radius. You then implement the red events in any relevant actors so that they can receive the damage notice. This will save you a lot of headaches later on as you then define the damage in the thing that deals the damage, rather than in the thing receiving the damage - the thing receiving the damage can then do whatever math it needs to in order to increase or reduce damage further say via armor buffs, or invincibility being applied if friendly fire is enabled, before reducing its own health.

#

So... Your logic should be:
Player presses fire button > "Executes on Server" event that spawns the grenade and moves it as needed.
Begin Play of Grenade > Has Authority > Timer > Timer Event > Detonation (SFX and VFX, probably already done via your spawns) > Apply Damage Node
Event Damage Nodes > receive the damage from the object, and reduce health accordingly (which health should be a replicated variable!)

meager crow
red salmon
#

what stops other players of other games to join my game session? And can you create different game version multiplayer play?

red salmon
#

?

meager spade
#

I am mind blanked, how do you pass multiple arguments to a URL?

#

URL = FString::Printf(TEXT("ServerTravel %s?listen?game=%s"), *CachedTravelMapName.ToString(), *CachedGameModeAlias); ?

static flare
#

@meager spade normally ?first&second&third
so maybe ?listen&game=%s? Never used it in UE tho, this is just basic url-style, so I don't know.

#

Anyway, the reason I came here: My character will be a small non-humanoid drone of sorts, with very few animations, and I need full control of rotation (using quaternions). Should my character derive from ACharacter or APawn? I though APawn would be the obvious choice, but I'm seeing that ACharacter has a lot of replication-functionality that I guess I would need (multiplayer game). Is it easier to implement everything I need in an APawn, or to "fight off" what I don't need in an ACharacter? Or am I misunderstanding something?..

meager spade
#

could be &, but i am struggling to see where its parsed :/

#

APawn has no replicated movement system

#

so if you went for Pawn, you would need to do the replication your self (smoothing, etc)

#

handling inputs, etc.

static flare
#

That sounds awful.. Thanks, I guess I'll try with ACharacter first then. It just seems to assume a humanoid figure and general common movement, but I guess I should be able to override whatever I don't like.

#

damnit

#

When games have drivable vehicles, are they ACharacter? They'd need movement replication and smoothing etc. too.

meager spade
#

depends on how they implemented it

#

but Chaos vehicles have replication built in

#

(VehicleMovementComponent)

#

UChaosWheeledVehicleMovementComponent

static flare
#

I don't know what Chaos is, but I'll look into it ๐Ÿ‘

meager spade
#

well its the new physics engine for UE

#

you could try looking into Network Prediction plugin but its very very experimental

violet sentinel
#
        FString TravelParams;
        for (auto& Pair : TravelUrlParams)
        {
            if (!Pair.Value.IsEmpty())
                TravelParams.Append(FString::Printf(TEXT("?%s=%s"), *Pair.Key.ToString(), *Pair.Value));
            else
                TravelParams.Append(FString::Printf(TEXT("?%s"), *Pair.Key.ToString()));
        }
#

if you passing it to gameplaystatics::openlevel as Options param you need to strip first ? symbol

#

as it adds own

#

i call Client/Server travel myself directly (also enforce full map package paths instead of short names)

kindred widget
# violet sentinel ?param=value?param2=value2 etc

As a side note to this, despite that you guys aren't really fans of Kismet functions. UGameplayStatics has functions to parse string and integer options from that string already if you don't want to rewrite them. Rather useful.
UGameplayStatics::HasOption
UGameplayStatics::ParseOption
UGameplayStatics::GetIntOption

fluid summit
#

Hi! quick question.
I'm storing my characters information as STs on my player controller, but i'm having troubles because of the max array size.
Can anyone think of any other way to store Entries of some ST on the player controller?

#

There can be any number of characters, so it has to be dinamic

dense sundial
bitter oriole
#

95% of the time it's 50 lines of code to call exactly the same thing in the normal C++ API

dense sundial
#

Oh I see, didn't know that

dense sundial
lucid pewter
#

I have opened my .sln project and created MyProjectServer.Target.cs
with this code:

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

public class GreenPollyServerTarget : TargetRules // Change this line according to the name of your project
{
    public GreenPollyServerTarget (TargetInfo Target) : base (Target) // Change this line according to the name of your project
    {
        Type = TargetType.Server;
        DefaultBuildSettings = BuildSettingsVersion.V2;
        ExtraModuleNames.Add ("GreenPolly"); // Change this line according to the name of your project
    }
}

|| GreenPolly would be the name, don't judge XD ||

But Visual Studio gives this error:

Server targets are not currently supported from this engine distribution.
MSB3073 exit from command "E: \ UE_4.26 \ Engine \ Build \ BatchFiles \ Build.bat GreenPollyServer Win64 Development -Project =" E: \ Coding \ UE-soft \ GreenPolly \ GreenPolly.uproject "-WaitMutex -FromMsBuild" with code 6.
kindred widget
#

@dense sundial If you're using C++ at all, there is already a way to change the player's associated name in the PlayerState. But in general, don't rely on beginplay for initialization in multiplayer. It's more of a "This actor just became relevant to this client, so set up it's known state incase it's OnReps ran before it was ready." A lot of it is mostly just calling the same update functions your OnReps from state does.

dense sundial
twin juniper
#

Heya yall. Have tons of a unity experience but starting to learn Unreal. Any recommended tutorials for learning multiplayer basics for Unreal? Just trying to have two characters push a ball back and forth and such and got everything selected as replicated in the properties and such but would imagine there is a lot more to it then just that lol. Thanks n sorry for noob questions lel

kindred widget
#

I would just manually set both variables personally. But if you wanted a function to forcibly set it, I'd say PostInitComponents override.

lucid pewter
twin juniper
lucid pewter
bitter oriole
kindred widget
lucid pewter
bitter oriole
#

Did you compile the engine yet?

lucid pewter
bitter oriole
#

Associate the project to the new engine you built 4h later?

lucid pewter
#

I don't think so, I do random things and see if it works

dense sundial
bitter oriole
#

When i'm saying you need a source build, you need a source build

#

aka not using the launcher engine at all anymore

lucid pewter
bitter oriole
#

Read the instructions in the readme

#

You need to actually compile that engine and use that one now

twin juniper
bitter oriole
#

(For the record, dedicated servers is really not a great idea unless you're a larger team doing a competitive shooter)

dense sundial
dense sundial
lucid pewter
#

The servers, the networks, are a very complicated thing ... The communication between client and server etc ............................. .................. but it is something nice!

bitter oriole
# dense sundial Oh, why's that if you don't mind my asking?
  • You only need dedicated servers if you have either competitive gameplay (with a client-side anticheat, cheater report service, and round-clock hack stomping) or at least say 100 online players all the time (95% of PC games don't)
  • Need a source build
  • Need to host the servers ($$)
  • Need to host them for much longer than the game sells
  • Need to update the servers
#

Cooperative games with <6 players don't require any of that and are MUCH more reasonable for teams that don't have a publisher

dense sundial
lucid pewter
#

Lol on PlayFab you can make a free server up to 100k players for 750h per month divided by each core, or you can implement a solution like Contabo, 5 โ‚ฌ per month, 8GB Server, very scarce but to start with it's great! And like me, you can find yourself a team online ...

bitter oriole
#

Everyone tells me that and then disappears forever with their project, but okay

kindred widget
#

The one only reason for a smaller company to have a dedicated server setup is for persistent worlds that you allow players to host for themselves. But it's also worth considering a listenserver setup for that as well for easy gameplay. It's still a decent amount of extra effort through.

lucid pewter
bitter oriole
#

Hard to claim you're not one of those before you even get the dedicated server compiling

#

Anyway, people never listen, I'll be there if you have issues compiling the engine

lucid pewter
lucid pewter
#

Let's hope my PC doesn't explode

kindred widget
#

40 minutes is kind. I've seen people complain about engine builds taking hours.

bitter oriole
#

lmao, 10 or 40m

#

More like 2-5h

lucid pewter
lucid pewter
bitter oriole
#

Probably you didn't press the build button yet

dense sundial
#

Just built the other day and it took several hours between the .bats and the actual build

lucid pewter
bitter oriole
#

Might be something with your system then, like a strong CPU with a slow SSD

dense sundial
#

(P.S. running the bat generated a minimized popup window that I didn't see until like an hour had passed ๐Ÿ˜…)

lucid pewter
bitter oriole
#

As long as the entire engine and software is on the SSD, should be slow but work

bitter oriole
#

There's your problem

#

Though that SSD is too small anyway

lucid pewter
lucid pewter
bitter oriole
#

I have a 1TB SSD just for Unreal source + current project and it's barely enough

lucid pewter
lucid pewter
bitter oriole
#

That module yes

#

It's like 1/3 of the build usually

lucid pewter
#

(and thanks)

fluid summit
bitter oriole
#

Project is at 200Gb without the asset sources

#

Do a few releases and you're left with 50GB there easily

#

(Assuming you do your job and keep pdb files, etc)

#

The asset sources is just 40GB which is surprisingly small lmao

verbal tendon
dense mason
#

hello guys here are my create and join sessions bp

#

the problem is that when I create a session and join it from another player

#

they are not in the same lobby

#

they appear on the same lobby where the buttons are tho

#

what am i doing wrong?

verbal tendon
#

Easiest workflow to remember and adapt is as follows: Have a lobby level that the server opens, where the session is created and the other player joins. Then once you have all players inside, do a travel from server to "Start the game"

dense mason
#

will that be easier than this ?

verbal tendon
dense mason
#

๐Ÿ’€

#

ok ill try

verbal tendon
#

What you want is a function like this for the server to call. Because unless ServerTravel is specified the server will be alone in the map. With ServerTravel it takes all the clients with it

#

So once all your players are in the lobby and everyone is ready, when the host clicks the "Start" button ( or whatever logic/workflow you want for starting your game ) that is what you call

dense mason
#

but my game doesnt require a lobby system like that where all players join each other and you go to final map

#

i want each individual player to join/host a session where all other players can join

verbal tendon
dense mason
upper owl
#

I believe the ping is by accident and you wanted to ping someone else?

upper owl
#

no worries

dense mason
#

I got it working

#

But now my client cant move

verbal tendon
# dense mason But now my client cant move

Because you probably have movement that is server only, and that was working before because you werent a client, by opening a level you were always the server. Entirely different issue.

dense mason
#

i think its not replicated maybe

verbal tendon
#

Whichever it is, you don't need to actually do all of the session stuff, you can just debug this in PIE

#

In case you didn't know!

dense mason
#

wait what!!?

#

tell me more

lucid pewter
#

Here I am back after completing everything ... Keep giving me the error, I think I'm doing something wrong, for example the last step I don't know how to do it ๐Ÿ˜ฎโ€๐Ÿ’จ

After compiling finishes, you can load the editor from Visual Studio by setting your startup project to ** UE4 ** and pressing ** F5 ** to debug.

verbal tendon
#

Your main viewport will be the "Server" the popup viewport will be the "Client"

dense mason
#

nah it doesnt work my character can jump but not move so its an replication issue

dense mason
verbal tendon
#

Make an example project and check where you deviated from the standard

dense mason
#

oof

verbal tendon
#

Places to check would be: Character, CharacterMoveement component

#

Unless you have done funky logic in the controller related to movement

dense mason
#

๐Ÿ˜ญ

#

my character can jump and turn in place so it shouldnt be replication issue

bitter oriole
#

Move your project to the new engine with right click / change engine version

lucid pewter
bitter oriole
#

Which is literally what I explained how to do

bitter oriole
#

Once you've associated, open the project in VS and compile

lucid pewter
lament cloak
#

Anyone know of any good articles on syncing lag compensated projectiles?

Right now I've got the server bump up the projectile by the "half" ping using PlayerState->ExactPing. When the projectile moves the server queries for nearby enemies and rewinds them by the "half" ping. It's mostly good, but there's some false positives, either hitting on the server and not on the client, or hitting on the client but not the server, and hoping to find some tips on how to solve that.

The reason I'm doing it this way as opposed to the client telling the server when they hit someone, is because it's a top down game with culling on enemy positions passed the camera. So the client can't reliably tell the server when they hit someone off screen, because the client shouldn't know there's an enemy there.

#

I've also heard mixed opinions on the accuracy of ExactPing and wondering if that's a source of some of the problems

#

There is also UT's PredictionFudgeFactor which seems like some magic value, not sure if anyone knows the story behind that

crimson valve
#

Anyone know why I can't change to alternate viewmodes (unlit/lighting only) in standalone game?

#

I'm trying to use the console command viewmode unlit but nothing happens

summer tide
#

Can you modify net culling distance of a character during run-time?

soft dawn
#

Is Standalone Game the best setting to use for testing in editor? I'm playing with multiple clients and a dedicated server (running in separate process). I'm noticing certain things in my game are just broken when running with PIE and not broken when running as Standalone Game. Is it safe to assume PIE is sort of buggy for multiplayer? I'm ok sticking with Standalone Game but I also don't want to be overlooking something I did wrong causing those issues when using PIE.

#

I've wasted a lot of time debugging stuff that didn't work in PIE but aren't actual issues (at least from what I can see) when running as Standalone Game

kindred widget
#

@soft dawn That's a semi complex question. Generally speaking Standalone is a more accurate representation. PIE is faster in some cases and can be used for a lot of things. But you'll still find plenty of errors and issues when you play on an actual build.

soft dawn
#

ya i understand - i'll describe one issue I saw. ServerTravel from online lobby to gameplay map, first client (New editor window PIE) connects and loads in, second client connects and loads in (separate process). first client doesn't see any of second client's animations related to CMC (it can see second client move but character anims are locked and just slides around). Second client can see first client fine. First client reconnects to server and can see second client fine.

#

it works fine if both clients are run as Standalone Game

#

Maybe if I'm testing anything with ServerTravel I should stick to Standalone Game. I know it doesn't work at all in editor if you run server/clients under a single process

kindred widget
#

Ah. Yeah. PIE cannot ServerTravel. PIE is only really good at testing from a single map.

soft dawn
#

thanks, confirming that gives me some relief ๐Ÿ™‚

lucid pewter
#

When I open the new Unreal Engine (the GitHub build), and open the project I had done on the "normal" Unreal Engine, it says I have to convert it, but when it says it needs to be rebuilt it crashes and says I have to do it manually!

soft dawn
#

You need to build the project in visual studio first

lucid pewter
soft dawn
#

What does it say needs to be rebuilt? A plugin? I usually get that notification if i've added a plugin but haven't built the project in VS yet

lucid pewter
# lucid pewter

Yes there is a plugin, but I tell it to disable it ... Here are pictures of what happens next

soft dawn
#

I don't think they the project is built properly. You opened your game project (not the engine project from git) in Visual Studio and built development editor x64 for your project itself?

bitter oriole
lucid pewter
#

I think I've found another problem

soft dawn
#

and you did the "Switch unreal project version.." to your source build from git?

lucid pewter
lucid pewter
#

Miracle, it's filling out!

#

Something, I don't know what, but I don't care, it will surely bring me forward! ๐Ÿ˜„

lost inlet
#

always add your workspaces to AV exceptions

bitter oriole
#

... If you really, really need to have that at all

lost inlet
#

well most people will have windows defender

#

and adding exceptions there can speed up file access

random verge
#

I'm creating replicated movement for karts (kart-style racing) modeled after CMC's implementation and have 2 questions. In CMC replication, are "dual moves" only pertaining to root motion replication? and in the context of kart racing, is there any real point of implementing root motion replication for the karts rather than just faking it where it could possibly apply? (like hit with an attack and spinning out type stuff)

#

If there's no point in supporting root motion for the karts, I could save quite a bit of bandwidth by removing it from the implementation.

jolly siren
#

Root motion replication isn't used if you aren't using root motion

random verge
#

from what I see in FCharacterNetworkMoveDataContainer, I think "dual move" only refers to root motion being included with an actual new move from this snippet:

// Optional pending data used in "dual moves".
    bool bHasPendingMove;
    bool bIsDualHybridRootMotionMove;
    
    // Optional "old move" data, for redundant important old moves not yet ack'd.
    bool bHasOldMove;

    // True if we want to disable a scoped move around both dual moves (optional from bEnableServerDualMoveScopedMovementUpdates), typically set if bForceNoCombine was true which can indicate an important change in moves.
    bool bDisableCombinedScopedMove;

Does that sound about right?

#

there was a few other comments scattered about that seemed to hint at the same conclusion

#

CMCs implementation is so confusing in places lol

#

gets hard to follow

random verge
vagrant grail
#

Hi, I need this : A table / struct containing the basics stats for a player like these :

  • Speed
  • Interaction Reach
  • Strength
    ...
    So I need 1 table / struct with all the default values (so I can revert to those values if I changed those stats for some players during the game)
    And I need this to work in multiplayer, so I need a table/struct for each person with those datas but I could change those during the game (like more speed for one player,...)

How would I go about that ?

dark edge
vagrant grail
dark edge
#

The same way you make an int or a vector different for each player

#

struct is just a data type

vagrant grail
#

i don't know how to do that

dark edge
#

Either each Playerstate or Pawn has a variable MyStats, or you have some central StatsArray or whatever

#

Then don't start with multiplayer lol. Learn to crawl before you try to run. Start small.

vagrant grail
#

I know you can have variables on the Character, but I don't want to save those on the player but more in a Stat table on the server

random verge
#

You really only do that for persisting between sessions. Reading from a database constantly during runtime is devastating for performance

random verge
#

You should check out "data driven gameplay" in the docs for some ideas.

#

that may even be overkill

vagrant grail
#

Also I need those stats to be on the same struct or something like that to not go around all my blueprint and fix them if needed. I need all of those datas on one single thing to just open it and fix things I want there without opening each blueprint and look for the variable I need

#

I don't need those stats to be saved between session, I only need them during the game then it will be reset to the default value in the next game (or if there's an mechanic of resetting those during game)

random verge
#

theres lots of ways you could do it. You could have all your static default values stored in a datatable, a data asset, a config. You load them from wherever into a data structure or variables somewhere for each actor that needs them and from that point on, you read and write to those variables until you need to load the defaults again

#

gah. root motion moves are a type of dual move. Sometimes an extra move is just packed to save bandwidth, also making it a dual move.

vagrant grail
#

Like how to reference that Struct

#

Do I have to spawn it or something else ?

random verge
#

You're missing some pretty fundamental concepts. You'll save yourself a lot of hassle and wasted time by following some of the simple "getting started" tutorials before going any further

vagrant grail
#

Guide me to those tutorials

random verge
#

actually, check the pins in #ue4-general . I'm sure they have a plethora of where to get started links

sage isle
#

Something I have been struggling with for a while is the gamemode, I have a variable I want to use in an actor but I know the gamemode only exists on the server. So I have been trying to find a way access it but with no luck, why doesnt something like this work cause I try to get the variable and it just gives me the default value of 0 everytime.

#

it shows the right value if I call from the authority side but remote its always 0

kindred widget
#

This logic literally never sets that float to anything.

#

Beginplay->IfClient->CallOtherFunction->IfServer->SetValue.

#

You can't be on the client and the server at the same time.

sage isle
#

damn, I thought thats what I was doing but I guess it was wishful thinking that it would work

kindred widget
#

As far as GameMode itself. You have the right idea, but you need to move your property to GameState. GameMode is server only It exists to be a Server only actor that can process things without a client ever having even local access to it. GameMode directly uses GameState to set replicated values and Multicast to clients for game related events.

#

Think of GameState as the networking friend of GameMode.

sage isle
#

I had tried moving the stuff to gamestate before and it stopped working but I think I need to just do that, cause I keep running into this issue where I need things from the gamemode

river hazel
#

Yep, a lot of times stuff ends up structured so that GameMode does things like ending rounds, deciding winner, etc, and then GameState is used to replicate that data down to everyone else, GameState is always relevant as well

#

if you throw everything on the Pawns you have to worry about them being unloaded on clients based on distance, but GameState/PlayerStates are around when PlayerController/Pawn might not be

vagrant grail
#

If I set a speed value to a player in the Construction Script inside the Character Blueprint, will people joining later will have the information or I have to create a server event that I call from the construction script and use the rep notify to set the values ?

proven kayak
#

Probably not great to call rpcs from the construction script. You should probably use BeginPlay.

vagrant grail
soft dawn
#

Hmm I'm seeing an error on my clients when connecting to a dedicated server LogPlayerController: Error: EnableInput can only be specified on a PlayerController for itself This happens between the construction script completing and begin play. Oddly this isn't affecting gameplay from what I can tell but i'm trying to remove all errors/warnings. Only search result that came up for this was resolved by making a new game mode which didn't help my case. I can reproduce this on a new map/gamemode/etc if i use the same player controller.

proven kayak
#

It's not safe against cheating tho, if that's something you care about

proven kayak
#

Either verify the value or skip the rpc then

#

Only set speed from the server

#

If the client wants to sprint then call a sprint rpc. Letting the clients control their own speed is how you get 500 mph cheaters

vagrant grail
#

Yeah I understand that example for the sprint system, but I'm confused on how to set up a data table for each player joining the game and make sure the next people joigning get the information too for each player

proven kayak
#

When you say data table are you referring to actual data tables or something else?

verbal tendon
#

The engine takes care of it for you

proven kayak
#

Actual data tables exist for everyone. Just replicating what row name each player is using would be enough

vagrant grail
#

I have 2 structs, 1 called Defaut_Stats and the other Player_Stats, and after each round of gameplay I need to reset those stat to default, and the Player_Stat is there to be able to increase some stats like Speed or Distance of Interaction

#

Like I need to have all my stats stuff in the same place so I can tweak it more easily

vagrant grail
verbal tendon
vagrant grail
verbal tendon
# vagrant grail ?

Your problem is easily solvable in C++, but I don't think the functionality is exposed to BP

#

So. As a workaround. Here is what you can do. All your data should be inside a single struct, your data struct if you wish. Assume this is part of your player BP

#

you make a member variable somewhere else that's persistent, like gamemode if you do this from the server

#

At beginplay on your player, you copy the data struct from player to gamemode, and when you want to restore it, you copy it from gamemode back to player

#

In C++ you could achieve this in a single line of code without needing to store that data somewhere special

#

@vagrant grail let me know if that's clear

tribal solstice
#

Heyo - I have a multiplayer game working on PC using Steam subsystem. I built a Mac version, but I can't get the Mac and PC to connect. They're both connected to Steam correctly, but the server doesn't show up. Tested and working with two PCs. Is crossplay not supported?

dark edge
#

This isn't that hard, what's the part you're getting stuck on.

astral totem
#

Anyone know how to make a multiplayer garage system that can store cars. Like you walk up to a PED and a prop widget says โ€œput away carโ€ or pick car to pull outโ€.

urban mason
astral totem
#

How to store a pawn. is what i'm trying to figure out.

silent valley
astral totem
#

Thanks

meager spade
#

you could serialize the actor

#

and on garage load, pull them actors (useful if they have a state (like damaged, etc)

minor ginkgo
#

can someone help me with a server RPC? I'm pretty sure that the client's player controller owns the character that owns the gun, but the Server_SpawnBullet event won't be called from client-side... (using blueprints btw)

west mauve
#

Does anyone know how to replicate AimOffset?

balmy pike
#

how can one map be split into separate dedicated servers?

bitter oriole
vagrant grail
# dark edge Just make 2 variables of type PlayerStats

The part I'm stuck on is I want to use a struct or a data table to contain all my stats variables so not creating a variable for each stat and have to look around all my BPs each time I want to change 1 stat and also I need to know how to copy values from a whole struct to another as I have 2 structs being the same just one being the Default_Stats so I can copy from it after each new round / game and the other one I need to have 1 Struct of player Stats per player so Stats don't get mixed with other player stats

blazing spruce
#

Hi, im having a problem with disabling input while the players are on a loading screen while they move from the lobby to the game, ive set up the loading screen using the Levels tab creating a persistent level, the loading screen, then the actual map, I've tried disabling input in loads of different places but every time I spawn into the game I have input before the loading screen widget has been removed from the viewport, it just wont disable for some reason, any ideas on how I can get it to disable input while the loading screen is still showing?

verbal tendon
vagrant grail
#

Now I have now another problem, I'm trying to use the Rep Notify and in the function OnRep I want to use a timeline to open or close my chest depending on a boolean isChestOpen, but it doesn't let me use a timeline in an OnRep_IsChestOpen function. How to do what I want if I can't use a timeline please ?

vagrant grail
#

Could anyone confirm that i understand the networking system of unreal with those statements please :

  • Server Event : Code executed by the Server

  • Not replicated : Objects not being replicated to other clients (but does the server get the state of the object too or not at all ? )

  • Multicast : Sends a signal to all the other clients at an instant T (so people joining later won't get the signal / infos that something changed)

  • Rep Notify : Variables being replicated over the network so the Server and other clients could detect the value changing and execute code from that. And people joining the session later get all the infos on what object updated and those who didn't update to be synced with the server and synced with everyone.

  • Dispatcher : A way to send message between actors (but I don't know if you can use a Dispatcher to communicate between server and client and vice versa or a dispatch made in server could only be received by other server code, and client dispatcher could be received only by client code). And I'm still confused on when to use the Dispatcher and when to use the Multicast.

Please ping me if any answer ๐Ÿ™‚

verbal tendon
# vagrant grail Could anyone confirm that i understand the networking system of unreal with thos...

Server Event
Only executed if called on Server or from client owning actor. That means if it's called on Player1 Actor from Player1 Client it will execute on server. If called on Player2 Actor from Player1 Client, nothing happens.

Not replicated
Just like OnServer runs if executed on server, any actor spawned gets the variables it has locally. So if you spawn an actor on server, it will have those variables. Nonreplicated variables for actors spawned on client , just like actors spawned on client, do not magically appear on the server.

Multicast
Yes

Rep Notify
Yes like replicated values, clients will be aware of changes. Also as with all replication, only changes on the server will be replicated to clients. You cant change a value on the client and expect it to be replicated to server & other clients.

Dispatcher
Dispatchers are not networked

vagrant grail
dense oasis
#

Hi, I wanted to make a Voice Chat System for my game, could anyone help me please? I'm using Ue5

minor ginkgo
dense oasis
minor ginkgo
#

If I have a Server_RPC event, does the actor needs to be owned by player controller from both server and client? (do I need to call SetOwner from both the server and client?)

kindred widget
#

Just the server.

minor ginkgo
#

Is there a delay for the PlayerController becoming valid? I'm trying to spawn a weapon and set the owner to the player character, but SetOwner doesn't seem to work on server? but it works if I re-equip the weapon

vagrant grail
# kindred widget Just the server.

Do you have an answer for my question above please ? With being unable to use timeline in the OnRep function (as you can't use the timeline in any function) so how would I go about that ?

dark edge
dark edge
kindred widget
#

Make an event run the timeline from that and call the event from the OnRep. Alternatively, get the timeline's pointer, I believe you can start and stop it with that as well.

vagrant grail
vagrant grail
dark edge
#

Yes. Honestly you sound like you're in way over your head. Don't even think about multiplayer at this point, learn how the engine works and how to do stuff in BP

#

You would set MyStats (which is a variable of type PlayerStats) to be equal to DefaultStats (Which is also a variable of type PlayerStats)

vagrant grail
dark edge
#

Set

#

Set Playerstats

vagrant grail
#

Can't connect the Default Stats to Player Stats, they're considered different even if they have the same amount and variable names in it

#

I'm gonna connect the execute pin later

#

it says "Only exactly matching structures are considered compatible". The only differences between those structs are the name of the structs and the values assigned to each variable in it.

dark edge
dark edge
#

Just do it like this
In your character have variables

MyPlayerStats(PlayerStats)
DefaultPlayerStats(PlayerStats)

Then to do the reset

MyPlayerStats = DefaultPLayerStats
verbal tendon
# vagrant grail Oh interesting

As has been mentioned above, it looks like you're in way over your head. Make a singleplayer game first, learn Multiplayer later. Separating the concepts will leave you less confused, give you an easier time mastering the different concepts at your pace one at a time.

vagrant grail
verbal tendon
# vagrant grail Already made my first Solo game

Given that you didn't know how to set a variable value and that you can't set two different classes ... I would strongly advise you make another one and focus on learning the basic core principles

#

Spend more time learning the engine before even touching Multiplayer, those are very basic concepts that you had no clue of

bitter oriole
#

We have this discussion every day, so don't lose too much of your time

#

Diversity's doing an online competitive cross-platform console MMO and no one will be changing their mind

verbal tendon
#

๐Ÿ˜

vagrant grail
minor ginkgo
#

๐Ÿ˜ตโ€๐Ÿ’ซ can someone help me in vc

verbal tendon
vagrant grail
bitter oriole
#

Classes and structs in C++ are exactly the same btw

#

Other than public being implied

verbal tendon
#

Well this isn't the #cpp channel and Diversity's doing BP ... so ๐Ÿคทโ€โ™‚๏ธ ๐Ÿ˜

bitter oriole
#

Ah, lmao

vagrant grail
bitter oriole
#

C didn't have classes so no

#

Anyway, no time to waste here, enjoy

vagrant grail
#

Thanks ๐Ÿ™‚

verbal tendon
# vagrant grail But I remembered in C there were 2 different things if I'm not mistaken

Having a dream is great. The advice here is tailored to get you there more reliably.

Breaking down your problem into multiple more easily achievable subsets is a good general rule of thumb for many different situations. Game development has a lot of areas that you need to learn, especially if you're doing everything yourself. Just trying to achieve your one dream will easily leave you disappointed.
Whereas if you're learning 50 new things, and you only manage to do 30/50 before you stop working on this, then that's actually not too bad - compared to having achieved 0/1 massive MMORPG cross-platfom interdimensional game project.

vagrant grail
#

With some basic mechanics and stuff like that ๐Ÿ™‚

short arrow
#

I believe it's even more of a problem in blueprints

pure vigil
#

Using advanced sessions, trying to test out OnlineSubsystemSteam. I have the DefaultEngine.ini configured (with SteamDevAppId=480) and I know it's working because I can load my steam avatar/nickname in game. But when I host a server and client locally, the client can't see the session. Is this because they're both using the same steam session? Any way to test this without having 2 computers?

short arrow
#

You properly, or reliably test steam related things in the editor

pure vigil
#

The editor doesn't seem to load the SteamSubsystem. If I use a "Has Online Subsystem" (for "Steam") node in the editor, it returns false

#

If I could do it in the editor, would be fantastic. Currently testing in a packaged game

short arrow
#

I dont see that node, what's it called exactly?

bronze moss
#

I have some variables in the GameInstance that I need to access from the server but when I do playerController:GetGameInstance()->VariableName it returns an empty variable instead of what's in the client. Should I be doing this from a different place?

pure vigil
short arrow
#

What's inside of it, that looks like a custom function

pure vigil
#

Oh, it's from the Advanced Sessions plugin (didn't realize that)

#

Looks like it runs

{
    return IOnlineSubsystem::DoesInstanceExist(SubSystemName);
}
limber gyro
#

Im trying to debug a connection timeout issue and some one mentioned a LAN option in a thread but i cant find it, can some one point me in the right direction as to where that may be?

balmy pike
#

what is maximum player capacity of dedicated server?

limber gyro
#

but i think by default theres a cap

#

not sure

dark edge
wicked lynx
#

does anyone have a recomondation on who to watch to learn how to make a multiplayer system? I cant seem to find a good article or video.

vagrant grail
kindred widget
dark edge
vagrant grail
# dark edge Nah that's gonna be in the sequel.

I just realized something : Any game with vehicles teleporting or out of sync in multiplayer aren't really bugged it's just quantum physics, so we're not ready to understand those. So anyone having those kind of vehicles are just ahead on their time ๐Ÿ‘€

dark edge
#

Oh shiiii. Stealing that.

#

The Unreal Networking Uncertainty Principle

gaunt pilot
#

Anyone that has experience in networking and helping us with servers for our game. I'm hiring! Please let me know, thanks!

kindred widget
#

I want to see the Steam reviews after this explanation. ๐Ÿ˜„

hallow sand
#

If I have an audio component that is playing a longer sound (a few minutes for example, like a speech or something) that starts before a player joins, how do I begin playing that sound at the same time frame for the player who just joined?

sinful marlin
vagrant grail
#

I have a health variable for the player, should I set it to "Replicated" or "RepNotify" ? as I want people joining later having the information too

tribal solstice
#

Does anyone know how to get the Steam subsystem working with Mac? I can't find any documentation anywhere. I've tried setting it up the same as PC and I get the Steam overlay, but cannot find or host servers.

kindred widget
vagrant grail
kindred widget
#

Usually for things like that, RepNotify. Event Dispatcher updating UI is much cheaper overall than tick. Less widget invalidation.

vagrant grail
kindred widget
#

It does. That part is more of a UI issue. I follow a very strict ideology that gameplay classes shouldn't touch UI classes. If I can't remove references in my HUD class and delete a UI class without altering other gameplay classes, I've done something wrong. The one exception to this rule is widgets in a WidgetComponent. UI should be interchangeable. Take a healthbar in the bottom left of your screen for you personal character. Instead of having the character create that widget and put it on screen and call updates in it. You can make a simple Widget, add it to anywhere you want without regard to where it goes in whatever hierarchy. That singular widget can globally get the local player's pawn, cast to the one that has the event dispatcher, and bind it. Now when health changes in the player character, their OnRep fires that event dispatcher and the healthbar changes. Now you also want a red deathly affect around the edge of the screen. You can do the identical thing. Create a new widget, add it to screen, bind to the character's health dispatcher, only play the affect when health changes and lowers.

#

Mean while, you have two completely independent widgets that can be removed and deleted with no regard to your player character. Your player character gameplay logic can remain clean and untouched.

pure mango
#

Noticed some weird behavior

  1. In the Player Character BP, I add the BP Component (BPC_Targeting)
  2. In the BPC_Targeting, I set a timer with a delay start (to ensure everything is ready)
  3. I run PIE with one Listen Server and one Client
  4. Consistently crashes once 10 seconds elapsed, although both Server and Client are ready
    Assertion failed: NetGUID.IsDynamic() [File:D:/build/++UE5/Sync/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp] [Line: 2734]

Works fine if I move the timer from BP component to inside the Player Character BP (as one would expect)

vivid seal
#

assuming the behavior is in an object that actually exists on both the server and client, yes

pure mango
#

Like GameMode exists only on the Server, so Events made there are only called on the Server
But things like OnComponentBeginOverlap or your custom Events will by default get called on both Server and Client

dense sundial
#

Hey all, quick question:

//In some actors constructor implementation
SetReplicates(true);
//or
bReplicates(true);

Which is better (if there's even a difference which I'd suspect there's not) and why? Thanks in advance :)

kindred widget
#

@dense sundial If you use the first, you'll get a warning in your logs.

dense sundial
#

Oh interesting, was studying and came across both and wasn't sure which to use, so then the first is to use if we want to make something replicate programmatically after it has already been spawned?

kindred widget
#

I believe so. To be honest I've never tested that. Fairly rare that you change that at runtime from my personal experience.

dense sundial
#

Gotcha, thank you :)

kindred widget
dense sundial
#

Oh interesting, what is the other call for component replication dynamically?

kindred widget
#

SetIsReplicated I think.

dense sundial
#

Awesome, thanks again

dense sundial
#

Another question to understand when "checking authority" vs a Server or Client RPC is the way to go. The example below is from the network compendium (page 23), would getting rid of the switch has authority node and changing the AddScore Event to be a Server RPC result in the same functionality while not being as resource efficient as utilizing Var Rep as it does already?

pure mango
dense sundial
twin juniper
#

hello everyone i need to serialise data for save (player levels/stats, actors, player made structures, etc) and then load it onto dedicated server does anyone know how i could do it or point me to documentation on it?
need to make a save system similar to ARK or Rust

#

maybe set it to do it at 0.01 hp or below?

#

not ideal but it would probably work

sinful tree
# dense sundial Interesting, but ideally, A Server RPC, The Switch Node, and is server all funda...

Definitely not. A server RPC where you set up the event to "Run On Server" means that the event can be called by a client to execute the code tied to the event.
So if you're keeping score using a server RPC, that means a client could call the RPC, and increase the score whenever they wanted to (ie. you're giving the means for a client to tell the server to do something).
Using an "Is Server" with a branch is checking whether the current instance of the blueprint is running on the server. This is useful to control paths in which only the server should be executing the following code. For example, you could have a "Begin Overlap" event that when the player moves into it, they score a point, however, you probably only want that to happen on the server rather than on the client. So you could hook up the "Is Server" with a branch to ensure that the scoring code only runs on the server, and only when the server is detecting the overlap, not the client.

sinful tree
#

Has Authority is a bit more complex. For example, if on the client you spawned an actor, the client would have authority of that actor. If you spawned that same actor on the server and had it replicate instead, the server would have authority. This is still just a simplification of it.

dense sundial
minor ginkgo
#

Can someone help me with a server RPC? It's not getting called from the owning client...

sinful tree
#

or server to many clients (executes on All events)

#

So like... If you wanted to a fire a gun.... Your button press needs to be RPC'd to the server.
The server can calculate if you can fire by making sure you have ammo, etc. It can spawn a replicated projectile actor, and it can do an "Executes On All" RPC to play the bullet firing sound.

dense sundial
minor ginkgo
dense sundial
sinful tree
#

As long as you check the ammo on the server too - the server should be the one that decides whether something gameplay related should happen to try and thwart basic cheats.
eg. If I was a malicious agent, I could make it so my client constantly sends the shoot gun RPC, regardless of whether or not I have ammo as I could flip that bit in my client memory that says I don't to I do. If the server doesn't check that I have ammo, and just proceeds to fire my gun because the client said to do so and we're relying on the check on the client side, then there's a problem.

verbal tendon
peak sentinel
#

What do you mean, auth checks are required and good. You cant determine who is authority and not otherwise?

verbal tendon
#

I mean there's plenty of screenshots of people forking logic in the same place with an authority check macro. For example AI only runs on server, you can do similar things, have the authority as early in the logic as possible, don't mix client and server logic - have a clear separation. It's all part of making the logic more maintainable and bugfree over the long run. Otherwise you eventually run into a lot of BP spaghetti logic

peak sentinel
#

It's a curse of BP rather than logic itself, also checking authority sometimes protects against usage of cheat engine

verbal tendon
#

If it's not a competitive game, nobody should have to bother

peak sentinel
#

Competitive games has their own problems bigger than Cheat Engine, some indie games could require protection against cheat engine too

kindred widget
#

Dude's never felt the sting of Steam reviews.

limber gyro
#

those do hurt

kindred widget
#

"Hur dur dis game suk, i join randoms an they cheateded, programmer bad"

peak sentinel
#

I mean its not just about cheat engine, its a simple branch, if you dont abuse it it'll work nicely ๐Ÿคทโ€โ™‚๏ธ

verbal tendon
limber gyro
verbal tendon
#

coop games are by the vast majority played with people that you know, so you know the person that's cheating. There's a social element to it

peak sentinel
verbal tendon
#

Further advice would be to learn C++ and to shift to C++ from BP eventually ๐Ÿง  ๐Ÿ˜‚

limber gyro
#

u mean i can make games without spaghetti?

peak sentinel
verbal tendon
#

Yup, it's inevitable, all the good practices can do is delay the inevitable. The ultimate solution is C++ ๐Ÿ˜„

peak sentinel
#

Latent and async tasks most things causing sphagetti from my experience

upbeat basin
#

Is there any common problem regarding to overriding replicated blueprint events? My project crashes when it hits to the function call of an overridden server event. It doesn't if I disable the function call or remove the overriding event. Is it my project or the engine that is broken?

kindred widget
#

Are you only overriding the Implementation function?

upbeat basin
#

it's not a cpp function

#

it's bp event that set as run on server

kindred widget
#

Oh, odd.

#

Lemme test.

upbeat basin
#

Weird thing is I can't find any exception in logs, it looks like it has cleaned up and exit without any issues

#

I'll take a look into it more when I have time but I'd love to hear your test results as well

limber gyro
#

im having a server crash where the server logs dont say anything, any tips on how to debug this?

#

just says fatal error

verbal tendon
limber gyro
#

this might be a stupid question but ive never done it before

#

~logs dont say anything

verbal tendon
limber gyro
#

dedicated

#

packaged dedicated server

#

running a listen server in the editor seems to be working fine

verbal tendon
#

and you're only experiencing the crash issue on packaged dedicated server? What about on a lsiten server?

#

Try a packaged listen server

#

You want to determine whether the issue is with packaged content in general or only with dedicated packaged server

limber gyro
#

im a bit confused here, in order for me to do a listen server i would have to have something like steam sessions no?

kindred widget
#

@upbeat basin Hmm. Not sure. It seems to work fine.

limber gyro
#

where the client would create a local server?

#

wouldnt that be the same?

verbal tendon
#

Right let's backtrace. I assume you haven't had that fatal error for forever, often an easier way is to figure out what might be causing it by what you changed since the last clean run and today

#

If you dont have any other good information

limber gyro
#

i havent touched this stuff in a while haha

verbal tendon
#

And depending on the amount of changes/time since your last clean run

#

Okay ๐Ÿ™‚ Nevermind then ๐Ÿ™‚

limber gyro
#

i removed steam

#

and then it crashed

#

so it probably has something to do with that

upbeat basin
vagrant grail
#

Is it possible to launch a 2 player test session in the editor, then press a button to make a third person join the session (without coding the whole session thing) ?

#

Because I need to check after opening a chest if a player joining later will see the chest open too or not

kindred widget
#

Editor Preferences. Allow Late Joining or something.

#

After you press play, it'll have a new button add a new client.

vagrant grail
sinful marlin
#

There's not a way to call an rpc on a specific client (not owner), is there? E.g. Server spawns cube A, cube A is owned by the server. I want the cube to be spawned in to all clients so all clients have their own cube A. But then I want to rotate cube A only for client A. So the change happens on the client only, but is triggered by an event on the server. The only way I can think of doing that is with a MultiCast and just having a check basically saying if(IamIntendedClient) { do stuff }

verbal tendon
sinful marlin
#

Well spawned on the server then replicated to clients is what i meant by that

#

but only replicated in existence really

verbal tendon
#

Those are two very separate things, that wasn't what you originally described ๐Ÿ˜›

#

What's the problem you're trying to solve?

#

If it's a replicated object, then its rotation exists on all clients and is server authorative

#

So rather than describing your solution, describing the problem you're trying to solve will be more helpful, gives us more context

sinful marlin
#

Essentially a basis for a loot system where all clients have separate loot, but the same loot. E.g. enemy drops an Iron Sword, all clients see the Iron Sword drop, but its their own drop, so if someone else picks it up, it won't disappear for the others

#

I was going to handle the actual spawning and picking up of the loot on the server just because that seems like the right way to do it

verbal tendon
#

Right that's easy

#

You keep the shared server object the "loot" that spawns

sinful marlin
#

But I also didn't want an instance of it spawning on the server for each client.

verbal tendon
#

you can spawn a new local object for rotation, VFX, wahtever you do when picking it up

#

and what you do is you just change the visibility locally

#

For the server object

#

so it disappears on clients that have picked up the loot

#

But more importantly imo, if this actor is never used again from the server side, no other interaction than picking it up. You can forego the server spawning of it and just spawn it locally non-replicated on each client

#

That's assuming you're not going to have hotjoin with the hotjoin player being able to pick up their own loot

sinful marlin
verbal tendon
sinful marlin
#

Fair enough

verbal tendon
#

competitive includes a lot of things, if it's gonna be an MMORPG ( the crowd favorite! ) that could be overrun with chinese loot farming bots, then you need to consider it

#

if you're just making a fun coop game you can play with friends that has loot - don't lose sleep over potential cheating

sinful marlin
#

Goodness no. No MMORPG for me. Just a little co-op hack and slash to familiarize myself with multiplayer and game networking

verbal tendon
sinful marlin
#

Right now i have it so everyone has their own loot pools, but it all exists on the server, and just have clients be the owner for the loot that belongs to them, and replicate the loot to owner only. But I was worried that could end up creating a lot of work for the server if each client has dozens or hundreds of drops ๐Ÿ˜…

sinful marlin
verbal tendon
#

The way I'd go about it is spawn the loot non-replicated on each client

#

on loot pickup -> communicate to server where your persisted inventory management lives, and tell it an item was added

#

So rather than creating an extra concept of loot management to your game, which you don't need

#

you just plug it into your inventory management, and the loot lives independently in the world

#

The more you simplify and breakdown your problem sets, the easier your life will be ๐Ÿ™‚ You only want a complex setup if it is the simplest way of solving your problem

#

Or if there's a game design that requires the other and is not negotiable. But that's a topic for another day ๐Ÿ˜„

sinful marlin
#

Yeah I think I was just overthinking how important server authority was for this specific case. I was handling all the of it server side, 0 trust in the client.

hexed thunder
#

So I have an actor component that has a struct, PlayerStats, tied to the player controllers and this PlayerStats struct contains things like health/kills which I want to display for all players in a widget. I am trying to update a replicated struct variable in playerstate, what is the best way to let clients update their playerstate's variable and make sure it is replicated? Shouldn't the server do the updating of a replicated variable to ensure it replicates?

verbal tendon
hexed thunder
# verbal tendon Not sure why PlayerStats on the actor is tied to the controllers. Unless control...

yeah if i could go back around i'd put the stats in state, first project so am sure going to make some mistakes. I think got it working. So if you were to have logic like telling the player they got damaged, ideally you would want to update directly in the playerstate? Would the general pattern be something like, let the server actors update the server version of client's player states to be the most ideal? Otherwise you go from client actor to client player state to server player state to all player states

dense mason
#

how can i fix this

#

I have a button which saves the character then when the main level opens it assigns the animation bp according to the character

hexed thunder
# dense mason

how are you telling each client to update the pawn to goku and to vegeta? looks like you're simply just passing in wrong logic per client

dense mason
#

And when the main level opens it sets the skeletal mesh and animation bp according to that string saved in game instance

hexed thunder
#

yeah so the clients are just setting everyone's pawns to that character string, because updating skeletal mesh isnt replicated

dense mason
#

Oh

#

So how should I do that?

hexed thunder
#

you're gonna need to do more research on this topic, put print strings and understand concept of ownership of these actors, why is it when you update the skeletal mesh on one client, it doesnt update on the other. I would have some logic to run on owning client of the pawn and then send a server event in pawn to go back and multicast, in the multicast u can update the mesh

dense mason
#

Do you think updating the skeletal mesh before joining the main level can help?

hexed thunder
#

put some print strings Anurag, you're asking the wrong questions and I gave you the solution but I don't think you understand, so put print strings and breakpoints and try to understand client/server versions of actors, take your time learning this or you're gonna keep struggling, I went through something similar several months ago and you really just have to play with it yourself. good luck

dense mason
#

Oof ok

hexed thunder
#

multiplayer isn't an easy topic for new developers lol, but its really worth learning

dense mason
#

๐Ÿ’€

verbal tendon
# hexed thunder yeah if i could go back around i'd put the stats in state, first project so am s...

It always depends on the project, the constraints and requirements. Some you have the server updating everything, some you have clients tell the server when to multicast something to everyone else ... it always just depends. Experience with multiplayer work will give you the knowledge you need to make those calls in the future. Everything has pros and cons, there is no universal solution to every problem. But just playing with the engine, making games, making mistakes and learning from others will get you there eventually. The learning never ends, all we can do is get better over time.

dense mason
verbal tendon
#

For example -very generally speaking- I tend to package variables into data structures. I have a "SpawnData" struct where various systems that spawn gameplay characters tweak various settings that they want differently. I store character variables in Data structures that I give to the character class for various systems

#

Different gameplay systems will reuse those data structures that's what they need. So you pass them the data to work with, they dont always need to know more. Keeps things modular. I'm speaking very generally here, because as I mentioned above. Every project is different and every problem you have can be solved in a number of different ways. You need to figure out what works for you and your project

verbal tendon
dense mason
#

Oh yes

verbal tendon
#

There are instances where you have to rely on using strings, because you have nothing else exposed to from the engine. Don't add instances of your own where you have to rely on strings ๐Ÿ™‚

dense mason
#

You mean I should create a structure to save my character right?

verbal tendon
#

Yes, i dont know the exact nature of your issue, but assume you want to spawn 2 different characters. You have a configuration class where everthing goes into

dense mason
#

And then directly get a copy to save the character

verbal tendon
#

and you spawn them according to the data in that class, rather than based on the string you put in and manually change things based on that

#

Saving character? Does this involve persistence?

dense mason
#

Yes

verbal tendon
#

Don't use strings ๐Ÿ™‚

#

You should just be able to save the different characters and load them

dense mason
#

Hmm ok let me try

unreal epoch
#

Hey, I'm debugging network lag on my game and am using the network profiler. It's my first time using it, so I don't really know how to spot any red flags. I was wonder if anyone could skin through this data and see if anything is sending enough data to cause problems.

#

these are my RPC calls ^

#

my actors ^

#

also actors ^

#

these are the settings I'm using to simulate a bad network

#

when playing with friends, sometimes the game is pretty laggy on the network when I join as a client, but I might just need to increase the bandwidth use in the engine config file

#

also, what does count mean in the profiler?

vagrant grail
#

How would I do to make my prototype game being played by a friend of mine ? Like do I just have to publish as an exe and send it to him or there's a way to have it being played by him and being able to join me ?

#

How to do that please ?

pure vigil
#

Using Advanced Sessions with the Steam subsystem, trying to get everyone's steam avatar. Can the server get everyone's unique net id and use that to get the avatars for everyone then send it to everyone to view? For some reason "Get Steam Friend Avatar" keeps failing when I try to get a client's avatar on the server

keen shadow
#

Can someone help please

dense mason
#

@verbal tendon my character is already getting data from the structure and loading it

#

its just the bp thats set using strings

#

np

keen shadow
#

yes

#

if you can help

vagrant grail
#

Is this the correct way to do damage in multiplayer ? I use an interface called "Damageable" with a function called OnDamage, but I feel like I do the job twice one by calling the function ApplyDamage and two by calling the interface "OnDamage".
Like should I do the calculation of the new health in the Event On Damage or somewhere else ? as I'm not sure if my Interface would be Server or Client

grizzled stirrup
vagrant grail
#

So I need to understand the proper way to do this

grizzled stirrup
#

In that case the client would likely do the trace, it would determine what was hit and then the data is sent to the server via an RPC which then verifies if needed and then deals damage

vagrant grail
#

But is the screenshot above good, so I have to use multicast or I did something wrong ?

#

Also the calculation of the new health could be done in the Event of the OnDamage interface or the interface is client only ?

grizzled stirrup
#

As I said the overlap happens on both server and client so you'd be dealing damage twice if a client walks into it

#

Also if you wanted OnDamage to fire on clients you need to replicate it back down with an RPC or OnRep variable

vagrant grail
#

I still don't understand

keen shadow
hallow sand
#

How do you start an audio component at the same spot as the server when a new client joins? For longer audio files like speeches or songs, so that the new client hears, at least mostly, what the other clients who were on the server when it started are hearing?

sinful marlin
#

I have a collider that will only trigger overlap events only while moving if im playing with a dedicated server. It runs normally for client and server when playing listen server though ๐Ÿค”. It appears that my animation from my GA isn't being played on server in dedicated server.

kindred widget
#

@sinful marlin Dedicated server by default has no cosmetics. No Animations, Particles, Materials, Sounds, etc.

#

If memory serves, there was a way to enable animations on a Dedicated though. Not sure of performance implications.

sinful marlin
#

Ahhh, I see. Is it common place to do collision detection for melee based combat client side then?

kindred widget
#

Really depends. I don't have a ton of experience, just vague knowledge from reading and watching conversations, but from what I can tell, a lot of people rely a lot on client actions telling the server they're doing something, and then server running vague checks to see if it might be somewhat possible. I'm 78%ish sure that Epic does the same thing with Fortnite, as that's one of the major reasons for stuff like EasyAntiCheat for client side cheat prevention.

sinful marlin
#

Noted. Starting to think I don't need to, and probably shouldn't, do everything server-side

kindred widget
#

I mean. Server can prevent a lot with very simple cheap checks. For instance if client says it hit something with a melee weapon, you can easily test the weapon distance, pad it a slight bit and do a distance check from their pawn to the target. Stops cheaters from "Meleeing" at range. I've seen Jambax talk a little bit about his system on HLL, if I'm not mistaken they do rewinds on server for bullet traces to see if a shot the client said it made could have potentially hit the same target on the server.

royal vault
#

replicate spawn emitter at location without rpc? I could spawn a replicated actor with a particle system but i want to use spawn emitter at location.

kindred widget
#

For what purpose? Is this for something happening on the server or Client authority?

lost inlet
#

and spawning an actor just for that is going to be way heavier than an RPC

sinful marlin
#

You could have a FVector on whatever is spawning the emitter to hold the spawn location and use an OnRep to spawn it when you change it

sinful tree
# vagrant grail Is this the correct way to do damage in multiplayer ? I use an interface called ...

Your "Damage Zone" is something that should only ever execute code on the server. RPCs (Your "Executes on Server" event you have inside of it) are meant for the client to send data to the server. Instead, any events like your overlap in your DamageZone, should use the Has Authority node with the path connected through the "Authority" path - you do this to make sure that clients aren't also trying to execute the code that follows.

The "Apply Damage" node itself already acts as an interface. You can use the corresponding event "AnyDamage" in the actors that you want it to deal damage to and the Apply Damage node calls it. So if you want your player character to receive damage, you put the event node below in your player character. When the overlap occurs it will call this event so you can deal the damage as you need.

verbal tendon
royal vault
#

theyre getting called btw

#

its just spawn emitter not working

dense sundial
# royal vault tried that and still doesnt work

Traditionally this is done with a Multicast RPC since it just needs to happen for relevant actors at that given point in time and it's cosmetic. Why are you specifically trying to not use an RPC?

royal vault
#

because its an actor not owned by any player controller

dense sundial
#

The actor saying to spawn the emitter?

royal vault
#

yea

#

also the multicast for spawning emitter doesnt work somehow

#

it works for everything but it

#

its run on server but it still doesnt replicate to clients

bitter oriole
#

Mutlicast is only server to clients

royal vault
#

yes so i would have to do a server rpc then mutlicast

#

but this actor is not owned

#

so it would drop

dense sundial
#

So from the table (Network Compendium Pg. 63) an actor that isn't owned should still be able to multicast if called from the server. I can't tell from what you've sent what exactly is going on

royal vault
#

yea

#

it should work

#

but for some reason it doesnt

#

better scr

#

its being called

#

but nothing happens

dense sundial
#

print the location being passed to it

royal vault
#

there correct

dense sundial
#

does it do it for the server, or just none of them?

royal vault
#

server has it

#

cleints do not

dense sundial
#

So from the server you can actually see it spawn properly?

royal vault
#

yes

#

everyting works from the server

dense sundial
#

hmm, gotcha, that is odd

royal vault
#

ye

#

multicast is just not working

verbal tendon
royal vault
#

it doesnt i added a breakpoint and its called

verbal tendon
#

When are you doing the Multicast?

royal vault
#

top right

verbal tendon
#

You might be doing the RPC before the actor is properly replicated to the client, in which case the Multicast "won't work" and the RPC will fail silently

royal vault
#

wait

#

so this is in a task

#

bp

#

which is getting called from a behavior tree

#

which is run on a replicated actor

#

but does behavior tree get replicated or something

verbal tendon
#

no

#

behaviour tree and AI only runs on server

royal vault
#

k

#

hm

verbal tendon
#

so if this is in some AI stuff there's no multicast cos there's nothing to multicast to

royal vault
#

wait what

#

wait so

#

i run this

#

which runs this

verbal tendon
#

The behaviour tree doesn#t exist on clients

royal vault
#

and thats it

verbal tendon
#

The AI Pawns exist on clients, but the BT doesn't

royal vault
verbal tendon
#

no

#

that's not how multicast works

royal vault
#

but bt is server

#

it mtcast

#

sends to clients

verbal tendon
#

They are executed on the actors the event exists on, so if it doesnt exist on client, there's no multicast

royal vault
#

o

verbal tendon
#

which is why if the actors arent replicated yet, or dont exist on client - there's no multicast

royal vault
#

any way to get around this

verbal tendon
#

Yes. Have your RPCs in actors that exist on client&server

royal vault
#

alr

#

ty

verbal tendon
#

So you want RPCs on your Character/AICharacter class for example

#

those are pawns and client owned, good place for RPCs to live

royal vault
#

yea so i just put the rpc on the actor the bt was run on

#

and it all worked

verbal tendon
#

correct

#

Yes RPCs are a little peculiar thing. This won't be the last time you run across them. If you think "Oh wouldn't it be cool if this MyDoorBP just had an RPC on it that would tell everyone it was opened?" -- well then you realize you can't quite do that because your doors wont be client owned and you ๐Ÿคฆ

royal vault
#

yea i ran into unowned server rpc problems so many times

verbal tendon
#

There's no good solution for this when you're purely using BP. If you ever get around to learning C++ there are things that can be done to make this less painful by doing some custom stuff

#
{
    void ExecuteOnClient_PowerTeleport( AVeilCharacter& Character, FVeilPowerTeleportData Data );
    void ExecuteOnServer_PowerTeleport( AVeilCharacter& Character, FVeilPowerTeleportData Data );
}```

So for example I can have those two specific functions - they're related to a teleport power usage by a certain character, alongside with the relevant data for that activation. Let's us keep the code modular, rather than having to stuff everything onto Character. The different RPCs being used can be defined and handled in different places.
#

And without having to deal with all the boilerplate code that Unreal usually has you write, is a lifesaver for my fragile nerves ๐Ÿ˜„

royal vault
#

ye

dense sundial
#

Is there an event that is tied to after a session has been joined?

verbal tendon
dense sundial
storm stone
#

Also is there an upper limit on how many structs I store on the server I have some heavy structs im storing in arrays on the server, is this a problem

finite goblet
#

If I lower the netUpdateFrequency to say 1 or 2 the game starts missing changes to replicating variables for prolonged periods of time .

#

why is that?

#

isn't it supposed to check for changed variables 2 times every second with a update frequency of 2?

minor ginkgo
#

Correct me if I'm wrong, but if a client wants to equip an item from his inventory:
1- He checks if conditions are met, then calls a server RPC to request equipping
2- Server re-checks conditions, then spawns equipment actor, attaches it's meshes to proper sockets, sets owner, sets variables that needs to be replicated (like player's current equipment info)
3- Server calls a NetMulticast RPC for cosmetic effects (equip anim montage, play sound, set visibility for FirstPerson/ThirdPerson meshes based on whether you're the owning client, etc)...

kindred widget
#

@storm stone Heavy is a relative definition. Though in general it really just depends. No one can know until you profile it.

oak oracle
#

hey there , does anyone knows , how to get pc's ip through code ? I got a listen server . server player hosts and all other players must get server's ip in order to connect, ip gets changed all the time , i want to get that ip address of server on the clients

twin juniper
#

Can someone tell me if "bAllowTickOnDedicatedServer" also applies on PIE server ?
or only compiled/shipping server

steep wolf
#

is it possible to override client rpcs in derived classes?

bitter oriole
#

Alternatively, you need a master server that your server connects to, with a database of known servers, for client to get a list of servers there

bitter oriole
steep wolf
#

thanks, it worked

rich locust
oak oracle
# bitter oriole You generally use sessions for that

hey , thanks for your reply , i also read that by just using ip address you want able to play with friend online . Ur friend need to make some manual router protocol changes . is there way to do it with code automatically ? So your friend just enters a ip and thats it

steep wolf
#

server calls RPC to AMyServerCharacter -> AMyClientCharacter : public AMyServerCharacter overrides the RPC implementation

bitter oriole
steep wolf
#

i do this because my client needs to have two seperate skeletal meshes, and my server only needs one

grim delta
#

Does anyone know if there is differences between setting up simple network multiplayer between UE4 and UE5? I just want to host a 5 player demo, on a local server and have a login.

grim delta
bitter oriole
#

There isn't

#

UE5 is essentially UE4 with new features

grim delta
# bitter oriole There isn't

Thanks, im learning multiplayer and was just making sure UE4 tutorials are still valid. What chance would i have that a marketplace package for simple login with multiplayer BP would work in UE5?

bitter oriole
#

Depends if it's a code plugin

#

But if you're learning, UE5 is pointless

grim delta
#

Yeah ive been seeing that a lot, but im coming over from other engines, Unigine mainly, and want to bypass UE4. I have my simple demo level made in UE5 and now just need to setup the server/client with login, and that will do for this stage of the project. If i get full funding then i will no doubt have to start again with a bigger team backtracking to 4.

#

I guess i was hoping to not have to learn 4 at all, but im not sure that is going to be viable really from what i hear

#

Is the Source 5.0 much better than the portal version?

bitter oriole
#

Yes

#

But UE5 and UE4 are almost entirely the same

grim delta
#

Except that one is broken

#

I think im just in love with lumen, GI and reflections, sky system, UI. I always disliked the UE4 UI (granted all the tools are there, its just that it always felt like it was made in the 1990s

grim delta
bitter oriole
#

Yeah, I'm using it for production

grim delta
#

Ive also seen you posted 1000s so i might go have a read through some of your advice.

bitter oriole
#

Lots of people are using UE5, if you can compile from source, fix the bugs yourself and don't need to produce working game packages right now, it's manageable

#

Epic shipped Fortnite with a branch of UE5 already

#

It's just not exactly straightforward right now

grim delta
#

I read you cant create a multiplayer without source anyway, is that the case?