#multiplayer

1 messages ยท Page 211 of 1

nova wasp
#

it depends on what you missed?

#

If you have to send it use a reliable RPC I guess, but be warned this is expensive

#

What I do is have an ack between client and server where they must share X frame being sent across

#

this is just network update rate I think in your case with this onrep, stuff gets sent far less than the actual simulated frames

#

If you want to send the state of literally every frame then you need to store it in a buffer somehow and send that over

grand mica
#

and yes an old move like unreal does it

nova wasp
#

If it's not reliable or acknowledged somehow then you are at the whim of packet loss

grand mica
#

can't afford it to be slow

nova wasp
#

there is literally nothing stopping you from sending anything you want as an rpc

#

as for speed yeah if this must be fast an unreliable rpc is the way afaik

grand mica
#

yess

nova wasp
#

server to client: "here is the latest frame I have received from you"
client: "cool, now I only need to spam frames after N frame in rpcs"

#

is what I do

#

If you can't gaurantee the thing showing up on the other side you use reduncancy and gaurantees... A replicated property that changes 100 times a second will not have every single change reflected on each side with default network settings let along network conditions

grand mica
#

the issue I am seeing with packet loss is -
The tick() of the client makes new moves and send it over the server. They get added to an array of all unacknowledged moves. But when there's a packet loss, the move doesn't get ackd and it has to be retransmitted.
The clarity I don't have is - what does the server do with the new moves when it knows the older one haven't been ackd yet.

And with more packet loss - the unackd moves list will just grow over the time and the server is still processing 2-3 moves a time at max

#

@nova wasp

nova wasp
#

a couple things

#

first of all, if you are using unreal's bandwidth emulation (the default average/bad settings)

#

it is 100x worse than real life packet loss

#

in real life if you see more than 1% packet loss you are going to literally disconnect lol (in my experience)

#

it represents a truly abhorrent spike but constantly on

nova wasp
#

You still haven't really shared if this is rollback lockstep with only sending input

#

or just trying to re-invent the cmc (sending moves and resimulating them in isolation)

grand mica
nova wasp
#

In my case, with missing moves all you can do is predict the next frames of input as being the same buttons being held

grand mica
nova wasp
#

this is how pretty much all netcode in games works for moving things... you have to predict a bit of what happens as you have only partial information

#

it might be an amazing deterministic prediction, or a bad one but good enough

#

with my rollback setup a misprediction is inherent to EVERY frame as you constantly get new differnet input from other clients... what this means is I resimulate the entire game tick a dozen times a frame to redo the newly received state (oh goodness)

#

Often times a misprediction can be corrected almost invisibly

grand mica
nova wasp
#

What most rollback games do is actually only display a delayed frame, so that any mispredictions are already resolved by the time you reach X frame. This also delays your input but vastly reduces the chances you get caught with funny mispredicts (2-3 frames at 16ms in most)

nova wasp
#

so next frame, you don't receive any new state

#

but you can say "well, they are probably moving this way"

#

the CMC in unreal is received on clients as just "it's here moving this way" and the TRUE position on sim proxies is actually incredibly shaky and jerky

#

but because the skeletal mesh component's position is interpolated smoothly at all times (lagging a bit behind) it's quite smooth looking even though it's actually teleporting slightly almost every net movement update

grand mica
nova wasp
#

unreal accepts a certain degree of difference on the client?

#

you are never 1:1 with the server

#

but it's about being close enough

grand mica
#
void UPawnAgentMovementComponent::MovePawnAgent(float DeltaTime)
{
    static int frame = 0;
    frame++;
    APawnAgent* pawnAgent = Cast<APawnAgent>(PawnOwner);
    const FVector& inputVector = pawnAgent->GetInputVector();
    FRotator DesiredRot = inputVector.Rotation();
    m_newVelocity = FVector::ZeroVector;
    m_rotation = pawnAgent->GetActorRotation();

    //UE_LOG(LogTemp, Warning, TEXT("m_rotation: %f, %f, %f "), m_rotation.Pitch, m_rotation.Yaw, m_rotation.Roll);
    if (!inputVector.IsZero())
    {
        int rando = rand();
        m_rotation = FMath::RInterpTo(pawnAgent->GetActorRotation(), DesiredRot, DeltaTime, 10.0f);

        m_newVelocity = inputVector;
        m_newVelocity.Normalize();
        m_newVelocity *= 300.0f;

        if (GEngine)
        {
            GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Yellow, FString::Printf(TEXT("Local Actor Rot: %f, %f, %f "), pawnAgent->GetActorRotation().Pitch, pawnAgent->GetActorRotation().Yaw, pawnAgent->GetActorRotation().Roll));
        }    
    }
    
    //UE_LOG(LogTemp, Warning, TEXT("Client frame %d m_position before update: %f, %f, %f "), frame, m_position.X, m_position.Y, m_position.Z);
    UE_LOG(LogTemp, Warning, TEXT("Client frame %d inputVector: %f, %f, %f "), frame, inputVector.X, inputVector.Y, inputVector.Z);
    m_position = pawnAgent->GetActorLocation() + m_newVelocity * DeltaTime;
    UE_LOG(LogTemp, Warning, TEXT("Client frame %d m_position after update: %f, %f, %f "), frame, m_position.X, m_position.Y, m_position.Z);
    pawnAgent->ResetInputVector();
}```
this is for the local client
nova wasp
#

I'm going to suggest you just use the new mover plugin or the CMC here, this stuff is seriously hard to do

#
    static int frame = 0;
    frame++;

ohhhh no, do not do this lol

#

very very bad

grand mica
#

it was just for logging. Not permanent code lol

#

xD

nova wasp
#

yeah, I was thinking "probably just to mess around" there lol

grand mica
#
ServerMoveAgent(DeltaTime);


const FVector LocDiff = m_position - MoveData.position;
const FRotator rotDiff = m_rotation - MoveData.rotation;

FRepMovement& repMovement = PawnOwner->GetReplicatedMovement_Mutable();

if (!LocDiff.IsNearlyZero(UE_KINDA_SMALL_NUMBER))
{
    if (!FMath::IsNearlyZero(LocDiff.X, 0.01f) || !FMath::IsNearlyZero(LocDiff.Y, 0.01f) || !FMath::IsNearlyZero(LocDiff.Z, 0.01f))
    {
        PawnOwner->SetActorLocation(m_position);
    }
    else
    {
        m_position = MoveData.position;
    }
}

if (!rotDiff.IsNearlyZero(UE_KINDA_SMALL_NUMBER))
{
    if (!FMath::IsNearlyZero(rotDiff.Pitch, 0.01f) || !FMath::IsNearlyZero(rotDiff.Yaw, 0.01f) || !FMath::IsNearlyZero(rotDiff.Roll, 0.01f))
    {
        PawnOwner->SetActorRotation(m_rotation);
    }
    else
    {
        m_rotation = MoveData.rotation;
    }
    
}```

this is for the server
#

it checks if the difference isn't large then just accept the client's position or rotation

nova wasp
#

serious question: why not just use the built in stuff here? You are pretty much making the CMC over again here but very slowly

grand mica
#

but this wouldn't be true if there's a packet loss because server's last position can't match up

grand mica
#

also, its a fighting game that I am aiming

#

i don't think Unreal's CMC is made for that

nova wasp
#

If you want true fighting game style GGPO rollback you need to basically replace this entirely with a full fixed ticking lockstep setup that is deterministic

grand mica
nova wasp
#

easier said than done of course lol

#

the ideas behind lockstep are not inherent to being peer to peer

grand mica
#

full fixed ticking lockstep setup, what exactly is this? I have capped the fps to 60 already

nova wasp
#

essentially nothing in unreal will work with lockstep determinism if they use floats of any kind but I assume the goal is to get... close-ish

nova wasp
nova wasp
#

and no turning on fixed ticking will not do this lol, you basically have to replace unreal's game framework entirely

#

but I think getting close is much more reasonable

#

you still have to have the ability to send the actual "true" state of things from the authority I guess

nova wasp
#

this is extremely hard and requires some fairly extreme restrictions

#

but 2d fighting games basically simulate... almost nothing

#

and can get away with being quite aggressive with resimulating frames and buffering state as opposed to a 3d game with physics

grand mica
nova wasp
#

yeah... I'm not sure which way I would go here

#

I would see if this game has any talks about how they handled things

#

it looks rather simple simulation wise so I imagine you could get away with raw ints as transforms/ custom collision

grand mica
#

anyways, it's just a bit complicated to handle the transforms and stuff through ints

nova wasp
#

how large is the range of values you need to represent

grand mica
#

bleh

nova wasp
#

yeah it's very complicated, you are the one who wanted full rollback in a fighting game though?

grand mica
grand mica
nova wasp
#

sure, you still need a buffer of previous things that happened

grand mica
#

I have that at this point, yes

grand mica
opal shore
#

can i put code in the dedicated server? cuz all tutorials just do two targets (client, server) and call it a day

#

aaaahh with the #if macros right

#

so i do #if client #if server and thats it? cool

lost inlet
#

you can even have target specific modules

keen adder
#

Heya, what's the best method for replicating structures in a crafting game? Like a Chest for example.
I don't want to replicate the actual chest because then it exists for all players, even when some are very far away.

Is there a better way to handle replicated objects at a distance? Or should I make the chest actor not replicated at all, and just sync it manually through playerstates and stuff?

upbeat basin
#

You can also define replication conditions for variables on your DOREPLIFETIME() macro

#

I didn't get what exactly you are trying to achieve but these should help you prevent unnecessary replication on clients that don't need the data

opal shore
#

is linux the preferred/stadnard os for game servers?

keen adder
#

then someone else runs very very far away, I need the chest to despawn on their client, but persist for whoever is nearby

#

Will relevancy and dormancy despawn the thing for clients that don't need it, but keep it alive for those who do?

#

That's why im wondering if it's just easier to spawn it for everyone locally and manage it manually

upbeat basin
#

That's already the default behavior of relevancy, it checks the NetCullDistanceSquared to determine if the actor should be destroyed on local world if the local player pawn is exceeding that distance

keen adder
#

Ooooh awesome.

#

At the moment whenever a structure/crafting table/etc is spawned by the host, everyone gets it no matter how far they are

#

So I'll look into that! ๐Ÿ™‚

upbeat basin
#

Is it possible that you've marked it as always relevant?

#

That overrides the relevancy checks

keen adder
#

I haven't changed anything besides the default lol

#

Just click "Replicated" checkbox and away I go

#

But yeah I'll read up on that, thanks!

upbeat basin
#

Well default value is probably too big for your map already.

#

You can try to lower that to test and see actors getting destoyed when you get distant from them

keen adder
#

Yeah good call, I'm also just wondering actually, if their functions would then properly replicate

