#multiplayer

1 messages ยท Page 468 of 1

grizzled stirrup
#

So the GM should also have a CurrentRound property, or it should just call the actual increment on the GS?

#

This would be in the GM StartNewRound() event for example

sharp pagoda
#

no just increment the gamestate's round directly

#

don't make a copy

grizzled stirrup
#

Ok cool

#

So the GS will actually hold the current value

#

But the GM can set and retrieve it

#

Got it, thanks!!

sharp pagoda
#

yep

lucid vault
#

I can replicate a chest's inventory to any player within 2 meters of it. But won't this allow hackers to determine the contents of a chest without opening it if they are within 2 meters?

#

Is there any way to only replicate the contents of a chest to the person that interacts with it?

copper mango
#

either RPC to the opening player only what loot they got

#

or you could do a custom replication condition

#

where the server saves which player interacted with the chest, and then your condition only replicates to that player

urban flower
#

anyone know where I can acquire 6 extra limbs so I can QA a 4 player coop game by myself ๐Ÿคฃ

meager spade
#

COND_InitialOnly

#

is that the first time the object becomes relevant on that controllers actor channel?

#

say i want a OnRep to fire once and never fire again per client?

sharp pagoda
#

pretty sure that just sends the initial bunch, so if you have an onrep condition for a property that differs from the archetype in the initial bunch yea you'd get an onrep that only fires once.

meager spade
#

yeah

#

so the weapon class gets set

#

when the actor is spawned

#

and this onrep will fire to set the mesh on other clients

#

once its set, it never changes

sharp pagoda
#

weapon class being a pointer to a data asset or something like that?

meager spade
#

just a TSubClassOf

#

that the server sets

#
    WeaponClass = NewWeapon ? NewWeapon->GetClass() : nullptr;
    CreatePickupMesh(this, Mesh, WeaponClass, 0.0f, FRotator::ZeroRotator, false);
    bFullyInitialized = true;
    ForceNetUpdate();```
sharp pagoda
#

should work, but why does it matter? If the mesh is never changing you don't really gain anything over the rep condition

meager spade
#

the mesh needs to be set

#

of the other clients

sharp pagoda
#

if the property doesn't change, it doesn't get serialized and thus no bandwidth impact

#

no i'm saying why initialonly

meager spade
#

so just a normal rep is fine?

#

it wont fire again unless it changes?

sharp pagoda
#

yea if the mesh doesn't change

meager spade
#

so initial is just for when you want the property to change once, and then you dont care for it changing again/

sharp pagoda
#

onrep is invoked when the client determines that there's a difference between their local copy and the serialized bunch's copy

meager spade
#

something like a server synch for time, where the client will get the servers time once, then keep its own timekeeping for example?

#

just an example, its all i could think off

sharp pagoda
#

initialonly is better used for situations when you need clients to get an initial state of an object or something to get synchronized, where they can then do stuff independently with that property

meager spade
#

sure

#

like day/night cycles

#

you could get the current value when you join

#

and then simulate it locally

#

once you know

sharp pagoda
#

yep

meager spade
#

makes sense

lucid vault
#

@copper mango When the server confirms that the player has interacted with the chest, how can I replicate the chest inventory data only to the player that interacted with it? I do have access to the player that interacted, but I can't figure out how to send that player the inventory data to display on screen.

potent prairie
#

youre asking an incredibly loaded question lol inventory systems are very complex

#

best thing to do is purchase an inventory system that has containers and see how they do it

lucid vault
#

It's not very loaded. I'm asking about a general networking concept

#

I have most of the inventory system built. I'm am now figuring out the best way to network it

copper mango
#

@lucid vault the best option is probably to send an RPC to the player when they open the chest, and that RPC tells them to show the UI (or whatever) for the chest as well as what items they are at which index in the chest

#

and then the player can send an RPC back to the server with like "hey I want to pickup item X"

lucid vault
#

Cool I'l give it a shot. Thanks!

fluid prawn
#

Yo

#

does anyone know what the ULocal Player class is supposed to do?

copper mango
#

can use it to like get the controller id or viewport information for a local player

#

and also has some stuff related to the online subystem like you could find out the player's gamertag or whatever

fluid prawn
#

so its not needed for any possession

#

or anything like that playercontroller related

copper mango
#

well you can get the player controller from UPlayer

fluid prawn
#

k

copper mango
#

a local player's automatically created for you

#

you might have to mess with it some if like you're gonna have multiple local players that are playing over the network I guess

#

but I dunno what other uses you'd want with it

#

it doesn't replicate so you don't want to put anything important to the game state in there

fluid prawn
#

k

meager spade
#

you can have multiple local players

#

for things like SplitScreen

#

(that is its main purpose aswell)

chrome bay
#

What do you mean by Tick Rate?

#

Doesn't really make sense in the context of a client

#

There is no setting for that. If you want to throttle a specific RPC, you need to use a timer of some kind

#

You can set the ConfiguredInternetSpeed and ConfiguredLanSpeed in a config file but very few engine systems actually care about them

#

If it's ticks, I would assume Hz

#

It only seems to be used in one place

#

And only affects the Server, not clients

#

So it's a terrible name for the variable, since technically it's more about the rate at which the server will replicate info to clients

#

NetworkDriver Line 3202 in 4.21

#

Well they probably didn't bother to look at what it's used for

#
        NumClientsToTick = FMath::Min<int32>( NumClientsToTick, FMath::TruncToInt( ClientUpdatesThisFrame ) );```
#

It's definitely a timing value

#

As far as I know you cannot clamp the send rate of a Client

#

If you want to throttle RPC's, just use a timing value

#

GetWorld()->TimeSince(LastRPCSendTime) > RPCThrottle

#

psuedo-code - and that's how Character Movement does it too

#

There are some settings in AGameNetworkManager for that too

#

Obviously the more you throttle, the less accurate it becomes and the more corrections you may need

#

ClientNetSendMoveDeltaTime, ClientNetSendMoveDeltaTimeThrottled, ClientNetSendMoveDeltaTimeStationary, ClientNetSendMoveThrottleOverPlayerCount

#

Have a look at GameNetworkManager

#

np's

#

I was slightly wrong, the server-side RPC's to the client for adjustments and move acking are throttled

#

those settings are in char movement

#

yeah they are

real yacht
#

after calliong RestartGame from gameMode

#

my pawn is not getting posses.

#

and movement doesn't work

#

where should i look?

wheat eagle
#

Hey guys I'm pretty stuck at something. I have a peer to peer session , where the host joins another session. I want the clients from the ptp session to join the session that the host is joining aswell. How can I achieve that using blueprints?

#

to manage the sessions I'm using the advanced sessions plugin

fleet raven
#

it seems like there's a bug in replicating newly spawned components/subobjects, where it does not set bNetInitial on the flags when replicating the newly discovered subobject for the first time, causing it to not send all changed properties with the initial bunch for it

#

did anyone else notice a problem with this?

chrome bay
#

Yeah that's a known and annoying issue I believe

fleet raven
#

๐Ÿค” are there any known fixes for it then? at first glance it seems like my change would be reasonable

chrome bay
#

I think the fix you suggested is similar to other ones I've seen

#

I saw something mention this the other day

fleet raven
#

oh wait it's not reasonable

#

this thing takes the flags by ref and it would keep the bNetInitial past this method

#

needs to be reset after

chrome bay
#

Yeah somebody made a quick fix fo rit recently

#

Trying to find it a sec

#

Damn I can't find it

#

It mentioned something about setting the flag before creating the new object, then setting it back afterwards

fleet raven
#

yeah that sounds like what I was going to try

chrome bay
#

found it

#

Looks like that's what solved it for them so yeah you weren't far off

fleet raven
#

hmm

chrome bay
#

aren't they coming in by const ref though?

fleet raven
#

oh br_big_brain it doesn't actually compile

chrome bay
#

mind you you could copy them and pass those around instead I guess

#

haha

#

galaxy brain memes

fleet raven
#

wait why are we even passing this by ref then

#

if it's going to be const

#

guess I'll just take out the ref and there'll be no need to reset it

#

yeah ReplicateProperties takes it by value too

chrome bay
#

it looks like the line at 3789 is the only thing that uses them, so you could just copy in the function, change the initial flag then not worry

#

be interesting if that solves it actually

#

hella annoying bug

fleet raven
#

of course modifying ActorChannel.h builds a ton of unrelated modules because it can

chrome bay
#

changed the header dint ya ๐Ÿ˜„

fleet raven
#

ye

chrome bay
#

what I meant btw was

FReplicationFlags FlagsCopy = RepFlags;
FlagsCopy.bNetInitial = true;
.....ReplicateProperties(Bunc, FlagsCopy);
#

saves changing the function signature then

fleet raven
#

hmmmm

#

it's still weird

chrome bay
#

yeah

#

I wonder how they've never run into this

fleet raven
#

maybe they just don't add new components

chrome bay
#

yeah it seems such a common thing to do

fleet raven
#

