#multiplayer

1 messages Β· Page 102 of 1

novel bison
#

not sure what to do w the playerstate after broadcasting it since I don't use it

latent heart
#

I hope that isn't meant to run on teh client

#

Well, the bottom part.

novel bison
#

ohhhh hmmm

latent heart
#

Or any of it really.

novel bison
#

you're right if i call this in an onrep

latent heart
#

No game mode on clients.

#

It will also run on the server, though.

#

For every client that joins.

#

Which graph is that in?

novel bison
#

this is the current behavior still

novel bison
latent heart
#

That'll run on every player for every player too then.

#

As every player state is on every player's instance.

#

I would move your update call to the game state or something πŸ˜›

novel bison
#

can i do a check to see if this is the local playerstate?

latent heart
#

tbh, you do want it to update if another player's state changes, though.

novel bison
#

well if any player state changes it notifies the GM

#

that's where the update function lives

latent heart
#

What does the update function do?

novel bison
#

and that loops over all PCs and tells them to update UI

latent heart
#

No need

novel bison
#

this is the current flow im trying to implement

#

but if thats wrong that'd be great bc it's not working lol

latent heart
#

All you need to do is:

novel bison
#

that will run for every connected client as well?

latent heart
#

Every client (and the server) runs begin play on every actor, even the other player's player states.

#

So you're binding that event on everyone for everyone.

#

You just need to trigger a UI update from that event.

novel bison
#

wow works perfectly

latent heart
#

πŸ™‚

novel bison
#

thank you so much

latent heart
#

np

novel bison
latent heart
#

Btw

#

I wouldn't use a boolean for your team, it means you won't be able to change it later on if you want to expand how your game works.

#

I'd use a uint8 combined with an enum or macro.

#

#define TEAM_SPY 0

#

or enum ETeam { Spy. Merc }; etc

#

Even if you didn't want to add more teams, you could add "flavour"

#

e.g. teams could be spy, merc, elephant, leprechaun, etc. And you just pick 2 for each map.

#

(team 2 vs team 7 still makes sense and would work with a uint8 up to 255 teams)

#

Or, if you want to make it even easier to identity things, use an FName!

novel bison
#

yeah that makes sense

#

its the same when i do it from the client, which works

latent heart
#

Shrug

#

Networking debug is a pita

novel bison
#

im sure it's something extremely dumb ive done

#

or am overlooking

#

always is lol

latent heart
#

I'd add a bp to the onrep in c++ and see if it fires twice each time you change something.

#

Or a UE_LOG

potent coral
#

how to fix host being able to push clients around by walking into them?

grizzled garnet
#

When testing multiplayer in client mode with network emulation off, clients still report to have 30-40 ms ping, is this normal or is this a sign of something wrong with project setup? (Profiling reveals nothing as far as I can tell)

grizzled garnet
#

Another question, I need an animation BP running on the server to synchronize with the client so that the client sees the server's current animation pose, accounting for latency. What would be the best way to do this, ideally within the animBP?

dark edge
#

Are you saying client needs to see server pose in real time (before any information about that pose could have made it over the internet)?

grizzled garnet
#

There's an idle animation for the character holding a laser weapon, when it shoots since the animation is out of sync it'll cause visual desync to players with higher latency

plucky prawn
#

Tell them to get better internet

grizzled garnet
#

though this is with the free 3rd person anim pack from back in UE4, we don't have an animator for the project but I'm thinking it would be better to use seeded random procedural generation instead

dark edge
#

ok so you don't need the client to predict the serverside pose, just that the animation is synced with the shot direction

grizzled garnet
dark edge
#

client seeing server late is fine, as long as it's ping ms late

#

Assuming you have a good enough network clock (there's a built in one but it's kinda not great), you'd just have to sync up the animation start time

#

Both server and client need to agree that the loop started at GameTime of 30.235

#

clients 30.235 is later than the servers but that's fine

grizzled garnet
#

Right now I was trying to sync by the client ping as the difference in start time but the player state doesn't report its ping until after the animation starts playing, though if GameTime is synchronized between server-client that could work as a better start time

dark edge
#

I mean you'll never get it perfect

#

how far off are we talking? Can you show a clip?

grizzled garnet
dark edge
#

It's just a get game time of some sort

grizzled garnet
#

oh ok

dark edge
grizzled garnet
#

UE just crashed a few secs after opening just now, but from testing I would say it's up to a half second off when network emulation is on (ping reported at 120 ms). When net emulation is off (ping reported more like 30 ms, hence the question before the one about animations) the animations are much more in sync as expected, wouldnt probably be noticable in that case in normal play

dark edge
#

What do you mean by "off"?

#

it will lag behind, that's to be expected

grizzled garnet
#

Yeah that's what I mean

dark edge
#

that's fine, as the laser shot will lag behind too

#

The problem you have right now is things aren't synced up at all, the loop is starting at completely different times

grizzled garnet
#

I think using GetServerWorldTimeSeconds to sync the start points is probably what I need, I'll see when I'm working on it tomorrow

dark edge
#

YEah I'd do something to the extant of:
BeginPlay:
LoopStartTime = GetServerWorldTimeSeconds (replicate this)

OnRep_LoopStartTime
AnimTimeOffset = LoopStartTime - GetServerWOrldTimeSeconds

now how you'd use the offset, I have no clue. There's gotta be some way to offset a looping animation somewhere.

#

Sounds like hell tho, I'd just not have an idle that you can fire out of, I'd snap to some aim pose

grizzled garnet
#

Yeah I figured that, using the starter pack animations isnt that great for this project, I'll probably work with a new arms-static idle animation and then apply a random aim offset that can be synced server to client based on GameTimeServer sometime in the future

candid haven
#

Hey everyone, I'm running into an issue where I'm using the "Event UpdateCustomMovement" node, which triggers just fine normally in singleplayer or on listen server, but when I switch from listen server to dedicated server while playtesting, it doesn't trigger. I've been scouring the web all day and haven't been able to find a reason as to why certain events won't trigger in the dedicated server play mode. Any ideas?

dark parcel
candid haven
#

so when i play with client and server in the listen server mode, it triggers, but when i switch to dedicated server mode, neither clients trigger. I'm testing with 2 players.

#

i thought it might be something related to the controller, but i can still look around, the update custom movement event just doesn't fire

thin stratus
#

Are you setting the movement mode to custom somewhere?

candid haven
#

yup yup

thin stratus
#

Cause as soon as there is code from you involved you gotta share that as you could be doing stuff wrong there already

candid haven
#

custom mode works just fine in the normal mode, and listen mode, just not dedicated. I even check to make sure that the movement mode is set to Custom when I begin play.

#

Update Custom Movement triggers in the other two, just not dedicated

#

ill share a screenshot here in a sec if that helps

#

This is net mode Play as Client

#

This is with Play as Listen Server

#

Keep in mind I'm mostly experimenting here so there's some goofy stuff going on (like unnecessarily casting every update), but my main concern is why the event UpdateCustomMovement doesn't trigger during Play as Client

thin stratus
#

What is the "CustomMovement" thing?

#

Cause it's replicated and you are instantly using it, so I assume you made sure that whatever is replicating there is actually valid?

#

Also you are using the Controller on BeginPlay, which is wrong

#

BeginPlay is not guaranteed to call when the Character is possessed

#

Especially not in Multiplayer

#

You have to call that in something like OnControllerChangedEvent and limit it to IsLocallyControlled

#

Besides the point, but when seeing this I gotta assume that there are more problems caused by wrong multiplayer code

winged badger
#

CustomMovement is safe to use like that only if its a subobject of the Actor whose graph that is

candid haven
#

So if you're referring to the Custom Movement node that has the enum, it's an actor component attached to this Character

thin stratus
#

Yeah, I mean I guess even if the Replicated Enum is "wrong", it's still custom MovementMode I guess

#

I wouldn't know why that would not call if you are a Client of a DedicatedServer

#

(the top part that is)

winged badger
#

as for controller use - 2 scenarios
1: Server - if the World called BeginPlay, you spawn the Character, Character calls BeginPlay and after that its possessed - no Controller yet
2:Client - if the Character Actor replicates before Controller, that also fails

thin stratus
#

Yop

candid haven
#

Gotcha. So what should I do to ensure that the Controller comes first? Is there a specific piece of documentation I can check out?

winged badger
#

ideally APawn::OnRep_Controller (c++ only) or overriding AController::SetPawn (also c++, prefer this option, as SetPawn is called from both Possess and OnRep_Pawn in COntroller)

#

so with SetPawn you don't need to handle server and client cases separately

candid haven
#

Alright, I'll take a look into that. In general, it seems that replication and doing anything related to custom movement is incredibly hostile to blueprints.

winged badger
#

well, doing any serious prediction with custom movement modes, like dashing, climbing, wall walking... etc

#

requires you to use a custom CMC class with custom FSavedMove class to carry those extra bits of information

#

and that is also c++

candid haven
#

That makes sense. I know delgoodie has a really comprehensive series on youtube but I haven't really gone in depth with it yet as it's pretty long. Do you know of any other series either written or video that are worth checking out?

winged badger
#

always worth checking pinned messages on this channel

candid haven
#

Ah right, my bad. I'll check it out. Thanks!

thin stratus
#

Which you can override

#

Also calls for Server and Client

covert igloo
#

when testing networked code. what is a good range to simulate latency with

chrome bay
#

There's no hard answers really, but a typial usage might be 1-2% packet loss and 100ms latency. The editor has presets for "average", "bad" etc.

thin stratus
#

It also depends a bit on what you are trying to test.

#

I often disable package loss, cause it's not like I can do anything about it anyway.
I haven't really had to fight with package loss yet, cause UEs networking handles this more or less anyway.

#

And pings over 100ms can already be seen as unlikely, but you can of course also go up to 200ms, just to see how bad it gets.

#

Like, if you notice something on 100ms that looks like an actual bug, then 200ms might help you repro it better or just visualizing it better.

#

Doesn't necessarily mean that you expect the game to work on 200ms

#

(although, without packageloss, 200ms should theoretically work as well as 100ms or 20ms, just with a higher delay)

covert igloo
#

thanks. that all sound pretty fair.
im testing a health system and so far even if i crank it up to 200. it just runs a little slower. everything seems pretty airtight.
but its cool theres a packet lost button. i didnt know that.

chrome bay
#

Pointers to objects are replicated by assigning a NetGUID to the object. When you "send a pointer" to a replicated or net-addressable object, that netGUID is what is sent.

#

Every Server/Client connection has a unique mapping of NetGUID's to object instances.

pearl bear
#

How this might be possible?

chrome bay
#

Only the properties you mark as replicated