#

Like if a Chest is set to "Open" while someone is far away and then comes in close

#

Does unreal automatically rep the variable when the chest re-loads into their game

#

And also is it even smart to have thousands of replicated objects managed by unreal

upbeat basin
#

Be aware that relevancy will destory and spawn your actor, causing your BeginPlay and EndPlay to be called for each object that becomes relevant again

keen adder
#

Or just let them be done locally and only changes are replicated

upbeat basin
#

And they will be a different instance, any local values you saved will be lost

keen adder
#

prob the latter imo, for an unlimited open world game

#

oh

upbeat basin
#

Replicated variables will be replicated again

#

So your states should use OnRep to correct themselves according to servers state when they become relevant again

#

Like your open state

#

So don't trust multicast RPCs

keen adder
#

Awesome, good to know!
Though it might be better doing it locally anyway -- considering there could be thousands spread all over the world

#

Yup

upbeat basin
#

You won't even be receiving them when an actor falls out of relevancy, since it's destroyed

#

Keep your state with a replicated boolean, let the client adjust whatever adjustment needs to be done according to that boolean locally

#

Don't trust BeginPlay for an actor that becomes relevant again either, it's not guaranteed to get your replicated values yet during the BeginPlay as far as I know

upbeat basin
keen adder
#

And great right on, thanks for the info man

faint hill
#

does anyone know how to make multicast RPC work when the calling actor gets destroyed right after executing the RPC?

#

seems like it simply gets dropped

#

to add some context - I would like to spawn a niagara effect on destruction

keen adder
#

I've had that issue before in Unity. The destroy happens on all clients immediately while the RPC gets queued up for the next call

#

What you can probably do is either spawn the effect on OnEndPlay()

zealous wigeon
#

btw isn't that what Unity does? sending inputs instead of position?

keen adder
#

Or have the object send the Server/Multicast to spawn an effect to a different object rather than itself.

ocean phoenix
#

Hello! Does anyone know how to check if the PlayerState is a host (Listen Server)? I mean so even client would know who is the authoritative player of the session, so the IsLocalPlayerController() wouldn't help me.

dark edge
#

er sec

#

if HasAuthority and IsLocalController will tell you if a controller is the server and the servers controller

#

there might be some analog for PlayerStates

ocean phoenix
#

Gimme a sec I'll try it

ocean phoenix
dark edge
#

then you can set some replicated variable

ocean phoenix
dark edge
#

APlayerState* HostPlayerState = ULeScoringComponent::GetHostPlayer()
with HostPlayerState being replicated

ocean phoenix
#

Based, thanks!

ocean phoenix
rich dune
#

Hi,

the gamemmode does only exist on the server, however only the gamemode has the applicationLifeCycle component where I can check if someone put the application the the background. How would I handle this on a client?

quiet yarrow
#

@dark edge so I found the issue, my client doesnt think its hitched to the wagon. however i cant find a proper way to tell the client that they are hitched without things breaking

dark edge
quiet yarrow
#

Just the client hitching. Other client and server see the constraint properly

#

here is client to client

#

as you can see the client shows no constraints attached, but the server shows it accurately

#

if this is just a limitation of the physics being replicated I would rather the client have the constraint be more accurate and the server/other clients be lagging behind. Im still fairly new at this so any suggestions are welcome

languid finch
lament flax
#

at runtime can i toggle between netserilaize and deltanetseriliaze for a fast array item ?

#

or is it only defined at compile time

zealous wigeon
languid finch
vapid gazelle
#

Is it fair to say that setting RPCs to "reliable" isn't entirely optional, it's actually something you want to be pretty thorough about, even though early on in a game's development you might not get bitten by it because you don't have enough network throughput that unreliable RPCs get dropped in favor of high priority ones?

I might have misread the docs, but my impression is that if something is essential to the integrity of the game state across the network and is not being spammed on tick, you want to mark it as reliable or risk the call being dropped and your clients getting out of sync?

zealous wigeon
#

it's as safe as validating player position

#

but introduces more friction when syncing client and server

lament flax
#

because there is rarely a case where its important to not have it droped

#

if you give me examples of your cases i can tell you more specifically

#

dont forget that missing a RPC means a player kick, so you absolutely dont want that for something recurrent or stupid

vapid gazelle
#

Is there a rule of thumb here that one might want to follow? My impression is that there are roughly two categories:

  1. things like player changing weapon, player respawning, player changing class - all of these are pretty essential and uncommon operation that you don't want to gamble not be transmitted to the clients
  2. operations like your position or rotation changing which are a stream of updates where if you drop a bunch of them it doesn't matter, it might introduce some jitter, but otherwise it's not mission-critical
lament flax
#

for 2. you are right

lament flax
# vapid gazelle Is there a rule of thumb here that one might want to follow? My impression is th...

for 1. not really, lets take the weapon change example:
lets take fortnite as an example: you have multiple guns, you scroll up/down to switch selected weapon

here is how its breakdown (its a example, idk how fortnite does this):

  • the inventory is a array of FMySlot, thats is replicated OnRep (impossible to lose data over time), the data is set on server

  • to change weapon, on scroll input event, we call an server RPC (unreliable, because if we miss it, be dont care, the player just have to scroll again)

  • once server RPC called and received, we do what we want (here, add 1 or -1 to the index), then replicated it (OnRep), the client will have its new weapon in hand

#

as you can see, most systems doesnt need reliable RPCs

#

as a more general way of saying:

  • if you are on client and want to tell something on the server, most of the time you can do unreliable RPCs because if its missed the player can just recall it (inputs, widget buttons, ...)
  • if you are on server and need to do something on client, either use unreliable RPCs (if its a one time cosmetic thing, like play a short sound) or uses variables (most of the time, OnRep)
#

does this help you ?

vapid gazelle
# lament flax for 1. not really, lets take the weapon change example: lets take fortnite as an...

to change weapon, on scroll input event, we call an server RPC (unreliable, because if we miss it, be dont care, the player just have to scroll again)

I don't get why this isn't a problem. At least I as a player would prefer if an action I took (e.g. change weapon) was always executed by the game, not occasionally dropped requiring I repeat it. This would make me feel like the game I'm playing is janky and "inconsiderate" as far as UX goes.

Also the important bit here is how likely this is to not be replicated. Are we talking once in billion weapon changes? Or are we talking once every 10 weapon changes?

lament flax
lament flax
#

same for shooting, you never use Reliable RPCs

meager spade
#

Lagging at 80 to 120 ping ?

#

What?

lament flax
#

if you want to test this out, play in PIE with net emulation at like 100-200 ping and spam shooting/scrolling whatever, you will be easily kicked

meager spade
#

60 to 80 ping is average

lament flax
meager spade
#

What?

lament flax
#

i guess it depends the game

#

and how skileld you are

meager spade
#

Mostly all games have predicted firing

lament flax
#

for a noob it doesnt change anything, for a pro player 50 ping and its over for him

meager spade
#

What ?

lament flax
#

because he will have faster reflexes

#

as soon as i have over 50 ping in volorant i see the difference for example

meager spade
#

But that is still irrelevant though

#

Sure lower ping is better

#

But it depends on server location and stuff

lament flax
#

anyways, whatever high ping is, no point in using reliable RPCs in the examples i gaved

meager spade
#

And your net connection

lament flax
meager spade
#

We use reliable for changing weapon

#

Cause changing weapon should never be dropped

lament flax
#

the effects are predicted locally but not the kill

meager spade
#

Fortnitenhas predicted firing

#

So does valorant

lament flax
meager spade
#

Pressing fire is instant

#

The actual damage is delayed

#

Cause its done on server

lament flax
meager spade
#

But actually firing gun is not

#

Also valorant has rewinding so ping is irrelevant

#

Fortnight uses the data from the shooter so again ping is irrelevant

lament flax
#

i should be more precise:

  • the local effects (animation bullet trace, shot VF) will be instant
  • the damage (and so the kill) will not
meager spade
#

Yes this is the way all games do it

lament flax
#

so in shooters over 50-70ping is a lot

#

but that wasnt the original discussion

meager spade
#

But if your determining what ws hit on server

#

Then you will have issues

#

Unless you use rewind logic

lament flax
# meager spade Also valorant has rewinding so ping is irrelevant

not if the player kills you before

i saw that (if you play with high ping)

  • you shoot the player (HS so he dies instantly) -> he doesnt shoot you back -> he dies (delayed)
  • you shoot the player -> very fast he shots you back -> he will mostly not die (maybe because ping has a priority on rewinding ? idk if valorant uses data from mutliple users to test if he has the time to shoot)
#

im talking about valorant here

#

the also very good example of better ping is better is fornite building retake

verbal ice
#

Valorant likely only has a maximum rewind time + shooter advantage. If two players kill each other, whoever reaches the server first will survive, since the other one will be dead (and therefore cannot have killed someone)

quiet yarrow
#

any alternatives to physics constraints that might replicate better?

meager spade
#

World of latency

verbal ice
#

Ay

fossil veldt
#

Hey y'all, anyone know what's the typical way to network player inputs for larger scale games like battlefield? Since in that scale i'm guessing bandwidth and CPU tends to be a problem, I was thinking perhaps going oldschool quake3 style is the way and just sending a compressed command buffer each frame, what are y'all thoughts? Maybe i'm overthinking it and I can just get away with RPCing every state change like reloading individually + push based replication?

#

