#multiplayer

1 messages · Page 209 of 1

dark parcel
#

Textures are not replicated with stock UE, but there is plugin in the market place that replicate textures

dark edge
#

Think about what you want to tell the server

#

Do you want to tell it "I want to open this safe"

#

Or do you want to tell it "I want to interact with whatever's in front of me"

#

Or do you want to tell it "I pressed E"

static owl
#

Thank you for the replies btw.

sinful tree
#

Is it always going to be the same player interacting with the safe, or can other players potentially interact with that safe at any time?

static owl
sinful tree
#

Ok, so that means you wouldn't be able to use inputs events on the object itself, nor be able to run RPCs on it, and you probably want to have something more generic to handle interactions rather than implementing the "E Key" input event in each actor.

Since inputs are normally only routed to pawns that you have control of, you would have to locally call "Enable Input" on the actor you want to send inputs to, which is kind of finicky to do in a multiplayer game. RPCs can only be sent to the server from a client through actors that are owned by that client, and an actor can only have 1 owner, so it wouldn't work well if you need to be able to have those 5 players being able to send that RPC.

What you need to do is create a generic function on your character or player controller as you mentioned, and send the RPC through it instead. You can pass along a reference to the actor you're wanting to interact with through the RPC. On the server's end, you can then use the actor reference to either retrieve an interactable component you can place on all interactable objects that may share similar code, or, use an interface and implement your own interaction logic per actor as you desire. As you're running on the server, you would likely also want to verify that the player can actually interact with the object, like they are within an acceptable interaction range and the object can indeed be interacted with by this player.

lament flax
#

so the issue was that i was nulling the Item At Slot A
then adding a new item (that was added at Slot A since it was freed)

since this is happening the same frame (tried next tick but same results) the NetSerialized is called only once to save and load the new item
so for Slot A i dont have (as expected):

  • Slot A: save on server & load on client Item to nullptr;
  • Slot A: save on server & load on client Item to NewItem;
    but its only doing:
  • Slot A: save on server & load on client Item to NewItem;
#

i would atleast the server to try saving twice

crude kelp
#

Hello can anyone tell me the advantages and disadvantages of dedicated servers? because cannot even make dedicated server because you have to compile the source on windows and it is a nightmare on windows.... Is it very hard to on windows, and I am thinking of making some " not even rendering or all of that listen server, any idea?

keen adder
#

Can I use RPCS anywhere, or must the actor/component be set to replicated first?

thin stratus
#

Aka ServerRPCs can only be called by the Owning Client.

#

Multicasts only by the Server.
And ClientRPCs only by the Server and only if the Actor (Component) is owned by a Client.

keen adder
#

Ah, I was using a UObject and my Server RPC was being ran by the clients lol

#

I swapped it to an ActorComponent, but I don't see how to set it to replicated?

#

This is the only option on ActorComponent 🤔

#

OR does the entire actor need to be set to replicate?

thin stratus
#

Yes, both

keen adder
#

Hmm strange, I change my UObject into a component, and now the ServerRpc is obsorbed but doesn't do anything, not even print msg to screen

#

Like this should work fine, I have the same thing in another component. But for some reason the server RPC does not print "Dropped" from the client side

keen adder
lament flax
#

does TMap has any known replication issue ?

keen adder
#

Is there a way to take ownership of another actor?

#

for the purposes of replication

lament flax
keen adder
#

It's already in the level, an actor that manages all item drops

lament flax
#

then its owned by the server iirc

keen adder
#

Oh, so the client can't use it at all?

lament flax
#

wait let me check something in my code

#

for a chest (level actor) i remember having to go through the player pawn to call server RPC
but i dont remeber if it was because i was firing in UI

keen adder
#

Thanks! I'm trying to get a client to run a server RPC on it but it is ignored

#

Oh

lament flax
#

if your actor is set to replicate then it means he has no owner

keen adder
#

So the player calls the ServerRPC > which interacts with the chest

lament flax
#

but let me check

#

so what i did was:

tardy fossil
#

could just pipe a generic "Interact" rpc through your PC and use an interface inherited by the actor you want to be interacted with to do specific stuff when interacted with

lament flax
#

yeah i had to do some redirects to use player owning conenction

#

to add items to chest inventory, i called a server RPC on my player, that then calls the event on the chest

keen adder
latent heart
#

Interfaces aren't messy at all and help clean up code immensely.

#

Depending on your implementation of them.

lament flax
keen adder
thin stratus
#

TMap doesn't support replication by default.

#

Same as TSet.

keen adder
latent heart
#

Interfaces don't "merge" classes.

#

Blueprints have interfaces. AngelScript should support them. Should.

lament flax
#

igot what i want in
FMinimalReplicationTagCountMap::NetSerialize

keen adder
latent heart
#

Uh huh.

#

I think you did them wrong.

thin stratus
#

Interfaces have usecases, very important ones. If you have the mindset of avoiding them, then you need to learn how to properly use them, cause you are most certainly creating shitty code in cases where you should have used them.

keen adder
#

I used em in my last C++ game heavily, and now I don't even have the option to use them and don't really miss em. 🤷‍♂️

latent heart
#