wait

#

it actually changed nothing

#

with and without this change, the component is created, beginplay runs, and then (in the same frame) it applies the properties

#

oh seems like the problem being solved in this topic is a different one

chrome bay
#

Ohhh wait a minute

#
WroteSomething |= Channel->ReplicateSubobject(ActorComp, *Bunch, *RepFlags);```
#

Both of those are taking the flags

#

so maybe it does need to be modified in ReplicateSubObjects after all

#

oh hang on that's in gamestate

#

weird fix

fleet raven
#

UActorComponent::ReplicateSubobjects just returns false so that first call doesn't matter

#

it does seem to be sending the things regardless though

#

the issue is that they are being applied after running beginplay on the component, while when the component is created together with the actor they are applied before running beginplay on the component

thin stratus
#

Sorry to cut into the discussion, but will RPCs (reliable) still be executed if they are called within the same frame of calling "TearOff"?

chrome bay
#

@fleet raven Hmmm could you do what you need to do in PostNetReceive maybe instead of BeginPlay?

fleet raven
#

that seems to only be a thing on actors ๐Ÿค”

chrome bay
#

It's in actor comps:
virtual void PostNetReceive() override { }

fleet raven
#

wtf

#

oh huh it is

thin stratus
#

Do I have a way of checking if an Actor is owned by a Client or ListenServer vs not owned by any?
Iirc spawning an Actor without setting the Owner makes the Server the owner by default, or is that wrong?

#

Trying to only call a ClientRPC if the Actor is actually owned by someone

#

However I would assume that the ClientRPC would call on the Server on all Actors which are spawned by the Server if no client is specified as owner?

fleet raven
#

you can just check if it has an owner with GetOwner() ๐Ÿค”

thin stratus
#

Yeah but wouldn't that return "not null" for a ListenServer even if it's not directly specified as the owner?

fleet raven
#

why would it? the actor just has no owner then

#

unless you specifically set the listen server controller as the owner

thin stratus
#

That's basically the question, cause usually it's said, that the Server owns the Actor if no Client is specified as owner

#

Will test it, thanks!

fleet raven
#

maybe there is some confusion with the server (as in the controller for the listen server) owning it and the server (as in the instance of the game or something, actually no one) owning it

thin stratus
#

Maybe

#

Just didn't expect the NetOwner to be null at all

#

Though they do something like if(SpawnParams.Owner == nullptr) SetOwner(Server's PlayerController) :D

#

Which a DedicatedServer wouldn't have, nvm I guess :D

fleet raven
#

that would be very strange and unnecessary

#

I would also expect this to already work as is, a client rpc on an unowned actor is simply dropped

#

but never tested that one

thin stratus
#

Me neither, usually you are aware of being in a non-client owned actor

#

But mine is a Component that can sit on the Pawn or on any other actor

#
if (GetOwner()->GetNetOwner())
{
    ClientNotifyDamaged(DamageInfo);
}
#

ยฏ_(ใƒ„)_/ยฏ

fleet raven
#

does it work properly without the branch

thin stratus
#

Never tested. Moving Health logic from pawn to a generic component

fleet raven
#

I'm thinking it should

thin stratus
#

I know that a ClientRPC on a Server owned Actor just calls on the Server (obviously)

#

Just not sure how actors work that are placed in the level

#

Or even AIs

fleet raven
#

well that makes sense considering if you set the listen server controller as the owner, that's the owning client now

thin stratus
#

Yus

fleet raven
#

wtf is a FUNC_NetRequest and FUNC_NetResponse ๐Ÿค”

#

checking out AActor::GetFunctionCallspace

chrome bay
#

Reflection stuff I think

#

although lol, the comments are equally useful

#
    FUNC_NetRequest            = 0x00000100,    // Function is sent to a net service```
#

GG Epic

fleet raven
#

found where uht adds those things

#

what the hell nothing in the engine uses these ServiceRequest and ServiceResponse specifiers

#

what is this hidden feature

thin stratus
#

Something similar to HTTP request and response?

#

It is talking about some sort of endpoint you can target, which doesn't seem to be inside ue4

chrome bay
#

maybe some archaic UDK stuff perhaps

thin stratus
#

Maybe

#

UT is also not using it

#

If only we would have some UE4 engine dev from the network end in here >.>

fleet raven
#

it does not seem like it works anymore

#

the flags are not checked anywhere useful and the endpoint name being parsed here is never used

twin juniper
rotund sapphire
#

It is working in order, according to epic standerds. But anyways, physics replication is the problem i believe.

ornate crescent
#

Any idea how to replicate Array of UObject from the Character?

chrome bay
#

welcome to multiplayer physics

lucid vault
#

Is it inefficient to replicate an actor reference?

twin juniper
#

Is there a way I can gather the highest score among players in blueprint? I need it for an after-report summary when ending matches.

sharp pagoda
#

iterate player states and track the highest score

#

@lucid vault no, it's just a single net guid

twin juniper
#

The iteration part I get but how do I track the highest score from them? Do I need to combine them into arrays or something?

#

That is the problem I am having right now.

#

A proper way to get the highest score of the players.