(I should be clear before anyone answers that i'm not interested in using GAS here)

brittle ledge
#

2 large scale games could still handle it in different ways even if they are similar in size and number of players active at once or in the same map

fossil veldt
brittle ledge
#

Regardless of approach if you want the server to know you do need to send a message to the server telling them what happened.
And the server will have to then tell everyone who needs to know about what happened; I don't think that's avoidable.

#

You can -optimize- by having features such as automated reload or stuff like that; so that players don't need to reload; or similar stuff; but reloading in itself I don't think is any issue compared to shooting or movement; movement is like wayyy more work and way more stuff than reloading

fossil veldt
#

I'm just asking how is the most optimal way to do that for a game like battlefield

#

and I do not believe it is RPCs

lost inlet
#

How is that hard to believe

#

If you think about something like Quake or the Source engine, then a usercmd is sort of a proto RPC and that's sent every "tick"

fossil veldt
#

Ya but the thing about the quake one is that it iirc it compresses the inputs into a bitmask so it's absolutely tiny

#

but I guess yea it's RPC every tick or RPC every action

#

hmm

#

What's the typical way pre-GAS of acking inputs like that then, do you just wait for the onrep?

#

Like if you predicted something like ADS, and the server goes no fuck you, how would you usually rollback

#

Just send another RPC back from server to cancel the status?

lost inlet
#

Probably more of a nack than an ack since the former is less likely

fossil veldt
#

ah yea ok

#

yea ur right NACK makes a lot of sense here

opal shore
#

should i use #if ue server or if (net mode ==) vlabla

lost inlet
#

I did something way back when that kinda worked, I would shadow variables like weapon state clientside so reconciling differences via the OnRep was less complicated

fossil veldt
#

I would shadow variables like weapon state
How do u mean

lost inlet
#

WeaponState variable, replicated
AutonomousWeaponState, not replicated. Locally controlled would get and set this value instead via accessors

fossil veldt
#

ahhh gotcha, interesting

#

I could do smthn like that actually, I'm doing similar to GAS tags

lost inlet
#

I used a setup like that for ammo too

#

Since for singly loaded weapons like shotguns, the values could get out of whack

fossil veldt
#

ah yeah I can imagine

dark parcel
lost inlet
#

Netmode works for PIE

dark parcel
#

Should never use multicast for something that needs to be in sync.

gray blade
#

this is in a level BP also

#

if relevant

dark parcel
#

Level bp, prob server 0nly

#

So multicast apart being the wrong choice is just not gonna work

dark parcel
#

And server rpc to communicate from client to server.

#

Server send seed for the random number -> player propagate change based on the incoming seed to change the weather

lost inlet
#

And server RPCs won't work from level BP because the client doesn't own the level BP actor

#

Though at least Epic were kind enough to make the level BP actor replicate

dark parcel
#

๐Ÿ‘€ didn't know that

#

Would totally not use level bp there though

lost inlet
#

I would not use it for a lot of things

gray blade
#

think i have an idea ;3

lost inlet
#

Like the thing you doing has to be incredibly bespoke for that specific level for it to be justified

dark parcel
# gray blade think i have an idea ;3

Start from having the server output a random number and ensure all clients received that same number.

From there it's just about using the number to choose which weather to use

gray blade
dark parcel
#

Yeah don't use level bp, create an actor and place it on the world. This actor can hold reference to the world object, e.g. lights, door, w.e

gray blade
dark parcel
#

No, in blueprint especially the communication only goes one way with level blueprint.

#

Just don't involve level bp at all for your weather system

#

Contain them in an actor instead

gray blade
#

wait i realize i can add them as comps

dark parcel
#

Create a variable of the type inside the actor class you create.

Mark it instance editable, expose on spawn.

Drop an instance to the level, use the eye dropper tool to select the target actor.

gray blade
#

sweet i just added them as actor components

dark parcel
#

That will work but you should know how to set references too.

#

Because there will be instances where you want to do one over the other.

gray blade
#

i can just drop this in to if I decide to make another map

dark parcel
#

Yes, reusability

#

Now imagine using level bp

#

You can't, re use it on other level

gray blade
#

and im not even certain that is the best way

dark parcel
#

No, just avoid it for now

fluid prawn
#

Question about Network debugging with Visual Logger. It appears that Epic has made improvements to it. From testing an analyzing the Visual Logger time line is now in sync for object time stamps?

#

meaning the client and server are in lockstep with the visual logger time line

#

before this you had to provide your own Lambda function to sync the client and server to line up correctly in the visual logger timeline (like sea of theives did).

#

seems like now its working out of the box?

burnt coral
#

Quick question is world partition replicated for us or do we have to do this ourselves?

silent valley
opal pulsar
#

I would assume the server needs to load all partitions relevant to each client but each client only needs their own partition to be loaded

keen adder
#

Heyas, what is the best way to replicate a TMap of UObjects? ๐Ÿ˜‹

#

Ive got an open world game where the state of crafting stations is a UObject. Meaning if a furnace is cooking, theres a uobject that handles it, so it can coninue cooking while the player is in another area

#

(Its done this way so states can easily be applied to anything)

But how would I go about replicating something like that? ๐Ÿ˜ฌ

lament flax
hoary spear
#

Dont replicate a tmap would be the best way :p

lament flax
#

you have to replicate it your way

lament flax
#

and why do you need a TMap

hoary spear
#

Uobjects are awesome (says the new uobject user , replacing my old struct approach)

#

Uobjects are far more dynamic , easier to expand upon :p

lament flax
#

yes

#

but somethimes a struct is just easier

#

now you even have instanced structs

hoary spear
#

Haven't tried those yet

#

But they're less bp friendly without an additional library set of functions

lament owl
#

what's the type of key in TMap?

dark parcel
#

you define it, TMap is key : value pair

#

TMap<FName, int> myMap;

lament owl
#

Just a different approach

dark parcel
#

You can just have a struct with a key value pair I guess

#

OnRep -> populate TMap in the receiving end

hoary spear
#

Or if the keys already exist on server and client...

lament owl
#

Good

kindred widget
# keen adder Ive got an open world game where the state of crafting stations is a UObject. Me...

This feels like an odd thing to do though. Like you have a crafting station that has a thing queued. Your crafting should just exist, like.. You have an array of shit queued, or maybe only one. This queue should have a started time and a completed time. Even if you allow 500 things to craft at once, you should have only a single timer for this table that gets updated to the smallest craft time. When the timer finishes, you finish crafts that are finished and find the new best timer.

For a client this means just simply getting the replicated data. They don't need to know anything more than the start time, end time, and current server time, and what the item is to display necessary info to the user.

For a server this means that if you're actively unloading zones, you need to save it and reinitialize the system and check those times anyhow when you reload and it just gets replicated to whoever is relevant anyhow.

raw drift
#

Hey!

Iโ€™ve been wondering why my character jitters on the client side when on a platform, whether they rotate or change position.

After 15 hours (no kidding) of meticulous testing, I disabled the camera lag, and suddenly all my problems were gone.

No more jittery movement on platforms, everything runs so smoothly in multiplayer now. So cool.
HOWEVER, now my movement feels so rigid, itโ€™s awful. The camera lag added a really smooth, stylish feel to the movement, and it looked great.

So now Iโ€™m stuck and asking for help. How can I make camera lag work properly in multiplayer?
Any ideas? Has anyone else experienced this?

Thanks so much!

hoary spear
#

Camera manager

#

Custom lerping ?

#

Seems like the camera boom struggles to keep up

#

Which ofc is a bit weird unless it replicates and get corrections or something..

dark parcel
#

Camera lag shouldn't have much to do with multiplayer?

#

maybe your platform is not interp smoothly on clients

hoary spear
crisp shard
#

Iโ€™ve had this same issue where adding camera lag makes things very jittery and laggy

#

So I actually donโ€™t use it at all for that very reason but Iโ€™d love to find a way to get it to work without that negative effect

dark parcel
#

maybe it's fighting with something

kindred widget
raw drift
#

Platform move like this

raw drift
#

I don't see why it's impacting multiplayer as well

dark parcel
raw drift
#

i also tried custom camera lag with Vinterpto and it result in exactly the same issue

dark parcel
#

you can't send movement data fast enough from server to client to be buttery smooth

#

most rotation/movement probably interpolated to smooth it out on clients

weary badge
#

Hey everyone, I'm working on a first online multiplayer and to be honest, I don't see the appeal of GameState. I feel like everything that is in there could aswell just be handled in GameMode for safety reasons. Am I missing something?

dark parcel
#

game state also replicated while game mode is server only

#

Scores can be something shared if you want players to see the same score for example

#

it make perfect sense to store that in the game state

#

since game state is replicated

weary badge
#

yes, i got that. But if I got it right, the client can alter stuff that's in the gamestate.

dark parcel
#

won't affect the game

#

Lets say they make them self rich, by changing the gold to 99999

#

But they only change their own gold in their own machine

#

in the server, their gold is still 50

weary badge
#

oh, that's what i was afraid of

dark parcel
#

what exactly are you afraid of?

raw drift
dark parcel
#

when the client want to purchase something, resolve it on server

weary badge
#

that he could change the values inside the gamestate and that it would affect others

dark parcel
#

they would only change the value for them self.

#

The only way for client to communicate to server is through server RPC

#

In a sense, what client sees are just visual, or illusion

crisp shard
dark parcel
#

the real value is hold by the server

weary badge
#

I think I got it

#

thank you!

crisp shard
#

Random Q but if I have different โ€œcasting timesโ€ or โ€œhold timesโ€ for doing different attacks but want them to all have the same Input Button would it be possible to change the value of the โ€œholdโ€ time for the input to trigger based on which attack it is?

kindred widget
#

You need an ability system. Not to mess with the input system.

crisp shard
#

like GAS?

#

i mean , i suppose i could do it via an RPC / timer but that just sounds terrrible in praticality

kindred widget
#

Why do you need an RPC?

#

If you were just going to modify the inputs timer anyhow, all you need to do is wait in the ability itself locally on the client and then do whatever you were planning on doing when the hold time ended on the client.

crisp shard
crisp shard
#

as they say

kindred widget
#

Much like CommonUI, I don't work without it anymore. ๐Ÿ˜„

crisp shard
#

i don't know cpp enough to get in there and use it to it's potential

#

im also using 2d sprites as characters (3d world tho)

kindred widget
#

Yeah, I get that. ๐Ÿ˜„ I wish we had redone our last project for it when we had a small window but we were too far in.

You don't really need C++ for anything other than attributes really. A vast majority of the rest of it is BPable.

crisp shard
#

i'll have to just do it at some point and change things. but mannnn would it be a task. legit would change almost every action

burnt coral
quiet yarrow
#

Im not sure how to replicate things coming from the animation BP. Couldn't find anything online specifically about it. Anyone have any tips?

gilded vapor
#

you don't replicate the anim bp itself generally

#

you replicate the parameters that you pass to the animbp

quiet yarrow
#

so in this scenario im casting to my character and pulling info off the cont/actor rotation

#

I would need to replicated the pitch and yaw within the character bp then when I cast I pull those variables instead?

quiet yarrow
#

ahh that worked. So I assume yes

wicked radish
#

I have a 2nd skeletal mesh on my character. I can't get it to replicate from the client. (if playing as server, it replicates for everyone. If playing as client, it doesn't)

I have setisReplicated to true on the mesh. Any ideas how i can get this to replicate??

latent heart
#

Nothing replicates from a client.

#

If you want to send data to the server, you have to use RPCs.

queen escarp
#

hey im trying to set initial speed in an actor with ProjectileMomvent Component but that dosent replicate obbiously, any tips on how i can replicate that ?

blazing bear
#

does calling a regular function inside a server rpc, makes the regular function also run by the same instance (server) ?

dark parcel
nova wasp
#

you can call another rpc from inside the code on the server I suppose if you wanted to, like client-> server then client -> server as a response etc

blazing bear
#

yeah that's what I thought, I just wanted to make sure that a non rpc helper function for example called inside a server rpc is running on the server as well

dark parcel
#