#

If the object is not statically addressable (i.e, via path name), or spawned at runtime, then the network system sends the object class so that the client knows what to spawn.

#

For example when an actor is spawned at runtime and replicated to a client, the first packet will contain the class. Either as an FName path or another NetGUID associatted with the class, so that the client knows WHAT to spawn. Then any replicated properties can be read-in after that.

#

Nope what you suggested is fine

#

Only if they differ from the default-serialized values

#

The server does everything it can to only send a property if it's actually changed.

#

What you suggested RE replicating a pointer and an OnRep is fine.

#

The object replicates independently of references TO that object

#

And note that by default UObject does not support being dynamically spawned and replicated, that requires extra work

#

Only AActor + UActorComponent support that out of the box

#

In the case you described, the OnRep will fire whenever that reference changes (e.g, becomes valid, becomes null, or changes to another object), but not when a property within that object being referenced changes.

#

For reference πŸ™‚

#

Classic UE documentation

hoary spear
#

Im a bit confused, im getting a warning when RPC'ing from PlayerState, about no owning connection... I thought this was owned by a local controller, and should work ?

#

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_PlayerState_C_0.

chrome bay
hoary spear
#

It definetly has replicated by that time, far into gameplay ?

#

I suspect its related to the invoker but im not really sure why, or where i've misunderstood this πŸ˜›

#

Invoked directly from a Widget

chrome bay
#

You only "own" your own

hoary spear
#

I'll walk up the tree and verify, but pretty sure it can't be anyone else's

chrome bay
#