sharp pagoda
#
for (const auto* player : gamestate->playerstates)
{
    if (player->score > highest_scoring_player->score)
        highest_scoring_player = player;
}```
lucid vault
#

Thanks for the answer xen. One more question, is it a bad idea to pass the player char to the server as a ref in order to determine player actions (such as pick up item)? Because a hacker could potentially spoof another player character and execute actions for that player instead

sharp pagoda
#

what's the use case?

lucid vault
#

Inventory system. Any actor can have an inventory (player, chest) and when the player attempts to move an item from one inventory to another, I want to send the player ref so that the server can check if that specific player has 'access' to each inventory. The access will be granted in various ways. For instance, if the player opens a chest, he will gain access to move it's items. The player also obviously has access to his own inventory

sharp pagoda
#

I would send the rpcs directly from the component so that the server already knows the player + inventory components involved

#

Note that you need ownership for that to work, so for example if you need multiple players to open a chest you need to send rpcs through a player controller tunnel

lucid vault
#

Right now the code for dropping an item resides in a 'slot' widget. So what you think I should do is call a player controller function from there that RPCs to the server?

twin juniper
sharp pagoda
#

step 1 is don't place any networking logic in widgets

lucid vault
#

Right

#

I could also RPC through player char instead of controller right?

sharp pagoda
#

yea, but you typically use the controller for that

twin juniper
#

Any good tutorials to make people with other connection being able to join the same game?

lucid vault
#

@twin juniper Look at Lawrie's answer

tranquil thunder
#

sneaks into the chat and immediately saves that link for later

#

has anyone here used spatialOS?

twin juniper
#

@sharp pagoda Is there a way I can translate this into Blueprint?

sharp pagoda
#

yea it's literally just a loop

twin juniper
#

@lucid vault So I should follow the video I send you, Changing the port in the "baseEngine.ini" file, And portforward it with my IP and the same port i used for the file?

ornate crescent
#

thanks @chrome bay

#

any advice/example of Persistent Items in persisent world? items with durability, for example

twin juniper
#

@sharp pagoda As in For Loop?

winged badger
#

that snippet was foreach, but for works too

#

(in BP terms)

lucid vault
#

@twin juniper Give it a shot. I'm not sure about that specific video, but the link I sent you is a solid guide.

fluid prawn
#

Question I am trying to Override Default Pawn Class for controller so I Read the Paw from my own player Controller.

    /* Override To Read In Pawn From Custom Controller */
    UClass* GetDefaultPawnClassForController(AController* InController) override;

The error I get is: Member Function declared with override does not override the base class member

#

how?

copper mango
#

I think your return type isn't correct

#

oh nvm it is

fluid prawn
#

i tried virtual also

#

It is a gamemode base tho.

#

I made sure the class I was inheriting from was the correct one because there is gamemode and gamemodebase

#

I think i got it

#

actually

#
virtual UClass* GetDefaultPawnClassForController_Implementation(AController* InController) override;
#

thats how its supposed to be..

distant talon
#

For struct serialization, if i have an FVector_NEtQuantizeNormal type used in a struct, can i assume it's already using it's own NetSerialize function?

winged badger
#

yes

#

if you look at say FHitResult, you'll see plenty of those

timber tree
#

Hi guys,
I have a small issue, I have created a dedicated server, register server with steam and now it shows in steam server list in LAN as well as Internet
But I am not able to find the server via Find advance session, any idea what can go wrong ??

ember needle
winged badger
#

no

#

@ember needle

#

replication data is not collected as the individual variables are set

#

the DOREPLIFETIME(MyClass, MyVar); order in GetLifetimeReplicatedProps is what determines the RepLayout

#

i am not sure how that translates to blueprints, as they often get confused

#

but it will probably be the order in which variables were marked to replicate shivers

ember needle
#

hum

#

so the only way is to group them into a struct?

queen stream
#

Is there a way to travel with a client (dedicated server or not) from one level to another in editor? I've tried servertravel, it doesn't work. Seamless travel doesn't work either.

thin stratus
#

Yeah, that's also the better way to handle it in general @ember needle

ember needle
#

ok thank you both

thin stratus
#

@queen stream ServerTravel should work, but only if non-seamless

#

Seamless is deactivated in Editor

queen stream
#

Ah. :l

#

So use server travel in editor and disable seamless

thin stratus
#

Just test standalone

queen stream
#

is there a way to run more than one client with standalone?

#

And use a dedicated server

thin stratus
#

Sure, you can start more than one instance on your PC

#

UPROJECT file -> RightClick -> Launch Game

queen stream
#

How can I tell one of the instances that it is a dedicated server?

thin stratus
#

Think you can do that via command line

#

Pretty sure the LaunchGame does just that

queen stream
#

Huh, I thought standalone was different than that

thin stratus
#

Standalone in this case is just without running it inside of PIE

queen stream
#

ah

thin stratus
#

It still uses the data from the Editor

#

So no packaging/cooking required

#

That also makes sure each game is its own process etc.

real yacht
#

where can we find that page exi?

ember needle
#

@queen stream I'd also recommend to untick "auto join server" in multiplayer options

distant talon
#

Does the built in (from server) var replication handle/prevent out of order packets from updating a variable?

queen stream
#

I don't see why I should untick it. As far as I can tell, if I want to play in editor, I can't change the level so auto joining would be nice.

#

(Because it would save me needing to write the logic in every level)

ember needle
#

ok sorry wrong assumption. I thought you were testing a multiplayer server, and auto-join does not give you any control on how users join in (so incompatible with advanced sessions).

queen stream
#

Does the auto-join impact more than just the play in editor?

#

Because if it does, then that could be a problem.

ember needle
#

my issue with it was that when testing advanced sessions, i would see connections happening even before I got to the whole host/join thing. And yes, they happened when launching game as cedric suggested.

#

(standalone, from shortcuts)

queen stream
#

aight, off it goes then

ember needle
#

well as you said it depends what you want to do

#

if you have your own system for joining, then IMO you should turn it off.

queen stream
#

I'm trying to have my cake and eat it too

ember needle
#

lol

real yacht
#

where can i find this pdf that exi has posted

#

?

#

few posts up

queen stream
#

Trying to make it so that I can, as needed, test with a dedicated server or with a client host.

#

...Without rebuilding

real yacht
#

cool thanks

ember needle
#

ok but with/without advanced sessions and your own loggying mechanism?

queen stream
#

I'm not sure what you mean by advanced sessions but with my own logic yes.

ember needle
queen stream
#

Ah.

#

Should I get it?

ember needle
#

anyhow, if you're building your own connection logic, then i'd tick that out. just to be safe.

#

i woudn't know ๐Ÿ˜„

#

in general, it just adds functionalities (for instance, voice control or better server settings).

queen stream
#

I'll give it a go.

#

Now if only I could get amazon gamelift to build. :l

ember needle
#

Only if you need it...

#

sorry haven't done any dedicated server work myself. Any pointers?

queen stream
#

In general?

#

ahh man. Now I gotta make it so esc closes the game for testing. :L

real yacht
#

when my player collect pickup, i;m getting this warning from server

#

my pickup have primary data asset as variable

winged badger
#

what does the pickup function signature look like?

timber tree
#

Hi anyone know how to implement ISteamMatchmakingServers -> PingServer

real yacht
#

@winged badger i think that problem is here

winged badger
#

show me the server rpc call

real yacht
#

this is my pickup function

thin stratus
#

So it doesn't support replicating the DataAsset?

real yacht
#

im not sure where should i look, my ide is to have dataasset for pickup (store properties for pickup there) and when player collect it, i want to have that properties in player

#

replicating no

#

there is no replicate

#

in bp

thin stratus
#

Sure there is

#

You are setting CurrentArmor

#

Which is replicated

#

Or do you mean "There is no replication setting in the asset"?

real yacht
#

yes, but there is no bool propertie

#

yes

thin stratus
#

Cause that would be normal, a DataAsset is a static asset that is not changed runtime

real yacht
#

there is no properties for replication primary data

#

yes

thin stratus
#

It should function the same way as other assets (Texture, Material, Sound, etc.)

#

Not sure why it shows that warning

#

If you can't make it work, you might want to utilize DataTables

#

And just replicate the Row Name

real yacht
#

that is the option

#

i have one question, when you look at my graph, when im doing set notify current armor, i'm passing data asset from pickup

#

and later that pickup is destroyed,

#

does set notify create new instance of that object

#

because pickup with initial data asset is destroyed

#

on server

thin stratus
#

There is only the one DataAsset instance you have in your Content Browser

#

As said, they are not modified runtime

real yacht
#

that was my next question ๐Ÿ˜„

thin stratus
#

It just references that, similar to a Sound

real yacht
#

okay, understand

#

i'm not sure where should i look about this warning, i mean

thin stratus
#

If you destroy the pickup, the DataAsset should just survive, cause it was only referenced in the pickup, not maintained

real yacht
#

everything is okay in gameplay, there is no any bug

#

i have all informations

thin stratus
#
bool FNetGUIDCache::SupportsObject( const UObject* Object, const TWeakObjectPtr<UObject>* WeakObjectPtr ) const
{
    // NULL is always supported
    if ( !Object )
    {
        return true;
    }

    // Construct WeakPtr once: either use the passed in one or create a new one.
    const TWeakObjectPtr<UObject>& WeakObject = WeakObjectPtr ? *WeakObjectPtr : MakeWeakObjectPtr<UObject>(const_cast<UObject*>(Object));

    // If we already gave it a NetGUID, its supported.
    // This should happen for dynamic subobjects.
    FNetworkGUID NetGUID = NetGUIDLookup.FindRef( WeakObject );

    if ( NetGUID.IsValid() )
    {
        return true;
    }

    if ( Object->IsFullNameStableForNetworking() )
    {
        // If object is fully net addressable, it's definitely supported
        return true;
    }

    if ( Object->IsSupportedForNetworking() )
    {
        // This means the server will explicitly tell the client to spawn and assign the id for this object
        return true;
    }

    UE_LOG( LogNetPackageMap, Warning, TEXT( "FNetGUIDCache::SupportsObject: %s NOT Supported." ), *Object->GetFullName() );
    //UE_LOG( LogNetPackageMap, Warning, TEXT( "   %s"), *DebugContextString );

    return false;
}
#

That's the function that reports your warning

#

If all the checks fail, it will print that

#

But no idea how that works internally

real yacht
#

i think that i have solved problem

#

i have removed repNotify

#

from currentArmor

thin stratus
#

So just replicated?

#

Or not at all?

real yacht
#

not at all

thin stratus
#

Well yeah that of course removes that

#

But now your variable isn't replicated anymore

real yacht
#

because data asset is static, i don't need to be replicated

#

i can get properties at any time

thin stratus
#

Yeah but the Client doesn't know which one :P

real yacht
#

you think if current armor is not replicated

#

this would not work?

thin stratus
#

I don't know why you replicated it in the first place

#

But "CurrentArmor" is now only valid on the server

#

Cause that's the only place where you are setting it

real yacht
#

yes, and i just want that

#

maybe it was my mistake accident. that i have put repnotify

thin stratus
#

Yeah then go without the replication :P

real yacht
#

and if i need something to show on locall client i can send rpc

#

from server to client and display some info

#

and that's it

twin juniper
#

where can i find out more about steam integration? i'm mostly interested in dedicated servers. is there any official documentation with all the recent stuff

thin stratus
#

Best guess is looking through UE4 Source

#

And if you need extra stuff then look into the Steam Documentation on Valve's end

timber tree
twin juniper
#

thanks

earnest moss
#

Probably a question you've all heard before but whats the limitations on multiplayer at the moment in regards to large worlds? I'm under the impression you have to have everyone on the same map with the inbuilt networking, but how much map can that networking handle? Can I have my players spread out a km from each other and still have good network performance?

#

is OWS the only openworld alternative to the base networking?

#

Even if anyone has a link to some relevant docs

tawny rivet
earnest moss
#

Phenomenal, thank you very much

tawny rivet
#

i'll try and answer the questions
with default character networking our game's players get kind of choppy at 40 players or more
the "move world center" technique the kite demo uses afaik doesn't work in multiplayer (but i figured that out a year ago, could have been fixed)
see the ref i gave you for the last couple of questions
i don't know anything about OWS, apologies

earnest moss
#

All good, OWS is a set of software for MMOs that gets plastered all over youtube when you search for openworld tutorials.

#

So my specific use case is that I have a series of maps with a portal room in each map and if all players agree the map changes. With the new replication graph it sounds like I'm about to split up replication areas. So a single player could enter a portal and be in a different instance on the same server.

#

Rooms in a server, I'd be able to decide what is relevent to the room and what is relevent to the server as whole and who gets access to either of those based on location or other factors

tawny rivet
#

something like that yeah

#

i have a replication bug of my own

earnest moss
#

You're using it now? Is it stable for early access?

tawny rivet
#

no, different bug

#

there are two points at which players can add teams:

  • in frames after the ruleset actor has been created
  • in the same frame that the ruleset actor was created (but still afterwards)
#

the teams are put in the array, and the first case works

#

i checked that with a breakpoint in OnRep_

#

but in the second case

#

OnRep_ is called twice on the client side, the first time with a number of NULL entries the same as the number of teams

#

it never corrects itself

#

so if a client opens up the ruleset edit gui, they will just see no teams

sharp pagoda
#

@tawny rivet Was just dealing with that the other day, the hacky fix is to set the net priority of the item you're spawning to be added to the array higher than the object containing the OnRep

tawny rivet
#

adding a new team will bring the null entries back, but it still won't replicate the state on the serve- oh shit thanks man

#

i'll try that

sharp pagoda
#

I was working on a proper fix by creating actor channel dependencies, but had a hell of a time getting the channels to open up when I wanted to so I'm just using that net priority band aid for now

fleet raven
#

there isn't a dependency between channels in this case through as the teams are subobjects of the ruleset

#

they're components added to the actor that has the array of references

#

the really curious part is that we made a much simpler test case, with an actor that has an array of simple references to components added to it, and that test works..

tawny rivet
#

Oh, ye

#

Differences: teams and rulesets are blueprint classes

earnest moss
#

Just quickly, Replication graph listed as early access, any glaring current bugs etc

tawny rivet
#

Not that we know of

earnest moss
#

Thanks again

tawny rivet
#

Fortnite uses it if that helps

earnest moss
#

Yep, I've watched the intro video on taht page

#

have the livestream and a youtube tutorial queued up now

#

seems perfect

tawny rivet
#

Good luck with your project then br_cowboy

earnest moss
#

Thanks. I've got a spacegame where your character is inside a ship and can take a bridge crew role to fly the ship. Working on planet surfaces/exploration now and It'd be a major get for me be able to have people in multiple places instead of squading up all the time.

fleet raven
#

mysterious replication issue was caused by bad client side code clearing the array after replication resized it so it wasn't able to fill the entries

#

I guess we learned: never ever fuck with the size of a replicated array on the client or everything breaks down

ornate crescent
#

i have problem with my EquipmentComoponent

#

I have this in the constructor of my Character

    EquipmentComponent = CreateDefaultSubobject<UDOEquipmentComponent>(TEXT("EquipmentComponent"));
    if (EquipmentComponent)
    {
        EquipmentComponent->SetIsReplicated(true); // Enable replication by default
    }
#

i miss something?

#

because replication dont work in the equipmentcomponent

red musk
#

Hi guys, I am trying to host a game on an android device but I get the error "Sessions not supported by Online Subsystem"

#

If I can't use sessions to host a game, then what am I suppose to do?

twin juniper
#

Noob question: how to smooth other player's movement in mp? I only found some old posts on answerhub and forums. Which is the "modern way" of doing it? Preferably without code, but it's okay with code too.

copper mango
#

like beyond the default smoothing?

#

or for like a custom movement mode?

ornate crescent
#

Yeah but i have problem/question
I habe actor component replicated in Character.
Some of vars in the ActorComponent are replicated but other i want to be change by the client

#

Example:
My EquipmentComponent have a pointer to UWeapon* WeaponEquiped;
This pointer is replicated, only manage by server.
I want when this vars is replicated, the client have SkeletalMeshComponent to render the item

#

The UWeapon And the SkeletalMesh are into the EquipmentComponent .
The Weapon is replicated but the skeletalmesh i need to be created only in client

#

But the problem is the EquipmentComponent is Replicated (into the Character)

#

Any can help me to find way to create and manage the Mesh only in the Client?

twin juniper
lucid vault
#

I used the player's camera rotation and position for line traces on the client. Now that I want to line trace on the server instead, should I replicate the camera and do the same or use an alternative method?

copper mango
#

you'd probably have the client send the facing direction in an RPC and then in your validate you can make sure it seems like a sensible facing for them based on your current information

lucid vault
#

I was thinking that maybe the client rotation is already being replicated somewhere and that it would be more efficient than sending more data

#

But that solution would work

copper mango
#

well, it depends if your camera can rotate separately from the character

lucid vault
#

It can't. It's and FPS

copper mango
#

you can aim up

#

that doesn't rotate your character

#

but it rotates your view

#

the server would only know about the character rotations I'm pretty sure

lucid vault
#

I was going to say that allowing a user to pass his own rotation for line tracing would allow a hacker to line trace in directions that their character isn't facing right?

winged badger
#

so? validate the hit of the trace is within the cone of forward

copper mango
#

@twin juniper how are you moving those blocks and stuff?

winged badger
#

that is at least, super cheap

copper mango
#

yeah so @lucid vault you can verify that it's within some valid error range of what you'd think is reasonable on the server

#

you know roughly what the yaw should be

#

and you know what the min/max pitch from that is

#

so using a little bit of vector math you can figure out if it's within a reasonable error margin

lucid vault
#

Right. I'l give that implementation a shot. Thanks

lucid vault
#

@copper mango @winged badger Okay, so I looked into the code more and ran some tests. The camera is rotated based off of 1) The player character's yaw2) The player controller's pitch. Both of theses values are replicated if I am not mistaken

winged badger
#

PlayerViewPoint or something like that

#

is replicated

lucid vault
#

I have never heard of that before

#

Let me check it out

winged badger
#

i never used it, just picked it up from reading here

#

so, assume approximate accuracy

lucid vault
#

What I was saying earlier was that (assuming PlayerViewPoint doesn't work out) I could use the char yaw and controller pitch to create the camera angle. At that point I would just have to figure out the location of the camera

winged badger
#

GetPlayerViewPoint on the PC

twin juniper
#

@copper mango I attach them to the hand

lucid vault
#

@winged badger GetPlayerViewPoint does indeed seem as though it will work. Thanks for that tip

#

Can't believe I couldn't find that method anywhere when researching

winged badger
#

oh i missed it too

#

initially ๐Ÿ˜„

copper mango
#

@twin juniper and the hand is a part of your character?

#

@lucid vault huh I didnโ€™t know that function existed

worthy perch
#

How can I set replicated properties of an actor before it replicates to clients?
SpawnActorDeferred will cause the actor to replicate to clients before FinishSpawning is called.

winged badger
#

any replicated variable will replicate in the same bunch that spawns the actor

#

any replicated variable set in the same frame the actor is spawned on server will be in that bunch

#

all of them will be available client side at PostNetInit() which calls DispatchBeginPlay()

#

so all your OnReps will fire before BeginPlay

worthy perch
#

Hmm, this is good information. Thanks, Zlo. I guess I have a different issue then. Namely, overlaps being called before those properties are actually set.

winged badger
#

if you defer spawn past the frame you spawn the Actor in

#

then you're in uncharted territory as far as im concerned

worthy perch
#

I believe I'm doing it in the same frame.

winged badger
#

as for overlaps

#
virtual void BeginPlay() override
{
    Super::BeginPlay();
    SetActorEnableCollision(true);
}
#

with initial state false

#

should fix it

worthy perch
#

I will look into that. Thanks a lot!

winged badger
#

deferred spawn has one big plus in networked environment

#

normally, any variables you set after spawning the actor are set after BeginPlay on server

#

exception to that is ExposeOnSpawn in BP and DeferredSpawn in c++

#

so, it lets you run the same initialization logic server and client side, as they will all be available on client by BeginPlay no matter which spawn you use

worthy perch
#

Thanks, Zlo. SetActorEnableCollision more or less solved it. I also had a situation in which I was calling NetMulticast RPCs before setting those replicated properties. And for whatever reason, I think, this means that those properties are not replicated with the initial bunch.

winged badger
#

replicated variables just sit there

#

until its time for net driver to evaluate actors for replication

#

RPCs go, right away, and not in the same bunch

worthy perch
#

Do you think it's a bad idea to call RPCs before FinishSpawning?

winged badger
#

yes

#

that could get as dodgy as GetPlayerController[0] ๐Ÿ˜‚

#

(it works as long as you're really careful and know what you're doing, otherwise you end up here with people yelling at you not to use GetPlayerController[0])

red musk
#

Has anyone gotten LAN play working via wifi between mobile and PC? I cannot get mobile devices to see other sessions for the life of me

twin juniper
#

@copper mango yes, the hand is just a skeletal mesh component attached to the actor's root comp. To be precise, I attach it to a scene component located near the hand. It's exactly the same setup as in VR example in the documentation.

copper mango
#

well, I guess main thing I was wondering was if you were using Character Movement Component or not

#

because that'd determine how the smoothing stuff would work

twin juniper
#

@copper mango yep, it's a character with a character movement component. and the movement mode is set to "flying"

#

otherwise is't just a character without a mesh

copper mango
#

have you tried messing with SmoothNetUpdateTime?

twin juniper
#

@copper mango nope, not at all. I will take a look

timber tree
#

@sharp pagoda Hi,
Thanks for the help, I successfully created this dedicated server registered with steam, and now it shows in steam server list in LAN as well as Internet tab, but my client is not able to find this server via find sessions advance, any idea what could have gone wrong.

sharp pagoda
#

@timber tree first see if you can join directly with open steam.IdInServerBrowser

timber tree
#

ok let me try

timber tree
#

It connects successfully

#

but then why I cant find it via find sessions advanced

meager spade
#

you are using SubSystem steam?

#

as that is the only subsytem that will handle steam.ID

timber tree
#

yes

sharp pagoda
timber tree
#

ok

#

ok found the issue Warning: STEAM: Ignoring game search request while one is pending

twin juniper
#

Helloooooo, So I'm looking for a simple guide do make people around the world (Or just the country lol) to connect to my IP and join the same server (None hosted server), I got my router settings so ye I can port forward it, I would just need a guide to set it up, And I can't C++ so that's not a option

thin stratus
#

Port Forward 7777

#

That's basically it

twin juniper
#

So you mean that I can take my IP, Make it a console command, Portforward my IP with (Both TPC and the other) then add 7777 as port, And my friend from other connections are able to connect?

#

@thin stratus

#

srry for ping

dull vapor
#

I've tried goggling this but can't get it to work ๐Ÿ˜ฆ I've tried several ways but the best I can get is that client and server can pick up the object but only what the server does replicates to the clients. Could anyone point me in the right direction so that the client picking up the object replicates aswell?

chrome bay
#

I'd suggest just doing all the pickup logic client-side, and telling the server what object you picked up

#

Willing to bet that the "first person camera" isnt facing the same direction or location on the Server. You can't garauntee they'll both grab the same object

dull vapor
#

Ah, I see. Thank you!

chrome bay
#

You can check on the Server to see if the target object is "roughly" in range to prevent blatant cheating

#

Also pro-tip, I'd advise putting a timer between RPC's, so that clients can't spam the server

#

Otherwise in theory, you can send RPC's just as fast as you can smash the input key

dull vapor
#

I guess that'd be smart. I'm just doing this as a learning project atm

chrome bay
#

Probs not important yet, just food for thought

twin juniper
#

Helloooooo, So I'm looking for a simple guide do make people around the world (Or just the country lol) to connect to my IP and join the same server (None hosted server), I got my router settings so ye I can port forward it, I would just need a guide to set it up, And I can't C++ so that's not a option

dull vapor
#

I've made the line trace and pickup local now, I tried to tell the server what object was picked up but I guess I'm not really good at this, anyone knows why this doesn't work. It tells me Picked Object is None.

meager spade
#

because you need to send the server the object in the RPC

#

the server wont have a clue what the hit object is

#

bas

#

and why is picked object replicated?

#

you need to learn the core fundamentals of networking

dull vapor
#

I really do.

meager spade
#

change your Server Pickup

#

put a input called Picked Object

#

and when you call Server Pickup, pass it the object

dull vapor
#

Like this?

meager spade
#

yes

#

ands your locaction

#

the server wont know that either

dull vapor
#

Ah, yeah thanks!

meager spade
#

mark it reliable

#

as it should be

#

oh it is nvm

#

then yeah that should work

dull vapor
#

Sadly still isn't moving on server side ๐Ÿ˜ฆ

#

Guess I have to watch some vids on networking and see if I can solve it

meager spade
#

well, did you verify the server has the correct object now?

#

is the object spawned server or locally? theres a few caveats with networking, for a object to be referenced over the network it has to either be spawned server, or if its on client it must have a name the same as the server and the object set to as NetNameStable, which im not sure is possible in bp. but either way, the object must be supported for networking

dull vapor
#

The object is in the level when you join so... server?

#

The server knows that it's the right object ๐Ÿ˜ƒ

#

but no move :/

meager spade
#

things placed in level

#

are on client and server

#

BUT they have the same name

#

so they are net name stable

dull vapor
#

oh

#

So it could just be moving the local one?

#

At the moment it just teleports the object back when clients tries to move it

meager spade
#

nmo

#

no

#

the server should move his version

#

just the same as the client

#

physics handle may be wrong

distant talon
#

After implementing a netserialize function on a frequently used struct i've noticed it causes an absolutely massive framerate hit, i can remove and readd it and note an average factor of 2 difference with hitches and dips down to like 1/9th the stable fps. Clearly doing something wrong. Anyone have a clue?

Contents of the struct:

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        FVector_NetQuantizeNormal Lin;

    //uncompressed timing information
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        float DeltaTime;
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        float TimeStamp;

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        bool Bool1;
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        bool Bool2;

bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess){
        bOutSuccess = true;        
        //compress bools to one uint8 and serialize
        uint8 Flags = (Bool1 << 0) | (Bool2 << 1);
        Ar.SerializeBits(&Flags, 2); 

        Lin.NetSerialize(Ar,Map,bOutSuccess);

        if (Ar.IsLoading())
        {
            Bool1= ( Flags & ( 1 << 0 ) ) ? 1 : 0;
            Bool2= ( Flags & ( 1 << 1 ) ) ? 1 : 0;
        }
        return true;
    }
twin juniper
#

Helloooooo, So I'm looking for a simple guide do make people around the world (Or just the country lol) to connect to my IP and join the same server (None hosted server), I got my router settings so ye I can port forward it, I would just need a guide to set it up, And I can't C++ so that's not a option

meager spade
#

pretty sure you asked that earlier

#

and cedric replied

twin juniper
#

Well the answear didnt told so much

#

Saying open port 7777 helped by nothing

#

I would like multiple people on same server, Same map, ect. I can portforward but how to make the server possible

meager spade
#

you just get people to connect using open Yourip

#

its that simple

twin juniper
#

But how to make them join same server

#

Does it make the IP redigt to 1 server?

meager spade
#

eh?

#

i suggest learning the basis of networking

#

your IP is global, if someone tries to connect to your ip on port 7777 it will connect to the game

#

as long as 7777 if forwarded to your pc

#

so calling open yourip console command

#

will connect to your computer

twin juniper
#

Why can't it just be simple, Like why can't I just make a easy console command with my IP, Portforward it, And people can connect to it using console from another connection/Location

meager spade
#

thats what i just said

#

you just call open yourip

#

from within your load level

twin juniper
#

So do I have to do console command Myip.port or just my IP in the BP?

#

Oh ok

meager spade
#

bp has a function

#

open level

#

just put your ip

twin juniper
#

Not the port?

meager spade
#

actually

#

console command in bp

#

open yourip

#

i think it automaically does 7777 (the standard)

twin juniper
#

Ye

#

I'm srry for the questions cus I'm new, But what you mean by open yourip?

meager spade
#

well if you are new, you are better to learn

#

than try to get things working over the internet

#

and im betting you downloaded a project which supports multiplayer

#

and just hoping to get it working right?

twin juniper
#

No, I buyed a asset for 56โ‚ฌ and was gonna use multiplayer for it

#

But is seems pointless

meager spade
#

seems pointless cause you are unwilling to learn

#

just buying an asset and thinking you can make a working game doesn't happen

winged badger
#

people trying to learn multiplayer from the start here

twin juniper
#

You seem to be unfriendly

winged badger
#

usually spend over a month till they get a basic handle on networking

meager spade
#

i am far from unfriendlyt

twin juniper
#

If you didn't wana to help, Then don't answear

meager spade
#

answer*

winged badger
#

and he was helpful, honestly

twin juniper
#

I won't care in you're opinon as it even nothing to learn from

winged badger
#

he suggested you rethink your approach, which you absolutely should do

twin juniper
#

I can take feedback and fact, But negative comments from people like you I don't care in

#

Well but I won't

winged badger
#

i personally don't like helping people who didn't put any work into it themselves

#

as you don't seem to have done

twin juniper
#

You know nothing about me or my project

#

So please come with facts before having those words

winged badger
#

i know few things

meager spade
#

:/

twin juniper
#

Apparently not

winged badger
#

you have no clue what you're doing, so your project is mathcing that

#

you demand support on community channel

#

which is just plain rude

twin juniper
#

Comment about my project without any knownledge or information about it, Is just pathetic

#

I asking for help by friendly people, Where you don't belong

winged badger
#

for the level of help you need, you should go and hire someone to do the project for you

twin juniper
#

You haven't success with anything, So you just as down as me then

meager spade
#

LOL

twin juniper
#

I can't see a single project and have went so good for you either

meager spade
#

this guy

twin juniper
#

Actully none of you have never success with something when is come to programming

meager spade
#

so what are you doing here then Mr Successful ?

#

asking for help for a simple networking problem?

twin juniper
#

Have I called me that?

meager spade
#

you seem to know more than me about Unreal Engine

twin juniper
#

I just sayin g that you callling me unknownledged when you can't either nothing yourself

meager spade
#

right..

twin juniper
#

You're on the basic level

meager spade
#

finshed trolling yet?

twin juniper
#

So I don't think you so success.d when is come to UE

#

You was the one started it

meager spade
#

i started what?

twin juniper
#

If you don't wana help, Keep shut

meager spade
#

by saying you should learn?

distant talon
#

Hey, could anyone help with an explanation of how adding a NetSerialize function works under the hood. The part thats confusing to me is that if i implement one (including setting the struct to allow implementing one) and leave it empty, the struct keeps working as normal.

Surely if i've chosen to implement netserialize myself and then leave it empty it should break network transfer completely? Why doesnt it? The reason i need to know is that when i do fill out the netserialize it's obliterating my framerates (which indicates at least, my function IS being called somewhere) and reverse engineering isnt working without understanding whats happening.

twin juniper
#

What was the reason you actully even commented to topic

#

As you was to no help at all

meager spade
#

@distant talon the idea of overriding is to provide your own custom way of serializing the data before sending it across the network, or when you receive it from the network. I am sure by default it just gets serialized to a basic level (good enough to work). But with your own implementation you can serialize it better to make it smaller for transit over the network. It checks a flag to see if you have a custom NetSerializer, and calls that

distant talon
#

Thanks, but i've observed that implementing the netserializer and leaving it empty doesnt seem to have any effect. Does that mean it somehow knows which parts of the struct arent being manually serialized and does them outside of the user defined function?

meager spade
#

i have never actually tried

#

are you sure its using your custom serializer?

#
struct TStructOpsTypeTraits<FSomeStruct> : public TStructOpsTypeTraitsBase2<FSomeStruct>
{
    enum
    {
        WithNetSerializer = true        
    };
};``` i am assuming you have thi?
#