If you are unsure, show your code

blazing bear
#

I'm on my phone right now, pc is off. but basically, the autonomous proxy character calls a server rpc to interact with an actor, the server rpc runs some stuff, and in case the said actor is an item, it calls a non rpc function inside the inventory component that picks up the item and attaches it etc.

dark parcel
#

Well you are already inside the server rpc, so that regular function only run in the server machine, unless there is a client or multicast rpc that calls that function.

You can just print string to check btw.

blazing bear
dark parcel
#

Or if you want to use the logger, you can see how to get the prefix from the cpp code.

#

Just be aware there is bug associated with it on 5.3-5.4 I think where it always show client 0

#

Epic made some changes and fk it up.

blazing bear
blazing bear
dark parcel
dark parcel
#

I'm on 5.1 and no prob

blazing bear
blazing bear
dark parcel
#

Oh you would need the client ID tho, I would look at the print string implementstion

#

Hopefully it's fixed in 5.4.2

blazing bear
#

aah alright I'll keep that in mind then

blazing bear
amber vale
#

Is it common for games to use projectile prediction for something like grenades, or just for things like guns and rocket launchers?

dark parcel
#

I think every games predicted that? Even if I have high ping in battlefield, the grenade are thrown right away.

#

Same with any other fps game I played afaik.

eternal canyon
#

valorant for example doesnt

dark parcel
#

I don't remember having delay when throwing a grenade or firing rocket when playing raze

#

Maybe I just don't notice it

sharp hamlet
#

Hey, simple question, what is the best place to store mp variables like kills, score, deaths etc, which are states (i.e: have to use repnotify). I understand that the best place to store is in playerstate, but i dnt understand why. What is the difference if we store in gamemode in an array

thin stratus
#

GameMode only exists once and only on the Server. You can't even use RepNotify there

#

PlayerState exists per Player and is always replicated to everyone.

sharp hamlet
#

So i dont have to do any replication programming in playerstate? So store kills there normally without an array?

lament flax
#

You decide whats reped and whats not

#

Inside the PS

lament flax
void nest
#

Hello. I'm using the default unreal character blueprint with movement component. But I'm experiencing strange stuttering/jittery movement when viewing clients moving from the server's perspective. Now here's the weird thing. Clients seen as clients and seeing the server from client all works fine. It's only clients viewed from the server that jitter around. What could be causing this?

sharp hamlet
# lament flax I think i would store this on PS

So u set the variable of kills in PS from playercontroller on getting a kill. It will call a function in the PS to set the variable of kills. Now this variable shud be replicated? Or repnotified? I understand this variable is kind of a state variable so needs repnotified then? Can you please clear my confusion

lament flax
sharp hamlet
lament flax
#

anywhere yo uwant to

#

it depends how you kill someone

sharp hamlet
boreal wadi
#

Can anyone here link me to or explain to me how a dedicated server takes advantage of multithreaded code. For example if I have a single core server and Iโ€™m using MASS to make math calculations on multiple threads for AI movement doesnt that single core only have 2 threads? Is it even worth writing parallel code or is it expected that if your game is running multithreaded calculations on the server you rent a machine with high core/thread count ? Yes Iโ€™ve googled, even asked AI Iโ€™m asking here because I want to hear from someone with experience.

nova wasp
boreal wadi
# nova wasp The simple thing is to just try running parallel tasks in a dedicated server bui...

True, and I've done some tests with the local server playfab provides with their gsdk. However, since I don't understand the underlying architecture I'm just making guesses on what's actually happening. It doesn't help that my pc is the server so I have 32 threads and everything runs at light speed lol. I guess I will have to push out a small fleet. I just wasn't sure I could run unreal insights on a cloud server.

sharp hamlet
#

Hey is it true that i cant do any sort of logic inside level blueprint if i m using a dedicated server?

tardy fossil
#

no thats not true

#

oh wait level blueprint i have no idea

#

but i dont see why it would be different for a dedicated server

sharp hamlet
#

I have a function that sets some variable in GM. The level bp, after begin play, and waiting for a few secs, checks that variable and performs some logic. This works if i m playing frm PIE. But when i m packaging and running the game on dedicated svr build, the level bp logics are not getting executed

hoary spear
#

Whenever i see 'wait/delay' in multiplayer setting to retrieve some value or reference I cant help but think this is a bad bandaid to an exec flow problem

sharp hamlet
#

Please, in laymanโ€™s terms plss

haughty smelt
#

Wait/Delay in a live environment will not always time out correctly, depending on ping/lag-spikes

sharp hamlet
#

Understood, thanks. Will change the code of level bp

quiet yarrow
#

Anyone care to help me try to figure out why my constraint to a AI pawn isnt replicating? Im on day 3 with this issue with no clear solution...

quiet yarrow
#

PROBLEM SOLVED !!

#

thanks anyway

proven pagoda
#

I'm having an issue on clients only with my Motion Matching anims. If the direction value is 0 then my anims are smooth, however if I'm going in any direction other than directly forward the anims stutter really badly. The character movement isn't correcting the movement is smooth, it's just the anims and it's only on clients. Any ideas where I could look I been at this for a long time

#

I also took motion matching away and made a regular anim instance with state machines and it does the same thing

#

I calculate direction with this function but I don't see why these values would have issues between client and server

latent heart
#

So question about Mover/NPP. Should the client, which is predicting its own movement, effectively be "ahead" of the server in time with its own local movement?

#

NPP isn't retroactively changing things to account for ping times with inputs or anything?

#

We've got a situation where when a client is moving in just a straight line with no course correction, the time input is received and acted upon, the server thinks the client is further back along the line it's moving on than where the client thought it was when it sent the input. By quite a margin.

#

So teh client is a good 100ms ahead of the server.

#

In this image:

  • Blue: where the server thinks the client is when the client sends input.
  • Red: Where the server thinks the client is when it receives the input.
  • White: Where the client actually is when it sent the input.
twin juniper
#

yellow?

solid river
#

I created a project based on Third Person template:

private:
    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
    UInputAction* FireAction;

    UPROPERTY(VisibleAnywhere)
    class UTextRenderComponent* Message;

protected:
    /** Called for firing input */
    UFUNCTION()
    void Fire(const FInputActionValue& Value);

    UPROPERTY(ReplicatedUsing = OnRepNotify_CounterChanged)
    int Counter = 0;
    UFUNCTION()
    void OnRepNotify_CounterChanged();

    UFUNCTION(Server,Reliable)
    void Server_IncrementCounterBy(int amount);
TPCharacter::TPCharacter()
{
    // ...
    Message = CreateDefaultSubobject<UTextRenderComponent>("Message");
    Message->SetupAttachment(GetCapsuleComponent());
    Message->SetIsReplicated(true);
}
void TPCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    // ...
    EnhancedInputComponent->BindAction(FireAction, ETriggerEvent::Triggered, this, &ThisClass::Fire);
    // ...
}
void TPCharacter::Fire(const FInputActionValue& Value)
{
    Server_IncrementCounterBy_Implementation(10);
}

void TPCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    DOREPLIFETIME(ThisClass, Counter);
}

void TPCharacter::OnRepNotify_CounterChanged()
{
    Message->SetText(FText::AsNumber(Counter));
}

void TPCharacter::Server_IncrementCounterBy_Implementation(int amount)
{
    Counter += amount;
    if (GetNetMode() == NM_ListenServer) {
        OnRepNotify_CounterChanged();
    }
}

But I don't see the Message changing when clicking the left mouse button on client machines, what is wrong?

The Message changes only when I play on Listen Server machine. The Message is successfully replicated to other clients.

twin juniper
#

'ThisClass' ?

#

Is this a thing?

dark parcel
#

Yes

twin juniper
#

'Server_IncrementCounterBy_Implementation(10);'

#

this is wrong

solid river
#

ThisClass is just an alias of TPCharacter, it is not the culprit.

twin juniper
solid river
#

Trying Server_IncrementCounterBy(10); now.

twin juniper
#

well done

solid river
#

It works. Thanks.

frail barn
#

there is a default array of players in the GameStateBase
how to get information, by which number a player is registered in this array?

frail barn
#

i compare player state from array and self, but every of this returns 0 for every client, means he is first one

dark parcel
#

Shouldn't relied on the order anyway

thin stratus
ripe lotus
#

If i change a replicated var on a client, will it get restored to the server val? Do i get a repNotify func call again?

chrome bay
#

No

#

If you change it on the client, the server doesn't know you changed it, so you won't receive an update. That is, until the Server changes it again and thinks it's different from the last acked value.

hoary spear
#

does this mean that the server is also tracking what it thinks the values are for all clients? pure curiosity

twin vessel
#

I'm trying to code an item/inventory system similar to minecraft's one.

So i have a inventory component with an array of ItemStacks (objects replicated through replicated sub-objects).

ItemStacks point to one item data asset, and has an array of fragments (objects replicated as well through the inventory component)

Items have a array of default fragments which are used to initialize the item stack's fragments array.
(Fragments are saved on the Item stacks only if they are different from the item's ones. If they get modified back to the default value, they get removed from the stack)

ItemStacks have a use function, which then calls the item's use function (which takes as parameter the item stack). The item implements functionality, but saves data on the fragments of the item stack

My problem is that i realized that this works well until i try to implement any kind of client side prediction to the item use mechanic, since if i was for example to have an ammo fragment, on the client i might rapidly remove ammo count till it reach zero, which would result in the fragment being removed, but then the server would replicate the change of the ammo count one at the time, resulting in the fragment being added again to the item stack (both on client and server since the fragment list is replicated)

My question is how would i deal with this, since i feel like i cannot just create fragments client side, since they are "replicated objects"
Should i just scrap the system?

Please tell me if i did not explain this stuff clearly enough
(Ping me if you answer)

https://github.com/XyloIsCoding/XyloInventoryUtil_Plugin

GitHub

Contribute to XyloIsCoding/XyloInventoryUtil_Plugin development by creating an account on GitHub.

latent heart
marble gazelle
# hoary spear does this mean that the server is also tracking what it thinks the values are fo...

depends. We have two cases here, replication and delta replication.
Replication just sends the complete state from the server to the client, once the server detects a local change.
For delta it's on the one hand users impl, but in general you keep a per connection cache that stores the last state so it can calculate the delta to be sent to the client (full replication if old state doesn't exist)

hoary spear
#

Maybe my eyes are deceiving me, but I'm sure there's a yellow mark there ๐Ÿ˜›

latent heart
#

Optical illusion.

#

I'm still wondering if it's just a bad setting or something. Idk.

#

I'd have thought the server would be simulating the clients at present time, not 100ms in the past.

keen adder
#

So what's the deal with Network Relevancy?
I have my objects CullDistanceSquared set to 1, yet it still perfectly replicates to all players