Yeah you want Inventory replicating from Server. How to deal with stacks vs items etc is up to you. The way I do my inventory entries is:

  • ItemDefinition (static data asset)
  • Count (1 for non-stackable, # for stackable)
  • Instance (either null, or some other object that represents the item, e.g. weapon actor or w/e)
#

Jimbux

#

Like fortbucks but more useless

hoary spear
#

Hmm. Owner of playerstate is nullptr,

chrome bay
#

RIP in penguins

hoary spear
#

so does that suggest others?

chrome bay
#

yeah

hoary spear
#

damn

chrome bay
#

Probably belongs to another player

#

On the Server/that player, the owner would be their controller

pearl bear
#

I had pretty weird bug, client camera is facing wrong direction and replication is not working on client but in view its okay,

ebon basin
#

When restarting a pawn (respawn through gamemode) only the server will execute OnPossess, it doesn't happen on the client owning that playercontroller, does anyone know a solution for this? I need to reset some stuff in my PlayerController but the reset is only triggered server side (from OnPossess)

coarse gale
#

ahh damn, I thought if I ever annoyed Laura I could just go hide in multiplayer where she cant find me, my plan is ruined.

coarse gale
#

I actually have some strange issue thats been bugging me. If I play as client, with 2 standalone games everything works as expected. But if I play as client with 2 pie windows, actions on one happen on the other client, even tho there is no RPC code on that function. so I have a widget with a text input, the onentered delegate seems to fire on both PIE clients, but there is no reason it should as there is no networking code on that function atall, and when playing as standalone clients this does not happen. So if it was a rouge RPC it should happen on standalone aswell, so PIE with 2 clients has strange behaviour, standalone with 2 clients works as expected.

outer sail
#

Hello, how can i disable server correction for character rotation?

#

it makes my rotation stutter during movement as my player faces the cursor in top down, doesn't need to be corrected by the server

chrome bay
#

The problem is serializing/replicating it. Structs don't really support inheritance since they are stored as data, so you end up slicing

#

Also this - only the elements you change are serialized, even with standard TArray

#

The difference is that FFastArray doesn't preserve item order, and uses a custom ID for each item, so that removals/additions to the middle of the array don't mark all subseqent objects as changed

#

There's a million ways to appraoch inventory though, generally. I've landed on something now that's flexible and performant so I'm happy

#

I strayed away from that. My item definitons are Data Assets

#

Well in my case the instance object is optional - it might be nothing, it depends on what class of data asset the definition is

#

My approach was that the inventory doesn't care what's in it - the data asset acts like a "factory" for creating/removing items, and the item has all logic self-contained

#

I'm planning to release it, just CBA to go through the hassle of making sample projects πŸ˜„

hoary spear
chrome bay
#

You can use the bulk-editor for consolidated editing. It's not perfect but it helps.

#

That's what we do yee

ebon zealot
#

calling a server->client rpc on begin play on a player controller doesnt seem to work

#

if I add a .1s delay it'll run it though

#

I'm guessing there's another event that should call the rpc instead of begin play, what's that called?

thin stratus
#

Are you trying to send data to the Client?

ebon zealot
#

nope

#

just an rpc call

thin stratus
#

Then what do you need the RPC for

#

BeginPlay will call on the Client too

ebon zealot
#

to do something on the client

#

after the server starts initing specific stuff

#

that stuff is replicated

outer sail
coarse gale
#

I just give literally everything a unique ID, its all stored in a db then I just recreate it from the json data. Having unique ids is good for many reasons imo

chrome bay
#

I would usually put an ID into the asset itself, and the asset manager builds a map of them by finding them from their primary asset ID. ANother approach is to maybe hash the primary asset ID or something

thin stratus
#

I usually use a Tag

#

And the FName for the ID

#

Then I can query things by Type.ID and also generally reuse the Tag if needed.

#

Also saves my butt from typos

hoary spear
outer sail
#

welp seems like no solution for disabling server correction for player rotation, but i got another question

How should i deal with prediction of spawning some replicated objects? So the client spawns an object locally instantly and later gets replaced by the replicated one once thats spawned on the server

thin stratus
#

Predictively spawning Actors has to be coded by you from scratch fwiw.

#

If they are moving, like a projectiles, you also want to "forward" the location by the latency on the server

ebon zealot
outer sail
hoary spear
#

OnRep calls whenever the property is changed by the server, and replicated to the client(s) @ebon zealot

outer sail
#

making a tower defense

thin stratus
#

The base idea is to spawn them on the the Client and then on the Server. When the Client receives its copy you gotta figure out a way to map them to the local version

chrome bay
#

(also generally not worth the hassle)

#

Unless it's something incredibly time-critical

ebon zealot
#

I dont want it to be called every time it's modified even outside of begin play

chrome bay
#

No OnRep is called during BeginPlay

coarse gale
#

I don’t actually know what you are trying to do, but the postlogin event is the first place it is safe to call replicated function on the player controller, if that helps

ebon zealot
ebon zealot
quaint ice
#

Hello, I am a little stuck on my multi-player and I would really appreciate some help because goigling wasn't fruitfull: my players collect collectibles. How many they have ist stored in the player state. Works like a charm.

The plan ist to have the game end, when someone has 5 pickups.

The issue I can't wrap my head around is: where and how to I check for that and when to call the win of the game when someone has 5. I'm really stuck. I assume I need a customGameStateBase, do I?

chrome bay
#

BeginPlay/OnReps are not linked to each other at all

#

Blueprints hacky OnReps might fire, but not because values are actually replicating.

ebon zealot
#

so modifying a property during begin play isn't going to cause it to replicate?

chrome bay
#

It will replicate yes, but it will not call the OnRep immediatelly

#

You have zero way to know where the property was changed from

ebon zealot
#

when will OnRep be called?

chrome bay
#

When the value replicates

#

And the client machine reads the properties in from the data stream

ebon zealot
#

yeah that makes sense

#

not exactly what i'm trying to use here

chrome bay
#

Which is usually before begin play if something is newly replicated

ebon zealot
#

here maybe I didnt explain it properly

#

player controller begin play -> add initial inventory items -> tell client initial inventory items are added, the client will handle these items differently from the new items added after / during gameplay

chrome bay
#

You have no way to do that

#

Not really sure why you would though anyway, that seems quite fragile

ebon zealot
#

well whenever an item is added to a specific slot for the first time (by the server) it'll need to do extra shit to make it render

#

but after that the client can assume the items and do the rendering itself

#

so all I want is call that render function once the items are added by the server for the first ever time

chrome bay
#

Why not just set a local flag on the item for whether it's been locally initialized or not?

ebon zealot
#

if my original approach wasnt going to work i was going to do that

#

but I thought this would've been slightly cleaner

chrome bay
#

Far from it IMO

#

BeginPlay() and OnRep are not linked, they can happen at anytime. You've no garauntee that the inventory will have even replicated by the time the actor begins play

ebon zealot
#

mainly because 99% of items wouldnt need that initial item bool

#

thus having extra data

#

but maybe i shouldnt worry about it much

chrome bay
#

For an initial packet, OnReps will be called before BeginPlay()

#

BeginPlay() can be called at ANY time, it's why it's such a terrible place to do initialization.

#

No the initial is still only pushed when the item becomes relevant again

#

But properties are alwasy read in before begin play. Unless that actor is say, part of the level - in which case BeginPlay() might be called first

#

But the two have zero linkage whatsoever, so logic that depends on their call order is extremely fragile

#

PostInitializeComponents() is by far a better place to do self-initialization. As soon as the actor is spawned, it initializes itself - regardless of whether GameState currently exists or whether the match framework has even called StartPlay()

#

BeginPlay is abused

drifting heath
#

Does UVitalityComponent* VitalityComponent need to be set in GetReplicatedProps(sp) in order to receive multicast events? The component is internally set to replicate. The OnDamageTaken event I wrote is triggering, but the parameters are null when passed.

ex

//CharacterBase.cpp BeginPlay()
    if (!VitalityComponent->OnDamageTaken.IsAlreadyBound(this, &ACharacterBase::SpawnDamageText))
         VitalityComponent->OnDamageTaken.AddDynamic(this, &ACharacterBase::SpawnDamageText);

// Spawn floating text actor/widget
void ACharacterBase::SpawnDamageText(AActor* DamageInstigator, float DamageTaken)
{
  ...
}


//VitalityComponent.cpp
void UVitalityComponent::Multicast_DamageTaken_Implementation(AActor* DamageInstigator, float DamageTaken)
{
        // Rider Debug Inspect: BP_Character_C    20.0
    OnDamageTaken.Broadcast(DamageInstigator, DamageTaken);
}

Floating Text when the damage is dealt to the enemy actor:

chrome bay
#

The actor itself needs to be replicated/addressable of course

drifting heath
#

Kinda what I figured.. I just realized as I posted that, that the event is triggering. It just had invalid values.

outer sail
#

Is it possible to have fully client authoratative movement in unreal?

#

i want the server to be the one who experiences the rubber banding

chrome bay
#

with character? Yeah, just literally check the "client authoritative" property

#

bServerAcceptClientAuthoritativePosition is the one, rather

outer sail
ebon zealot
#

is there a utility thing to check if an array was fully replicated in OnRep?

chrome bay
#

no, you can't know

ebon zealot
#

or do I have to go through each item and check properties

chrome bay
#

Check bIgnoreClientMovementErrorChecksAndCorrection or it'll still send movement corrections back

outer sail
#

to match the client

coarse gale
chrome bay
drifting heath
ebon zealot
#

well just that they arent null

#

it does it on stages i think

#

it sends an array of nulls with the same amount

outer sail
ebon zealot
#

and then it starts filling it

chrome bay
#

The array size will be set first. Item pointers will populate as those objects replicate/become relevant.

outer sail
#

i'm making a casual coop game so i don't need no server auth

ebon zealot
#

I just check every on rep if all items are non null

#

it works for now but it deffo doesnt seem rigid

chrome bay
#

Server doesn't send an empty array, it sends the same data - but pointers will be populated at arbitary times

#

At least, if they can't be reconciled right away

#

Since you have no ability to know which may replicate first, the object storing the references, or the objects being referenced

drifting heath
#

Okay. I think I see the issue with my Multicast thing now.. Multicast is sending it to all clients (dur), and I'm trying to have the damage text appear next to the actor taking the damage, but it's appearing next to me.

Since a client event would only trigger on the owning client (in this case an NPC), that wouldn't work. So I'm assuming I have to pass a 3rd argument for the actor who took the damage.

coarse gale
#

Well that reminds me about a question I had , Its my understanding that a multicast delegate (delegate not rpc) has nothing to do with networking. Is this true ?

drifting heath
#

Multicast sends it to everyone, including the server.

coarse gale
#

I know that true for an rpc

drifting heath
#

In my case, I had to consdier a dedicated server, which shouldn't be running the event

coarse gale
#

I was told a muticast delegate is a misleading name

#

I will take a read, It was my understanding its called multicast because it can hold multiple functions that it can call, but I think it can be confusing in the context of unreal and muticast rpcs

drifting heath
#
float UVitalityComponent::DamageHealth(AActor* DamageActor, float DamageTaken)
{
    if (FMath::IsNearlyZero(DamageTaken,0.001f))
        return mHealthValue;
    const float oldHealth = mHealthValue;
    const float NewDamage = 0.f - abs(DamageTaken); // ensures a negative
    const float newHealth = ModifyVitalityStat(EVitalityCategories::HEALTH, NewDamage);
    if (newHealth < oldHealth)
    {
        if (newHealth <= 0.f && oldHealth > 0.f)
        {
            //OnDeath.Broadcast(DamageActor);
            Multicast_VitalityDeath(DamageActor);
        }
        else
        {
            //OnDamageTaken.Broadcast(GetOwner(), DamageActor, NewDamage);
            Multicast_DamageTaken(GetOwner(), DamageActor, NewDamage);
        }
    }
    return newHealth;
}

Essentially this is what I'm trying to achieve. When OnDamageTaken (broadcast within Multicast_DamageTaken) is received by CharacterBase.cpp, the receiving player processes whether or not they dealt the damage. If they did, it spawns the damage floating text actor, showing the damage they did. So far, that works. Problem is, the text shows up next to the player who dealt the damage, which is telling me that this delegate is being triggered on the player who dealt the damage. It should be triggered on the NPC who took the damage.

#

OOHHHHHHHHHHHHHHHHHHHHHHH I think I just had an epiphany

#

It can't trigger on an NPC. It has to be triggered on the player who dealt the damage and then spawned.........whoops.

quasi tide
#

HasAuthority doesn't necessarily mean it is the server or client, just FYI

#

In most cases, yes.

drifting heath
#

I was thinking of this wrong. I was wanting the multicast to trigger on the NPC who took the damage and show the damage instigator the damage value........... It needs to be triggered on the damage instigator, and spawned on the actor who took the damage, because a multicast won't fire on an NPC.

coarse gale
#

yup, I had to use both those checks together yesterday to fix something

quasi tide
drifting heath
#

That's how I have it set up.. For some reason my floating text is showing up on my character and not the NPC.

#

AH... Fuck me. I found it.

#
    /** Sent to all clients from server when the DamageHealth() function runs
     * successfully, but the character survives the damage. Used to trigger clientside events.
     * May arrive prior to the mHealthValue actually being changed.
     */
    UFUNCTION(Client, Unreliable) void Multicast_DamageTaken(
        AActor* DamageTaker = nullptr, AActor* DamageInstigator = nullptr, float DamageTaken = 0.f);
    
#

I put Client. πŸ€¦β€β™€οΈ

[Edit] Works. >_<

coarse gale
#

Im still confused about an issue I encountered yesterday, where there seems to be a crossover of functions when playing as 2 clients in pie, that is not present when playing as standalone clients

#

It makes no sense to me, the function isnt even replicated. But the delegate is called on both clients in pie, and works as expected on standalone clients

#

So I have just been using standalone now for testing, there should be no difference in 2 pie clients and 2 standalone clients, but there is

drifting heath
#

Can you show code/BP? Probably a simple oversight like my issue above.

#

If the function is crossing over (I'm assuming you mean crossing over clients and running twice) it's probably being triggered on something replicated by the server. Just my initial guess.

coarse gale
#

Not at pc right now but ill post it inabit. Thats what it sound like for sure but its not a replicated function, just a text input in a widget that gets displayed on both clients widgets. And if it was replicated or a rouge rpc, the issue should be the same when using standalone clients.

#

Thats why I double checked about the multicast delegate, because all i’m doing is taking the text entered and updating the widget on the widgets text entered delegate. Its a strange one, and I dont understand why it would do it on pie clients but not standalone clients. The functionality of both should be the same πŸ€·β€β™‚οΈ

drifting heath
#

The only thing I can think of is an improper server check of some sort, though I understand you're saying it's not replicated. The only difference is standalone is one client with authority, and the other is two clients without authority. So basically it's running twice. You can run 4 clients and see if it runs 4 times, too. If that's the case, it might not be networking, but something like your player character is replicated and it's running on all 4.

coarse gale
#

So by standalone what I mean is in the editor, its set to play as run as client so it runs a server in the background. If I set it to 2 clients and as pie, it opens 2 clients and a server but those clients are pie windows, you can change the option to standalone so it still opens a server and 2 windows but those windows are not pie windows and more like packaged/standalone windows. I am running 2 clients and a server in both configs.

#

Im sure its something simple and a check like you said, but its really confusing me lol. I just dont know why 2 clients and a server in pie acts differently to 2 standalone clients and a server.

drifting heath
#

Nothing is simple when it comes to this multiplayer crap 🀣

coarse gale
#

I could just do all my testing with the standalone windows, which works as expected and is how a packaged game would be anyway. But I would still like to find the cause of why its doing what it does in pie

drifting heath
#

If I understand it correctly, "standalone" means that game is a client and a server in and of itself. By your description, you're starting two individual games and an empty server

#

but that dfoens't explain things running more than once

#

Oh, I'm thinking net mode. You're talking about the play feature.

coarse gale
#

ye, its still a client and connecting to the dedi in standalone mode

#

Honestly, my suspicion is that the widget delegate is shared between pie windows when its not supposed to be. If it was a network code error then the same should happen on the standalone windows. I could be wrong but thats whats it kinda pointing to.

#

I might make a blank project later, make sure there is no replication atall and test that widget delegate on 2 pie windows just to rule it out

odd wyvern
#

Hi, does anyone has experience with marking property as both Instanced and Replicated? Is it safe to do so? Will instanced flag be ignored on client? Also the property is inside of replicated subobject, so it may not be replicated at all times, since I may remove it on server during runtime or decide to not add it to replication from very beginning, but later on.

coarse gale
#

ok.. I worked it out, it was exactly what I thought it was...

#

I unchecked this box and the problem stopped

#

so it was not a network issue, it was the delegate being shared between pie windows because they were running under the same process

coarse gale
#

so fwiw, if anybody is testing multiplayer in pie windows, I recommend you uncheck that box, because the engine is clearly not separating the clients correctly in pie windows when running under the same process and you may get some funky behaviour. Will probably report this as a bug later.

chrome bay
#

If it's a static delegate then that makes complete sense

coarse gale
#

its these that were causing the issue

                InputLayer->OnTextChanged.AddDynamic(this, &UTerminalWidget_Base::HandleOnTextChanged);
                InputLayer->OnTextCommitted.AddDynamic(this, &UTerminalWidget_Base::HandleOnTextCommitted);
chrome bay
#

What is InputLayer?

coarse gale
#

its an editabletextbox in a widget

chrome bay
#

Sounds like there are other shenanigans at play here

coarse gale
#

well pie clients should not share an OnTextCommitted delegate, if it goes away when unchecking the box that runs the client windows in the same process thats an engine bug to me

chrome bay
#

They don't share it - the problem is elsewhere in your code

upbeat basin
#

So, if I attach an actor to another one, the attached actor's root component is being added to the target actor as another component, which makes both actors being deleted due to cull distance even if the attached actor is always relevant? Just trying to confirm if I understand correctly

coarse gale
chrome bay
#

Something somewhere is static, I garauntee it

#

PIE clients do share the same memory, so it stands to reason that if you create an object that is statically accessed, all clients will be able to get to it

coarse gale
#

its very possible, all im saying is that I ruled out a network issue, and its more to do with pie clients sharing memory etc

chrome bay
#

Yeah, but I'm just saying it's not an engine "bug" as such

coarse gale
#

ill have to investigate further, but atleast I know where to start looking now. I was checking replication and rpcs, when it wasnt that

drifting heath
#

The inventory system I wrote has no problem replicating the array, but it doesn't OnRep which slot was changed, so you end up having to iterate the entire array for everything that needs to know if it updated. The way I did it was just set the array to Replicated, and created my own Client_InventoryUpdated(int SlotNumber = 0) that gets called everytime a slot updates.

#

Then anything that's interested in knowing if the inventory has updated runs in O(1) instead of O(n) everytime the inventory updates

#

The only issue is things arriving out of order, but you could write some type of listen/check using OnRep and a Client RPC.

#

Yours should work but you'll have to iterate the entire array every time.

quasi tide
#

I just iterate the array every time. My inventory is only like 5 items. Not a big deal.

#

Do the simplest thing, but no simpler.

#

Rep conditions, Owner only

#

And if you're doing a client RPC - it's already client specific

obtuse temple
#

Is there a console command to toggle 'Run under one process'? Diving into the settings menu everytime is getting tedious.

drifting heath
#

DOREPLIFETIME_CONDITION(UInventoryComponent, InventorySlotsArray, COND_OwnerOnly)

#

Now that I think about it, obvs O(1) is better than O(n) but with how infrequent the inventory updates, the difference is probably negligible.

quasi tide
#

My check is just comparing ints pretty much. Even with 30 items, it is very negligible.

dark edge
#

O(1) is better in the extremes, but it might actually be much worse with small data sets. Depends on what the constant time component is

quasi tide
drifting heath
#

Yeah, sacrificing accuracy for speed. In this case, it'd be a negative outcome. If the array update isn't received by the time that InventoryUpdate is received, then it'll update before it's ready.

#

OnRep is likely the better outcome for inventory updates

icy jetty
drifting heath
#

I think the main issue with my O1 v On case with the inventory slots, is that if you go with the O1 option, you might update before the array replication is received... Which means you need to implement some sort of "Okay, I hear you're updating but I need to wait for the replication" thing, which complicates it even more. The O(n)\ here seems worth it, on second glance. Might change mine to just doing an atomic OnRep update.

#

Best case isn't really a factor in this situation.

#

Almost any time I've got a giant blob of error like that, it's because I didn't define a declared method, used the wrong class name or had a delegate that didn't exist.

#

Usually it's because I didn't define the method

quasi tide
#

"unresolved external symbol" - you are missing something in your build.cs

drifting heath
#

If it's throwing that on a native, then yeah that's most likely the case.

quasi tide
#

Go to that type it is complaining about, ctrl click on it, then copy the macro part of class SOMEMACRO_API Thing, and throw it in your build.cs includes.

#

Without the _API part though

serene sparrow
#

Slightly related question that maybe you might be able to help me with.

I have a relatively large array in my game. When I try to replicate it I get an error of the type:
[2023.07.19-15.30.26:281][ 70]LogNetPartialBunch: Error: Attempted to send bunch exceeding max allowed size. BunchSize=75039, MaximumSize=65536

Would using the FFast TArray solution help with that, or does that only help with the CPU time the server spends trying to find which array elements to replicate?

#

I won't really make too many changes to the array, but yeah sending it at first seems a bit problematic.

I mean 75039 bytes are like... 0.075 mb or so. Doesn't seem to be that bad to send to the player on join

chrome bay
#

OnRep still works with fast arrays

forest fulcrum
rain condor
#

I have a drop function who is replicated on server but when i drop item from client, others client (including sv) can't see it

drifting heath
#

Send a request to the server from the client to drop the item, then spawn/drop it on the server.

#
player wants to drop an item
  server_dropitem
    verify drop request is valid
    dropitem()
      spawn replicated actor
coarse gale
#

Even a limited knowledge of c++ makes certain things much easier than using blueprints

icy jetty
#

Well making multiplayer stuff strictly in bp is not recommended anyways

coarse gale
#

I was trying to do database access in blueprints and the data management was absolute hell

#

Turns out my problem earlier is normal behaviour when running pie clients on single process, so I dont have to worry about it

pallid wasp
#

Hello, how do i save multiple structs for each player? with one i got it working but multiple... just how? especially if 1 struct is saved like 4 times each player, so i cant do it with loop for each with break.

drifting heath
#

Spawning the item, yes, you're sending it to the server which is good. I think the server->client->server calls are redundant, though.

#

Just have the server check if they have the item, and if the drop is valid, then spawn the item. All the client needs to do is tell the server that they want to drop an item.

#
void ACharacterBase::DropItemOnGround(int InventorySlotNumber)
{
  if (HasAuthority())
     // Replicated SpawnActor Logic
  else
    Server_DropItemFunction(InventorySlotNumber) // Call function on server
}
void ACharacterBase::Server_DropItemFunction(int InventorySlotNumber)
{
  if (HasAuthority())
    DropItemOnGround(InventorySlotNumber) // Run drop logic as server
}

A basic, non-func, unoptimized C++ version.

glass orchid
#

is there a way to have a level open with the listen option by default, so basically on startup? instead of using an open level node

rose turret
#

I have a philosophical question about how the different multiplayer code paths work together -- particularly the CMC client-side prediction, GAS prediction, and actor replication

both CMC and GAS are doing client-side prediction with validation/rollback, but on different code paths. does it make sense to integrate them or do they run together seamlessly while being separate? for example, if at T=5 I activate an ability and move the character at T=6, both of those are "user inputs" so my instinct would be to shove them both into SavedMoves. (is there really a difference between crouching via compressed flags and doing a super jump or sprint in GAS?)

with entity replication, let's say that I am running forward in the CMC and I bump into a box, triggering its physics and knocking it over. do I simulate the physics for the box locally and allow the server to correct that via actor replication? do I wait for the server to tell me that the box moved? if I roll back the CMC move, do I just let the box correct itself via actor replication (because I never actually bumped into it)

sorry if this is a bit jumbled, still trying to wrap my head around how these all play with each other

coarse gale
#

doesn't actually seem all that difficult tbh, if the client is just doing the ability and then sending to the server for validation, if the validation fails the server should still have the correct/previous values to just send back to the client. I guess there might be a few extra things to consider but the basics of it seems simple enough

#

Thats basically what I was saying, you don't update the damage on the server if the validation fails so the info on the server is still the correct info. As for the revival, I might consider applying damage instantly on the client and then validating after as that can be rolled back fairly easily, but if the damage leads to a death it might be better to wait for validation before destroying the actor, just a thought

keen hound
#

ue5 hangs when Player 2 joins the game

#

How to fix it

#

Be it standalone , as listen server , as client ,,, It Hangs Slowly like it get lags so hardd

#

Actually the whole engine lags

#

Why?

#

WHen it is only 1 player

#

it works fine

coarse gale
#

very generic question with many possible causes

keen hound
#

Is It?

#

It worked fine , It suddenly got like this

#

Is there a way to find out the exact prob?

coarse gale
#

it is, it could range from hardware to code

dark parcel
#

Only lag in editor for me

coarse gale
#

if it worked fine , then started freezing up, what changed between those 2 times

dark parcel
#

Maybe stand alone too but that's like same machine trying to join

keen hound
dark parcel
#

When it comes to actual different machine connection there shouldn't be lag (packaged version)

keen hound
coarse gale
#

did you add anything between yesterday and today ?

dark parcel
#

Lags everytime another player join (from same machine)

keen hound
#

then is it okay to package?

dark parcel
#

Try packaged build with 2 computers

#

Yea I'm fine

dark parcel
#

I connect 3 machine all good

#

No lag what so ever

keen hound
#

Oh The Same machine is the prob?

coarse gale
#

if you can test a packaged build on another machine ^^ that is your best bet

dark parcel
#

I mean the other player probably eat your memory when you joining. Since they are in the same machine it's only natural that your system lagged altogether. Imo

coarse gale
#

well if its trying to run multiple instances of the same game and possibly a server aswell, it might struggle

#

depends on how much is going on

dark parcel
#

Non async loading map always shit your pc

keen hound
#

Ohh

#

Thanks Guys

#

I'll try packaging and running in different machines

#

Ohh 1 more thing

#

I have two maps in my project , Main menu , and the game's land map

#

In the main menu it doesn't lag

#

Only in the game's land map it lags

#

In the main menu , the character cannot move , but is spawned and a hud for starting match (start button ) things like that is in the hud

#

When the match is started and when the player enters the world map , engine lags

#

It also lags when the world is opened and I just play in editor with 2 player no.

#

Still the machine is the problem right?

vivid seal
#

This is kind of a vague question but how do you go about debugging issues caused by packet lag? I have a root motion dash ability that works great in multiplayer, even with 200ms latency. However, as soon as I add even 1% packet loss, I start getting issues with double dashing and being snapped back into place. I still end up at the right spot and it often looks seamless on other machines, but locally im rubberbanding.

rose turret
# vivid seal This is kind of a vague question but how do you go about debugging issues caused...

your gold standard here is being able to see the code path that caused this

if possible: can you set breakpoints that fire when a double dash happens so you can see how you got there?

sometimes you can't set breakpoints because the problem is timing dependent, so it needs to run at full speed without breaks. options there are recording information that will allow you to reconstruct the call stack. one easy one is just really chatty logging -- "x happened", "y happened", etc. and you can see the control flow that happened and form a hypothesis about what's going on

twilit radish
#

There are also console commands and logs you can enable specifically regarding the movement system to debug I believe, maybe they can be useful here too. Although I don't exactly recall which ones πŸ˜…

ivory bear
#

For a replicated automatic rifle, would you put the timer inside the server event or after the button press and have it call the server event?

rain condor
#

Can i replicate uobject with blueprint?

dry dove
#

Hi, i have that error when i want to build the dedicated server
Erreur MSB3073 La commande ""C:\Program Files\Epic Games\UE_5.2\Engine\Build\BatchFiles\Build.bat" ZGameServer Win64 Development -Project="C:\Users\xxx\Documents\Unreal Projects\ZGame\ZGame.uproject" -WaitMutex -FromMsBuild" s'est arrΓͺtΓ©e avec le code 6. ZGame C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets 44

ivory bear
#

Player respawn. I am getting an error on the respawned character (player ref not valid, pending kill or garbage). Yet the player spawns completely and has a working red dot.

magic vessel
#

I'm using the fast array, I'm looking to invoke some logic on PostReplicatedAdd on the class that I'm using to hold it]

fossil spoke
#

Either have the Container be initialized with a reference to the owning class object (not really recommended if the Container is meant to be generic).

#

Alternatively, you can setup some delegates on the Container which owning class objects can bind to.

#

You would just broadcast those delegates in the appropriate functions inside the Container.

magic vessel
#

Okay, I was wondering if there was a built in way to do it

#

But this seems like a much better way than what I was going to do

fossil spoke
#

FastArrays are self contained, they dont expose anything like that to external classes.

#

You need to implement it yourself.

magic vessel
#

There is a third way I can think of, using an interface

#

Keeps it generic and avoids bloat

fossil spoke
#

Not sure what you mean?

#

How does an Interface help?

magic vessel
#

So when PostReplicatedAdd is called, I could get the owning object and call an interface function on it that will handle the change on the client

fossil spoke
#

Sure you could, but delegates would be more appropriate.

#

Since you wouldnt need to track the owner

#

If the FastArray is dependent on the owner (its purpose is highly specialized) then you may as well just expose functions that it calls directly on the owner.

#

The ASC does this for example when it uses FastArrays for stuff.

#

Since the FastArrays its using are highly specialized there isnt any reason to make them generic enough for other classes to make use of them.

magic vessel
#

Thinking it through with your input, I agree that using delegates would be the better way to go

#

Thank you for your help πŸ™‚

charred solar
#

Hello everyone!
I have a quick question about Anim Notifies
Are these always triggered? I saw in some forum answers that they could fail to trigger, specially if their montage tick type is set to Queued, I'm having an issue where I put a notify in a montage I loop if the player holds a key, but sometimes the server stops triggering it, the client continues to trigger it and playing the animation.
If I play in Listen Server the animation stops playing in the server, this is because I need the Anim Notify in order to keep looping the montage.

#

Also I tried to put the Tick type as Branching point, but it triggers twice in the client and in the server

uneven lion
#

So I know you can't call a PlayerController RPC from an interface or owned actor, but could I call an RPC in the inherited class?

e.g.

class AExtraRPCs : public APlayerController
{
    UFUNCTION(Server, Reliable)
    void someRPC();
};

class AMyPlayerController : AExtraRPCs
{
};
fallow bison
#

If I’m working on a multiplayer game. And I want a specific macro to be replicated so the server knows what forces where applied to the client? What order should I have my events run through?
I cannot figure out why my client is just stuck in place vibrating violently. Client can see server and server can interact and push client around, but client can’t move

sinful tree
fallow bison
uneven lion
lost inlet
distant dock
#

Hello, I'm having a problem connecting a mobile ue5 built-game to a windows dedicated server.
It initially connects to the server but then immediately disconnects.
Anyone else faced this issue before?

pallid wasp
#

Hey! i want the server to save stuff but i need a local struct from the client but if i cast to the client the struct is full of emptiness while local it has stuff in it

coarse gale
pallid wasp
coarse gale
# pallid wasp oh i see, ty!

you need an RPC or replicated variable, casting is only really saying β€œis this thing of this class” but you are not getting a remote instance of it just by casting to it

pallid wasp
coarse gale
#

I don’t want to confuse you so I wont try to explain them much, my wording might be misleading but I dont think thats a fully accurate description. The basics is that a variable exists on the server and that variable is sent/replicated to all the clients so they can also see it but not edit it, but there is a few different types. RPCs are different than replicated variables.

pallid wasp
coarse gale
#

if the info is stored in a replicated variable that the server has authority over and is passing that info to a client, then you can just cast to the actor and check it on the server. If you have a variable that is not replicated and does not have server authority, and is local to client. you would need to use an RPC to pass that to the server

pallid wasp
distant dock
#

Hello, I'm having a problem connecting a mobile ue5 built-game to a windows dedicated server.
It initially connects to the server but then immediately disconnects.
Anyone else faced this issue before?

lime echo
#

Hi there. Is there any difference between having a replicated property with a rep notify, and having a replicated property with COND_InitialOnly that after the initial update, is updated via a reliable NetMulticast RPC (in which I put the code I would place in the rep notify)? I don't care for the fact that replicated properties might skip changes on the server and jump straight up to the newest server value. Should the RPC approach have quicker arrival times to clients? In terms of performance, is there a significant overhead that comes with the RPC approach? Thanks.

safe vapor
#

Hey Folks,
SUBJECT: I wanted some help regarding relevancy and OnReps
I wanted to as about the IsNetRelevantFor (https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/AActor/IsNetRelevantFor/)

What I want to achieve:
I have a custom class derived from ACharacter, PlayerCharacter
This class has some replicated variables that rely on OnRep of each of these replicated variables, and the condition is default. This is called on owner and on simulated proxies
I want to leverage this in my squad mode (co op). What I mean is variables like health, custom player states (knocked down, prone, crouch, armed etc) are all notified through their respective OnRep method. As mentioned earlier the OnReps are called on simulated proxies as well.
OnRep will only be called if the pawn is relevant, I want to override the IsNetRelevantFor method and make sure that a teammate is always relevant throught the game no matter where ever they are

Let's say Tom and Jerry are a team and Spike and Tyke are a team.
I have a TeamSystem class that holds this information on every client device and on the server, which pawn is their teammate.

Basically
Tom and Jerry (PlayerCharacter) will be mapped as teammates
Spike and Tyke (PlayerCharacter) will be mapped as teammates

Client 1 -> Tom
Client 2-> Jerry

Client 3-> Spike
Client4-> Tyke

pseudo code
APlayerCharacter::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const { Check if RealViewer(this actor) and Viewtarget(another actor) are teammates if teammates return true else return super }

Its a large message but have tried to give as much info as possible
THANKS IN ADVANCE

Checks to see if this actor is relevant for a specific network connection

safe vapor
plucky prawn
safe vapor
plucky prawn
#

oh sorry i didnt read your code correctly. so you want your team mates to always be relevant? then your code should be fine

safe vapor
pearl bear
#

When broadcast delegate from Multicast RPC clients cannot get that rpc call, any idea about why?

twilit radish
#

I think your logic is a little bit messed up somewhere though. Normally the flow of shooting looks something like this:

onClientWantsToShoot (no matter if the listen server or an actual client)
  sendRpcToServerToShoot() 
  // Maybe also play some VFX or whatever

onServerReceivedRequestFromClientToShoot
  if validShot
    damageWhoeverGotHit()
    invokeNetMulticastToShowClientShot()

onNetMulticastClientShot
  if NOT client that shot
    // Do whatever you want like playing VFX, sounds, playing a notification of some kind.
    // Maybe the player that you shot died or whatever.
```The important parts to note in here are:
-  `damageWhoeverGotHit` and `invokeNetMulticastToShowClientShot` are on purpose seperated. If someone got hit by a bullet you likely want to update someone's health, maybe they have armor that broke or whatever. That's what I would consider a "stateful" change and should not be inside a RPC but instead use replicated variables to prevent relevancy issues etc.
- The net multicast only triggers the logic for the person that did not shoot. You very likely want to play some kind of shooting VFX / sound the moment you actually shoot locally on a client to prevent latency making shooting feel laggy. However eventually that multicast will also arrive to that specific player which has already triggered their sounds, VFX etc. and thus shouldn't do that again.
#

Kind of yeah. Games often do predict things like the sound playing, a shooting effect (muzzle flash etc.) to indeed prevent latency from messing things up but do not actually predict the hit. That's up to the server to do (and if needed for your game in specific validate the shot).

#

But then you do indeed get the 'issue' that the person who actually shot with their weapon also gets another request to play VFX etc. So that's why you need to specifically check whether or not they already did so πŸ™‚

#

A blood splat is fine I would say. If you're referring with an explosion to a grenade or whatever that's a whole different story xD

coarse gale
#

I personally wouldn’t bother with client predicted shooting myself but its down to you at the end of the day, Games like overwatch for example AFAIK dont use it and that feels responsive enough, providing you dont have stupidly high ping you will never notice. The reason I say it doesnt use it is because sometimes when you enter the training ground you can be given a really poor server with high ping, as its just a training ground I think they give you low priority on the network, and when you shoot things it can have a noticable delay but during normals games this never happens.

twilit radish
#

I would not predict health honestly. There's a good reason why most games don't do this, simply because if it does go wrong and the server has to correct it higher level players will get thrown off by it rather quickly. Especially if the person or enemy they shot is already low health and should basically be dead at that point.

coarse gale
#

I explain how I came to that conclusion

#

its an educated guess based on my experience with the game

vivid seal
#

overwatch has client prediction

#

they just don't predict hit markers

twilit radish
#

Maybe we should clarify a point. "Local prediction" in my case was purely VFX, sounds etc. Those do 99% of the time get predicted in games because you don't want to shoot locally on a client and have to wait 100-200MS before a sound gets played. But the actual damage, whether a hit was valid etc. are rarely ever predicted.

vivid seal
#

the little X mark on your crosshair when you deal damage to someone only occurs once the server has verified the hit. everything else is predicted

#

also the sound it makes when that X mark shows up

coarse gale
#

I am just going off what I have experienced with high ping in the training ground, it waits for the server before applying any damage. If they do use it during games then I stand corrected, I was just basing it on that experience

vivid seal
#

when you left click, your gun instantly fires, your shot position/direction is saved off and sent to the server, effects are played, sounds happen etc. but if you have lag you will notice you dont get hit markers or the hit sound instantly, since the server has to verify that your shot hit something

#

i dont remember if they use rewinding or if they just sanity check, i think i remember then talking about rewind? havent watched their lag comp talks in a bit

coarse gale
#

Thats kinda what I mean, the damage is not applied instantly on client and then rolled back if not validated by the server

vivid seal
#

that's pretty common, and usually not what people mean when they say client predicted shooting. client predicted shooting in most cases usually just means "when you press a button, your gun fires on your screen" so that the game doesn't feel laggy

#

usually damage numbers aren't predicted, though you could i guess

#

most examples i've seen don't predict anything to do with actually affecting the health of enemies, just purely visual/audio feedback and your own ammo

#

i think we are all saying the same thing just using different terms

coarse gale
#

ye I think there is just some misunderstanding of terms

vivid seal
#

i thought originally you meant they do no client prediction, which to me means you press left click and NOTHING happens until the server tells you your shot was valid, which would be super unresponsive feeling at even low latency

coarse gale
#

I just remember altaro talking about the GAS system and how that applies effect on client predictively and then roll backs, and I think he was talking about predicting client damage the other day and then rolling back, could be getting mixed up tho

#

you were talking about predicting client damage and then rolling back the other day and potentially having to revive people, the comment I made about overwatch was just saying that they don’t do that, and I wouldnt bother trying to do that personally

chrome bay
#

You only predict effects on yourself, and nothing majorly state changing. Would be pretty jarring for the player if your "death" was rolled back anyway.

#

You want to predict as little as you can get away with

whole pine
#

anyone know how i can retrieve the state of another users 3d mesh capture?

thin stratus
whole pine
thin stratus
#

Well if it's a state, I would rather use OnRep/RepNotify

whole pine
thin stratus
#

:D I hope you did, because you should not use RPCs for State anywhere

whole pine
#

ah what canya do

whole pine
thin stratus
#

Idk what that exactly means.

#

What exactly is even a 3D Mesh Render. Do you mean a capture 2D of a 3D mesh for the UI?

whole pine
#

i was gonna ask if i need a whole new capture with a whole new mesh for other players?

#

my guess is yes. cause how can i look at my character and theirs using the same capture and have different items etc on them

thin stratus
#

Yeah, you'd need one per player

whole pine
thin stratus
#

It depends on how this all is supposed to work

#

If you need to see all characters in your UI at the same time, then yes

whole pine
#

just one player at a time

#

whether it be the owning player or another player

#

only one inventory window should be open at a time

whole pine
thin stratus
#

If you only need one at a time, I guess

whole pine
# thin stratus If you only need one at a time, I guess

so just a little bit more info... lets say i have someone in my friends list. theyre offline. how do i get their save game state of what they had equipped before they logged out (which i have set up). do i need to associate their id with set repnotify variables before they log out?

thin stratus
#

You could do that yes

whole pine
#

u using playfab?

#

oh

keen hound
#

?

whole pine
# thin stratus You could do that yes

in this case, i have different types of items that spawn onto my player mesh. do i set this mesh variable to repnotify and set it after the item is attached to my player?

thin stratus
whole pine
#

oh

thin stratus
#

And in the repnotify you can assign the mesh to the component

whole pine
thin stratus
#

You gotta diff between Mesh being the SkeletalMeshComponent and Mesh being the SkeletalMeshAsset

whole pine
#

asset meaning the actual skeletal mesh file in the content browser?

thin stratus
#

Your image is spawning an Actor and Attaching it to the Component

#

If you do that on the server and you ensure the Actor is replicated, then you don't need to do anything

#

Attachment on Actors is replicated

whole pine
#

depending on item type it spawns actor and attaches it

thin stratus
#

If you do this on the Server and the Items are replicated it should be fine already

#

If not then then whatever data you need to spawn those actors would need to be repnotify

ivory dagger
#

does anyone know if steam online subsystem can be used with mobile platforms like android and ios?

quasi tide
#

Steam doesn't participate in the mobile space, so I wouldn't imagine it would be all that useful, even if it were able to be used.

ivory dagger
#

cause there are no subsystems specifically for mobile

quasi tide
#

EOS

#

Or your own setup

#

Or some other 3rd party

ivory dagger
#

alright thanks

fallow bison
limber gyro
#

im trying to find the best way to mute the enemy players voice, i've never messed with this so im a bit lost, im thinking about doing it when they join the server, is there a local call back for when a player joins that i can use? is this a good idea at all?

chrome bay
#

If it's muted locally then no. Generally what you do is join a channel, the server decides which channels you can/can't join and handles the requests

ivory dagger
#

@quasi tide can you please help me with this? it says mobile platforms arent supported by EOS

#

is the solution to buy a 3rd party plugin?

quasi tide
#

Or...just expand on it yourself?

#

EOS does support the platforms. Just write your own subsystem

#

You could always just buy the one from Redpoint as well

#

But remember, code plugins are a per seat license. So everyone on your team needs a license.

rustic nimbus
#

can someone help me? idk how to make it work for also the clients

quasi tide
#

Make what work?

#

What is "it"?

rustic nimbus
#

the set view target with blend

rustic nimbus
#

i want everyone to view from the same camera

#

or same spot ig

quasi tide
rustic nimbus
#

but how tho

quasi tide
#

GM is server only

rustic nimbus
#

ik but like, i want them to see from the same camera after they enter the level

quasi tide
#

I understand. You just need to only do this on the client.

#

You can do it in beginplay and have it behind a HasAuth check or do a client RPC.

#

This code is only executing on the server

rustic nimbus
#

oh that's right, thanks

#

im so dumb man

quartz iris
#

How do I get the local playerstate?

#

Not this right?

quasi tide
#

Where is this being ran?

quartz iris
#

on rep

quasi tide
#

Pawn? Actor? Game Instance? GameState? Some random other actor

quartz iris
#

On rep of the playerstate that won

quasi tide
#

Sooooooooooooooo - you want to get the local playerstate inside of the playerstate that is being onrepped??? What?

quartz iris
#

I don't know really

formal solar
#

I think that would work

quartz iris
#

Basically I just want to play a widget on the winner/loser repsectively

#

This is inside the gamemode

quasi tide
#

You can get the first local player controller from the GI and then get the playerstate from that

quartz iris
#

GI?

quasi tide
#

GameInstance

quartz iris
#

ah

#

Again

#

I think you should tell me as I don't do it properly

#

Could you show me the code of how to do it

quasi tide
#

No? I'm not on a computer that has Unreal installed

quartz iris
#

I'll pay you

quasi tide
#

Get game instance. Get first local player controller. Get Player State.

#

That is the order

#

If you can't type in 3 nodes, you should stay far away from multiplayer.

quartz iris
#

That doesnt work tho

quasi tide
#

Show me

quartz iris
fallow bison
#

Could I technically be able to replicate only client position and rotation and leave the movement components and physics interactions purely client side? I understand that would be bad if there are cheaters but ultimately it only leaves the server the job of locating the vehicle and copying it's location and facing rotation.

quasi tide
quartz iris
#

Are you sure you don't mean gamemode?

quasi tide
quartz iris
#

This is not helping if you're gaslighting me when its not even correct lol

quasi tide
#

The method exists. I apolgize that I can't remember everything that is exposed to BP.

#

But if you don't want help, sure - godspeed

fallow bison
#

I thought prediction required the server to run the movement for the client, and the client just sends a bunch of rep notifies?

#

then the client interpolates the locations sent vs the location it has

dense prism
# fallow bison that's what that is?

Well Like you said. U don't want to server to check anything . and Just duplicates values the client send to all the other player(who are also client)

fallow bison
#

OH.. I suppose my method doesn't take multiple clients into account

#

so client to client wouldn't be seen. I guess I can run a multicast from the server to the clients after the client sends it's location to the server.

#

That way the server is the only positioning everything and the clients just have to interpolate themselves into it, instead of the server doing it.

#

Iunno

#

I'm kinda dumb with this. I just started

quasi tide
#

@quartz iris Replace your Get Player Controller call with the one that is built into the PlayerState. Then compare if the controller is null or not.

#

If the PC is valid - you're in the PS that your client owns. If it is is invalid, you're in a PS that your client doesn't own

quasi tide
#

Don't use any of the versions that ask for an index

#

PlayerState has a function to get the player controller that created it.

#

Use that one

dense prism
# fallow bison Iunno

Client That is Replicating to server will update faster then other playersclient seeing the update later there will be delayed between all the clients update that' what i am saying\

quartz iris
fallow bison
#

I guess my question is the order in which events need to happen

quasi tide
#

Why would you cast?

quartz iris
#

Because I can't get the playerstate you're asking for atm

quasi tide
#

You don't need a specific playerstate for this comparison - you just need a playerstate

quartz iris
#

I don't know if its something with the onrep

quasi tide
#

GetPlayerController

#

The one in the PlayerState. Not the gameplay static one

quartz iris
quasi tide
#

Again - for the umpenth time. Not that one.

#

Do not use the one with the index

quartz iris
#

which one

dense prism
quasi tide
dense prism
#

Theres something call replication pirority

#

It's has been explained in one section of this video

fallow bison
#

that requires c++ right?

dense prism
#

Well even if you are using blueprint . c++ code is going to run anyway so he just explains it in good way . How overall ue4 networking arcitecture works and yeah there will be some c++ code mention there but he will explain

fallow bison
#

Ok

#

Thank you

#

that's very helpful

quartz iris
#

ah wait

quasi tide
#

It's stock Unreal

quartz iris
#

I turned off the context check

#

it shows

quasi tide
#

You can use this to determine if you're local or not (in this case)

quartz iris
#

Theres an error

quasi tide
#

You just need to check if it is a valid PC or not.

#

The error is because this BP is not a player state

#

Which I asked where this was being called a long time ago

quartz iris
#

The Gamemode

quasi tide
#

GameMode only exists on the server

quartz iris
quasi tide
#

There will be no onrep that happens

#

Well - in BP OnRep still happens

quartz iris
#

How should I be doing the show widget system for the winner?

quasi tide
#

But it won't end up on the client

quartz iris
#

I need it to be handled via the gamemode

quasi tide
#

GameMode doesn't exist on clients.

#

Do a multicast in the GameState

quartz iris
#

So I need to move the gamemode code into the gamestate

quasi tide
# quartz iris .

I don't know what this is trying to say. I very specifically asked where the code is being executed.

#

There is no "best" place

quartz iris
#

Well

#

I'll call the event through there I suppose

quasi tide
#

Obviously you don't init a pawn in a darn widget

dense prism
#

well someone is high

quasi tide
#

Initialize it wherever you decide to spawn it?

#

Just spawn it on the server and make sure it replicates

#
  1. Spawn on server
  2. Have an HasAuth check in BP
#

Problem solved

quartz iris
#

This will work fine?

quasi tide
quartz iris
#

So it shouldn't be in the gamemode

quasi tide
#

That doesn't mean the GM can't call a method that is networked though

#

So you'd get the GS and then call your multicast or w/e.

#

People use it differently.

#

Some people literally just use it as the point of entry and that's it

#

Some use it to manage score required to win, etc..

quartz iris
#

Im not sure what I did wrong

quasi tide
#

That won't work because the code is being executed on the GameState

quartz iris
#

Ok

quasi tide
#

In multiplayer, you really need to pay attention to what class and machine the code is executing on.

#

Cedric's network compendium goes over the main classes in this regard.

#

Constantly refer back to it.

#

I sure as heck did in my numerous attempts at understanding this stuff.

#

There are honestly only a few things that are quite rigid.

#

Such as how a player logs in or how to travel from map to map.

#

Otherwise, you don't have to use a lot of the built in stuff.

#

It is just helpful.

#

Not a MP one, no. But a SP, yes. My current game is MP. But I've done a few contracts in the MP sphere as well though.

#

TBD

rain condor
#

can i replicate uobject?

dense prism
#

Pretty Sure You Can , Pls Look At Pinned Messages in This #multiplayer Channel or you can refer to the reply of this message @rain condor

keen hound
#

I'm Testing now in the Pc within the editor and with android .

#

The Height Of Player 1 (Android) changes (becomes small) for Player 2 (From Pc (In Editor))

#

Android View

#

From Engine/Editro/Pc

#

What's the problem here?

#

And The Player 2 character's Jump and some movement Jitters

#

Does anyone know how to fix this?

cedar thunder
#

I am having an issue with some networked code, i am calling destroy on an actor when interacted with but Destroy returns false when the client interacts with that object. here is my code for the interact function

{
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, TEXT("Interacted"));
    bool btest = this->Destroy(); 
    GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Black, FString::Printf(TEXT("%s"), btest ? TEXT("true") : TEXT("false")));


    
    ATGB_ADW_UProjectCharacter* Player = Cast<ATGB_ADW_UProjectCharacter>(Character);
    if (Player) {
        Player->AddItemToInventory();
    }

}```
#

is this just an issue where you cant call destroy on the client?

sinful tree
# cedar thunder I am having an issue with some networked code, i am calling destroy on an actor ...

If it's a replicated actor, then the server is in control of it and can only be destroyed by the server. Additionally, you wouldn't want just your client adding it to their inventory as the server should likely know what is in the client's inventory.

Replication is always one way, server to client. Clients can call RPCs which allow the to request the server to do something, so then you set up the RPC in such a way that the server validates what the request is, performs it and replicates the results.

cedar thunder
#

ok thank you

cedar thunder
sinful tree
#

Definitely not.

#

You wouldn't want your client to have access to destroy any actor they please.
You would RPC that you're attempting to interact with a particular actor. Once running on the server, you do the rest.

cedar thunder
#

oh ok

#

that makes sense

#

thx for your help

#

i just call the Interact function from the server

keen hound
#

How to replicate movements correctly?

ornate copper
#

Hi, does anyone one have experience with custom net drivers?

dry dove
#

i've issue with creating dedicated server, anyone able to vocal and help me a bit please?

ornate copper
#

Specifically what are things that I would need to consider when writing one

limber gyro
steep mica
#

lets say I am making a game like minecraft where you can break blocks, the block itself cannot actually call functions to the server because it won't have the authority to. So I guess it would be inside the player? In simple cases like this it could be fine, but doing this in everything? This would just make the player script extremely massive.

hollow eagle
#

RPCs would need to be on something the player owns, not necessarily entirely on "the player" (whatever that is - there's already at least 3 different things that represent the player by default so you're already splitting things up). And replicated components on those things would be fine too.

sinful tree
steep mica
#

alright, thanks

sinful tree
#

Input > RPC to Server > Server does stuff.

steep mica
#

is there any resources on repnotify (C++), can't find any actual docs on it, just the very short page for the ContentExamples project

keen hound
#

Guys

#

What is the limit on multiplayer for UE5?

#

In peer to peer , in android how may players can it support?

latent heart
#

Fortnite probably doesn't use stock UE... anything, though.

#

Not that you have access to yet anyway.

keen hound
#

It uses a dedicated server isnt it?

sonic python
#

Yeah How Many Players Does Peer to Peer Support in a Multiplayer match?

#

What if it is in Android?

sinful tree
#

Well, there is no peer-to-peer in Unreal. It's still a server/client set up. You can have one player act as the host which is known as a listen server. No one can really answer how many players it can support as there's too many variables involved:
A) The CPU speed and RAM available which can vary greatly across android devices and is far more limited compared to standard computers.
B) The network connection is likely to be poor if running on cellular networks limiting how well the game can run with more players. Sometimes it may be better when connected to a Wifi network, but as the server will never be connected to a hardwire, you're likely limiting how well it can host a game.
C) How complex the game is itself and how much data needs to be replicated.