this*

distant talon
#

It seems to be, since when i implement it fully it has the notable effect of absolutely wrecking my framerates

#

yeah

meager spade
#

then maybe its not serializing the data at all?

#

how are you serializing the data?

distant talon
#

ah, fair enough. I just have a pretty big struct that i'd like to compress down. Here is the cut down example of the inside of the struct which im testing with, it still has the same performance issues

UPROPERTY(EditAnywhere, BlueprintReadWrite)
        FVector_NetQuantizeNormal Lin;
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        FVector_NetQuantizeNormal Rot;

//uncompressed timing information
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        float DeltaTime;
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        float TimeStamp;

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        bool Bool1;
    UPROPERTY(EditAnywhere, BlueprintReadWrite)
        bool Bool2;

bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess){
        bOutSuccess = true;        
        //compress bools to one uint8 and serialize
        uint8 Flags = (Bool1<< 0) | (Bool2<< 1);
        Ar.SerializeBits(&Flags, 2); 

    
           bOutSuccess &= Thrust.NetSerialize(Ar,Map,bOutSuccess);
        bOutSuccess &= Rot.NetSerialize(Ar,Map,bOutSuccess);

        if (Ar.IsLoading())
        {
            Bool1= ( Flags & ( 1 << 0 ) ) ? 1 : 0;
            Bool2= ( Flags & ( 1 << 1 ) ) ? 1 : 0;
        }
        return bOutSuccess;
    }