#

Everyone can see it at all times/distances and it sends/receives all events/calls

#

Is there some other setting that must be enabled to use network relevancy?

lament flax
#

if yes, can you show the settings

lament flax
keen adder
keen adder
#

Also sorry about the other day, I asked a question but then had to leave immediately unfortunately

lament flax
#

no worries

keen adder
#

This is part of my other question actually.

I've got a open world crafting game like minecraft. I'm not sure how to handle the structures people create. Like if someone builds a furnace and puts food in it.

Trying with network relevancy, so the furnace is visible and working for those near it, but ignored for everyone else

#

The other option was making the furnace local, and just RepVaring it's state to everone.. but that's a TMap of UObjects lol

lament flax
#

you can set a default distance relevancy

#

thats what i do when player builds

#

the "overlay" building piece isnt rep if to far away

lament flax
keen adder
#

Well right now I just set it on the player pawns to test, and they're all visible and animating perfectly at all ranges

#

I assume a cull distance of 1 should break them at some distance right?

lament flax
#

can you test on a simple actor ?

#

make it display a var that increments each tick/few secs on server and thats reped to clients
go close then far away and see if its stops

keen adder
#

Good idea! But does this also turn off it's rendering?

lament flax
#

no

#

its REPLICATION relevancy

keen adder
#

Ah poop lol okay. So probably not good for open world then?

lament flax
#

you will need that

keen adder
#

As you'd be able to see those blueprints from miles away

lament flax
#

but for some game like MC, idk if you want to spawn/destroy the actors on client if to far
or just make them hidden and not net relevant

lament flax
#

like shadows etc arent displayed when far away

keen adder
#

Yeah it's just odd if there's hundreds. Also my trees and bushes are designed the same way as those placable objects -- as they can grow and animate dynamically

#

So that means if all players are spread out, all the trees/bushes/structures in every players area, would also exist to everyone else nearby lol

lament flax
#

if VERY far, hidde/destroy

keen adder
#

IT's just their existance I'm worried about, as they'd still need to be created when loading that area -- and thus their state needs to persist locally anyway

lament flax
#

and use a savegame to save it and restore if players comes close enough

keen adder
#

As there's not gonna be infinite trees existing with their own states

lament flax
#

thats what MC does, it reads data from chunk data or generates a new chunk if none exists

keen adder
#

Oh right, I forgot about savegames mid game

lament flax
#

you would have to rely on saving and loading

keen adder
#

And it just saves the chunks to disk?

lament flax
#

one savegame class save is one file

#

.savegame i think

#

or .sav

keen adder
#

and it saves all chunks in there?

#

That seems like a massive file

#

lol

lament flax
#

i said chunks because thats what MC calls them

#

you will have to design and write your system

keen adder
#

Yeah, for the structures I'll prob just go with having everyones be local, and it just updates the states to everyone

lament flax
#

a lof of json iirc

keen adder
#

yeah

#

Oh that was my question on the TMap of UObjects

keen adder
lament flax
#

there is a lot of ways to do so

keen adder
#

And a TMap -- <TilePosition, UObject state>

lament flax
#

i would just have an array of objects with a struct that holds data

keen adder
#

Now I can easily multicast when someone cooks a porkchop or whatever, and another when it's cooked

#

but unsure how to repvar that

#

Right, and repvar the entire Array?

lament flax
keen adder
#

I guess it's smart enough to only replicate what changes or is added?

lament flax
keen adder
#

Yeah haha, but I'll hold onto that link for later

#

Because it's a TMAP of Uobjects. The campfire actor itself does nothing. But clicking it with a porkchop creates a global UCookItem object that handles all the cooking -- so the campfire can unload safely and still continue

lament flax
#

if you want big replicated arrays i would suggest FastArrays

keen adder
#

So yeah maybe I'll have another Reppedvar just holding the items state, while the Uobjects handles all the timings and stuff

keen adder
lament flax
keen adder
#

Yeah I know, neither are UObjects lol, hense me asking here ๐Ÿ˜„

lament flax
#

UObjects can be

keen adder
lament flax
lament flax
#

the best idea is to profile both and see

keen adder
#

Right, just worried on that you mentioned, being able to add/remove in the middle and not replicating the rest

leaden bone
lament flax
unkempt tiger
#

I realize this isn't strictly about multiplayer but primarily multiplayer games deal with spectating so asking here

#

When I set my gamemode's spectator class, it seems that pressing ; in the editor to enter the dev camera will actually spawn the gamemode's spectator class? Making it difficult for me to navigate around the map due to my spectator's behavior

#

Is there a way to avoid this linkage?

lament flax
#

check editor settings

#

maybe you can set a class there

unkempt tiger
#

Oh, you're right there's also F8 which remains unaffected

#

Well, it's two different cameras, two diff behaviors

#

but I guess F8 can work for now (my editor settings search attempts came up empty)

#

Thanks ๐Ÿ‘

crisp shard
#

if i wanted to do a little short camera cutscene when leveling up or something would i just do all that logic on that client ? like just normally play a level sequence for that client ?

plush lotus
#

hello i have created a little game (local mode only) if i want to test the game with some people with online game system. Is it possible? Or i need to deploy the game on steam or something like that?

I didn't start the online training yet but it's to have an idea of what is possible to do.

lament flax
fossil veldt
#

Anyone want my scuffed ass node to get around the stupid clientside issue where playerstates aren't predicted so you have to wait on the rep down? I can open sauce it maybe if anyone actually wants it

#

Tried lots of other solutions over the years and annoyingly this seems like the most robust / straight forward one

#

But in any case useful on character when u need the PS on begin play but it's invalid - lmk if anyone wants the sauce

plush lotus
lament flax
plush lotus
hoary spear
#

I ended up with some chain of 3 or smth

fossil veldt
#

couldn't be bothered to hook into the OnRep

#

from C++ it's really really trivial to just override the onrep for playerstate since it's virtual but in BP it's much more annoying unless you go expose it manually

#

It's essentially just a fancy wrapper around set timer next tick with a validity check

hoary spear
#

Yeah its trivial-ish to get it through c++ , they should be exposed to bp by default imo

lament flax
fossil veldt
#

rather than having to do any client specific binding

keen adder
#

Is there any plugins or anything that allow FFastArraySerializer to be used in blueprints?

haughty ingot
keen adder
#

FFastArraySerializer isn't exposed to blueprints, so I can't actually use it for replication within blueprints

haughty ingot
#

You can just make your struct you inherit from it exposed to BP

#

But you canโ€™t directly create a fast array in BP.

keen adder
haughty ingot
#

They can (in C++), but Iโ€™m not specifically sure what youโ€™re trying to ask. If you inherit from a fast array and your struct is marked as a blueprint struct, you can still use it in BP.

#

Youโ€™d just need to make your setter functions make the fast array dirty as needed.

maiden flame
# plush lotus hello i have created a little game (local mode only) if i want to test the game ...

Like Fishy suggested, you can use Hamachi. It emulates a LAN over the internet using a VPN, so you can connect separate wireless networks to the emulated LAN/Hamachi network.