I would say trying to do any kind of real-time multiplayer hosted on an android while on a solid WiFi connection, shoot for at most maybe 4 players?

whole pine
#

top section adds entered chat into a chatbox(works fine) bottom section adds entered chat into a component above players head. if i were to replicate the component to other players, what would i be setting as the variable to rep notify

steep mica
#

yeah I straight up cannot find anything that talks about OnRep

coarse gale
#

there is brief part about it in there

steep mica
#

yeah this is something else, thanks

latent heart
#

Also have you checked the multiplayer compendium in the pinned messages?

steep mica
latent heart
#

OnReps are called on server+client when used in a BP and only on the client with c++. Honestly I'm not sure if you define one in c++ and then subclass the class in BP whether it will treat it as a bp or c++ variable in this respect. Whether setting it in BP will trigger the onrep simply because it was set in BP. I don't really use bp that often.

#

And it's called (in bp) as soon as the variable is set on the server and (in all cases) by the client when a variable update is received from the server.

steep mica
latent heart
#

So usually if you're doing c++ stuff, you would do something like this: ```cpp
UPROPERTY(ReplicatedUsing=OnRep_Value)
int32 Value;

UFUNCTION()
void OnRep_Value();

void SetMyVariable(int32 NewValue);

void UMyClass::SetMyVariable(int32 NewValue)
{
if (HasAuthority())
{
Value = NewValue;
OnRep_Value();
}
}