If you ever do a if (X->IsA<...>() { do thing } else if (X->IsA<...>() { do thing } else if (X->IsA<...>() { do thing } you've got a clear case for an interface that'll make your code a lot cleaner.

lament flax
#

looks like they save it using

    const int32 CountBits = UAbilitySystemGlobals::Get().MinimalReplicationTagCountBits;
        int32 Count = TagMap.Num();

        Ar.SerializeBits(&Count, CountBits);
        for(auto& It : TagMap)
        {
            FGameplayTag& Tag = It.Key;
            Tag.NetSerialize(Ar, Map, bOutSuccess);
            if (--Count <= 0)
            {
                break;
            }
        }

and load with

// Update MapID even when loading so that when the property is compared for replication,
        // it will be different, ensuring the data will be recorded in client replays.
        MapID++;

        int32 Count = TagMap.Num();
        Ar.SerializeBits(&Count, CountBits);

        // Reset our local map
        for(auto& It : TagMap)
        {
            It.Value = 0;
        }

        // See what we have
        while(Count-- > 0)
        {
            FGameplayTag Tag;
            Tag.NetSerialize(Ar, Map, bOutSuccess);
            TagMap.FindOrAdd(Tag) = 1;
        }

        UPackageMapClient* PackageMap = CastChecked<UPackageMapClient>(Map);
        LastConnection = PackageMap ? PackageMap->GetConnection() : nullptr;

        if (Owner)
        {
            UpdateOwnerTagMap();
        }
#

to reset the map, why dont they clear it directly ?

latent heart
#

while(Count-- > 0) this is cursed

lament flax
#

true

#

same as having a public var Owner and func SetOwner thats has logic and only use Owner

latent heart
#

Also

#

Why do you have a Map and then just set the value to 1?

#

Does it ever go above 1?

lament flax
#

?

#

oh

#

its just the default value

#

keys with 0 as value are removed

#

with such setup, am i forced to us Replicated or can i try ReplicateUsing ?

#

what does Rep notifies need extra ?

meager spade
#

Eww who's using angelscript

keen adder
meager spade
#

You whole conception of interfaces merging classes is very wrong. Interfaces are for things that can respond to something but you as an implementer don't care what it is. For example interaction interface can be on a chair, a player, a door. Etc. You don't care what it is when you call interact just that it responds to yours calls.

#

We have never needed to use anything like Angel script on a team. Nor have we have ever considered it. Verse will becoming soon

keen adder
#

Yeah I know, I've used em many times. I guess I'm just salty to the stupid long iteration progress with compiling in C++ lol

meager spade
#

We don't have long iteration times with c++

#

We have what we want in our head. Design the base layout and class layout before writing any logic.

#

Then we start implementing the details

keen adder
#

Yeah every setup is different. Sometimes you're a team with design phases, powerful computers with build farms, etc.

Sometimes you're a dude in his basement with a shit laptop and a second job where every second count lol

meager spade
#

Closing and booting the editor takes me 1 or 2mins max and compiling is also super fast. We also live code our implementations once the class layout is made so we don't need to keep rebooting editor when implementing the logic

keen adder
#

Everyone's got different options that are right for them 😄

meager spade
#

I mean sure. But if you want to make anything viable in unreal your work station is very important

#

If your workstation is slow then you have to compensate somehow

#

I know that feeling all too well..

#

But Angel script? Urgh

#

There was a game released that used it

#

Can't remember what it was

keen adder
#

It Takes Two

meager spade
#

Ah that's it

#

But the majority of the people on that team were not progrsmmers at c++ level

#

That's why the ones they did have integrated Angel script iirc

lament flax
#

isnt there a popular crash on The Finals with Angel script

meager spade
#

The finals use it ?

lament flax
#

yeah i remember

keen adder
#

It's still programming the same as C++, and you still need to use C++ fairly often

lament flax
#

had it almost every 2 games

#

crashs the game

meager spade
#

:/

#

I'm waiting for verse epic made it its going to be reliable and easy to use...

keen adder
#

But it's let me recreate my Minecraft-like voxel game in unreal in just a month, complete with turn based combat and almost-online multiplayer

meager spade
#

Sarcasm btw

lament flax
#

now im currious what angle script is, i thought it was just some private the finals plugin name

keen adder
#

Which is crazy -- but just because of the literal 0 downtime when working

meager spade
#

It's a scripting language

keen adder
#

Yup!

meager spade
#

Bit like lua

lament flax
#

or py

keen adder
#

Basically yeah lol

meager spade
#

Py?

keen adder
#

If you don't need ultra performance, why not triple the dev speed 😄

#

imo *

meager spade
#

Python is a programming language

#

Scripting languages work on as layer on top of another language

keen adder
#

Either way it's nice that it sits on top of C++, it's not a replacement. So full C++ is still an option but it saves us from ever having to look at a blueprint node hehe

meager spade
#

Like blueprint is technically a scripting language

#

Just visual

keen adder
#

yeah

#

I'm gonna dip for lunch, GL guys! 🙂

lament flax
#

so angel script i just a language that overwrite a lot of UE native functions so you dev with it instead of doing c++ ?

meager spade
#

Not quite

lament flax
#

from i read on the home page, it sounds "cool"
but what are the down sides ?

meager spade
#

More limited

#

Ofc

#

But I dunno never used it

lament flax
#

souns like a in-between c++ dev and BP designer

keen adder
lament flax
#

thanks

#

but i prefer finishing learning c++ and UE without any extra scripting tool

lament flax
#

it saves the keys but not the values

latent heart
#

If the only value it ever has is 1, just use a set, not a map.

lament flax
#

no the value is a uint8

#

so it can be 0-255

#

i need to figure out how to serialize the values

torn zinc
#

I'm for some reason still struggling to getting smooth rotations based on mouse. The client jitters a bit still when i move the mouse slowly. Am i still not getting this right?

#

Enabling camera lag does seem to smooth out the visuals

meager spade
#

Timer on tick ?

#

Oof

torn zinc
#

Just something i tried, disregard that part 😄

meager spade
#

Why you replicating the rotation for

#

Control rotation is already all handled

#

I don't think I have ever needed to replicate the actors rotation to server

torn zinc
#

Doesn't work any other way, at least that i have tried. I'm doing 6dof, which might be why

meager spade
#

Right but there is better ways to do it other than this but require c++

#

If your BP only. Your very limited

torn zinc
#

Yeah i've noticed that. I'll keep it like this for now since it seemingly works, if i need to i might have to do some c++ instead

torn zinc
#

I assume this is the best way if i'm sticking to BP? Or is there a better way. If i introduce emulated lag it's bad.

blazing bear
torn zinc
#

Yeah basically

blazing bear
#

@torn zinc I did something like this recently. The actor that will rotate needs to have Start With Tick Enabled = false (I'm sure it exists in BP), and have a bool bShouldRotate. Inside the tick, have a branch checking for the bShouldRotate condition, when it's true, you set the rotation however you want. Have a RepNotify on the bShouldRotate, when it fires, it checks if bShouldRotate is true, if yes, then Set Actor Tick Enabled = true, if not, then set it to false. Now have the server call a function inside the actor that needs to rotate, the function shouuld start with a branch checking if Actor Tick Enabled = true, if so then return (leave the function), if Actor tick enabled = false, then set any parameters that define how your actor will rotate IF any, finally, set bShouldRotate = true.

torn zinc
#

Ok im gonna try that after dinner, thanks!

blazing bear
#

Np!

queen escarp
#

player controller

#

on client gets "access none"

#

but still works ?

haughty ingot
#

Think about who BeginPlay fires on for a player controller, here’s a hint. It exists for both the server and the owning connection.

sinful tree
# queen escarp

Begin Play of Player Controllers fires on both the client and the server. If you're running a dedicated server, it doesn't have widgets as it's headless, so it can't create a widget, and then you're attempting to add that widget to the server's viewport, but because it couldn't create the widget, you get the accessed None.

daring gorge
#

i have!

#

its a bit messy to setup but i can help

#

currently only using it to store/retrieve some data though nothing too fancy

#

hii

#

the oil rig is the only idea i could get for a cool conquest point on water

#

and yes rust is kinda to blame hehe

#

oh shit thats actually a very good idea, im gonna very much use it! thanks

#

i dont remember very well because i set it up long time ago, although let me look back into some of the code and let you know

#

also i do know some tutorials that might help you up

formal solar
#

If I have a reliable event that I call on server, let's call it event A, and in event A I do set timer by event for event B, will event B be reliably called even if I don't tick the box for reliable?

short arrow
#

If event B is not marked for replication then it would always be reliable

ripe lotus
#

Hey ppl, simple question, im confused.
i have a mesh on each pawn, i want each pawn to move it (client side, auth proxy), and i want that movement to be replicated to other clients.
what's the most common way to do that?
should i add an rpc or a replicated var on the client to send the transform every so often?
im reading the docs but im confused.
https://forums.unrealengine.com/t/trying-to-replicate-a-static-mesh-component-from-a-client-to-all-other-players/1761002
https://dev.epicgames.com/documentation/en-us/unreal-engine/networking-overview-for-unreal-engine?application_version=5.0#actorreplication

someone on the forums said
"Replication is Server to Client, Always. Then engine will not replicate changes on a client to the server or any other client.
Clients must request the server to make the change, then that change can be replicated out to other clients."
so i wonder if i should do the rpc route.

grand kestrel
# ripe lotus Hey ppl, simple question, im confused. i have a mesh on each pawn, i want each p...

The absolute minimum information you need to send is Location and Rotation
The usable minimum probably also includes Velocity and possibly Acceleration
It would be good practice to compress the information in some manner also - possibly using an FFastArraySerializer so you only replicate what/when you need - after you have it working
This should all be contained within a struct

Then you send it from Client (Auth) -> Server via unreliable RPC on Tick
And the server Replicates this data with COND_SimulatedOnly

Client auth is very simplistic 🙂

ripe lotus
grand kestrel
ripe lotus
formal solar
#

of course I always want A to be reliable because I want the initial timer trigger to be guaranteed

short arrow
#

Also the way unreliable works is pretty specific, either you have enough bandwidth available that frame to send out the multicast or you don't. It's not checking per individual client

#

Packet loss is a different story though

#

We are way over thinking this. Event A being reliable and guaranteed does not mean Event B will be reliable

#

It's great if you can't afford Steamcore

#

It actually works as intended I've never found any bugs with it

#

You might be doing something wrong

kindred widget
torpid lantern
#

I'd like to build a widget that shows the number of connected players. I'm thinking of using OnPostLogin/Logout to send an event that counts the connected player and multi-casts the number to all player controllers.

Am I overthinking this, or is there an out-of-the-box way to do this?

short arrow
kindred widget
sinful tree
# torpid lantern I'd like to build a widget that shows the number of connected players. I'm think...

Begin Play of PlayerState can call to the GameState and trigger an Event Dispatcher that signals when a player joins the game.
End Play of PlayerState can be used similarly to notify when a player has left the game.
Any UI and widgets can then bind to that event dispatcher in the GameState to know when a player joins and leaves - make sure you have the event dispatcher pass a reference to the PlayerState that calls that dispatcher so that your UI can read the appropriate PlayerState.
If you ever need to construct something based on whoever is currently in the game, then yes, use the PlayerArray in the GameState to get all the PlayerStates.

torpid lantern
#

Thanks both!

fossil spoke
#

Its terrible for other reasons.

#

Namely that each of those nodes is likely creating a new UObject for every call.

#

GameSparks had a plugin that had a similar design

#

UI Designers would go crazy with their nodes

#

Throwing them on Tick and in for loops

#

Creating crazy amounts of Objects

#

We ditched GameSparks after that.

#

So it was a short lived issue for us.

#

You are likely better off creating a Struct with the same layout as your expected data and exposing that instead.

#

If not, then you are kinda shit out of luck.

#

Probably

nova wasp
#

Is there a nice way to send somewhat large amounts of data (~100kb) that isn't me just sending an omega rpc?

#

I currently just yolo it into an RPC and it's of course turned into a large object rpc

fossil spoke
#

You could just open your own socket?

#

Stream it through that socket

nova wasp
#

I could probably look into it but I have no context for what a socket is here

fossil spoke
#

Just a TCPSocket

nova wasp
#

If it was static why would I send it?

fossil spoke
#

@nova wasp Take a look at FTCPSocketBuilder

nova wasp
#

Ah, so this is what python remote calls use

#

Hilariously the rpc is working... okay-ish

#

I could heavily compress it and I probably should

fossil spoke
#

RPCs arent exactly designed for large data

nova wasp
#

100kb is fucking massive beyond words for an rpc

#

that is like 20 separate rpcs end to end

#

it's not a lot of data at the high level but you have to consider that most rpcs are like 100 bits

#

of course, this is mostly for two things

  • initial world state
  • the occasional "you are being yelled at back to this state" rpc
#

Let me see if I have a network profile of it

#

server to one client

#

replicate the texture data? what replicates that?

#

Does anything send rendertargets over the network built in?

fossil spoke
nova wasp
#

yeah that is... not something that implies it being a texture makes it easier to send over the network

#

the data is arbitrary, it could be anything

#

nevermind...

hoary spear
#

TcpSocket ftw!

nova wasp
#

My other hilarious attempt: one giant fastarray

#

for each type of thing

#

it actually worked, but quickly starts capping out how fast it sends updates

fossil spoke
#

Just use a Socket man, its what they are for.

nova wasp
#

yeah, I guess I still also have another more "per object" transmission that's more typical of actor replication

#

because I am foolishly tiling at windmills not using actors here I am in for a bad time

fossil spoke
#

You might be able to use a UChannel but I havent looked into that

nova wasp
#

UDataStream maybe in Iris

#

they are incredibly annoying to make extensible because epic did not consider anyone would

fossil spoke
#

Im stuck in UE4 so not sure how much has been made better

hoary spear
#

Sounds like it would do about the same as a streaming socket

#

Guess theres no real-time network transmission options in UE yet

fossil spoke
#

Sockets are the option

#

...

#

They are literally right there, they are easy to use.

nova wasp
#

I imagine coming up with the hard parts of how to stream the data is the user's problem?

#

Do they require me to come up with acking the pieces?

fossil spoke
#

You just convert it to a byte array and push it through the socket

#

No

nova wasp
#

sick, this sounds great then

hoary spear
#

It handles that itself

nova wasp
#

thank you all for the suggestions

fossil spoke
#

The Socket API is really friendly

hoary spear
#

I wonder how a realtime protocol would compare to regular sockets tho

#

Probably wouldnt even be worth the implementation

nova wasp
#

The hilarious part is that the netblobbed reliable rpc is already kind of doing what I want

#

of course this is wasting some bits I imagine but... meh

#

but yeah I imagine the socket won't get cute with splitting it up 200 times

tardy fossil
#

Uchannels are pretty easy to use

keen adder
#

Hey broskis, is there a way to get a list of all connected PlayerControllers, or Controlled Pawns?

#

Basically when someone drops an item, I just want it to check if anyone is nearby to auto pick it up

marble gazelle
#

on the server you have all controllers, I think game mode and or game state knows about them

keen adder
#

Oh nm, looks like I can do GetNumPlayerControllers, and then loop over GetPlayerController(i)

#

Might be able to do it through ugameplaystatics 😄

kindred widget
#

Inventory or held items should have nothing to do with player controllers. :/

keen adder
dark parcel
#

Why do you need to get the controller

#

The pawn are the one that physically there

keen adder
#

Works perfectly 😄

#

I don't see an option for GetNumPlayerPawns, but ^ works great

dark parcel
#

I would assumed the item will be dropped somewhere in the level, then it would just check nearby player pawns to be considered for the loop

keen adder
#

How would you get nearby player pawns, if not looping over them and checking their distance?

#

But you're right, because players might be in a different Level at some point, in which case this code may error

#

I guess GetActorsOfClass may work better? Or GameTags

dark parcel
#

You can loop and check the distance I am just not sure why you want to loop according to the number of the players in the world.
Imo it can just be the relevant pawn near the items

keen adder
#

Relevant pawn near items

dark parcel
#

When the item drop, get the location, do a radius trace filter it with player character.

#

that will be the relevant

#

then I can just loop over them

#

so Player 7 at the end of the world don't need to be considered

keen adder
#

Oh, isn't that expensive to perform every tick?

dark parcel
#

there is no tick involved tho

#

I thought you are initiating the suck upon item drop

keen adder
#

Oh no if the item drops on the ground it can sit there until it expires, if no one grabs it

#

like minecraft

dark parcel
#

I wouldn't say it's expensive at all either, but you certainly don't want to send rpc on tick when you don't have to

#

You can just check for overlap

#

the item can have Collision component

#

on Overlap -> suck the item

#

no need to check every frame

keen adder
#

Yeah was wondering that too, not sure how expensive overlap is either as i assume it's doing the same traces internally

#

And what if players have some sort of upgrade that increases pickup radius

#

I figure individual checks might be easier

dark parcel
#

most mesh in the world already have collision anyway

#

the item shouldn't be an exception

dark parcel
#

instead item reacting to player

keen adder
#

Thanks for the suggestion!

#

So, is there any way to delay destroying an item for clients?

#

Ex: An object moves to a position and gets destroyed.
The clients see it's movement 0.5s delayed, but still see it get destroyed at the same time as the server. So it appears to be destroyed 0.5s too early.

#

Unreplicating it at the end would be nice, so the client can destroy it on their own time. But I don't think it's possible

chrome bay
#

GetWorld->OverlapMultiByChannel or whatever and filter the results

#

Pickups querying players is wierd though. Should really be players querying pickups. You're bound to have far less of them to start with.

keen adder
#

Yeah player overlaps -> items definitely makes sense

chrome bay
#

Well, you still need to set them up with a valid collision profile ofc, but scene queries are fast

#

Overlap events are slow. You can turn them off and quite literally get 50% of your CPU time back.

keen adder
chrome bay
#

I mean ultimately they are the same thing, but yeah that's a scene query. Overlaps are also scene queries though tbf

#

But they're costly because they are updated everytime something moves, which is usually just wasteful

hoary spear
#

Arent they updated async ?

#

On some worker thread?

keen adder
#

Another interesting question: If it's possible to force OnRep, even if the var is the same?

chrome bay
#

Yeah, but only in C++

#

Use DOREPLIFETIME_CONDITION_NOTIFY and pass COND_Always as the last argument

keen adder
#

I've got an FString that stores the animation, and OnReps to clients. BUT if the animation is repeated, like Attack is done twice in a row, it won't rep it

#

O dang nice

chrome bay
#

If it's done twice in a row, it won't replicate twice anyway

#

Server sends all property "differences" at the end of the frame. If it thinks client already has a value, it won't send it again

keen adder
#

Yeah that's my question

chrome bay
#

Which is ofc by design, replications only job is to ensure the state matches

#

And it needs to do that as efficiently as possible

keen adder
#

Yeah, might have to send along a multicase if the attack is repeated

chrome bay
#

COND_Always is usually used when you are modifying replicated properties ahead of the server, for prediction or something. Rarely has much use though.

lost inlet
#

and COND_Always is clientside

chrome bay
#

Yeah

lost inlet
#

a multicast RPC is more appropriate for these one shot things

chrome bay
#

You could use an incrementing counter also, that would technically qualify as "different"

keen adder
#

My issue is that the Client who requested the multicast will also get hit by it

chrome bay
#

but ye, multicast might be what you want here

keen adder
#

Like, Client does "Attack", then "Attack". It obviously knows to repeat it properly.

Requests a multicast from the server, multicast comes back and forces is to run "Attack" again (a third time, now)

lost inlet
#

yeah so ignore it?

#

you could send a client RPC from the server to each individual player except the one you want to ignore if you really wanted, unreal doesn't have an easy mechanism for multicast RPC filtering

keen adder
#

Eh it just gets odd. If I do if(Anim == "Attack") return , then the other clients would ignore it, as they were already set to "Attack"

keen adder
lost inlet
#

well that doesn't even sound like a correct condition for ignoring it

#

like you can tell if a pawn is locally controlled and therefore has predicted the action

keen adder
quasi tide
keen adder
blazing bear
#

Is the HasAuthority() function not available in an actor component class? I can't access it somehow

chrome bay
#

I would also strongly consider using FName not FString if you are doing string comparisons like that

#

Or tags, even

lost inlet
#

Or enums

#

but yeah like 3 better ways than a string

blazing bear
keen adder
#

So what's the deal with IsLocallyViewed()?

#

My player uses a CameraActor that follows the pawn (and does some other stuff when needed), yet IsLocallyViewed() for all pawns at all times. Is it just better to use "WasRecentlyRendered?"

lost inlet
#

IsLocallyViewed is true if the pawn is a view target for a local player controller

#

and when possessing, your local pawn is likely to be the view target

#

it's not a visibility check

candid quail
#

Hello guys I have a question. Can a pointer to asset be replicated? I have a AnimMontage, that I know is loaded on every peer, can I replicate a direct pointer to it (instead of soft ref)

UPROPERTY(replicated)
TObjectPtr<UAnimMontage> Montage;

#

will appreciate any info ; )

chrome bay
#

It can yeah

candid quail
#

And what happens if this montage is loaded only on serwer, but is not in memory on peer? Will it still work?

lost inlet
#

depends on the value of net.AllowAsyncLoading

#

if it's false (the default) it will hitch

candid quail
#

hitch? I thought it will not play at all

#

ohhhh you mean it will block load?

lost inlet
#

read the cvar description

#
    TEXT("net.AllowAsyncLoading"),
    0,
    TEXT("Allow async loading of unloaded assets referenced in packets."
        " If false the client will hitch and immediately load the asset,"
        " if true the packet will be delayed while the asset is async loaded."
        " net.DelayUnmappedRPCs can be enabled to delay RPCs relying on async loading assets.")
);```
candid quail
#

ok i understand, so it will always load, it variable is false it will bock load, hence hitch

#

good, thank you very much

fringe dove
#

When serializing a struct for an RPC or replicated property is there a way to make sure it is byte aligned (for better oodle dictionary compression)? Or are they all packed into the Bunch as bit aligned with no control over it depending on what came before?

#

like can you read from the Ar an amount of padding bits to add/read to get things back into byte alignment?

verbal vapor
#

I made this object on my map

#

first of all, how do I get reference to it so i can rotate it - triggered by my character input action

#

and how does the replication works here?

lament cloak
#

How, if possible can I limit the tickrate of the server in PIE?

fringe dove
# lament cloak How, if possible can I limit the tickrate of the server in PIE?

I think it may not be possible (someone correct if wrong), pretty sure it is all synced together; if you need to debug blueprints in dedicated server and another instance you could launch two editor instances and limit the server with t.maxfps, and also turn off the stuff that slows down unfocused windows in the editor settings

lament cloak
#

Ya, I think that's the way to go sadly. Or I just suck it up and package the server

magic vessel
# verbal vapor

First point, you'll want a soft actor reference and then you should be able to select the actor in the loaded level

#

As for the replication, you should be able to add a rotating movement component to it that (if memory serves) replicates the rotation for you

#

Then you just add to the rotation on the component

quiet yarrow
#

Is there a better way to do this?

#

im noticing some stuttering after this. Trying to keep it as stable as possible since it involves physics

frail barn
#

i have an issue with a minimap camera
this logic perfectly works with main camera, and makes visible characters of the same team to each other
but a minimap camera always showing team1 units, ignoring this check
how to make it affect another camera too?

frail barn
#

thanks god

queen escarp
sinful tree
# frail barn i have an issue with a minimap camera this logic perfectly works with main camer...

This seems strange and not sure why you need a multicast for this. Minimap stuff is almost always something that can be handled entirely locally based on data about the actors you're trying to represent within the minimap, so that means it almost always could be handled through OnReps and appropriate already locally triggering events (like begin and end plays). A multicast could maybe be used with a minimap if you're trying to do something like a "ping" on the minimap in which case a player would need to communicate to others the location of that ping, it's not something that late joiners would necessarily need to know about, and it's not something that needs to stick around, but that doesn't appear to be what you're trying to do here.

Team information is usually something you would store within the PlayerState if it's only players that can have a team. If you have AI or other actors that you want to have on teams, then you'll likely need to utilize the pawn to store that information. I'd highly recommend aginst using a Name for teams, and instead use an enumerator or GameplayTag, the GameplayTag being a bit more flexible to use. You can use OnReps of the Team variable to signal an event dispatcher that can notify your minimap of the pawn's team that changed - the minimap can also check the owning player pawn's team value against it, and if they match, then you know that they are on the same team.

worn flint
#

hello does anyone have a good video/website to understand what I need to change to make my custom movement component compatible with unreal's network prediction ? preferably in c++ but I could manage with blueprints, thanks

queen escarp
#

ohhh

#

tips on workaround/replacement

sinful tree
#

If you're only working in blueprint, then all you really have is an event in the PlayerController when their pawn changes, On Possess

frail barn
queen escarp
daring gorge
#

are rep notifies reliable?
for attaching my player to boat im doing it on server and setting it as a replicated w notify variable, on the notify func im calling the attachment so any new comers and the client themselves know of this attachment, however its not really syncing" up, sometimes the client doesnt snap to the location yet is attached

daring gorge
#

never mind people, im literally stupid. it was the collission

#

is it a local function that gets called on each client?

#

but it acts on the client with their copy of the variable right?

#

i see

#

seems reliable to replicate stuff

sinful tree
# frail barn yes, i use this logic for "pings", and its bugged same way i try to place this l...

Well, it boils down to:
Server replicates variables to clients and can call multicasts and run on client RPCs (which execute on the client that owns that actor).
As a client, you can only send Server RPCs on actors that you own.
Any data that you want to share with clients need to be replicated through replicated actors by setting replicated values on the server or sending those RPCs. Those actors need to be relevant to the client in order to receive the information as the actor wouldn't exist otherwise.

So if you want something to show and hide based on a Name value, then you should be setting the value as you need while running on the server and using the OnRep of that value to trigger the event that would then cause things to change as needed when the new value is received.

daring gorge
#

i mean i would only chose to use it in sitaution whre im sure that the value will change

#

for example the driver once seated cant be set to another one, and if he leaves then the variables to go null ptr so i believe that works

#

multicasts ruin my project because irrespective of stuff being set, it goes ahead

#

wouldnt i want to run something like that on multicast though?

#

right but as you said the repnotify wont work, then i wont really have a choice?

#

wow im gonna need some chai to do this

#

the collission being the problem and then this repnotify/multicast

#

i surely have to revisit a lot of stuff i wrote like 2 years ago or smth

static owl
#

This is my first time using Blueprint Interfaces. I have two doors: Safe Door and an actual Door. What am I missing here? If i disable the interaction input for the top (safe door) then the regular door opens fine and is replicated, and vice versa. If i leave both interaction inputs connected then nothing happens for either door (although if i put print statements at the end of the run on server and multicast, they are both printed).

#

Oh and this is in my Character blueprint^^

sinful tree
static owl
#

This was from Matt Asplands Replicated door tutorial!

static owl
#

For instance if I have the Safe blueprint like this:

#

and then the character blueprint has this:

sinful tree
#

The purpose of an interface is to allow you to communicate to another class without having to know the specific type as you implement that interface in the target actor. If the target actor doesn't have the interface, then the interface function will not be called on it.

A cast attempts to convert an object variable's type to also allows you to communicate to another class but requires you to know the class (and also creates a dependency in your blueprint to that class) which then allows you to call the already known about functions and access the variables of that class. If the cast fails, then the output reference will be invalid preventing access.

#

Once you're running on the server in your character, you can call the interface in which case you can call any other multicasts or set any replicated values that your door can then use without having to involve your character blueprint.

static owl
#

Im sorry im very new, but im trying to understand. Do i need to remove the casting part, and somehow after TRUE branch, I need to send the interact message to the SAFE?

daring gorge
#

this is your message

#

you dont need a hard reference to that class anymore. think of it as if you had not just safe but many other things you wanted to interact with, would you send a message to that item and then on that message run a function or would you keep casting and binding an event and individually write down all your code in player/whatever that wants to interact

#

this is what that message calls

#

and instead of binding the event i believe you can just call a server RPC that sets the rotation right after the message comes in

static owl
#

@daring gorge Would you have time for a discord call so i could share my screen? im still a little confused!

#

if not i understand!

sinful tree
#

No casting is needed for this.

daring gorge
keen adder
#

Heyas, any way to know if a remote pawn is controlled by a player or AI?

#

IsPlayerControlled() returns false for everything

#

unless.. beginplay is just lying again -- in which case, which event to use??

static owl
fossil spoke
#

AI Controlled Pawns dont have a PlayerState by default, you would need to set that up yourself.

keen adder
#

Nopenope

keen adder
#

That's why I ask if there's some correct event to use, as seemingly nothing net-related works in beginplay

fossil spoke
#

Yeah probably because the PlayerStates havent replicated that early.

keen adder
#

and I feel odd using an arbitrary timer

keen adder
#

Or like, how is it done in most games

fossil spoke
#

Wait until the PlayerState calls BeginPlay

keen adder
#

And for remote AI? (which have no playerstate OR AIcontroller)

#

How/When are they initialized remotely

#

Atm I have no way of knowing if a pawn is controlled by AI by a remote player, as it doesn't really trigger any playerstates or controllers

#

so it just looks like a Pawn that's not net-ready yet

fossil spoke
#

Look at the AIController

#

It should have a property called bWantsPlayerState

#

This should give a PlayerState to your AI Pawns

#

If its enabled

keen adder
#

Oh interesting, but then am I able to specify which Playerstate? Or do the AI pawns get the same PlayerState as human players

fossil spoke
#

They get the same PlayerState

#

You would need to override the functionality to inject your own.

keen adder
#

Which seems like a very odd way of just knowing when they're net-ready lol

#

Aight nvm, was hoping there was an easier solution but guess not

#

Unreal could really benefit from an OnNetReady() event or something

fossil spoke
#

🤦

keen adder
#

🤦‍♂️

late stratus
#

Anyone ever run into an issue where Mutli Box Trace By Channel doesn't work on their dedicated server, seemingly for no reason? I've triple checked all the obvious reasons it wouldn't generate a hit event, and still I'm stumped. I'm getting the feeling that it's some hidden setting

#

I'm calling it in an Anim Notify State during an animation montage, when a sword is swung

fossil spoke
#

What do you mean by "doesnt work"?

sinful tree
# static owl So do you think the RPC's should be in safe logic? Like the custom events?

An RPC to the server must happen on a client owned actor. If you attempt to call a server RPC on any other actors, like your safe, it won't work.
You can run mutlicasts on other actors when executing code while running on the server.

Input (which would happen on something normally owned) > Detect Interactable Actor > RPC to Server with actor reference > The RPC should then call the interface on the actor reference passed through the RPC.
The implemented interface in the actor (which would be running on whatever actor you call it on if it implements it, and also on the server if you called it in the RPC) will do whatever you want it to do.

An interface can be called locally on the client, but then that code is only going to be executing on that client. An interface is a means of calling a "generic" function that classes can choose to implement and each class can have their own implementation - they don't specifically care about any networking themselves as it's just like calling a function.

late stratus
#

The animation montage is running on both the server & client through a gameplay ability. The hit is successful on the client, but for some reason, not the dedicated server.

I've read that VisibilityBasedAnimTickOption can potentially affect that, and have changed the property, but to no avail.

static owl
#

Does this look better?

Character BP.

#

Safe BP:

static owl
sinful tree
#

No. After your branch, call an RPC to the server passing in a reference to the actor you want to interact with.
Once running on the server, use the referenced actor from the RPC and call the interface.
The interface implemented on the actor can then do whatever you want - exactly like how you're calling the timeline. You don't need to have separate events for each object your character may want to interact with in this way - just one RPC for causing an interaction from a client to the server, and then letting the server replicate anything necessary back VIA the actor itself rather than the character that first initiated the process.

static owl
sinful tree
#

Sorry, don't do voice.

static owl
static owl
sinful tree
#

That is one type of RPC, yes.

#

Three types of RPCs:
Server (Run On Server) ---- Will execute on the server if executed while already running on the server on any actor, but if requesting to execute on a client it will only start to execute on the server if called on a client owned actor.
Client (Run On Owning Client) ---- Will only execute on the client that owns the actor. I believe if there is no link to a client being the owner it'll execute on the server
Multicast (Executes On All) ---- Can only be called by the server and will attempt to communicate to all clients, so long as the clients have that actor relevant.

static owl
#

im sure this is still incorrect lol

sinful tree
#

That is closer.

#

You need to pass a reference to the actor you want to interact with through the RPC (You'll need to take the "Array Element" pin and have it connect into the RPC)

#

Change the "SAFESM" type to "Actor" and rename the pin to "Actor" then use that to call the interface in the RPC.

static owl
#

I was originally asking because I have two doors, and the code looks the same^ but i could only operate one at a time. If the InputActionINTERACT (at the start) was connected to both sets of code for the different doors in my character blueprint, then nothing would happen. It would only open if one was disconnected. Im going to change the code to the updated version and see if i can use both now

sinful tree
#

Now you can rename that RPC to be something like "Interact ON SERVER".
This will work for any actor that implements the interface, so yea, any doors you place should work fine. If you want to create more actors that utilize this functionality, all they need to do is implement that interface and code out what happens when someone interacts with it.

static owl
native tapir
#

I'm trying to create multiplayer game and I have some question.

I want to damage system according to which body is hit.

For example, if bullet or sword is hit head then dealing damage 50, if bullet or sword is hit arm then, dealing damage 20

In this circumstance, server need to know client is cheating or something.

So, I need something like rollback system to get sort of information about the actual head or body physics body is actually that position certain of that time.

To achieve this, I started looking at charcter movement component but I'm not sure, this component actually can handle physics body rollback system.

Does anyone know how to figure it out this problem?

fossil veldt
woeful ferry
#

Hi,

I have a native actor class I'm spawning on the server side that doesn't get replicated. Anyone knows what could cause it?

Ctor:

{
    PrimaryActorTick.bCanEverTick = false;
    bReplicates = true;
    bAlwaysRelevant = true;
}```

How I spawn it: 

```void UVallhundVoxelWorldManager::Initialize(FSubsystemCollectionBase& Collection)
{
    Super::Initialize(Collection);

    UWorld* World = GetWorld();
    if (World->GetNetMode() != NM_Client && World->IsGameWorld()) 
    {
        WorldManagerActor = GetWorld()->SpawnActor<AVallhundVoxelWorldManagerActor>();
    }
}```
pseudo wagon
pseudo wagon
# woeful ferry AActor

AActor does not have RootComponent by default. Without RootComponent your actor won't get replicated. Add RootComponent or set bAlwayRelevant to true.

woeful ferry
#

I guess AInfo is better for these purposes

queen escarp
#

hey im creating an actor from a character to the server (all works) inside that actor im Timelining movement around the map (this works but not showing same for Server/Clients) which is the problem

#

how would i replicate that character so the client tells the server where it should move etc ?=

#

this is how im moving the Actor

#

i need the player to tell the actor to move via the server rather then have the actor moving itself on server since its local side and cant talk with the server right

magic vessel
#

Some basic questions here:

  • Is the actor you are trying to move definitely replicated?
  • Is the actor setup to replicate it's movement?
queen escarp
#

it is replicated
it is set to replicate movement

#

but i changed it calling the movementpart from the character bp (owner) then everything works

#

i knew it would its more what practice is best when creating an actor on the server how would u "controll" it via the client

#

since the other way i only know how is using the CMC which is very costly

#

was the settings on the Actor

sonic frigate
#

Hey guys

I have **multiplayer widget( cull) **problem
There is a nametag above each players ( child component in Pawn blueprint), host always can see others, but if a client is too far deactivate or cull other players, when REAPPEAR in certain distance the widget reset all values and name is incorrect.

Any idea, what event can I call to set name again ?
( temp solution: I increased Net Cull Distance Squared, )

storm abyss
#

Hey there, I’ve been following the tutorials from GameDevRaw on how to create an online game with blueprints and I have reached a point in the editor where I when play a standalone game I can create a server, it shows up in a server list for another player, I can join with that other player and the game can start with both players. But when I made a build for the game to test it out on two different computers, when I try hosting, it doesn’t show up in the servers list on the other computer with the build. Did I forget to check a box that allows it to actually create servers or be online or is it some other issue?

#

I think it might be find sessions that isn't working but I don't know

#

it also seems when I play in the editor it doesn't matter if it is set to lan or not, the server always shows up in the list

boreal bison
#

Does anyone know how I could conditionally make a static mesh in my level see-through for just one player but normal for everyone else?

#

I basically want to have one player who can see through all the ceilings in my level

silver lagoon
#

I have a question I can’t find an answer to online; does a replicated ACharacter, seen by a client that doesn’t control it, still execute all the ticks of its components?

keen adder
#

2 separate actors. A replicated one and a personal one

#

Heya guys, RPCS can not have return types right?

#

Like it won't do anything?

fossil veldt
#

Yo so - i'm a lil rusty on gameplay network programming, quick question for you peeps - how does attachment work in a networking context? If I do AttachToComponent on the server, does that rep down to clients or do I need to multicast the attachment

quasi tide
#

I think it is replicated. I can't recall me ever doing an onrep/rpc to attach on clients.

#

But would it really matter? Server is authority on positions and the client would follow the server's position.

#

So as long as it is attached on the server, probably doesn't matter much.

fossil veldt
#

and if you don't want that behaviour - aka you want mismatching positions on an actor

quasi tide
#

Yeah - attachment is onrep'd @fossil veldt

#

USceneComponent::SetAttachParent marks the field dirty

#

And there is an onrep for the attach parent

burnt coral
#

So my understanding was that Switch Has Authority execution pins only get called if it happens on such.. For instance the remote would only happen if a client uses it.. Is this wrong? Because I am having an issue where if my player moves left / right / or backwards then it creates two line traces.. So I am misunderstanding something here??

dark edge
#

you care if you're locally controlled

burnt coral
#

Isn't that the same thing?

dark edge
#

no

fossil veldt
burnt coral
#

See I am not understanding something.

#

Can you elaborate please.

fossil veldt
#

I wonder is there a way to do attachments without triggering the onrep

dark edge
#

Your character would return Remote on my machine

#

if we're both clients

#

You don't want that, you want your character to trace only on your machine

fossil veldt
#

like i actually don't want the behaviour of server + client attachment in this case, i'd like an item to be attached to the 1P mesh on the local client and then for everyone else it's on the 3P mesh

dark edge
fossil veldt
#

ideally

quasi tide
burnt coral
dark edge
#

Your character on your machine is remote and locally controlled.

#

Other clients characters on your machine are remote but not locally controlled

#

Listen servers character is authority and locally controlled.

dark edge
#

The 2 concepts are orthogonal. You can be locally controlled or not, and you can have authority or not.

burnt coral
#

So remote is just another way of saying a replicated entity in the world that is controlled by a client?

Also do you mean orthogonal in the sense that they do not affect each other directly? ( but we assume they can do it indirectly, maybe? )

#

Appreciate your patience.

haughty ingot
#

Server has authority over all actors spawned on its instance, clients don’t have authority over actors spawned on the servers instance. If the server spawned an actor, it will be the authority on the actor, the clients will not be. To them it’s a simulated proxy. Being controlled by something doesn’t necessarily have anything to do with network authority.

opaque forge
#

So I'm having a really weird issue regarding replicated physics. When the game starts, all my replicated physics objects work as well as can be expected. However, once a player picks one up (and gains ownership) and drops it (and loses ownership), it becomes extremely buggy:

#

Anyone know what to make of this?

#

It also happens if another client player picks it up, although I wanted a high FPS for the demo so I left it as one player

haughty ingot
opaque forge
#

Both

haughty ingot
#

You check the box and you set it to simulate physics at the start of the game?

opaque forge
#

yeah

#

The parent class sets it to simulate physics on beginplay

#

But I check the box anyway

haughty ingot
#

And when you drop it, who sets it to simulate physics then?

opaque forge
#

the parent

#

from c++

#

lemme pull that up

haughty ingot
#

Which connections

opaque forge
#
void APickupActor::Detach()
{
    GetRootPrimitive()->SetSimulatePhysics(bWasPhysicsEnabled);
    GetRootPrimitive()->SetCollisionEnabled(PrevCollisionType);

    DetachFromActor(FDetachmentTransformRules(EDetachmentRule::KeepWorld, true));
}
haughty ingot
#

Is that function called from an RPC?

opaque forge
#

repnotify

#

And I know it works because the detach works properly

haughty ingot
#

Well attachment replication is already handled via a rep-notify. But shouldn’t matter anyway

#

Which type of physics simulation are you using?

opaque forge
#

rigid body

#

I'm a fucking...

#

I replaced bWasPhysicsEnabled with true and it worked

#

I think

#

I need to test more

haughty ingot
#

Is the server calling that rep-notify as well?

opaque forge
#

yeah

haughty ingot
#

So just know that attachment is already handled from a rep-notify. When the server executes that function it’s going to set the attachment again when the notify fires, which is fine. But just know it’s happening twice

#

See AActor::OnRep_AttachmentReplication()

opaque forge
#

Well thanks for the help I guess

#

Is SetSimulatePhysics also replcated?

haughty ingot
burnt coral
opaque forge
#

Basically, it checks whether the current piece of code is running on the server or the client

#

For a replicated actor, authority = server and remote = client

#

Although if a client spawned an actor, it means the client has authority and no one else knows it exists

worthy oak
#

Authority and remote actually has to do with who owns the object it is not necessarily the server

opaque forge
#

The server still has authority over player-owned actors

#

Like pawns

worthy oak
#

But in your own example if a client spawns something they are the authority

opaque forge
#

Yes

#

But ownership is something completely different

worthy oak
#

So its authority over the object it isn’t a network check

opaque forge
#

?

dark edge
opaque forge
#

exactly

burnt coral
#

Thanks for help.

#

I appreciate it very much.

keen adder
#

Heya guys, can Clients spawn actors?

opaque forge
#

Yeah, but they'll be client-only

keen adder
#

I ask because I'm making a large open world game. So in some situations, clients will be far from the host, and thus the host will not have their area loaded

#

So if the host spawns the items, they'll fall down into the abyss

opaque forge
#

In that instance, no

keen adder
#

Any way way to give ownership after they're spawned?

opaque forge
#

The host needs to have the area loaded. If it's not, actor spawning is the least of your concerns.

keen adder
#

Same goes with enemies and AI, I might have to transfer ownership when to whoever is closest

#

But think of games like minecraft, valheim, etc. Where clients can be literally miles away from the host and still play normally

opaque forge
#

The host still loads those areas

#

They're just not rendered

#

Unreal Engine uses a server-authoritive model. If you're looking to change that, you're gonna be in for a world of hurt

keen adder
#

lol

opaque forge
#

But Unreal has a really powerful open-world system out of the box, and a lot of great resources on how to use it

#

I'd start there

#

Don't re-invent the wheel

keen adder
#

Oh interesting, though I find unreal tools are VERY hard to customize

#

like you either cookie cutter exactly what they have, or make your own from scratch

#

Though mine's a voxel game, so already the host is generating the world as fast as it can for a decent draw distance

#

Can't imagine it also generating 3 other areas at once, when players split up

opaque forge
#

Well that's how Minecraft works

#

And every other open world game I can think of

#

(there's a reason the server starts to chug in MC when players split up and load new terrain)

keen adder
#

Oh interesting, I didn't know it did

#

Man this project just grows and grows lol

opaque forge
#

I've learned the hard way that it's important to have a strong foundation before getting into the details like replicated actor spawning

#

Notch had "cave game" years before he made it open-world

keen adder
#

Oh yeah, I've got a pretty good voxel base with turn based combat and all

#

works great in multiplayer too

#

BUT

opaque forge
#

nice

keen adder
#

when players split up, nope

#

All broken

#

lol

opaque forge
#

Yeah the host needs to have all areas loaded

#

That's a major performance concern you're gonna have to think about

keen adder
#

Yeah because the rendering itself is nothing, but actually generating the voxels is what takes the time

#

Especially because mine are much more details than minecraft

opaque forge
#

For instance, Minecraft has a separate render distance and "simulation distance," and world processing that would need to be synced is only done within the simulation distance

keen adder
#

Hmm interesting, yeah and my shapes can be simple cubes for collision too

opaque forge
#

Even if you think it might not work out in the long term, I highly recommend exploring some of Unreal's open world tools before ruling them out entirely

keen adder
keen adder
opaque forge
keen adder
#

Awesome

opaque forge
#

But keep in mind they were implementing their engine from scratch

#

I do modding, so I can tell you that Unreal is structured quite differently to the Minecraft engine.

keen adder
#

Oh yeah for sure

opaque forge
#

I would focus on what people have done in Unreal first.

#

Like Fortnite

keen adder
#

Fortnite is dedicated server though right?

#

So I'd imagine it can handle a lot more, not having to render the world it's simulating

opaque forge
#

Yeah, but listen servers and dedicated servers work on the same principles.

#

Also, rendering and simulating happen on separate threads

#

So the fact that you're doing both won't be too much of a performance hit

keen adder
#

Hmm okay, yeah thinking about it already

#

Would you happen to know the name of their Openworld sample?

#

I can't seem to find it

opaque forge
#

Also, I don't play fortnite, but I think it can be a listen server as well

#

The city sample?

keen adder
#

The great resources you mentioned

opaque forge
#

What I just posted

keen adder
#

Oh shit that's it?

#

I don't think that's gonna be an easy learning experience lol

opaque forge
#

Also, just google "Unreal Engine Open World"

keen adder
#

I have, I'm just worried about the engine generating procedual voxels for a bunch of players at once, as apposed to just flipping on/off premade areas

opaque forge
#

I'd say try to get a pre-made open world working first, then try to focus on dynamic generation

keen adder
#

Mmm shit, I've already got my minecraft game going, would hate to start over lol. But definitely a lot to consider, thanks for all the info man!

opaque forge
#

You don't have to start over

#

If you've already got the combat system and other stuff in place, you have a really strong framework

#

But if you've built the voxel system with the assumption that clients can be authoritive in generation, that's gonna have to go

#

That's just not how UE works

#

Or any mainstream game engine for that matter

keen adder
#

Oh I meant testing with pre-made areas, as it's already designed for loading chunks, breaking blocks, etc 😛

#

But yeah definitely a lot to think about here 😄

#

Thankya 😄

opaque forge
#

If you can figure out how to serialize your world at runtime in a format that's compatible with World Partition, that could probably serve you really well

#

But I don't know the details of your game

keen adder
#

The base of it is very similar to minecraft -- the other details aren't really that important in this circumstance

opaque forge
#

cool

keen adder
#

Do you mean like, saving the world to disk?

opaque forge
#

In minecraft the way it works is that the server has complete control over the voxel world. When you break and place blocks, the client just tells the server via RPC that it wants to break or place a block in a certain spot.

#

That's how I would do it

keen adder
#

That's how I'm doing it atm yeah

opaque forge
#

And also, make the particles that appear when she breaks the block completely client-side

#

No reason to waste bandwidth and processing power replicating those

keen adder
#

Oh? I replicated every single block in the particle!

#

Jk of course lol, server just says what broke

#

and clients take care of all the visuals 😛

opaque forge
#

just making sure lol

keen adder
opaque forge
#

yeah

#

Not really in the scope of multiplayer lol

keen adder
#

How would that speed things up though?

opaque forge
#

I assume you're saving the contents of your world to disk when they're unloaded

#

If not, ignore that part

keen adder
#

Oh nope lol

opaque forge
#

ok lol nvm

keen adder
#

I just save any block that was modified in a big tasty TMap

#

And then regenerate the world, plugging back in the changed blocks

opaque forge
#

oof

#

It might be easier to save the world to disk

keen adder
#

Haha 🤷‍♂️

opaque forge
#

Minecraft loads its worlds from disk significantly faster than it generates them

keen adder
#

Yeah I'll prob incorporate that later on, just trying to get it feature rich asap

opaque forge
#

Like, almost three times as fast

#

But I guess that depends if you expect players to enter pre-explored terrain much

#

And if they'll be updating it a lot

keen adder
#

Oh, I only generate like 5 blocks tall though (not gonna have huge cave systems), the big resource sink is actually creating the procedural mesh

opaque forge
#

Ah

#

Well you could always cache those meshes

#

But it's probably not worth

#

Also, you probably shouldn't be replicating the mesh

#

Tell the client about the voxel pattern and then generate it on the client

keen adder
#

Yeah that's why I let everyone generate their own world based on a seed

#

and only replicate changes made to it

#

But hmm, I think the simulation thing could be a good idea. Generate ultra basic collision for other players

opaque forge
#

I see what you were thinking with client-authorative generation then

keen adder
#

Yeah everyone explores their own identical worlds, and RPC back changes made

opaque forge
#

What I would do is have the server do base voxelization alongside the client, and then the client handles generating detail parts of the mesh

#

That won't effect gameplay

keen adder
#

Yeah that's what I'm thinking

#

Will also read a lot more into this in case of any other pitfalls

opaque forge
#

But look at Unreal's default open world system and see if you can use anything from it

#

Could be very helpful

keen adder
#

Right on will do, and will try to find as much other info as I can. thanks man!

daring gorge
#

i have afriend who did the same and even let people have their own lil radius to generate and delete chunks around em

opaque forge
#

Yeah that can cut down on network lag significantly. But the server still needs to have it generated as well

daring gorge
#

in my case the server spawns in the proc gen actor and replicates the seed, im making like 4-5 small islands at max in my game

opaque forge
#

I think Lego Fortnite does procedural open-world generation

#

Maybe you could try to research how they did that

#

*in a multiplayer setting

daring gorge
#

ive already made the terrain generation and even added in some monuments, ive even experimented with caves and such so, all we need is to layer up stuff basically and since my case isnt very complex i dont have much left to do

#

theres also an article for replicating proc gen

opaque forge
#

Really where?

#

I think @keen adder could benifit from that

daring gorge
keen adder
#

Oh hey sorry just explaining all this to my GF haha. But def gonna give it all a read over again after 🙂

daring gorge
#

i just have it bookmarked, yet to look into this myself

daring gorge
keen adder
quiet yarrow
#

Been having this issue with my client. The server sees it perfectly, but the client seems to be missing some info. Any suggestions or help is welcomed :)

glacial moat
daring gorge
daring gorge
quiet yarrow
glacial moat
quiet yarrow
#

I have it setup to RPC server from the player BP when you press E. Then it leads to the entire connection process within the wagon BP

daring gorge
# quiet yarrow yes, It is attached using a physics constraint

so i dont know how to solve your exact issue but i had issues replicating actors with physics so i tend to simulate physics locally, and as for the attachment i had this sorta issue so i made sure the clients were informed of the attachment through a rep notify

daring gorge
daring gorge
daring gorge
daring gorge
#

dont mind the breaking character but only when client knew of the attachment was this smooth, or else it would just lag around in the air whilst the boat would be going forwards

daring gorge
quiet yarrow
daring gorge
# quiet yarrow gotcha, so maybe thats the part im having a hard time grasping. What should I te...

you could use a rep notify? something like set the wagon as a variable and on the func call the attachment. this makes sure it is called on all the clients. if this doesnt fix it then it could be literally physics being replicated. physics actors do that, you can try debugging this part by simply using smoothsync component, if it works then it should be the physics, if not then sure attachment

glacial moat
daring gorge
#

right so the widget should have a character variable, the character it belongs to and you could essentially take the image variable from there and it should work easily

glacial moat
#

On event construct it casts to BP_ThirdPersonCharacter and stores it as a variable

daring gorge
#

UI is not replicated so imagine it as a local component

daring gorge
#

that way the UI works in respect to that character variable

glacial moat
#

I have the HUD widget that uses an event dispatcher to pass in to this widget what the image should be, then that character has that widget as a component on him

#

I just don't know what inside this widget should be replicated

daring gorge
#

UI cant be replicated

#

wait let me show you like a simple thing i have in my project

glacial moat
#

So I should just use the event dispatcher to pass the image directly to the character?

#

How do I set it so that the space is Screen If I do that?

#

Guess I'm trying to wrap my head around what to do after the character gets the image

#

I have it set to screen so that all the icons face the individual user (client)

daring gorge
#

ive sent ya dm

lament flax
glacial moat
#

In screen space so that all the icons face the client

lament flax
#

The space type doesn't impact anything on how to make that "replicated" :)

glacial moat
#

I'm just figuring what I need to replicate to get it to work properly.

glacial moat
lament flax
#

What i would do:
(Lets say you want to replicate the info using a texture, but it could be anything, a tag, some id, etc)

  • Have the actor with the widget component or the widget component replicate
  • make a soft ptr Texture(2D?) variable
  • make it replicated OnRep
  • in the onrep, load the soft ptr and apply it to the widget

Now to make it set on server (so it gets replicated) you need to call a Server RPC (with the texture as parameter) on the characters/widget components

daring gorge
#

^^

glacial moat
daring gorge
#

also you neednt use a dispatcher at all but if you do then you can use it as the alternative of on rep

#

just to say "ive set the image"

#

do arrays in bps when marked as onRep not call the onrep function when stuff is added?

verbal dust
#

I'm trying to set up a listen server and conect from an external network. Its worked fine on the local network between 2 PC's. It doesnt work with external network.

I've opened the port (17777) and have a public IP. I've used online port checkers and they are saying the port is closed. From what I'm reading this could be because the service (the unreal game) isnt listening, or something isnt working with port forwarding

cursive steeple
verbal dust
daring gorge
#

i see, im using 4.26 and my onrep func doenst hit when i add an element

cursive steeple
daring gorge
#

yeah that worked

#

weird way

cursive steeple
daring gorge
#

think i might just use fastarray replication and convert code to cpp cus why not

cursive steeple
verbal dust
cursive steeple
lament flax
daring gorge
lament flax
#

Thats good news

verbal dust
#

I allowed inbound and outbound for that port in firewall too

cursive steeple
verbal dust
#

ive set it to both udp and tcp on the router

#

so that should be fine

cursive steeple
#

other than your usual antivirus stuff I have no immediate ideas :x I'd definitely be interested tho when you find the reason.

verbal dust
#

Is there a way to troubleshoot ports? Want to figure out if its a router issue or a game issue first. I havent used port forwarding on this router before so it could be that

#

If I run netstat in command prompt would the port show up there while the game is running? because its not

glacial moat
neon obsidian
#

I'm clearly overthinking here....

How would I spawn an actor locally for each player knowing that one of them is a listen server?

I've tried making it a non-replicated actor that is only relevant to the owner.

fossil spoke
#

In what context are you trying to spawn the Actor?

#

All non replicated Actors are considered "local"

neon obsidian
# fossil spoke In what context are you trying to spawn the Actor?

Player State Server event runs through a series of spawn functions (Load save, create save, etc). Which then spawns a widget.

I'm trying to spawn a local actor that will hold the character "creator" that you visually see in that widget.

If I call the spawn within the server event, both users see the same thing and only the server can "change it" (It's still replicated somehow 🤔). If I spawn it on the client, it's reverse, they both see the same thing but only the client can use it.

fossil spoke
#

You want to check the PlayerController for IsLocalPlayerController

#

Only spawn the Actor that belongs to that PlayerState if the PlayerController is a Local PlayerController.

neon obsidian
#

ah, nm I found the issue 🙂

#

Thank you!

cold cipher
#

is there any tutorials about mesh visibility? like setting mesh as visible to other players only
doing a fps game,
but other persons should only see the third perso mesh

#

or should I use the same mesh for first person and third person view since I'm beginner on ue5

#

(or replicating a mesh with yourself being the one that can't see it)

dark parcel
#

That's not even network related?

#

You just need to tick bOnlyOwnerSee in the component panel

#

Or something down that line

thin stratus
dark parcel
#

Maybe I'm misunderstanding what he want

#

Isn't it just a component that only the owner see e.g first person hand

thin stratus
#

They want what you answered them: Only display FP Mesh to Local Player and TP Mesh to others.

That's a Multiplayer problem. So why is that not network related?

#

Or wydm with Network Related?

dark parcel
#

Cuz I thought ticking only owner see will do the trick. Regardless multiplayer or not

#

Since only the owner will see the mesh

thin stratus
#

Yeah but that's a Network Owner.

#

And the question is still about a multiplayer problem.

dark parcel
#

Ohh ok, well I never done fps before but I would suppose other character like A.I can also "hide" their fps arms from the player by ticking the box

#

Yea my bad

thin stratus
#

The Boolean is even worse. Cause it relies on the ViewTarget

#

You can tick that and change the ViewTarget and you will see the TP Mesh

#

Which is good of course, but the Boolean is shitty named

#

Booleans fwiw

#

But the problem is a multiplayer problem, even if the solution is useful in Singleplayer too

thin stratus
#

Most people for starters have the character's Mesh Component as TP and add an additional one as a child to that as FP.

#

Just make sure you don't add the FP one to the capsule directly, but rather to the Mesh when using a character

#

Add / Attach I mean

#

Cause the Mesh is smoothed so everything visible has to be attached to it

quiet yarrow
#

Anyone have an idea on what would be the best way to attach a playerpawn to a unpossed/ai pawn using a physicsconstraint?

#

this is my current setup just to get debugging with replication

#

just have no idea how to replicate a physics constraint tbh

#

i've done it on my player pawn, but I cant get it working with an outside object

cold cipher
dark parcel
cold cipher
#

I know, he mentioned me

chrome bay
chrome bay
reef dew
chrome bay
#

You usually have entirely separate first and third person meshes. Nothing about them should be replicated.

#

Add the -log argument. By default they run with no window

#

So they're probably all running in the background if you look at task manager

#

Should get a crash dump or log file somewhere you can look at

#

If not, launch it via visual studio and see why it crashes

#

seems okay, just outputting the available device memory I think

reef dew
#

thirdperson's arms are hidden and modular arms are used instead of them
viewport looks like these

chrome bay
#

Don't hide the third person arms. Use them for third person characters

#

hide the first person arms for third person

#

Doesn't make sense to do it any other way

#

None of your animations will match up

glass crescent
#

Hello guys ,
i am attaching one actor to another while spawning on the server side and then giving possesion to player controller , that object is coming under the parent in server side only but not on client side , so do i need to again attach it to that parent on client side ?

glacial moat
#

Hello, I am still having trouble with what exactly to replicate. I've tried different suggestions the best I could but am still having difficulty getting things to replicate. Or knowing exactly what to replicate and where. I was able to fix an earlier problem where the buttons were affecting both characters.

Issue : When one character clicks on the button, the icon should show up for that player on every client.

https://streamable.com/k1r92d

Watch "2024-09-11 08-19-32" on Streamable.

▶ Play video
dark edge
#

Widgets don't network

#

what you should be replicating is some struct or class CurrentlyCastPrayer or something to that effect, in the pawn

#

the HUD or widgets aren't doing the prayer, the Pawn is

glacial moat
# dark edge

So I cant replicate anything inside the widget blueprint or the widget itself?
I need to replicate a structure?
I'm still not understanding how to do it if I cant replicate the widget

dark edge
#

The UI isn't where a spell "comes from"

upbeat basin
#

Is FWorldDelegates::OnPostWorldInitialization delegate safe to use for checking if the menu or game world is being loaded? I am using the World parameter on the delegate itself to get the world name and compare it with my predefined menu and game level names in developers settings to determine which level is being loaded. But from time to time I'm getting a crash from World->GetName() function even though I have a valid check for world. Logs and callstack shows it's caused by GetFName().ToString(), the implementation of UWorld::GetName() with an access violation. Is there anything visible that I'm doing wrong here?

glacial moat
# dark edge UI should never be the source of data, just a view into that data

That defiantly makes sense when you put it like that, it just brings the next problem of how to get it to look like that on another client if I don't use the widget as the replicant. I can replicate the image right on the character, but how do I get it to show up above the head with the size and what not in the right place

dark edge
#

onrep -> look at the ActivePrayer -> set widget based on ActivePrayer.IconImage

glacial moat
keen adder
glacial moat
keen adder
#

So for example if you want a button to appear on everyones hud, your character would ask the helperclass (playerstate) to create a button on everyones hud.

Player -> Helperclass.CreateButton() -> Multicast to all HelperClasses -> Createbutton on player hud

#

I don't think you can create replicated components. You can have them replicated on replicated actors but I don't think they're as flexible

dark parcel
#

That's an option

dark parcel
#

Just have a replicated variable in the character or controller

#

On rep -> update widget

glacial moat
#

I've read that multicast only works if you dont want to count on it showing up on other peoples things, and should only be used for like emotes

dark parcel
#

Just avoid multicast completely for now

#

100% for anything stateful

keen adder
dark parcel
#

It's really as simple as replicating a variable

#

I have name tags for each player

#

They are represented by a fName, that lives in a character

#

OnRep -> get widget -> set text

#

No multicast should even be considered for something like this

#

Only lead to broken codes

#

You don't have to ask the server for anything, the server update the variable eventually if it's marked as replicated

#

The client respond accordingly with OnRep function. In your case just update the widget

glacial moat
#

Okay, right now I have a HUD widget that updates the ActivePrayerOverhead Widget on button click, Should I use an Event dispatcher to Character, then set the ActivePrayerOverhead Widget from there?

dark parcel
#

Who's updating what

#

Do the client have a say on what image it will be?

#

The tip here is that, the only way for client to talk to server is via server rpc

glacial moat
#

So (currently) my HUD widget has all the buttons, when a button is clicked, it sends what image should be updated on an event dispatcher to the ActivePrayerOverhead widget.

dark parcel
#

So if you want to click a button that change the variable for everyone, you need to send server rpc as client. Telling the server to change the variable to the value you send.

#

If the variable is marked as replicated, the server will then update the variable on all clients

#

Where client can update with OnRep

#

I would suggest trying to synchronise some primitive values if you still not sure how replication work

glacial moat
dark parcel
#

Sync a boolean across all network

#

If you can't do that, it will be harder to leap

#

Imo stay away from w.e you are doing. Just get very basic replication work

glacial moat
#

I have done replication before like this >>

dark parcel
#

Sync one variable across all network. Allow server and client to modify the value but ensuring that everyone sees the same thing eventually

#

Because the idea is the same

glacial moat
dark parcel
#

Can't read that on my phone

glacial moat
#

Button press > call on server > add static mesh > set static mesh > set is replicated (component to add)

dark parcel
#

Your been given the answer tbh

glacial moat
#

Yeah, im going to try to go back and read a few times,

dark parcel
#

If it make sense to put it in the character then so be it

lost inlet
#

the mesh on a static mesh component isn't replicated

glacial moat
lost inlet
#

ah RIP, it is replicated. the more you know

#
    TObjectPtr<class UStaticMesh> StaticMesh;```
glacial moat
lost inlet
#

well I'm not scrolling through the lore, what is the actual issue

glacial moat
#

I think im going to try one of the solutions and see what happens

lost inlet
#

solution to what

glacial moat
#

Basically Widgets dont replicate, and I need to set the variable not inside the widget

#

if I understand what everyone is saying properly

lost inlet
#

yes, widgets don't replicate and only exist clientside

glacial moat
#

One thing that has happened to me though, is that If I set the widget as a component, instead of creating at runtime,

#

the widget will replicate client side only

#

for all characters

#

maybe I didnt use the word replicate properly in my explanation just now

lost inlet
glacial moat
#

That was an issue when I had the widget as a component instead of adding it at runtime

dark parcel
lost inlet
#

well widgets shouldn't be responsible for any actual gameplay state, but for it to work over the network, it has to be sent using an actor relevant to each player that needs to see it

dark parcel
#

It doesn't matter if you add it on run time or add as component

lost inlet
#

such as a character or player state

dark parcel
#

How are you updating the image to begin with?

glacial moat
dark parcel
#

Shouldt you have the icon on top of the character you control only.

glacial moat
dark parcel
#

I don't think that's a fix, but just a hunch

#

Might just be saved by a race condition which could happend in the future

glacial moat
dark parcel
#

Show this event dispatcher and how it is binded

glacial moat
#

Not sure how much of the code you want to see, so Im going to send this part >>

#

Then on the widget that it gets sent to >>

#

on rep notify >>

dark parcel
glacial moat
dark parcel
#

Widgets don't replicate

#

Your rpc is useless

glacial moat
#

IE ActivePrayerOverhead widget

dark parcel
#

Incorrect way of doing it. Calling rpc in hud or widget will just get dropped

glacial moat
# dark parcel Widgets don't replicate

Yeah thats what im gathering from everyone, so my idea was to just send to BP_ThirdPersonCharacter, then update inside the character like what everyone is suggesting

dark parcel
#

Good luck

#

That will work if done properly

#

Player state or characters

glacial moat
dark parcel
glacial moat
dark edge
glacial moat
dark edge
#

You are making this way more complicated than it has to be