winged badger
#

@distant talon take a look at FHitResult in EngineTypes.h/cpp

distant talon
#

Aye there's also a good FMove example in there

winged badger
#

pretty sure you need one of this:

template<>
struct TStructOpsTypeTraits<FHitResult> : public TStructOpsTypeTraitsBase2<FHitResult>
{
    enum
    {
        WithNetSerializer = true,
    };
};
distant talon
#

Yep, have one, i only pasted the inside of the struct for brevity

winged badger
#

but it should be a good example, as it has NetQuantized vectors, floats and bools for the most part

distant talon
#
template<>
struct TStructOpsTypeTraits<FMyMove> : public TStructOpsTypeTraitsBase2<FMyMove>
{
    enum
    {
        WithNetSerializer = true,
    };
};

#

Yeah whats confusing is that i've followed the example fairly closely

#

I have the compressed bools and the vectors happening, though in that paste i've left out the floats but it's laggy either way

#

But what i really dont get is why leaving it empty has no effect. it should break everything.

#

i've double and triple checked that it's the right struct being called

meager spade
#

no clue, maybe the engine detects it got no return

#

or invalid return

#

and serializes it itself?

distant talon
#

Oh thats a good idea

#

at least explains the lag followed by it working

winged badger
#

you do have a flaw in bOutSuccess