void UMyClass::OnRep_Value()
{
UpdateMyUiOrWhatever();
}```

coarse gale
#

is there more than one OnRep function ?

latent heart
#

You have to define your own OnRep functions

#

So in that example, in the header, you would use cpp UFUNCTION() void OnRep_Value()

coarse gale
#

I understand that, Im just wondering what the OnRep in that doc is that explains this if it was something else

latent heart
#

Which doc?

coarse gale
#

The one I linked

#

It has an OnRep example

steep mica
#

I know the syntax, those are the only questions I had

coarse gale
#

And explains its called on the client when the server updates the value

#

it answered your questions, thats what im saying

steep mica
#

didn't read it because Daekesh personally offered to answer the questions I have on it

steep mica
#

also was busy doing something else

coarse gale
#

I know, you said it was something else, but it wasnt. Thats why I wondered if there was more than one OnRep

latent heart
#

Is that directed at me? I still have no idea what you're on about.

steep mica
coarse gale
#

no, I was just wondering if there was some OnRep I wasn’t aware of. It doesn’t matter.

latent heart
#

Not in c++. OnRep is called on the client, always, when a new value is received. That's why it's OnRep - On Replication. On the server that doesn't make sense. It's not replicated to the server. It's just there already. In BP they call the OnRep on the server too because it's just, idk, more convenient?

#

I guess adding a setter, authority check and manual call is too much for BP people.

steep mica
#

it makes perfect sense to me

#

thanks

latent heart
steep mica
#

I wouldn't need to actually put my variable inside the LifetimeReplicatedProps if I do it the way you do?

latent heart
#

That's a thing for every c++ replicated variable, I think. I'd forgotten about that.

coarse gale
latent heart
#

That's just a convention.

#

You don't have to follow it. It's not set in stone.

#

And it can be any function which matches the signature (ufunction with void return with no params)

coarse gale
#

ye, thats just what I know as an OnRep function. I know it can be called something else but I was just confused they said it was something else πŸ€·β€β™‚οΈ

steep mica
#

They were explaining it's blueprint implementation so I wanted to know the C++ implementation

coarse gale
#

ahh, I sent you blueprint docs ?

steep mica
#

... No?

#

honestly not sure if you are being passive aggressive at this point

latent heart
coarse gale
steep mica
coarse gale
#

So thats where the confusion started…

steep mica
#

no, I am saying it's different from the one I looked at previously, you asked a question before sending that link

coarse gale
#

Then it was just a misunderstanding.

whole pine
#

how do i get the state of a specific clients scenerender capture

#

and associate the scene render capture with an id

latent heart
#

Same way you'd get any other information about a client.

#

Have the client send an RPC with that data to the server.

whole pine
#

how would i associate a playfab id they get when they log in (variable) and attach it to the rpc

whole pine
latent heart
#

You want to replicate the image?

#

I.e. stream a video from the client to the server?

#

Or is it a single image updated infrequently?

whole pine
#

single image

latent heart
#

Either way, I think that's too much info for regular replication. It might just fall over. But you can try. You'd have to access the image data and send that.

#

A TArray<uint8> effectively.

#

I doubt uint8* would work.

whole pine
#

i cant just rpc a material?

#

that the image is using

latent heart
#

A material is just like a program that runs on your gpu. It contains no real data...

fossil spoke
#

What are you trying to acomplish?

#

Why do you need to send an Image across the network?

whole pine
#

show what items other players have attached to their inventory

fossil spoke
#

So why not just send the Item IDs instead?

#

And rebuild it on the other side?

whole pine
#

im new

coarse gale
#

I had the same question, I thought you were trying to do some opencv stuff on the server or something

whole pine
coarse gale
#

nope, I just wondered why the server needed an image

#

and the only thing I could think of was some crazy opencv thing lol

whole pine
#

ohh

last storm
#

Hello, from a FOnlineSessionSearchResult, anyway to get the current player number ?

keen hound
#

Then Is Replication process in Dedicated server more complex?

#

Which Type Is Preferred for 100 player multiplayer game?

chrome bay
#

dedicated

#

You'll never get 100 players on a listen server

sinful tree
#

I gave 4 as an example if you're trying to make something that can be hosted by any random Android phone. With mobile you have to set expectations to be low as they're not super powered devices with tons of RAM and network capability. It could be more, it could even be less depending on the device, the game, and the network.

You won't be running a 100 player server on a listen server, especially if it's on an Android.
You could potentially run a 100 player server on a dedicated server but it would require extreme levels of network optimization.

chrome bay
#

Even with dedicated it takes massive work

sinful tree
# keen hound Then Is Replication process in Dedicated server more complex?

The replication process is the exact same between listen and dedicated, and if anything programming for dedicated is somewhat simpler. With a listen server you need to take into account that the server of the game is also a client, so anything that you normally would want to happen on a client only may also need to happen at some point on the server too which can have its own set of quirks depending on what you're trying to do.

fair latch
#

Im thankful there is a plugin that replicates material in marketplace

#

Going to get that later when i get to the part

kindred widget
#

Why replicate the material though? It's usually much easier to just replicate some basic state and locally set up a material for it.

#

I mean you can replicate a material or an instance that is in the content browser already. Just not it's parameters. But those are usually driven by other replicated state.

fair latch
#

I want cloth customisation where the user insert their own texture from their computer

#

Simmiliar to maple story 2 cloth customisation

#

They give you a template for the texture then user can edit the texture in their comp which they can upload to the server for everyone to see

#

If its a material that we have access in content browser, then there is no need for me to replicate the material

stable grotto
#

Bandwidth: dedicated servers, bandwidth is the maximum amount of data transmitted to and from the server per second. bandwidth is only about the internet speeds right?

thin stratus
#

There are some suggestions for how good the average download of a player is

#

But your DedicatedServer should also not push out tons of data

stable grotto
dry dove
#

Hello everyone, i have a question, if i make a dedicated server, i have to make 2 Projets? 1 client and another server to avoid leak server informations to clients ?

whole pine
#

i can click on my players to open their inventories. i was gonna detect what player is clicked by line tracing and getting a name tag component and the name thats within the component. is that a reasonable method?

coarse gale
whole pine
#

i dont know what player when i click on it yet

#

i was gonna use the linetrace to get the nametag within the name tag component and use it to verify other aspects of their ivnentory

coarse gale
#

β€œI can click on my players to open their inventory” is that a factual statement or a dream ?

whole pine
#

nvm

coarse gale
#

instructions unclear, conflicting information. If you wont clarify it then πŸ€·β€β™‚οΈ

whole pine
#

this is a spiritual journey i need to conquer on my own

surreal plaza
#

Through c++, I am used to creating blueprint references using TSubclassOf, compiling then assigning through the editor. In the case of a struct definition that isn't created until runtime, I need an in code reference to the blueprint. What is the best way to achieve that?

surreal plaza
coarse gale
normal crypt
#

Hi. Do replicated actors(those who aren't the authority) tick? I didn't see anything in the doc saying they don't tick, but I'm having this situation where a replicated actor ticks only once and then never again, even if I re-enable the ticking manually after.

coarse gale
normal crypt
coarse gale
normal crypt
#

c++

keen hound
#

What is the easy way but good working one , to set up a dedicated server?

coarse gale
#

I would offer to look but Im new at c++ anyway so wouldnt be much help, I would have asked if you are calling super begin play, but if it ticks once and works on authority you must be, right ?

keen hound
#

Should I get help from third party?

normal crypt
coarse gale
normal crypt
keen hound
#

And There's no p2p in unreal right? then it's a listen server type , how many players can it hold? 12- 32?

quasi tide
#

However many your computer can handle.

ivory bear
#

How often should this event fire when the UI is set to 2 players and "Play As Client"

cedar thunder
#

how long does it take a TArray to replicate?

magic vessel
cedar thunder
# magic vessel If you're worried about that, it might be worth looking into a fast array

no im not worried about it, im experiencing an issue where the client crashes when updating the main hand because the inventory hasnt updated, this is my code

{
    

    UpdateMainHand();
}

void ATGB_ADW_UProjectCharacter::UpdateMainHand()
{
    UE_LOG(LogTemp, Warning, TEXT("Testing: %s"), (Inventory[0] ? TEXT("true") : TEXT("false")));
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, TEXT("Test"));
    UE_LOG(LogTemp, Warning, TEXT("Item: %s"), *Inventory[CurrentSlot]->GetFName().ToString());
    // Attach the weapon to the First Person Character
    FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
    Inventory[CurrentSlot]->AttachToComponent(this->GetMesh(), AttachmentRules, FName(TEXT("GripPoint")));
    btest = true;

}

void ATGB_ADW_UProjectCharacter::AddItemToInventory(AItem* Item)
{
    if (GetLocalRole() == ROLE_Authority) {
        
        if (Inventory.IsEmpty()) {
            Inventory.Add(Item);
            UE_LOG(LogTemp, Warning, TEXT("Item: %s"), *Item->GetFName().ToString());
            CurrentSlot = 0;
            UE_LOG(LogTemp, Warning, TEXT("Item: %s"), *Inventory[CurrentSlot]->GetFName().ToString());
            
            UpdateMainHand();
        }
        else if (Inventory.Num() < 5) {
            Inventory.Add(Item);
        }
    }
    else {
        UE_LOG(LogTemp, Warning, TEXT("Someone Without Authority Attempted to Add Item To inventory"));
    }
    
}```
#