If you don't want to rely on Hamachi you can use a subsystem that is compatible with Steam for example.
Although, I think Steam is region locked until you pay for your own app (might be possible to bypass by changing your download region, but I can't vouch for this. Though, it definitely works to use their free testing app ID within the same region, across countries).

haughty ingot
#

If you want to bind to the post replication functions you can just store a shared pointer of a delegate (to prevent copying) inside of the fast array item and then make an async node to bind it to.

keen adder
#

I'm not really a C++ guy lol

#

I've used it a long time ago, and many other languages -- but that sentence was a bit much for me lol

haughty ingot
#

Iโ€™m basically just trying to say that you can use a fast array in BP, but itโ€™s up to you to make the reflected functions to interface with it

#

You just canโ€™t create a fast array in BP

keen adder
#

Yeah that's what I was asking earlier, if there were any existing plugins that did that already

#

Trying to find some online info on exposing structs to blueprints and coming up with no information

haughty ingot
#

Did you create a fast array in C++ already?

keen adder
#

Like can I actually do:

struct FBP_FastArray : FFastArray
{```
#

?

#

Oh wait

#

Are you talking about a UObject wrapper?

haughty ingot
#

No

keen adder
#

Create the fast array in a blueprinted Uobject

#

oh lol

haughty ingot
#

That is correct, (besides the naming)

#

Thatโ€™s the only way TO make a fast array

#

You inherit from FFastArraySerializer(Item)

keen adder
#

Oh, interesting. I couldn't find any info online, and then asked chatGPT and it responded with something about cheeseburgers and cats ๐Ÿคทโ€โ™‚๏ธ

keen adder
hoary spear
#

Sounds about right lol cheeze and cats

haughty ingot
#

Donโ€™t use VSCode NaughtyAI

hoary spear
#

You'd prob be fine with regular Arrays aswell ๐Ÿ˜…

keen adder
#

But VisStudio is like 18terabytes and ryder needs a subscription ๐Ÿ˜ฆ

hoary spear
#

Just once ? Perpetual licence thingy

keen adder
hoary spear
#

Resizing*

#

Yes

haughty ingot
#

Resizing fast arrays can cause issues in its own way

hoary spear
#

Can largely be avoided

#

Resizing, that is

keen adder
hoary spear
#

(But this is the best)

keen adder
hoary spear
#

Just dont shrink it

haughty ingot
#

If youโ€™re getting to the point where you want to use fast arrays youโ€™ll probably end up using C++ more often

hoary spear
#

Null it instead

#

Or do the swap trick

keen adder
#

Hmm, so Add to available nulls, but Resize if array is already full

#

That could work yeah

haughty ingot
#

Thereโ€™s lots of ways to handle fast array removal, as an example my inventory items store a handle which is essentially a reliable index I can use to reference the item, and then I just use RemoveAtSwap when I remove items, so the array only changes 2 rather then shifting the whole array and needing to send a large packet

#

So I donโ€™t need to rely on the indices of the actual items themselves

keen adder
#

What does RemoveAtswap do?

hoary spear
#

RemoveAtSwap yes , exactly

haughty ingot
#

Removes at an index, then swaps the last element in its place

keen adder
#

Hah cool

#

So it still shrinks, just - always from the end

#

That's very smart

hoary spear
#

Optionally shrinks, if im not mistaken

haughty ingot
#

Say you have an array of 500 items, and you remove number 3โ€ฆ 497 other items now need to shift and update the array.

#

If you just use .Remove

hoary spear
#

(With shrink)

keen adder
#

Yeah fo sho. And removeAtSwap will only remove the last instead

haughty ingot
#

^^

#

Lots of people donโ€™t realize this problem when they start using fast arrays

keen adder
#

So before I dig my face into this, does FastArray behave sort of like a TMap? I read it's order isn't guarenteed. So I'm assuming it's items use some sort of GUID instead of an index?

haughty ingot
#

And they constant add/remove and lose a lot of the benefit

quasi tide
#

My inventory is only 6 elements. I don't even bother with fast array

hoary spear
#

Mine is 200, i dont bother

#

Its fixed size so delta change is fine

haughty ingot
#

But I do also keep a TMap on the array for fast lookup since itโ€™s O(1)

#

The client just builds it themselves after every change

hoary spear
#

Same lol

keen adder
#

That won't affect performance?

#

Or is that perfectly acceptable within a frame?

haughty ingot
#

Na, itโ€™s a couple cycles

#

Way less then it would cause to lookup an item in the array

#

(Without knowing the index)

keen adder
#

Or you mean a single loop over the array once for the Tmap, is way better than doing it for every item lookup

haughty ingot
#

Na, CPU cycle

#

Multiple CPU cycles happen inside one frame

keen adder
#

Ah great, sweet lol.

#

I'm got a mine-craft like game where you can interact with things (imagine cooking food) on actors. The interactions are stored in a Tmap<Uobject> as the actors can load in/out but their interactions(cooking) keeps running in the background

haughty ingot
#

Using .Find has a time of O(n)

keen adder
#

So I guess the easiest solution would be a replicated TArray<StateStruct>, with RemoveAtSwap when a state is removed, and creating a TMap when the array changes for easier lookup later?

haughty ingot
#

Arrays are better for iterations and keeping cache misses down to a minimum, hash maps better for lookups

hoary spear
#

Cooking uobject sounds like something youd iterate over

haughty ingot
hoary spear
#

One does not exclude the other tho. Using them in tandem can be pretty practical

keen adder
#

Would there be a better solution? Or is that pretty ideal

haughty ingot
#

Donโ€™t get caught up in the โ€œbetterโ€ solution right now, just get it working

keen adder
keen adder
haughty ingot
#

Just make the fast array and then you can post it here and someone can show you how/if it needs any improvements

keen adder
hoary spear
keen adder
#

Yeah exactly ๐Ÿ˜›

hoary spear
#

Personally id just stick eith regular array untill proven insufficient

#

Odds are, if done right, its not

haughty ingot
#

Give me a second and Iโ€™ll just post some code of a fast array I use

keen adder
#

Aight, I just don't wanna get caught in a performanc eproblem and not know what the issue is

haughty ingot
#

You can just copy it

keen adder
#

It's incredibly hard to find any info on extending structs online, or even fast arrays for that matter

lament flax
keen adder
#

I guess I could get rider for situations like this, but atm without intellisense experimentation is kind of impossible

lament flax
#

in source

keen adder
#

๐Ÿ˜ฎ

haughty ingot
#
USTRUCT()
struct FNetworkManagedObject : public FFastArraySerializerItem
{
    GENERATED_BODY()
    
    FNetworkManagedObject() = default;
    FNetworkManagedObject(const TScriptInterface<INetworkManagedReplicationInterface>& InInterface, const TArray<uint8>& Payload);


    /** The object being managed */
    UPROPERTY()
    TScriptInterface<INetworkManagedReplicationInterface> ReplicationInterface;

    /** Buffer of serialized data */
    UPROPERTY()
    TArray<uint8> Data;

    void PostReplicatedAdd(const struct FNetworkManagedObjectContainer& InArraySerializer);
    void PostReplicatedChange(const struct FNetworkManagedObjectContainer& InArraySerializer);
};

USTRUCT()
struct FNetworkManagedObjectContainer : public FFastArraySerializer
{
    GENERATED_BODY()

     /** Fast array items for networking. */
    UPROPERTY()
    TArray<FNetworkManagedObject> Items;

    /** Stores an [object : index] map for fast look-up. */
    TMap<TWeakObjectPtr<UObject>, int32> HashMap;

    

    bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
    {
        return FastArrayDeltaSerialize<FNetworkManagedObject, FNetworkManagedObjectContainer>(Items, DeltaParms, *this);
    }

public:

    FORCEINLINE TArray<FNetworkManagedObject>::TIterator CreateIterator()
    {
        return Items.CreateIterator();
    }

    FORCEINLINE TArray<FNetworkManagedObject>::TConstIterator CreateConstIterator() const
    {
        return Items.CreateConstIterator();
    }

private:

    FORCEINLINE friend TArray<FNetworkManagedObject>::TIterator begin(FNetworkManagedObjectContainer& Array)
    {
        return Array.CreateIterator();
    }
    FORCEINLINE friend TArray<FNetworkManagedObject>::TIterator end(FNetworkManagedObjectContainer& Array)
    {
        return TArray<FNetworkManagedObject>::TIterator(Array.Items, Array.Items.Num());
    }
    FORCEINLINE friend TArray<FNetworkManagedObject>::TConstIterator begin(const FNetworkManagedObjectContainer& Array)
    {
        return Array.CreateConstIterator();
    }
    FORCEINLINE friend TArray<FNetworkManagedObject>::TConstIterator end(const FNetworkManagedObjectContainer& Array)
    {
        return TArray<FNetworkManagedObject>::TConstIterator(Array.Items, Array.Items.Num());
    }
    
    
};```
#

Just mark them as BlueprintType if you want to use them as BP

keen adder
#

Awesome thanks so much! I'll check out FFastArraySerializer.h and also study this to get a better grasp of it all

#

Sweet ๐Ÿ™‚

plush lotus
formal solar
#

why do you need to use player state and why do you need to use a widget

#

just spawn an unreplicated actor from player controller?

#

make sure it is spawned client side

fossil veldt
#

Yo anyone know if there's an easy way to predictively spawn an actor, then spawn it on the server, replacing the predicted one with the real server spawned one

#

I know they do something similar to this with the player controller but not sure if that's a special case or not

neon obsidian
formal solar
#

player state exists on server and clients

#

my guess is you are calling the event on the server version of player state, could be wrong

#

need to see exact setup

neon obsidian
#

Mind if I DM it to you? ๐Ÿ™‚

formal solar
#

yeah but no guarantee how fast i am at replying

twin vessel
#

Is there a way to set a UPROPERTY pointer to a UObject derived class to point at a uobject class in editor? Like you would for a data asset

twin vessel
#

No i would like to have an actual pointer, like you can have a pointer to a data asset

#

I want only one instance of that uobject and reference it whenever needed

tidal temple
twin vessel
#

Are you familiar with how minecraft's inventory is coded?
There is one instance for each item, and then how many item stacks you might want, which contain a reference to the instance of the item needed

#

I wrote the complete use case in delgoodie's server (i see you are in that one too)

tidal temple
# twin vessel Are you familiar with how minecraft's inventory is coded? There is one instance ...

Ah, i see. In general, i think you can create a structure containing your items pointer, example:

// Rough example, for sure.
USTRUCT FInventorySlot
{
  int Count;
  AItem* PointerToItem;
}

// Property in your inventory class (probably an UActorComponent):
TArray<FInventorySlot> InventorySlots;

And you have to add some kind of "add/resolver" function, example:

// Rough example 2.
void AddItem(AItem* Pointer)
{
  // Probably, since you are using a data asset, you can introduce some kind of item ID, as minecraft does it. You can look up for this ID in array of item structures and increase count or add a new slot if it is not there. Usually, people fake empty slots visually and do not store them as "default" structures.
}

At least i would do it like so.

#

I don't recommend you to keep empty-slot structures and especially do not recommend you to use 2D arrays, if you are working on multiplayer game.

twin vessel
#

My problem was with the fact that you can have a uproperty(edit default only) pointer to a data asset, which you can assign in editor.
But i wanted to do the same with a uobject* instead of a dataAsset*.
The reason is that as of now, items are data assets, but i wanted to turn them into simple uobjects.
And i need it to be a pointer i can assign a default value to in editor, since i might want to specify default items for an inventory.
(Sorry my brain is so fried i cannot really explain myself)

But that is probably not doable

twin vessel
tidal temple
twin vessel
#

Minecraft does not put items in the world, it creates an item entity (which would translate to an actor) with a reference to a ItemStack.
All the "items" you see in minecraft inventory are ItemStacks which have a reference to a item class (which is shared between all stacks of the same item)

dark edge
#

I really like just having items be structs

twin vessel
#

So since i only need at any point in time only one instance of any item class (for example i could have 20 bananas stacks in my inventory, but only one banana item would be loaded) i should probably go with data assets

#

But since items contain logic i was wandering if it would be better to use uobjects

tidal temple
#

+1 to Adriel. I think it's just better in every possible way. I don't get why you need them to be an UObject? Which interactions are blocked with struct-only way?

twin vessel
#

Item class implements functionality only, no data. So i think a struct would be not optimal

#

Anyway my question was: you know when you have something like this on a component (with UXIUItem being a data asset)

TArray<TObjectPtr<UXIUItem>> DefaultItems;```
And then in the property panel you can add elements to the array, and then select data assets from the editor?
I wanted to know if it was possible to do the same if UXIUItem was a UObject
#

Cause when i tried, it just did not show any asset available

#

But yeah i agree, i should probably change my approach to this system

tidal temple
#

Let's start with a thing that UObjects are ten times more expensive than UStructs, it's important, i think. Sorry, but i still don't get what are you trying to reference at editor level. Maybe you are looking for TSharedPtr?

twin vessel
#

I was just trying to use a UObject to cover the same exact functionality as a DataAsset, which admittedly might be not smart

#

But i figured out that the reason why i wanted to use a UObject instead of a DataAsset was not gonna work

lament flax
hoary spear
twin vessel
hoary spear
#

You can use instanced uobjects for the editor functionality (picking item ref and so on)

#
UPROPERTY(EditAnywhere, Instanced)
MyUObject* Item;

// Class propeprties
UCLASS(Blueprintable, EditInlineNew, CollapseCategories)

verbal heart
#

I have a Multicast RPC however it looks like it is only being executed on the server (once for each client). Am I misinterpreting this?

cpp:

void ANordicVillageBase::SetVillageOwner(AActor* NewOwner)
{
  if (HasAuthority())
  {
    OnVillageOwnerChanged(NewOwner);
  }
}

void ANordicVillageBase::OnVillageOwnerChanged_Implementation(AActor* NewOwner)
{
  if (!NewOwner) return;
    
  GEngine->AddOnScreenDebugMessage(-1, 50.f, FColor::Yellow, FString::Printf(TEXT("NetMode: %d"), GetNetMode()));
}

h:

UFUNCTION(NetMulticast, Reliable)
void OnVillageOwnerChanged(AActor* NewOwner);

GetNetMode is 1 (NM_DedicatedServer), and the debug message shows twice for each client

verbal ice
#

Is the character's control rotation safe to use within a CMC context? i.e. GetMaxSpeed()?

#

Seems so, nvm

plush lotus
#

ok thanks. i will test it and see if it works ๐Ÿ™‚

lost inlet
#

specify what

#

if you're connecting, you don't specify a map

#

it's just the typically IP:port of the server

#

though with steam/egs p2p this will be some ID-based connection string

cobalt notch
#

I added MoverComponent to Pawn at runtime and getting this Replication error. Any ideas?

LogRep: Error: RepLayout->ReceiveProperties FAILED: PlayerPawn /Play/002_Maps/UEDPIE_1_L_Basic.L_Basic:PersistentLevel.PlayerPawn_0
LogNet: Error: UActorChannel::ProcessBunch: Replicator.ReceivedBunch failed.  Closing connection. RepObj: PlayerPawn /Play/002_Maps/UEDPIE_1_L_Basic.L_Basic:PersistentLevel.PlayerPawn_0, Channel: 5
LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 127.0.0.1:17777, Name: IpConnection_0, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_1, IsServer: NO, PC: PlayerControllerNew_0, Owner: PlayerControllerNew_0, UniqueId: NULL:, Channels: 6, Time: 2024.09.17-03.41.37
LogNet: UNetConnection::SendCloseReason:
LogNet:  - Result=ObjectReplicatorReceivedBunchFail, ErrorContext="ObjectReplicatorReceivedBunchFail"
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 127.0.0.1:17777, Name: IpConnection_0, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_1, IsServer: NO, PC: PlayerControllerNew_0, Owner: PlayerControllerNew_0, UniqueId: NULL:
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_1
LogNet: Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet: NetworkFailure: ConnectionLost, Error: 'Your connection to the host has been lost.'```
vapid gazelle
#

Are there any abstractions out there that would allow game designers working on a multiplayer FPS-style game using Blueprints to not have to know anything about what server or client are, how variables are replicated, RPCs and co? Anything out there that makes their gameplay logic "just work" intuitively without them having to understand the underlying synchronization layer?

My understanding is that this is how some high end AAA live-service games are implemented, with the programmers hiding most of that complexity away from designers through something custom they implemented for that particular UE project?

thin stratus
#

The problem is that in most cases it's very important to know when to use RPCs vs Variables and where to place what code. If one could hide all of that easily then we wouldn't need to learn multiplayer for UE in general.
You can only really accomplish this on a per system basis imo

vapid gazelle
thin stratus
#

Yeah even on a per project basis it will be tricky. It's difficult to stop people from doing the wrong thing. It also costs too much time fwiw

#

You'd need to code a gazillion nodes and events to and then teach people to use those

#

At that point I would suggest that the designer learns some networking :D

#

I mean, this is a general question, not directly aimed at abilities

#

Not the entirety of an FPS game

vapid gazelle
#

The use-case I had in mind was mostly around designers prototyping abilities and functionality early on before it's ready to be productionalized by programmers

#

Yeah. I suppose this would be a "tech designer" as they're sometimes called?

#

The case I had heard of involved a very, very well capitalized game, so likely not feasible for 99% of studios out there.

thin stratus
#

I met a lot of designers that understood how networking works and were able to create prototype abilities just fine.
I don't think they are that rare.

lusty kelp
#

okay quick question, i do not need internet or do I to connect to my game thru ue4

#

because i can connect just fine without internet??

#

just curious is all

thin stratus
#

@lusty kelp Depends a bit on what you mean.

marble gazelle
lusty kelp
#

oh so i dont need internet to host or join my game?

#

via lan?

thin stratus
#

Unreal Engine supports LAN Games, yes.

#

If that's all you want.

lusty kelp
#

i am asking i am offline when i join my game

thin stratus
#

I don't follow, sorry

lusty kelp
#

okay player 1 is hosted > 2 joined thats all no network involve extra

marble gazelle
#

so you run both on your local PC?

thin stratus
#

I think you are lacking a base understanding of Networking, not even related to Unreal Engine.

lusty kelp
#

yeah

#

i am in UE4 so in yes i am

dark parcel
#

Trolling again

lusty kelp
#

what?? i am on the game testing

thin stratus
#

A Server, may it be a ListenServer (so a Player hosting in their Game) or a DedicatedServer (so a headless process that runs without Players), has to Listen to Connections on a Port (default 7777).
A Client (Player) connecting to that Server will try to connect to <ip-address>:7777.

Now, if you would package your Game now and you host a Server (ListenServer fwiw), it will listen on 7777 for incoming connections.
By default, in most cases, this will only allow connection via LAN, because most people (you probably included) have a Router that requires opening ports (you may have heard about that concept).
Without opening port 7777 to the public internet, only PCs inside your LAN can connect to that Server.
If you'd open the port in your Router to the public, you would be able to connect to the Server from outside via the public ip address of your Router.

lusty kelp
#

i am using no ?listen

#

only ?bislanmatch =1

thin stratus
#

DedicatedServer?

lusty kelp
#

open level via node

#

bislanmatch if it is a dedi then

thin stratus
#

Is OpenLevel triggered by a player pressing "Host Game" or similar?

lusty kelp
#

yes

thin stratus
#

Then it's a ListenServer. I don't think bIsLanMatch is enough though. You'd need to add the ?listen to it

lusty kelp
#

i could join without the internet, dont u need internet?

thin stratus
#

No, you only need Internet if you want to expose the Server via opened Ports (in your Router) to the public.

#

Inside your LAN or even the same PC you can host and connect just fine.

lusty kelp
#

so if i get tthis fl them to test my game and join without internet i wont come here to be mad at you

thin stratus
#

I don't really understand that sentence. Maybe cut it into multiple parts if you struggle with English.

lusty kelp
#

i meant i wont blame you for telling me a lie

thin stratus
#

Ah, would you consider it a lie if I believe it's true? ;)

lusty kelp
#

( lol indeed

#

well off for today, thanks

#

im just stating fyi that u dont need internet because ue4 already have a network built for you

#

u dont need to migrate this that or even add extra modules

#

the blank template does indeed have a network source already in when u load up your game

thin stratus
#

Yeah it uses SubsystemNULL and the default NetDriver.

#

Which offers LAN and connection via IP over the Internet if needed.

#

Extra Modules would only be needed if you want stuff like Sessions over the Internet via Steam for example.

lusty kelp
#

yes true but i just saying is server for example / node is for that

#

u do not need this Seam, or any thing fancy

#

u just need the blank UE4 start up

#

i am not using nothing like that in my ini

#

4.24 fyi

wet bridge
#

Hey, I'm finding that my animation blueprints aren't synced up between the client and server, which means that when I randomly choose an idle animation to play, it will play a different one on the server and client or play the same one at different times.
How would I go about syncing these between the client and server

lusty kelp
#

add custom nodes

#

oh to answer your question @thin stratus i using keys press to host join not ui

#

and when i run on dedi server i can join too offline

wet bridge
lusty kelp
#

yeah

wet bridge
# lusty kelp yeah

Can you go into more detail on what you mean? Are you suggesting making my own animation playing nodes that fire via rpc to the client or something?

hoary spear
#

(Does syncing idle anims really matter? They'd only know during lan play and even then i'd imagine it's 'meh')

dark parcel
#

As for random idle, you can replicate the anim sequence.

Don't even need to do random seed and all that. Make the anim idle sequence a replicated variable and have the server pick the anim based on random value.

dark parcel
#

Someone helped me on this before, I didn't know we can replicate anim seq

wet bridge
#

so what do you want me to show specifically?

#

like the state machine state?

dark parcel
#

The idle anim in the anim bp

#

Go inside your state machine

#

Or where ever you are playing it

wet bridge
#

yup, and you want a screenshot?

#

of how much of it?

dark parcel
#

Just the anim player

#

I tried replicating time with the player btw. Painful and not worth it, end up scrapping

#

Don't use random seq player

#

You will potentially get different result on each machine

#

Can you drop an animation there, then screen shoot

wet bridge
#

what should I use instead? Is there a collection node with an int input that I should set manually?

dark parcel
#

Tell me what option you get

#

Tldr, you assign the animation from the owner of the anim instance. Not in the anim instance it self.

Abp does not replicate.

#

Neither of these, I'm at work so can't show but I will see if I can find the post.

dark parcel
# wet bridge thanks

Have a sequence player (mark it as replicated) in your player character.

On begin play, if authority, get random anim and set it to the variable.

Abp simply read that value from the character.

#

This way server will choose the random anim and all client will play the same anim

wet bridge
dark parcel
#

You can get the sequence player position and advance the anim player position but it was a painful process and I can't think of a way to scale it.

#

Having the players playing the same random idle animation suffice for me

latent heart
#

If an actor has bForceNetAddressable (or is basically network enabled) is it just the name of the actor that is the same on server and client? There's no kind of id or anything?

quasi tide
#

That sounds right to me. Though I haven't ever had to use that flag. So just distant memories of talks in this channel

latent heart
#

Thanks!

#

That's disapointing.

#

I was hoping there would be an int or something.

queen escarp
#

this is a NPC spawning stuff i hjave 4x of them they all spawn the same each time ?=

#

i have the random but they always spawn the same ?

lost inlet
#

Where's the multiplayer part? I'm not sure why the spawn item class variable is replicated

#

RIP

queen escarp
#

nevermind i was being dumb

weary badge
#

Hello, does anyone have an idea why my traving is weird on the client?

lost inlet
#

I'm not sure how I'm supposed to interpret this screenshot

indigo brook
#

Quick question about multiplayer; how does one go about doing multiplayer for xbox or playstation? I'm aquanted with Steam and EOS, but I have no clue what's involved with xbox or playstation

lost inlet
#

That's what online subsystems are for, and there are NDAs

indigo brook
#

Aye, fair enough

#

Essentially it would be probably C++ instead of blueprints though right? Or do they give devs plugins?

#

Noob questions, I know haha

lost inlet
#

Well trying to do multiplayer and online platform stuff only in BP is bad at the best of times

#

And you get platform plugins that add stuff to the engine. A source build is required

indigo brook
#

Aye, It's possible with Advanced sessions for P2P type stuff, basic 2 player co-op.

#

But yes, I can understand the apprehension to just doing in in BP

#

I'm gauging how limited my game multiplayer abilities are based on what consoles need haha. I'm a blueprint heavy dev

azure hull
#

Hi, as far as I though, during SeamlessTravel PlayerState persists as well. But for me, PlayerState is null. I started to look through engine seamless flow. And I found where it's being set to null and I'm wondering, what I'm missing.

void APlayerController::SeamlessTravelFrom(APlayerController* OldPC)
{
    // copy PlayerState data
    if (OldPC->PlayerState)
    {
        OldPC->PlayerState->Reset();
        OldPC->PlayerState->SeamlessTravelTo(PlayerState);

        //@fixme: need a way to replace PlayerStates that doesn't cause incorrect "player left the game"/"player entered the game" messages
        OldPC->PlayerState->Destroy();
        OldPC->PlayerState = NULL;
    }

    // Copy seamless travel state
    SeamlessTravelCount = OldPC->SeamlessTravelCount;
    LastCompletedSeamlessTravelCount = OldPC->LastCompletedSeamlessTravelCount;
}
kindred widget
indigo brook
lost inlet
kindred widget
#

It's called Hell. Run away.

indigo brook
#

Advanced Sessions handles that well enough for Steam haha Fair enough. Multiplayer can be a pain in the butt for sure!

#

Thanks for answering my questions guys

lost inlet
#

You can likely do some stuff with Advanced Sessions if it's just using the OSS API

#

And not specific to Steam or whatever

indigo brook
#

For sure, from my experimentation, it's been working decently well, but it's not scalable and I'm stuck within the Steam architecture, or EOS. I basically need to hire a programmer if I'm lucky enough to port my game to Xbox or PlayStation (if they'll even accept my game)

lost inlet
#

Well if you get SDK access just learn the TRCs that are relevant

#

You may have specific UX requirements over how you handle parties and lobbies too

kindred widget
#

Going to be brutally honest. If you want to test out releasing a console game. Do it singleplayer first. Singleplayer TRCs are hell enough. Online TRCs are straight up wild.

indigo brook
#

Noob question, what's a "TRC"

kindred widget
#

Technical Requirement Checklist

indigo brook
#

technical review

#

I had to look it up, gotcha

lost inlet
#

On PS5, you must have activities too

#

Unless they changed that

indigo brook
#

Thanks for the combined knowledge guys. Now I have some research to do! Have a good day

lost inlet
#

Also don't forget about supporting gamepads

indigo brook
#

100% already am

kindred widget
#

As in still need them.

#

Also localization. ๐Ÿคข

lost inlet
kindred widget
#

The amount of things Sony and Microsoft don't agree on per word, that varies per language, is wild.

indigo brook
#

Steam = beginner mode
Xbox/PlayStation= hard mode

#

I'm slowly working my way to graduate one day, still another year or two maybe to go

kindred widget
#

Consoles in general just have a quality standard. Which is great. But it's a steep hill from PC only.

lost inlet
#

I shipped a gen8 game, thankfully most of the challenge went to an outsource team getting the thing to run

#

But we did the gamepad implementation

#

I had to do some backend DLC purchase verification stuff though

indigo brook
#

I was thinking of adding cosmetic stuff...but I'll pass on that for my first multiplayer game, I'm just focusing on co-op, friend invite only type campaign

kindred widget
#

Also don't do it on 4.27 or prior. 5.+ has so many fixed TODOs and fixes in networking code in general.

indigo brook
#

Yeah, I'm working off 5.4.4 right now

#

Good heads up though

kindred widget
#

I recently found out you can crash in a Listview in 4.27 if you give it two playerstates and they null out for a frame.

indigo brook
#

One single frame

jade scroll
#

i have the node " find path to location synchronously" but i cant replicate it all works fine... but the return value of this node only run on the server? what can i do?

azure hull
# azure hull Hi, as far as I though, during SeamlessTravel PlayerState persists as well. But ...

It seems by overriding engine's PC SeamlessTravelFrom with commenting out:

        OldPC->PlayerState->Destroy();
        OldPC->PlayerState = NULL;

Issue is solved, but doesn't look to me like a good solution, because from looking at git this part of code was updated 2 years ago. Doubt that it's an engine issue.
But by the look of epic comments // we don"t need the old PlayerState anymore (in AGameMode::HandleSeamlessTravelPlayer(AController*& C)), it seems that PlayerState is meant to be empty during SeamlessTravel? And I mean when you look at the SwapPlayerControllers event in BPs.

hallow dagger
#

i have a replicated chaos vehicle, and i want it to block pawn's movement
right now the pawn pushes the vehicle, how do I achieve this?

dark edge
#

is it a pawn or character?

#

how is it doing its moving?

hallow dagger
#

its a pawn

dark edge
#

how is it being moved around?

#

physics, a movement component, just setting position on tick, what

hallow dagger
#

movement component

dark edge
#

You can probably set its collider to query only which should make physics things just ignore it, try that

hallow dagger
#

same result ๐Ÿค”

jade scroll
#

why the replication dont work for the pathpoints?

#

all works fine its just the node " find path to location snychronously."

#

is this node something special? or why the replication didnt work?

dark edge
#

vehicle might be hitting some mesh or something else

strong junco
#

I have a fast array defined like this:

struct FFastArray : public FFastArraySerializer
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY()
    TArray<FFastArrayItem> FastArrayItems;

    void AddAndMarkDirty(FFastArrayItem& FastArrayItem)
    {
        FastArrayItems.Add(FastArrayItem);
        MarkItemDirty(FastArrayItem);
    }

    void RemoveAndMarkDirty(int32 Id)
    {
        for (int32 i = 0; i < FastArrayItems.Num(); i++)
        {
            if (FastArrayItems[i].Id == Id)
            {
                FastArrayItems.RemoveAt(i);
                MarkArrayDirty();
                break;
            }
        }
    }

    bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
    {
        return FastArrayDeltaSerialize<FFastArrayItem, FFastArrayItem>(FastArrayItems, DeltaParms, *this);
    }
}

template<>
struct TStructOpsTypeTraits<FFastArray> : public TStructOpsTypeTraitsBase2<FFastArray>
{
    enum
    {
        WithNetDeltaSerializer = true,
    };
};

where I use it in my class:

    UPROPERTY(ReplicatedUsing=OnRep_FastArray)
    FFastArray FastArray;

    UFUNCTION()
    void OnRep_FastArray();

The Add works great and results in the client getting OnRep called each time and having all the items added. Not shown is another function I use to modify already existing items which also works as expected.
The remove however only works if there is only one item in the array. If there are more then one item then it will remove the item on the server, call OnRep on the client, but not remove from the array on the client. So the client get's the OnReps but is still stuck with a array full of items that should have been gone.
I have poked and prodded this and I can not figure out why this happens. Any ideas what might cause this or how to debug this?

hallow dagger
fossil spoke
lament flax
#

any reasons why this struct isnt replicating ?

USTRUCT()
struct FSLPreBuildingData
{
    GENERATED_BODY()

    bool PreBuildingModeData = false;
    int32 Priority = 0;
    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
};

template<>
struct TStructOpsTypeTraits<FSLPreBuildingData> : public TStructOpsTypeTraitsBase2<FSLPreBuildingData>
{
    enum
    {
        WithNetSerializer = true
    };
};

    UPROPERTY(ReplicatedUsing=OnRep_PreBuildingModeData)
    FSLPreBuildingData PreBuildingModeData = FSLPreBuildingData();

#

oh i forgot to flag the props with UPROPERTY()

strong junco
# fossil spoke Show us your `FastArraySerializerItem` struct

It looks like this:

struct FFastArrayItem : public FFastArraySerializerItem
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY()
    int32 Id = -1;
    UPROPERTY()
    UMyDataAsset* DataAsset = nullptr;

    FFastArrayItem() {}
    FFastArrayItem(const int32 InId, UMyDataAsset* InDataAsset)
        : Id(InId), DataAsset(InDataAsset) {}
    
    bool NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
    {
        Ar << Id;
        Ar << DataAsset;

        return bOutSuccess;
    }
};

template<>
struct TStructOpsTypeTraits<FFastArrayItem> : public TStructOpsTypeTraitsBase2<FFastArrayItem>
{
    enum
    {
        WithNetSerializer = true,
    };
};```
#

Thank you for the templates, I will compare what I have with those

modest dove
#

does anyone know how to pack different data per client when sending a multicast from server to clients? I would like to optimize the multiplayer network by comparing the previous acknowledged data with the new one and sending the data which is changed from the previous one. somewhat like delta compression implemented in quake3 (the paragraph above the image in "Network protocol" session might explains my idea https://www.jfedor.org/quake3/)

fossil spoke
short arrow
#

Think I remember reading blueprints resends the whole struct

#

Hmm, can't seem to find the documentation for it, but I'm pretty sure blueprint structs do not have that functionality and check/resend the entire struct regardless of what was changed

#

so as long as you're not using blueprint structs you're set ๐Ÿ‘

brazen anvil
#

Is there a better way to handle items than to use blueprint actors? Like what about a mesh and a struct that acts as the blueprint that holds data for that mesh?

blazing bear
brazen anvil
modest dove
late stratus
#
                if (HitActor->GetHealth() <= 0)
                {
                    if (UPrimitiveComponent* PhysicsComp = Cast<UPrimitiveComponent>(HitActor->GetMesh()))
                    {
                        if (PhysicsComp->IsSimulatingPhysics())
                        {
                            UE_LOG(LogTemp, Warning, TEXT("LAUNCHING"))
                            const FVector LaunchDirection = (HitActor->GetActorLocation() - GetActorLocation()).GetSafeNormal();
                            const float LaunchForce = 1000.0f;
                            PhysicsComp->AddImpulse(LaunchDirection * LaunchForce, NAME_None, true);
                        }
                    }
                }

Anyone know why this wouldn't move an actor when it's called on the server?

The actor's mesh is simulating physics, and the actor's movement is replicated.

proven pagoda
late stratus
proven pagoda
#

In your server RPC you might have to send the client direction value idk if it'll have any stuttering issues if the server calculates direction different than the client

subtle kernel
#

guys, what is the proper way of running dev with real dedicated server? I can run server instance from editor, if I run as separate process, right? So I can run two editors one runs server and another will be client that will connect to that server. Is there any easier or more correct way to do it?

thin stratus
#

You don't need two editors. It's generally advised that you ultimately package the Server every now and then, but for smaller studios, let alone single devs, that's a bit of a jump.
If you want to start a headless server without actively running the editor, you can use .bat files for that.

#

@subtle kernel

#

Basically you can make a .bat file with the path to your Engine, and the path to the uproject, and then add -server -log and such things to it.

chrome bay
#

Soo.. Iris users. Does anybody know if the "Groups" concept supercedes any "Filtering"?

#

Trying to mimic an object which is spatially filtered for "normal" connections, but then use an inclusive group to force them to replicate to specific connections regardless of filtering.

#

Documentation for Iris is actually decent (!) but doesn't seem to specify this anywhere

brittle ledge
subtle kernel
#

Iโ€™m still struggling with building from source. Suddenly my pc decided to overheat and deadlock ๐Ÿ˜… had to change thermal paste

#

I need to be able to package from command line, need to read about it. Would be so much quicker