#

if your last local NetSerialize call returns true, bOutSuccess will be true even if one of previous calls failed

distant talon
#

hmm, the &= should prevent that. If it's false it will remain false. It's also how it's done in one of the other netserialize funcs in enginetypes.h

#
    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        // pack bitfield with flags
        uint8 Flags = (bSimulatedPhysicSleep << 0) | (bRepPhysics << 1);
        Ar.SerializeBits(&Flags, 2);
        bSimulatedPhysicSleep = ( Flags & ( 1 << 0 ) ) ? 1 : 0;
        bRepPhysics = ( Flags & ( 1 << 1 ) ) ? 1 : 0;

        bOutSuccess = true;

        // update location, rotation, linear velocity
        bOutSuccess &= SerializeQuantizedVector( Ar, Location, LocationQuantizationLevel );
        
        switch(RotationQuantizationLevel)
        {
            case ERotatorQuantization::ByteComponents:
            {
                Rotation.SerializeCompressed( Ar );
                break;
            }

            case ERotatorQuantization::ShortComponents:
            {
                Rotation.SerializeCompressedShort( Ar );
                break;
            }
        }
        
        bOutSuccess &= SerializeQuantizedVector( Ar, LinearVelocity, VelocityQuantizationLevel );

        // update angular velocity if required
        if ( bRepPhysics )
        {
            bOutSuccess &= SerializeQuantizedVector( Ar, AngularVelocity, VelocityQuantizationLevel );
        }

        return true;
    }
#

i might be missing something tho

distant talon
#

its also weird how in the engine type (the one i just quoted) they return true regardless, never returning false even if boutsuccess is false

#

did actually try that too, no change

winged badger
#

just a guess

#

but deserialization won't know how to pull out angular velocity

#

if bRepPhysics is false

#
else if (Ar.IsLoading())
{
    AngularyVelocity = FVector::ZeroVector;
}
#

might end up with garbage value there

#

which could in turn cause your framerate to drop as you're entering undefined behavior waters

#

@distant talon

#

similar issue might occur with RotationQuantizationLevel, as its not serialized and archive unpacking that has no idea which way it should use

distant talon
#

That is actually engine code

#

that was the example i was following

#

could be wrong but, it's known working

winged badger
#

that scares me

distant talon
#

its also a bit confusing that they dont use the if (Ar.IsLoading()) for their bool unpacking

#

because another netserialize func in the same file does

#

Okay, so i've done network profiles for both with and without my netserialize function. So i can confirm it is working when i do it, it cuts down PropertySize per second by a whopping -90%, it's just confusingly very laggy

#

total bandwidth is cut by 30% but that's not surprising since it's not the only thing being replicated.

winged badger
#

do the same values you sent arrive on the other side?

distant talon
#

yep, still working

#

When i say "laggy" im talking about the big average framerate cut and framerate spikes, it's half the avg framerate dips to like 5 fps at times which isnt playable

#

it's just some bitshifting and moving stuff to an archive, i cant see how that should cause such huge performance issues

winged badger
#

it couldn't, unless you got some garbage values in the process

#

and the lag is due to your project trying to reconcile those

distant talon
#

Hmm, that makes sense, but not sure how to approach fixing that

#

i've tried commenting out pieces of the netserialize func but like i mentioned earlier, even if i empty out the whole function it still works which is bizzare

#

it seems to know to fall back for properties that arent being serialized

winged badger
#

that AngularVelocity is a good example, if you tried to use it client side with !bReplicatePhysics

#

undefined behavior

distant talon
#

Yeah my struct doesnt have any switches like that

#

mine was posted a few pages up

#

can repost

winged badger
#

i don't see any such flaws in that snippet

meager spade
#

maybe you are serialzing something massive and due to the serialize its taking a long time?

#

๐Ÿคท no idea

#

๐Ÿ˜„

distant talon
#

I mean, two fvectors, two floats, two bools

#

some of the base structs are bigger

#

thanks for the attempted help though this is one of those bizzaro problems

#

uh, hmm. This struct is also included in another struct somewhere else. That might be related.

winged badger
#

base structs as this one inherits from another struct?

distant talon
#

no struct inheritence happening here. There is another struct which has one of these structs as a member is all. gonna try disabling that struct maybe and seeing if that's the cause of the framerate issues somehow

distant talon
#

disabling the struct that has a member that is one of these structs fixes the framerate wreckage. Now to figure out, why...

winged badger
#

oh, a fruitful day there

distant talon
#

Yep. Though, i only just got back

#

i wasnt spending another 3 hours working on that, heh

winged badger
#