it errors on Inventory[CurrentSlot] when the client calls the Update main hand function

#

and i have discovered that Inventory[CurrentSlot] is null on the client but not on the server

#

here is the code for the header file as well

#
        int InventorySize = 5;
    UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Replicated, Category = "Inventory")
        TArray<AItem*> Inventory;
    UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, ReplicatedUsing = OnRep_MainHandUpdate, Category = "Inventory")
        int CurrentSlot;
keen hound
dry dove
#

Yes sΓ©parated projects ? Client/Server

magic vessel
#

What slot is it printing out as the current slot? Is it what you are expecting?

cedar thunder
#

yes

magic vessel
#

I meant in the update hand function

cedar thunder
magic vessel
#

Why are you updating the main hand on both server and client?

cedar thunder
#

the only issue as far as i can see is that the AItem being added to the array is not replicating properly between the server and the client

cedar thunder
magic vessel
#

I'd recommend looking into the fast array if you want to attach something to the players hand when an item has been added

cedar thunder
#

ok thx, i will try that

keen hound
#

I'm confused

#

How to make a dedicated server

#

Should I make my pc as a dedicated server?

#

Will the EosCore Plugin help in creating a dedicated server?

#

Will it create a brand new dedicated server?

#

Or will it make my pc as the server

#

will this work on android?

cedar thunder
keen hound
#

So Confused....

#

Anyone know this?

cedar thunder
#

and just let the client talk to the server whenever they need to change main hand slot?

limber gyro
#

im trying to figure out the best way to notify clients of a player joining the server, i know theres login/logout in the game mode but the game mode only exits on the server? is there a callback like this that gets called in the client? or do i have to add like a multicast in the login for the clients to be notified?

solid sparrow
#

anyone able to help me out. I got a dedicated server and within the gamemode I Open a new level and it doesnt appear to be bringing the players to the new level like i recall listen servers doing. I have seamless travel enabled and im not opening the level with any special options thanks for the help!

limber gyro
keen hound
#

did you make it?

limber gyro
#

u need to compile from source if u want to make a dedicated server

#

theres tutorials on youtube for that

ocean ivy
#

Hello there mighty multiplayer experts. I have a question you might be able to help with.
As you can see on the screengrab I run a Event on the PlayerController (1) to spawn a possessable pawn at the location of a random PlayerStart(2) and then also possess it as the playercontroller. After that I try to bind a event to a dispatcher to update some variables later on. The Dispatcher is called on the Pawn (character).
This is indented to be a base for multiplayer (dedicated) (Play as Client Net Mode).

Problem right now is, the bind event does not fire when the dispatcher is called ... why could that be?