i had one bizzare engine fail at serialization 2 days ago that ate a couple of hours

#

programming is fun ๐Ÿ˜„

red musk
#

Whats the right way to connect to a client to a server via IP? Is it executing console command with open <ip> ?

#

Or is there another way

winged badger
#

that method doesn't come with NAT punchthrough, so you'll have to port forward the ports to PC running your server, unless you are on the same subnet

red musk
#

thanks!

wheat eagle
#

Hey guys I'm pretty stuck at something. I have a peer to peer session , where the host joins another session. I want the clients from the ptp session to join the session that the host is joining aswell. How can I achieve that using blueprints?
to manage the sessions I'm using the advanced sessions plugin

chrome bay
#

You don't need to do the IsLoading check in NetSerialize when using the << operator in FArchives because it handles that internally already

#

Oops, late

meager spade
#

yeah that was last night ๐Ÿ˜„

chrome bay
#

dangit discord ๐Ÿ˜„

meager spade
#

lol

#

i hate that

#

always catches me out

chrome bay
#

sometimes the "you are looking at older messages" bit just never pops up for some reason...

meager spade
#

yup

winged badger
#

and it ended with his struct with custom NetSerialize being a member of another struct without custom NetSerialize

#

everything works, but his framerate drops to half

chrome bay
#

ahhhh GG rekt

idle flame
#

Hey,
Is it possible to replicate curtom actor component stored in my character class pls ?
I've try to PROPERTY(Replicated), but it doesn't seems to be replicated

chrome bay
#

If the component is a default component in the actor, you don't need to mark it as replicated

#

If you want to have replicated properties in an actor component, set bReplicates = true; in the component.

idle flame
#

I'm trying to replicate my ACHealth Component and I'm initializing it like so :

chrome bay
#

Okay well first off, you don't need to do AddOwnedComponent. Component registration is done automatically.

#

If anything that probably does more harm than good

idle flame
#

@chrome bay kk thx I'll remove that

winged badger
#

if it inherits from a USceneComponent, you do need to SetupAttachement

#

when its a default subobject

#

otherwise, just creating it is sufficient

idle flame
#

My actor component inherit from UActorComponent

chrome bay
#

Yep that's fine, so just creating it is enough

idle flame
#

@chrome bay ok thx ^^

chrome bay
#

In the constructor of your custom component, add this:

winged badger
#

components that are default subobjects have a unique name, relative to the Actor

chrome bay
#

That will allow you to have replicated properties in the actor component, just like an actor

#

and call RPC's from it etc.

winged badger
#

if that Actor is replicated, or loaded from a Package (pre-placed on map, which gives it a stable name = same name on all machines)

chrome bay
#

^ that

winged badger
#

the unique name for the component (in the scope of the Actor) is sufficient to resolve a NetGUID

#

which means the pointer to a component sent over the network will be valid

chrome bay
#

Also this should go without saying - but just look at how the engine does this already, there are examples all over the place

#

Download ShooterGame, it's old but good for reference when starting out

winged badger
#

and as Jamsh mentioned, if that component has replicated properties, or sends any RPCs, it needs to be replicated, otherwise it doesn't

idle flame
#

@winged badger @chrome bay Thx for the advices. Yes my component has a float Health replicated to client.

rotund sapphire
#

How much improvement would you gain by sharing actor channel with other actors, child actors for example?

#

It's been a while this was posted, tho i can't read the UDN discussion so i can't judge it's effectiveness

grand kestrel
#

@rotund sapphire Do you mean basically setting SetReplicates(false); and then replicating them through ReplicateSubobjects()?

rotund sapphire
#

That's a neat idea, haven't thought about that. Tho the answerhub post indicates there much is more to it. I just can't access the UDN discussion to see the picture.

grand kestrel
#

I'm aggregating the ticks for all pooled objects (projectiles in particular), could make sense to do that for them too

#

Ahh

#

Its a bit annoying he put it on UDN

#

Odd he wouldn't just put it somewhere publicly accessible

rotund sapphire
#

Guess UDN doesnt quite allows it :) Against the business model probably.

grand kestrel
#

Ahh

#

I'm sure I'll get access eventually, just never really cared that much about it

rotund sapphire
#

You're not missing out much, as i hear. Except for a few cases like this one.

grand kestrel
#

Still, I don't see why the way I said wouldn't do it

#

Wonder if there's some way you can test

grand kestrel
#

@rotund sapphire Please @ me if you do find anything, I'm pretty interested

modern swift
#

hey guys, may I ask what is the best way to identity/create the unique id for each player,?

#

I search some forum said get the gamestate can know all the connection in the server

#

How can I actually implement in c++ ?

rotund sapphire
#

@grand kestrel Ok, but i may going to test your patience :) I don't have a current plan to just get to it now - it was part of a design question for future reference. But in time i'll look into it if there's nothing else comes up. I'll probably repeat this question maybe someone has practical xp with this. You never know...

rotund sapphire
#

@modern swift struct FUniqueNetIdWrapper you can perhaps modify the online subsystem to generate / set this struct for the joining player. But i think it is going to be null without steam etc. Without OSS the player's has some unique names however derived from the computer id ?Name=MyCOMPUTER-1ABC212... upon join, so that's kinda unique (not secure). You can also use the player id to identify them, that is unique too. Not sure if any of these will help you.

quartz venture
#

Hey everyone, I'm not sure if this is the right place to ask this but I need help with a network issue, specifically replication. I am trying to update an AI character Rotation to face the target, via a BT Service with a tick of 0.001 sec and another AI that has a beam, which gets updated in the same manner but the service calls a multicast function in the AI Pawn BP. whenever I have more than two instances using those functions simultaneously I get a huge lag that lasts until 2 of the AI characters get destroyed. I am thinking my approach of the beam update is wrong and i would really appreciate any help

meager spade
#

Multicast every .0001 sec? That is faster than the tick rate

#

And if that multicast is reliable that's going to hurt

quartz venture
#

thats what I suspected as well. will it be enough to lower the update rate to something like 0.01 for example? P.S. It is reliable yes, otherwise the update never occurs in my case

bitter oriole
#

So, I've run into the "want to fire RPC on an actor I don't own" thing. Is it safe to change the owner of an object during gameplay ?

grizzled stirrup
#

@quartz venture Why not just use SetFocus() ?

winged badger
#

@quartz venture nothing that RPCs on tick should ever be reliable

#

And should deninitely not be a multicast

#

Imo multicasts should be restricted to quick prototype logic you will replace, and for cosmerics, strictly unreliable

#

And 0,01 is still every tick at 100 fps

quartz venture
#

@grizzled stirrup I totally forgot about that HOLY. THANK YOU

#

@winged badger I see what you mean. my problem is that the beam indicates which target the AI is locked on so it still should be updated every time the target moves which mean every tick

winged badger
#

Or you could just replicate target pointer

#

And let clients calculate rotation on their own

#

1 pointer only when the target changes vs multicast on tick is not realy a choice

#

Especially when doing it via pointer makes the game look smother on client

quartz venture
#

wait

#

if i replicate target location

#

and define On_Rep function

#

would that work?

winged badger
#

You replucate target, not target location

quartz venture
#

but i need the beam to follow the target

winged badger
#

Clients know whete that actor is on their side

#

So they can pull its lication whenever they want

#

And rotate to dace it

#

Server just needs to telk them what actor to turn towards, nothing else

#

Sorry for typos, mobile, large fingers

quartz venture
#

no problem dude youre being a great help

#

thank you

#

okay what i want is not a rotation

#

its beam target location

#

basically a particle system

winged badger
#

You just have to put that logic on the pawn, as there us no client side contriller

#

Replicate the pointer to actor/component beam is aiming at, client doesnt need any other info

#

If your targeted actor moves, server will tell that to clients by replicating its movement

quartz venture
#

Oh I understand now

#

as long as the target is replicated

winged badger
#

You are basically replicating its position again, only 100 times costlier

quartz venture
#

its location gets updated automatically

winged badger
#

Yes

quartz venture
#

alright ill try it right away

winged badger
#

And simulation is smoother,because its right on point every frame, but it can diverge if you use the approach you used above, as packet for targets m9vement replication m8ght get dropped, but you beam will still track it like it wadnt dropped

quartz venture
#

@winged badger thanks for your help. I ended up passing the target to the pawn and doing the calculations for the beam target point on the pawns tick. I'll look more into it tomorrow. Again thanks for the help

modern swift
#

hi all anyone know the shooter game example is p2p or authorization server architecture, anyone success put shooter game example in dedicated server/cloud server?

copper mango
#

it's server/client. the networking model in Unreal is fixed as server/client

#

to change it to peer-to-peer would require a lot of significant changes

#

that being said, it is possible to run as a "listen server" where you're both the server and one of the clients at the same time

#

but that's not peer-to-peer

modern swift
#

when the player click host in the shooter game, the player game instance will become server and let other players to search and join, is that correct?

#

can I build one dedicated server to let player to open many rooms in the lobby and let other players to select the room to join?

#

I just wondering one dedicated server instance can handle many rooms/level for multiplayers

twin juniper
#

Pretty many use dedicated server to make a main server where people connect using IP example

lofty ravine
#

First we got that damage event, and it is sending print string

#

Then second image is in character blueprint, and third picture is also in character blueprint and sents the print string

#

fourth picture is of the widget itself, can someone please help whats wrong?

twin juniper
#

Why won't my scound player load into same svr?

#

When I play on the main svr both players are in, But in entry lvl and connect using the simple IP command it load them in seprate

#

I could portforward, But I first want it work over Lan

lofty ravine
#

I solved the widget problems

rose egret
#

how do I copy my properties from GameState and GameMode to new instances after seamless travel?
I ma looking for something like APlayerState::SeamlessTravelTo(class APlayerState* NewPlayerState)

meager spade
#

CopyProperties

#

i know that exists on PlayerState

rose egret
#

I don't see such a function.

#

I said GS and GM.

#

๐Ÿ˜

meager spade
#

not sure you can

#

cause those are gamemode specific

#

you would need to copy them to say game instance or something

#

then back into the new game mode

#

as they don't persist during level changes

rose egret
#

my game instance is dirty enough at the moment.

#

I don't wanna put all the grabage there

meager spade
#

you would need somewhere to store it

#

gamestates should not persist nor gamemode during level changes

#

so you might need to change your logic

rose egret
#

how come player state has APlayerState::SeamlessTravelTo but not others

meager spade
#

cause playerstates can persist between levels

#

if i have my inventory on playerstate, and i load a new level, i want my inventory to come with me

rose egret
#

thats what doc says:
By default, these actors will persist automatically:

The GameMode actor (server only)

Any actors further added via AGameModeBase::GetSeamlessTravelActorList

All Controllers that have a valid PlayerState (server only)

All PlayerControllers (server only)

All local PlayerControllers (server and client)

Any actors further added via APlayerController::GetSeamlessTravelActorList called on local PlayerControllers

#

..

#

maybe I don't get it right

meager spade
#

๐Ÿคท all i know is that you can use different gamemodes per level, so when you change level, it has to create a new gamemode for the level you just entered (cause they can be different, same as gamestate and player state), which is why PlayerState has a CopyProperties function to copy stuff from one PS to another

grizzled stirrup
#

In the case where you have a round based game (like CSGO) and want to determine if the current score of a team has reached the score limit (at the end of a round), would this be best done in the GameState or GameMode?

#

My initial approach would be to have the end of round event trigger first in the GameState which compares the score value of each team (stored in the GameState) with the score limit (via a GameMode getter)

#

It then calls the appropriate GameMode functions depending on the result (GameMode->StartNewRound() or GameMode->GameOver)

#

Would this be a correct approach or should all of these kind of end of round checks happen directly in the GameMode?

grizzled stirrup
#

Looking at ShooterGame it seems they do almost everything in the GameMode..

#

I guess I'll do the same in this case

#

And have the GameState more for just carrying current values (like time and current score) that the GameMode can easily fetch

meager spade
#

gamemode

#

GameState is like it says, the state of the current game

#

GameMode controls everything to do with the game (rounds, timers, etc)

grizzled stirrup
#

Ok thanks!

#

I just thought the GameState might handle state based events like ( CheckIfRoundShouldEnd()) which could be fired after each death of a player

meager spade
#

not really that is for the gamemode, the gamemode should check GameState

sterile plaza
#

Morning. I'm just getting my project updated to work with multiplayer. I have two characters you can click to move. It seems to be working but my MovementComponent is set up to OrientRotationToMovement. This seems to work locally for other actors, but not the one you're directly controlling. The way I'm networking this is when you click somewhere, it sends the location to the server via RPC on your player controller and then it calls UAIBlueprintHelperLibrary::SimpleMoveToLocation().

Any ideas about why rotation would work for unowned actors, but not for your own?

#

It appears OrientRotationToMovement is no good for replication. Turned that off, set my ActorRotation to be based off of my velocity and it kind of works, but it's pretty jittery.

meager spade
#

we use orienttomovement over the network ๐Ÿคท

sterile plaza
#

it appears my controllers are owned by each client, but the actors are all owned by the server...

#

which seems very odd considering they're owned by the controllers, so now I'm investigating that

meager spade
#

err i got confused there

#

the server spawns the controller, the controller is replicated to OWNING client. This means, the Owning Client and the Server both have a controller, other clients cant access or even see other clients controller. So basically in a nutshell, controller is Server and the client.

sterile plaza
#

yep

#

the client can tell the server about its controller because it owns it

#

I was expecting the possessed pawn to also be owned by the client, but for some reason that doesn't appear to be the case in my project.

#

shouldn't I be able to put a breakpoint for Client1 on the actor possessed by his controller and get past SwitchHasAuthority?

meager spade
#

PossessedBy is server only

#

so a SwitchHasAuthority there is useless

sterile plaza
#

ah, right. Getting the role is more useful.

#

strange, it's UAIBlueprintHelperLibrary::SimpleMoveToLocation that's super jittery

#

If I just move the pawn manually it's smooth.

plucky wadi
#

I have a blueprint multiplayer question (dont know if i should put it in this or the blueprint section) is this how multiplayer basicly works? or am i missing something? http://prntscr.com/nzm0f1

Lightshot

Captured with Lightshot

viral raft
#

When there I play with 1 player, this code works fine, but when a second or more players appear then it keeps sending this error:

#

Thats the code ^^

#

It also keeps logging the print, so its not setting

#

The goal is to, change the attached socket from the Rifle Pick component

sterile plaza
#

The code in the first image will have the server sending Walkspeed1 and the client will be sending Walkspeed10. I doubt that's your intention.

main owl
#

Hey, trying to get client side stuff working. Have some NPC's that have health, mana, ect.

The floats for these are all set to be replicated. They are populating with a data table, which the variable for is also set to replicated. Have a kill volume, only the first NPC placed dies on the client side, on server side all NPC's in the kill volume die correctly:

#

Any ideas what I am missing?

plucky wadi
#

How do i replicate the movement speed? since the server accepts the "request" but doesnt apply any changes?

twin juniper
#

After making a dedicated server, Do i still have to package my game?

viral raft
#

Yeah

#

Clients need updates too

#

@twin juniper

twin juniper
#

Ok thanks

keen thorn
#

Hi, anyone got some guidelines on how to bitpack my data so when sending data across network with RPC or replicated? I know C++ have bitfield but not sure if it is directly supported in ue4 or do I have to declare usigned ints and write to it using bit operators. All help is appreciated :D

rose egret
#

how TArray is replicated? I got a very weird bug. it seems when OnRep_ is called the new array is appended to the previous one ๐Ÿ˜ฆ

#

shouldn't it just override the entire array

#

?

opaque flicker
#

Hey, Help Pls
I have a Replicated wall actor, which has a child actor component inside that contains a replicated door actor, everything works fine in editor when i open the door it opens just fine in editor without any problems ... however when i build the game (Dedicated server and Windows no editor) then i try to open the door it gives me this warning and the door doesnt open at all and stay closed forever, and when i destroy the wall, the door stayes there not destroyed..

hasty orbit
#

hello I have a problem I would like to make a dedicated server
I am in part 5 of the doc (Building server)
but I can not build. I use visual studio 2017 and I downloaded unreal source engine 4.21

#

when I try to build I have 4 error

#

desolate if it is in French visual because I am french short I show you my eror

#

can you help me please

winged badger
#

@opaque flicker show me your open door RPC

#

@hasty orbit that looks like you have a UCLASS specifier on a class that doesn't inherit from UObject

#

or a GENERATED_BODY(), or both

opaque flicker
#

@winged badger it's A rep notify gets set then called on all clients top change the Door parent compoentn trotation

winged badger
#

how do you reference it from inside OpenDoor?

#

i usually avoid ChildActorComponents, so it is somewhat of an uncharted territory

#

but basically, it means that your door cannot be referenced over network

#

so you had to have used a pointer to it somewhere

hasty orbit
#

I do not understand what you are saying @winged badger

winged badger
#

i have no idea what Aserveur_d is here

opaque flicker
#

@winged badger yea the (On server Door) can't reference the (On Client Door) is this unreal bug ?

winged badger
#

i don't think the child actors, being instantiated from a template benefit from the usual "just has to be a part of a replicated actor in order for you to reference it over network"

#

typically

#

if a component is a part of the Actor defaults, and that Actor is either replicated, or loaded from a package (pre-placed on map_

#

you can reference the component over network

#

how that works is that replicated Actors have a NetGUID, and components have a stable name relative to the actor, which is sufficient to resolve the reference

hasty orbit
#

@winged badger is the creator of the doc in the server

winged badger
#

and if they are preplaced, then Actors have a stable name (as in same name on all machines) and components have stable names relative to them, so you can effectively reference a component on an actor that is part of the package without the Actor or the Component being replicated