keen hound
kindred widget
sage cape
#

how can u increase the array size limit u can send over the network?

ocean ivy
kindred widget
#

And the after print runs? O.o

ocean ivy
kindred widget
#

I'd maybe check that you're not somehow unbinding that event, or make certain it's being called.

#

And called on the right instance.

ocean ivy
thin stratus
#

I'm confused by that RPC setup in the PlayerController

#

But I guess that's not the concern atm

kindred widget
#

And you're sure that branch is running true, ever?

ocean ivy
thin stratus
#

Well, your bind is ServerOnly

#

Are these booleans set on the Server?

#

Cause they aren't marked for replication

kindred widget
#

I assumed this was all server code. I am a little curious why the controller needs to care about sprinting for anything though.

ocean ivy
thin stratus
#

Yeah, also what is that ServerRPC setup in the PlayerController

#

It's like you are standing in front of the fridge to get food, and then walk to 3 different rooms just to get back to the fridge

ocean ivy
#

Sprint is set here E.g

#

the events svr sprint true point to something else

thin stratus
#

What does the RPC do

ocean ivy
#

RPC as in ... ? sorry : s

thin stratus
#

You know what an RPC is or?

#

Cause otherwise I will send you to the Compendium before doign anything more

kindred widget
#

Controller probably also shouldn't be saving it's own boolean to a state that isn't really relevant to the controller itself.

#

Controller has access to it's possessed pawn which has access to it's sprinting state. But it still shouldn't really need it.

thin stratus
#

For the record:

GameMode's PostLogin will call for new players. Can also use HandleStartingNewPlayer or whatever it is called. You can do your spawn code there. There is 0 need to have the RPCs in the PlayerController, unless you are passing data to the Server for the spawning that the Server doesn't know about.

#

And even if you want to trigger this from the PlayerController, you can just do that on BeginPlay instead of limting it to LocallyControlled, you can limit it to Authority.

#

For the sprinting: You need to set those booleans on the Server. Your "Svr Sprint True" (and apparently false, even though you could just make one event and give it a boolean input) need to set that variable.

#

Furthermore, BP replication of custom movement, like sprinting, will feel really shit

#

Movement Replication is advanced and needs C++ to be working well

ocean ivy
thin stratus
#

Yeah cause you have no latency in the editor :P

ocean ivy
#

Will process the other information and optimize, ty for that ^^

ocean ivy
normal crypt
ocean ivy
coarse gale
stable grotto
#

Widgets gets removed from parent when using open level, is it possible to keep them using blueprints only? (to use as loading screen for example)

kindred widget
sinful tree
# keen hound did you make it?

For testing, all you have to do is set your Netmode to "Play As Client" and this will run a dedicated server instance in the background and the editor will act as a client that connects to it. If you want an even more authentic experience, you can set the editor to "Standalone Game" which will then create real instances of both the server and client instead of having the editor simulate them.

If you're new to multiplayer, it'll be a long while before you're ready to actually package a dedicated server. Once packaged you can then deploy it to whatever computer you want to have running it, start it up, and then have clients connect to it, but again, it sounds like it'll be a while before you'll need to do that and you have a lot of other systems to figure out.

keen hound
#

For android..

sinful tree
#

You're not even at that step yet. Don't worry about it for now. Learn how to make something multiplayer.

#

Learning how to make something multiplayer can give you further insight into what you're trying to accomplish and help you to determine what you're capable of and what you need.

graceful flame
# keen hound Oh well then If i make a dedicated server that way, how many players can it supp...

That's a very vague question to try and answer because there is no set number of players a game server can support. It depends on the limitations of your game. For instance the complexity of the code that has to run every frame, the desired player experience in terms of client prediction vs rubber banding, the frequency of actors sending updates over the network and the server's hardware are all factors that define this number for you. If you want a game to support lots of players on one server then you'll probably want to design it in a way that keeps players far apart from one another as much as possible so that you don't have to constantly update as much data.

keen hound
graceful flame
#

It depends on everything

#

FPS is part of the player experience yes

#

If 100 players are all in the same room that's 100 characters each client's PC has to update every frame. But if 100 players are spread out all over some huge map then you can use various optimizations to only update the number of other players which are relevant to the current player.

pallid mesa
#

fortnite is cheating! its unfair πŸ˜„

keen hound
#

Oh

#

Optimzations to only update the number of other players which are relevant to the current player?

pallid mesa
#

there are a bunch on top of that

sinful tree
# keen hound Well I kinda have created a multiplayer game and want to release it

And you're asking about EOSCore and what a dedicated server is and how to make one.... If this has anything to do with the project you've been mentioning recently.... You had jittery character movement, and strange scaling issues on your character. You said made a combat system that isn't working out a couple of days ago and asking for recommendations for a combat system on the marketplace.... You then start asking about hosting a "peer to peer" server in Unreal which isn't a thing, then asking about hosting 100 players on a single server. This is not stuff that can easily get solved in a couple of days.

Not to be mean, but you're miles away from being able to release anything sane unless you've scrapped that project and decided to go for something extremely simple but I doubt that based on your questioning about running huge multiplayer games and it doesn't sound like you've gotten a handle on multiplayer yet. You still need to figure out matchmaking / online subsystems at the very least.

If all you're actually trying to do is test by having a couple of androids connect to a server, at the bare minimum, all you need to do is have a computer running the editor and hitting play on a level with it set up to run "Play as Client" which will then create a dedicated server instance for you. You can then grab your internal IP address of the computer its running on and have the clients connect to that IP address at port 7777 and they should then be able to join the game.