#multiplayer

1 messages ยท Page 564 of 1

limber gyro
#

I am trying to run my server without steam i got the following in my engine.ini

#
GameName=GameName
Port=7777

[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=480
bVACEnabled=True
SteamAppId=480
bUseSteamNetworking=false 

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000 
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0  

[OnlineSubsystem]
DefaultPlatformService=Steam 
#

i only want the steam overlay and i will handle the servers myself

#

what am i missing?

twin juniper
#

port forwarding?

fossil spoke
#

@limber gyro

#

You need to define 2 netdrivers.

#

And set DefaultPlatformService=Null

#
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="BeaconNetDriver",DriverClassName="/Script/OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Null
PollingIntervalInMs=20
bHasVoiceEnabled=false

[OnlineSubsystemSteam]
bEnabled=True
bUseSteamNetworking=False

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName=/Script/OnlineSubsystemSteam.SteamNetConnection
#

This will by default use the IPNetDriver, but also enable Steam for Clients.

#

bUseSteamNetworking=false is important.

#

This disables the SteamSocketSubsystem from overriding the default SocketSubsystem.

#

Critical for the Server to be able to accept connections via IP.

#

And Clients to initiate those connections.

#

You will have the Steam Overlay when running the Game via Steam.

limber gyro
#

ok, but can you explain to me how those line are achieving that?

#

how is it telling the clients to use certain stem stuff

fossil spoke
#

Well i kind of just did.

limber gyro
#

i understand that i need those lines to do what i asked, i am just trying to understand what exactly does what

fossil spoke
#
DefaultPlatformService=Null```

This decides what the default OSS will be, important for letting the Server NOT use Steam.
limber gyro
#

ok, so if that tells the server to not use steam, how does the client know how to use the overlay

#

becuase i tried that before and the overaly didnt show up

fossil spoke
#
bEnabled=True
bUseSteamNetworking=False```

This enables the Steam OSS, but disables its overriding of the default SocketSubsystem, which is super important for Clients/Servers to still use IP connections.
#

The overlay will show up when the Client opens the game via Steam.

limber gyro
#

so it wont show up vie testing?

#

via editor''

fossil spoke
#

Not in Editor no

limber gyro
#

im also using lobbies and friends, let me check if every thing is workign correctly

#

it crashes with that .ini

fossil spoke
#

Yeah well thats a complicated setup

#

If you want to use Steam Lobbies as well....

limber gyro
#

i guess i am screwd then

#

im trying to join playfab servers but using steam for friends list and lobbies

#

so that they can join together

fossil spoke
#

We have exactly the same setup but using GameLift instead.

limber gyro
#

how did u guys set it up?

#

is it that complicated?

fossil spoke
#

I used PartyBeacons to manage the lobbies.

limber gyro
#

i have no idea what that is

fossil spoke
#

Guess you should do some research ๐Ÿ˜‰

limber gyro
#

is that stea mor ue?

fossil spoke
#

UE

#

But it uses Steam for invites etc

#

At least my setup does.

limber gyro
#

what a mess

fossil spoke
#

Yep

limber gyro
#

if i move to EOS will i be able to do direct IP connections without all this trouble?

#

or is it the same mess?

fossil spoke
#

No idea, dont use EOS

#

But id say it will help

#

Although will likely come with its own set of challenges.

limber gyro
#

i feel like i have my hands tied here

#

im developing this game alone and nothing is easy

#

t least when it comes ot backend

fossil spoke
#

Yeah using Steam OSS is either all or nothing. Unless you do custom management of it all like we did.

limber gyro
#

i assume ur not coding alone

fossil spoke
#

I am the only programmer on the Team.

#

Sadly

limber gyro
#

well i assume u have some years of experience then

fossil spoke
#

A few ๐Ÿ˜›

limber gyro
#

how did u do the custom management

#

what would that look like

#

and how long did i take you?

#

also why did u guys chose AWS, its a mess and a half

fossil spoke
#

The Team has worked with AWS before being the main reason.

#

Its more expensive than troublesome IMO.

#

You pay for the whole Amazon ecosystem really.

#

But anyway.

#

It took a while to get Steam working with IPNetDriver setup for Servers.

limber gyro
#

aws was my first option until i discovered playfab, it was 100 times easier to setup and they have a nice interface that makes thing way more smooth

fossil spoke
#

I havent used Playfab.

limber gyro
#

you should

fossil spoke
#

Might check it out on the next project lol

limber gyro
#

the only bad thing i have to say about playfab is that they dont use sockets

#

but most services dont

#

my original idea was to do everything with playfab but then i realized you couldnt see your friends online because they dont use sockets

#

kinda defeats the porpouse of having a friends list if you cant see them online to play with them

fossil spoke
#

You could make your own Friends List with Playfab im sure.

#

When the game starts just log with Playfab that they are online??

#

I dunno ๐Ÿคทโ€โ™‚๏ธ

#

lol

#

Surely they have some sort of persistence system

limber gyro
#

they do have friends list functionality, the thing is ur just sending a json to the server that says, "user loged it at X time"

#

if they log out u have no way of knowing it

fossil spoke
#

Yeah, not familiar with it, so hard to give advice.

limber gyro
#

what about this thread

#

this guy managed to connect with IP by setting some subsystems to null

#

do you have any idea how to do that?

#

i did try to bypass the id check on preLogin but when you connect the server crashes

#

not sure if you read it before

#

but it seems like a decent alternative to managing everything yourself

fossil spoke
#

This is why you set the following.

#
DefaultPlatformService=Null

[OnlineSubsystemSteam]
bEnabled=True
bUseSteamNetworking=False```
limber gyro
#

ye i know, but i am trying to not lose 1 month of work haha

#

the guys says: My solution was to remove the check in PreLogin and then yeah it created problems converting between FUniqueNetId types. So I Made a routine that could convert everything into a NULL online subsystem unique ID (which is basically just a string) and the server just keeps those around.

#

but how would you go about setting that to null?

#

and where?

#

the preLogin method?

fossil spoke
#

Yeah well thats why its a pain, the OSS system is pretty rigid, especially when it comes to Steam OSS.

limber gyro
#

but do you have any idea how to set that to null?

fossil spoke
#

You most likely have to override a bunch of stuff and provide a conversion between whatever UniqueNetID structure is being used down into a Null OSS UniqueNetID structure.

#

Each OSS has its own format for UniqueNetID

#

Which is where the issue comes in.

limber gyro
#

i think its about time i leave game dev and get into gardening or something ๐Ÿ˜‚

#

i think i found the discord of the guy that posted that, im gonna see if he can give a hand

hybrid wren
#

Hi there, I want to use "Linear" mode for "Network Smoothing Mode" of my Character Component. It's working well on dedicated Server, but If I use Listen Server with 2 players, the server still use Exponential mode ... anyone know why is this happening ?

#

If I use "Disabled" mode for "Network Smoothing Mode" the Listen server does use Disabled mode. Only that Linear mode does not works on the Listen Server : /

real cedar
#

Once upon a time, I managed to have people be able to load up the dev build I had, and they could hop in the same session that I created. Now, they can't even view the server in the browser. I'm wondering if anyone would be able to help point me in the right direction. Steam is enabled and works fine.

I have also found that I now have to set it to a shipping build instead of the dev build as hosting a session or even going to open the level for a single player environment gives me a fatal error message now.

hybrid wren
#

@real cedar Make sure your steam and your friends steam has the same Download region in the Steam settings. That was the issue with I had.

real cedar
#

@hybrid wren How do you set that?

hybrid wren
#

Steam -> Settings -> Download -> Download Region

real cedar
#

Hmmm. Alright I will give that a try.

#

I've just been compressing the build and giving them the link via dropbox lol

real cedar
#

@hybrid wren Thank you very much for your help. Finally got to test it and yes, that definitely worked. Just trying to figure out why they are getting a black screen now when trying to join the server. Will have to check the logs.

hybrid wren
#

Be careful with this settings, sometimes it get reset on my steam ... not sure why

gleaming niche
#

black screen usually means they aren't connecting, and you aren't handling errors, and it's just loading /Maps/Entry or whateer the default is

real cedar
#

I've told my testers just to reset their download stuff back to what it was prior when we're not testing

#

That's what I kinda thought, stuck in a loop or something when trying to connect. Unfortunately, it wasn't spitting out any logs

gleaming niche
#

shipping config?

#

if so, you need to enable logs in shipping, and build the release from engine source, if you want to see logs

winged badger
#

mine logs just fine, just not in a folder im used to

#

appdata/local/projectname/saved

#

in shipping

gleaming niche
#

thats where my logs go. but i had to enable it

#

beccause there is the #define that when it is 0, the UE_LOG() macros evaluate to nothing

#

controlled by bUseLoggingInShipping in the build target,and that needs a TargetBuildEnvironment.Unique

#

and aunique environemnt, requires building from source

winged badger
#

thats odd, as i had the logs with a vanilla build

#

in shipping

gleaming niche
#

๐Ÿคท

real cedar
#

Yeah I'm in shipping config because I get an error that crashes the build every time I try to open a level, while I'm in the dev build

gleaming niche
#

turn off teselation in your landscape material for now

#

for me the crash happens in shipping

#

lol

#

so i had to disable all tesselation so we could resume testing

gaunt kestrel
gleaming niche
#

it always did it automatically for me. so that's why the other day i couldn't understand why you kept having to do it.

#

ah, the copying of the sentry file, I see.

real cedar
#

How do you disable tesselation? (Sorry for the noob questions lol)

soft shell
#

I've a RepNotify variable that's "expose on spawn", server spawns the actor and set's the variable.. Client's execute the rep notify, which is fine for dedicated servers.. but for listen server's the rep notify is never fired (given it's also the server).. is this known to be the case? and if it is, how do people handle them for listen servers?

#

I could in theory test for listen server in BeginPlay() of the spawned actor and manually execute the things the RepNotify does.. but seems hackish

hybrid zodiac
#

@soft shell Yeah RepNotify is only executed on the client when it receives a notification from the server that the value has changed. One way I resolve this is I just call the RepNotify function on the server after changing the value. If the RepNotify is just a cosmetic effect, then you can add an additional check to make sure the game is not running as a dedicated server before calling it

eternal anchor
#

did anyone done automated multiplayer tests for gameplay ?

soft shell
#

Thanks, that's exactly how I implemented it..

royal sparrow
#

Does anyone know of any fancy ways where I can run a windows server executable with -log and have it print to the same command prompt? Iโ€™m trying to run my server in a docker container without having to use -t to keep it alive indefinitely.

gaunt kestrel
#

did you tried -log ๐Ÿค”

royal sparrow
#

yeah. The -log causes the docker container to exit since it starts up the new log inside of another command prompt

gaunt kestrel
#

linux build works with log without any keys

#

build it and start in WSL

royal sparrow
#

I tried that one too. Linux was my preferred platform but for whatever reason, it won't package one of my plugins. Felt like I tried everything to get it to work including trying to package on the Linux machine itself as well as different linux docker containers + a full fledge install of Ubuntu desktop on a vm

#

Its weird. Linux will build client/server flawlessly and it just throws errors saying it can't find /Script/pluginname/filename repeatedly for the same plugin until it finally crashes.

#

I think the only thing I haven't tried yet is to download the source on my ubuntu machine and build for linux. Really don't want to do that but I might just so I can use Agones :/

shrewd tinsel
#

if i spawn a grenade on clients pc and the grenades actor is set to replicate

#

will it spawn on everyone else's pc?

#

and why

waxen socket
#

Only actors spawned on the server can replicate.

shrewd tinsel
#

thanks

upbeat crystal
#

is they anyone in here that can help me to make my gaming server public to get all people across the world to get access I have a customer in Kuwait if you can help DM me

shrewd tinsel
#

i can try helping you here

#

have you opened your ports?

royal sparrow
#

To bump faxcorp's response, how is your gaming server hosted currently?

winged badger
#

@upbeat crystal is that steam?

#

is it configured to filter out the games by region?

upbeat crystal
#

@winged badger I have no Idea I installed Windows server 2019 assigned a static IP that is it I have no idea on filters i have opened ports the server is on my network at home @royal sparrow

winged badger
#

i asked if its steam, not where you installed the server

upbeat crystal
#

it's not steam no it is installed on my custom built system

jovial stream
#

How can I create lag compensation for my players' collsion?

bitter oriole
#

By storing all collision data every frame for as long as the max correction time, for each player, on the server

jovial stream
#

@bitter oriole I couldn't figure out a way to store the collision data, how would I go about doing that?

#

In blueprints if possible

wise zephyr
#

can someone help me real quick with a function with websockets in the engine

#

TSharedRef < IWebSocket > CreateWebSocket
(
const FString & Url,
const TArray < FString > & Protocols,
const TMap < FString , FString > & UpgradeHeaders
)

#

i dont know what to put for the last 2 params

#

this is such fucking bullshit

limber gyro
#

is the PreLogin function the first time the server receives the player's unique net id?

random nymph
#

We have a weird sound problem in our multiplayer game. We are playing sounds with the play sound notify in anim montages, but if the actor using the notify is behind the player and culled away the sound plays multiple times

gaunt kestrel
#

@wise zephyr if you need just a listen 8080 socket you could use

FHttpServerModule::Get().GetHttpRouter(8080);
FHttpServerModule::Get().StartAllListeners();
real needle
#

Hi, can anyone tell me why this movement is not properly replicated on client and what I should do for it to be? (This is just a simple example to illustrate my problem)

karmic briar
#

@real needle what are you trying to do

real needle
#

@real needle what are you trying to do
@karmic briar I am actually implementing swinging movement and I run into trouble where it was lagging on client and smooth on server. So I created a simple test like this to show the problem

chrome bay
#

Movement replication is complicated. Since you're using a character though, Unreal has a built in system for character networked movement. You shouldn't be hard-setting the actors position on tick, you should be using input events and calling Add Movement Input

#

The example projects all show how to correctly move a character

real needle
#

And the Add Movement Inputs are the only movement functions which are replicated?

chrome bay
#

@real needle the functions are not replicated, but they go through a very complex process in the character movement system that is networked

real needle
#

@chrome bay And if I am using AddForce function, can it be somehow replaced with the networked functions?

chrome bay
#

So long as you call AddForce on the character movement, it sort of works already

#

You just have to make sure you call it both server and client side, but it won't be smooth

#

It's not meant to be used often

kindred widget
#

Are pointers safe across RPCs?

#

RPC will be in a UActorComponent, Component is set to replicate, and the actors that the component will be a part of will be replicated, and the pointers are to these UActorComponents.

gaunt kestrel
chrome bay
#

@kindred widget They are yes, assuming the pointers are to UObjects and can be resolved

worthy knot
#

what does the "reliable" check do?

chrome bay
#

Makes an RPC reliable

#

vs. the default which is unreliable

#

Reliable guarantees it will arrive (clients are kicked if they drop reliables) and maintain order of execution within the same actor

analog prism
#

So... If I want to have multiple local players on one client in a networked game... how much will I be fighting Unreal? Because it looks like it's kinda designed around online games having only one player per machine

chilly mist
#

I have a replicated TArray of UObject*. The UObject themselves replicate properly.
But what's the best way to find out what have changed in the TArray?

chilly mist
#

Yeah, my plugin now works in multiplayer, but struggles in singleplayer.
Great ๐Ÿ˜†

stable kindle
#

Hi guys is there a good way to figure out if all your objects have been spawned and replicated before starting a match ?

dark edge
#

@worthy knot You would mark the RPC for ChangeWeapon reliable. You would NOT want to mark SendThrottleValue reliable as it presumably is changing all the time and missing a couple updates won't matter. A reliable RPC will retry until it's successful nor you get kicked. Don't send a million of them.

waxen socket
#

@analog prism It gets a little hacky but it's not impossible. There are games that have been published with mixed local/online co-op.

analog prism
#

@waxen socket Neat--any specific examples? Maybe someone out there has some lessons learned they can share...?

waxen socket
#

The method that I'm aware of is to spawn extra controllers while still unconnected to a network using CreatePlayer. Then, when you join or create a session, those extra player controllers will travel together and replicate properly on the new map.

rich ridge
#

Guys I m writing my generic RPC function, UFUNCTION(Reliable, Server) void ClientToServerRPC(ENotifyRPCType NotifyRPCType, UObject* AdditionalData); My question is do my UObject needs to be network supported like below ```virtual bool IsSupportedForNetworking() const override;

/** This is to replicate variables. */
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;```
analog prism
#

@waxen socket and they'll change to the new playerController classes no problem?

waxen socket
#

When you use CreatePlayer, I believe it spawns them as the default controller class, yes.

chilly mist
#

@stable kindle I would assume that if you use property replication and reliable RPC, then on client-side UE should be preserving the order of events? So if you make all the necessary changes on the server, before starting the match on server, then clients should be getting all the changes before starting the match too.
Though I'm by no means well-versed in networking, and more knowledgeable ppl here may disagree with this rather naive assumption.
Are you encountering situation where the match started before all necessary changes are replicated?

analog prism
#

Sounds good @waxen socket. Right now I'm actually trying to work out how to route the controller inputs the way I want so I can have one local player be allowed to use mouse and keyboard. Wondering if there's a plugin that helps handle it better than I can

waxen socket
#

Hm, I haven't yet done that but I've seen resources around explaining it.

arctic willow
#

Should one develop a game to be suited for Dedicated Server and Listen Server structure?

Is that something devs do?
Juggling around with Authority, NetMode to optimize both ways for their game?

For example, if I develop only for Dedicated servers, I only need to create widget's on the clients, but if I would want to have Listen Server as an option too, I need to differentiate the NetMode too, so the Listen server Player creates that Widget too.

chilly mist
arctic willow
#

Thx

chrome bay
#

@analog prism ShooterGame supports split-screen online play

#

It's not simple though

analog prism
#

Okay, good to know. Thank you @chrome bay!

chrome bay
#

@rich ridge You can't send arbitrary UObjects through RPCs - the object itself has to be replicated by something else first, like through an actor channel.

#

AKA, the object already has to exist at each end.

#

Calling that will just result in the object resolving to nullptr at the other end.

rich ridge
#

Ohhh, so any workaround this

chrome bay
#

Not for UObjects no

rich ridge
#

Meaning fundamental types will work like int, float, string, etc

chrome bay
#

You can sort of send arbitrary data via RPC by sending either a TArray of bytes and telling the other end how to decode it, or using a wrapper struct which has a custom netSerialize method

#

The Gameplay Abilities system kind of does this, but there are limitations

rich ridge
#

Yeah TArray of bytes will work for me

#

I can parse the TArray of bytes

chrome bay
#

Have a look at FGameplayAbilityTargetDataHandle for an example of how to handle it with a wrapper struct

#

It sends a type and uses reflection to create and deserialize the data

#

There are still limitations but it can sort of be done

rich ridge
#

Nice trick though, thanks a lot.

chrome bay
#

np's

#

have dealt with it before ๐Ÿ˜„

stable kindle
#

@stable kindle I would assume that if you use property replication and reliable RPC, then on client-side UE should be preserving the order of events? So if you make all the necessary changes on the server, before starting the match on server, then clients should be getting all the changes before starting the match too.
Though I'm by no means well-versed in networking, and more knowledgeable ppl here may disagree with this rather naive assumption.
Are you encountering situation where the match started before all necessary changes are replicated?
@chilly mist yes actually the game state actually calls HandleBeginPlay as soon as it's replicated i think. even without the server having started the match

chrome bay
#

Properties and RPC's do not replicate in order

#

They are independent

#

When an RPC arrives there's absolutely no guarantee that the properties will also be up-to-date

bitter oriole
#

The only guarantee is between Reliable RPCs on the same path (same sender, same receiver)

rich ridge
#

I have seen in many examples "reliable" and "Reliable" . What is the difference between them??

bitter oriole
#

None

#

UPROPERTY is case insensitive, incredibly

chilly mist
#

I guess I was too naive x_x

rich ridge
#

@chrome bay I have this setup which I did few days back, and I don't get NPE UFUNCTION(Reliable, NetMulticast) void SetDraftPickState(UDraftPickDataModel* InDraftPickStateDataModel);

#

as you said the uobjects will be null for RPC functions, but they are not null

long hollow
#

has anyone here played with origin shifting in MP ?

viscid escarp
#

seems like is a bug according to google

fleet raven
#

no

rich ridge
#

Just want to share an information, we can send arbitrary UObjects* in RPC function calls.

fleet raven
#

it depends if they are addressable

#

i.e. assets, replicated objects in world (actors, components, any other subobjects you replicate manually)

rich ridge
#

@fleet raven I m creating an UObject like this and passing to RPC function and it works. static UDraftPickModel* Get(uint8 InHeroId, ETLPTeam InTeam, FString InPlayerId);

fleet raven
#

if you are just using NewObject, with no extra stuff, the ptr will be null on the other side

rich ridge
#

UDraftPickModel* UDraftPickModel::Get(uint8 InHeroId, ETLPTeam InTeam, FString InPlayerId)
{
UDraftPickModel* DraftPickModel = NewObject<UDraftPickModel>(GetTransientPackage(), NAME_None);
DraftPickModel->Team = InTeam;
DraftPickModel->HeroId = InHeroId;
DraftPickModel->PlayerId = InPlayerId;
return DraftPickModel;
}

#

no its not null on my server

fleet raven
#

(however, it might have a value on the same side, such as when calling a multi cast rpc on the server side, the clients will still have null)

rich ridge
#

its client to server RPC

#

and I m able to see the clients data on my server

fleet raven
#

yeah that's not a thing unless you modified the engine to achieve this

rich ridge
#

i didnt modify the engine

#

i put breakpoints to validate this

#

@fleet raven can i DM you

fleet raven
#

I mean sure

#

well this is unexpected

#

seems like this is some new feature

rich ridge
#

i don't think his is new feature, other wise epic would have advertised this feature like iPhone commercial

sterile shale
#

hey is there any functions that will exicute on the server exactly when they join? i have a multicast function updating alot of stuff but i need to quickly send an array over when the game begins and only then , any help is appretiated, i have been messing with begin play and what not and i can get int the clients pawn which i want the data to get to from the server so i try to run a server function and it says :: No owning connection for actor MySnake_C_1. Function returnserverlocations will not be processed. and i dont mind doing a total work around like i believe an event might work but i wondering if there are any OnJoin:: functions.

#

that would like fire anything in them when another player joins the game, so i can have a server function that sends data just to the new players replicants . of the other players

waxen socket
#

@sterile shale Have you tried PostLogin?

#

Or HandleJoiningPlayer?

sterile shale
#

ill look it up and try it thanks both those sound good

feral root
#

how do you replicate where the player is looking

#

without

#

controller rotation pitch

meager spade
#

why would you not use Controller Rotation pitch?

mortal kernel
#

How do I replicate my Input Axis Value for MoveForward/Right ?

jovial stream
#

How can I save the pose of a skeletal mesh and apply it to another one? I am creating lag compensation and I just need to get the skeletal mesh's pose from a specific time and apply it to the hitbox, which is another skeletal mesh which is the same as the playermodel

dark edge
#

@mortal kernel Something like this will work but if you're using the CMC, just add the movement locally and itll handle it.

mortal kernel
#

and what exactly do I do on the server side then ?

#

Because I will need to have it in the animation blueprint

dark edge
#

Look at how the default 3rd person template does it.

#

If you're using a humanoid character, do it that way

mortal kernel
#

but I need the axis value for the strafe movement

#

the default tp bp is just "get velocity and vector length" boom speed...

#

it's not replicating

dark edge
#

@mortal kernel You should be deriving strafe and forward alphas by the resultant movement and facing direction. Unless you want running full speed into a wall and just jogging without moving to be a thing

#

Show your setup

mortal kernel
#

I don't have a setup

dark edge
#

So you haven't tried anything and it still doesnt work? lol

mortal kernel
#

I tried earlier and ran into an issue so only the clients could see the servers animation but the server couldn't see the clients animations

dark edge
#

show where you're sending the value

mortal kernel
#

I don't have it anymore

#

I mean I can see if I can find it

dark edge
#

Anyways, you need to send the axis values to the server with a NON RELIABLE run on server event

#

then in the event, they need to set a replicated variable

#

That'll let everyone have the values

#

The problem is that your local player will have the replicated values so they'll be delayed

mortal kernel
#

why does it have to be non reliable ?

dark edge
#

because you're sending it every frame

#

reliable will keep retrying until it gets through if network conditions arent perfect. There's not a whole lot of sense in sending something you are updating many times a second as reliable

mortal kernel
#

I see maybe this were the reason why it sometimes happened that I could stand infront of the other player without him to see me

dark edge
#

If that's happening, your stuff is all effed up. The Character Movement Component should work pretty good

mortal kernel
#

I'm pretty

#

much struggling with replication and all this

#

so yea might be

dark edge
#

If this is your first UE4 project, I recommend NOT doing multiplayer.

mortal kernel
#

I want multiplayer and If I'll have to go through hell I'll take it

polar wing
#

@mortal kernel I like your attitude xD. I think that's a path we have all walked.

winged badger
lilac bear
#

@mortal kernel if you're a visual learner like me, this is a good place to start with the basic concepts of networking (it's blueprints but the concepts are very applicable to both c++ and bp) But make sure to follow up this with eXi's network compendium doc as it fills out more details than what Billy goes over.
https://www.youtube.com/playlist?list=PLZlv_N0_O1gYwhBTjNLSFPRiBpwe5sTwc
@winged badger and others. Not sure how everyone feels about this super old very good tutorial (from Epic's Billy Bramer circa 2014) but he's still one of if not my fav dev tutorials from Epic to this day on this topic's fundamentals ๐Ÿ™‚

barren patrol
#

is it possible to send server-side movement inputs to an Autonomous Proxy? Right now, it seems to be viewed as corrections by the client and looking very spazzy.

winged badger
#

@lilac bear while you can in theory make a networked game using only blueprints, i would not recommend it

#

it only has bare bones network functionality

lilac bear
#

@winged badger agreed, I used these tutorials to understand the basic concepts of networking ๐Ÿ™‚

winged badger
#

and part of it is hacked in

chrome bay
#

@rich ridge I'm still very much willing to bet that only works in the editor environment because of the shared memory/process.

#

Incidentally Epic suggest the same thing I did - use USTRUCT() and use the same method as FGameplayAbilityTargetDataHandle

#

But yeah they also confirmed that the object won't be available at the other end so will resolve to null. Strongly suspect that editor mischief is at play.

rich ridge
#

@chrome bay Yes your assumptions is absolutely spot on and it does makes a lot of sense for UObject* not null in RPC function call. I will validate it right away.

#

Yes you were right, I launched my game is separate process, and I get NPE.

chrome bay
#

Haha yeah, it would be nice if it did work though

#

Though even if it did a struct would probably be better anyway to avoid the overhead of an object

rich ridge
#

yes, now i m going to revert that commit.

meager spade
#

@rich ridge bitten by static uobject in single process?

rich ridge
#

No it's not static UObject, the game instances are running under same process , so they share memory and thus my objects was never null in function RPC

#

When I ran my game in separate process, I started getting nullptr

meager spade
#

yeah so you got bitten by the single process bug

rich ridge
#

Yes correct

meager spade
#

he said my uobjects replicated fine in editor but broke in standalone

rich ridge
#

Same here

meager spade
#

it also has to be replicated via an Actor

#

or ActorComponent

#

in the ReplicateSubobjects function

rich ridge
#

Right

meager spade
#

else it will never be sent anywhere, and it also must be created on server per normal replication rules

fervent spoke
#

i'm having a problem where a replicated actor is getting spawned before a variable is replicated.
I'm having the server set the variable (replicated) then spawn the actor (replicated), then the actor does something with the variable.

all of the clients see the actor spawn before they get the variable update, so then the actor uses the outdated variable info

meager spade
#
{
  bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

  if (SomeUObject)
  {
      WroteSomething |= Channel->ReplicateSubobect(SomeUObject, *Bunch, *RepFlags);
  }

return WroteSomething;
} 
#

kinda like that

#

@fervent spoke spawn the actor deffered

#

assuming you are doing it in c++

fervent spoke
#

i'm using BPs

meager spade
#

then use Expose on spawn

#

to set the variable

#

not set it after the spawn

fervent spoke
#

i thought expose on spawn set variables were serverside only

#

like

#

if the server spawns the actor and sets the exposed variable

#

then none of the clients receive that variable info

meager spade
#

eh

#

it just sets the property, and if its replicated, it will be set before the Actor calls BeginPlay on client

fervent spoke
#

google said that doesn't work but i will try and report back

#

this thread specifically

#

unless i am confused

meager spade
#

the property has to be replicated

#

if its not replicated, clients will use the default property value

fervent spoke
#

ooh

meager spade
#

not the server set value

fervent spoke
#

ok

#

yeah that worked thanks

faint seal
#

Iโ€™m just getting started into multiplayer, my question is where would spawning an ai actor for a wave based gameplay be best at. Iโ€™m leaning towards game state but not sure if game mode would be better.

meager spade
#

make a spawn manager

#

either as an actor in the level

#

or in GameMode

#

as AI is only spawned Server side

#

it doesn't matter

#

i have a SpawnManager in the level that handles it

waxen socket
#

I too use a SpawnManager actor.

rich ridge
#

@waxen socket why actor, why not Uobject for managers???

#

These managers don't need most of the logics of actor

fleet raven
#

use world subsystem

#

works nicely in multi-PIE

rich ridge
#

The respective GameMode can assign world context to managers in BeginPlay

#

Manager doesn't need replication, controller, etc logic . They just maintain some state and fulfill business logic.

#

And actors they kind of fall in presentation layer.

waxen socket
#

Mine has a collider to see when spawned objects go out of bounds, arrow components to help me visualize the trajectories of the spawned enemies and other bits and bobs.

winged badger
#

@rich ridge plenty of reasons to use an Actor

#

you might have SpawnPointActors on the level, if you have a SpawnManagerActor on the level, you can set the references in editor/on PreSave for example

#

there is also that SpawnManager might want to replicate something for the UI visible on clients, say time to next wave or wave count

#

it depends on the game, but in some advantages of a standalone Actor are just too good to pass

rich ridge
#

Mine has a collider to see when spawned objects go out of bounds, arrow components to help me visualize the trajectories of the spawned enemies and other bits and bobs.
@waxen socket don't you think this violates the single responsibility of a class??

winged badger
#

and it doesn't, recovery and debug are part of its responsibility to handle the spawning

rich ridge
#

This is reasonable

#

there is also that SpawnManager might want to replicate something for the UI visible on clients, say time to next wave or wave count
@winged badger now this violates single responsibility of class.

#

Apart from spawning it is also doing RPC, so multiple responsibility for a class.

winged badger
#

no

#

its not doing an RPC

rich ridge
#

I meant replication

winged badger
#

and its just making sure that its client side instance has the correct data for the UI

#

it doesn't manage UI, just broadcasts changes

#

that UI hooks into

rich ridge
#

Wait , why client will have spawn manager??

#

It should exist on server

winged badger
#

why would you hack in a separate object to display a spawn manager data on clients?

#

(in case you need to show spawn manager data, not every game does)

#

we for example, show current wave and the time left until next one

rich ridge
#

Showing spawn manager data on clients means some sort of RPC

winged badger
#

just a replicated variable is sufficient

#

and networking (keeping clients in sync) is not a separate responsibility for Actors/Objects in networked games

rich ridge
#

Ohhh yes right if your manager is actor based.

winged badger
#

doesn't matter whats it based on really

#

if you need any of its data on the client, replicating it is the par tof its primary responsibility

rich ridge
#

Yes I got your point now.

waxen socket
#

I too now understand my own class better thanks to Zlo.

rich ridge
#

does this function works within the editor as I start 10 clients in different process and one dedicated server processUFUNCTION(reliable, server, WithValidation, SealedEvent) void ServerNotifyLoadedWorld(FName WorldPackageName);

winged badger
#

it works just fine, ever read the comment above it?

#
    /** 
     * Called to notify the server when the client has loaded a new world via seamless traveling
     * @param WorldPackageName the name of the world package that was loaded
     */
    UFUNCTION(reliable, server, WithValidation, SealedEvent)
    void ServerNotifyLoadedWorld(FName WorldPackageName);
#

so it wouldn't be called after you start a PIE session

#

as you didn't seamless travel into the level

rich ridge
#

i m getting error. virtual void ServerNotifyLoadedWorld_Implementation(FName WorldPackageName) override;

winged badger
#

the function in PC is not virtual

#

ah

#

the _Implementation is

rich ridge
#

my IDE throws error while compiling but it show this function in override list

fleet raven
#

SealedEvent means it's not virtual

#

the only usage of this specifier in the engine

#

cool, isn't it?

winged badger
#

well, you can override HandleSeamlessTravelPlayer instead to do what you need to

rich ridge
#

yea i did that

winged badger
#

but its still a super clumsy practice

rich ridge
#

virtual void HandleSeamlessTravelPlayer(AController*& C) override;

rich ridge
#

this is not working, the first map load is non-seamless travel

#

i guess I need to override this from GameInstance and manually send RPC to server about the map load for first time as it is non-seamless travel virtual void LoadComplete(const float LoadTime, const FString& MapName)

kindred widget
#

Is it possible to change a replication type? I have a component that I'd like to replicate differently based on where it's being used, but I'm not exactly sure when GetLifetimeReplicatedProps is called or how to affect a variable before it is.

rich ridge
kindred widget
#

Sorry, to be more clear, I need to change if a variable is replicated just to owner or if it's replicated to all connections. This just shows how to set that initially and how to change if it's currently replicated or not replicated.

gray scroll
#

i am trying to expose login function to BP so i created a custom game instance and added the following in it:

        bool Login(int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials);```

but getting the following error
https://cdn.discordapp.com/attachments/710371393321042050/749337351066746930/unknown.png
it seems to be defined though
eternal anvil
#

Hey there. Anyone have experience replicating subojects?

rich ridge
#

@gray scroll you can only expose UObjects or Ustructs to blueprints

#

@eternal anvil do you mean uObjects?

eternal anvil
#

Yes I do

#

@rich ridge I've been getting this error
LogNetTraffic: Error: UActorChannel::ReadContentBlockHeader: Sub-object not in parent actor
Just saw some older conversation about it in the cpp channel and am reading about NetSerialization now

rich ridge
#
    virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
    virtual bool ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags) override;```
#

override these 2

eternal anvil
#

Yup, I have done that

rich ridge
#
{
    bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
    WroteSomething |= Channel->ReplicateSubobject(MyObject, *Bunch, *RepFlags);
    return WroteSomething;
}```
wheat magnet
#

how to implement multiplayer in HTML5 in ue4?

#

either local or dedicated

eternal anvil
#

@rich ridge I have done that as well

rich ridge
#

and finally override these 2 in uobject ```virtual bool IsSupportedForNetworking() const override;

/** This is to replicate variables. */
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;```
eternal anvil
#

The specific issue I'm running into is this adding a replicated UObject to a TArray belonging to another object

rich ridge
#

the replicating UObject has to be the part of replicating actor

eternal anvil
#

After overriding the functions you mentioned above the replication works fine, but if I try to add a replicated UObject to an array and delete the old owner I get the error

rich ridge
eternal anvil
#

Can't it change parents (outers?)

rich ridge
#

this is hardcoded into engine

eternal anvil
#

Right

#

Thanks for the help. I'm going to see if there's a way to accomplish what I'm trying to do

rich ridge
#

@wheat magnet anything pure c++ engine code will work on any supported platform by engine. So yes you can write multiplayer game for HTML5. and for dedicated server the binaries are for OS like windows, Linux, not for browser stack like chromium, etc

wheat magnet
#

is there any example project of html multiplayer or any article that helps?

rich ridge
wheat magnet
#

i want local multiplayer in html5

rich ridge
#

like LAN based

wheat magnet
#

yes, not dedicated, but it should lan based

rich ridge
#

please checkout shooter game, you can package that game for HTML5

wheat magnet
rich ridge
#

this is html or javascript based fatal error, I can't help much

#

i would suggest you post on answerhub

twin juniper
#

How correctly use cull distance for bp actors?

gleaming niche
#

@eternal anvil how are you instantiating the object?

#

i fyou're using NewObject<> just make sure teh first parameter is the actor instead of null.

#

so it's package outer is the actor.

#

eg, when I instantite item UObjects

                , ItemClass->GetClass()
                , ObjectName
                , EObjectFlags::RF_Public | EObjectFlags::RF_Transient
                , ItemClass, false);```

PackageOuter in this instance is either the container (component) or actor if it's holding onto it, in the case of say, an item pickup
eternal anvil
#

@gleaming niche Thanks, I am. Maybe there's something fundamental I'm missing but the problem is this:
I want to "transfer" the UObject from one actor to another. After that transfer I want to destroy the previous actor

gleaming niche
#

ahh

#

use Rename()

eternal anvil
#

I can do the transfer but when I destroy the previous actor the UObject goes away as well

gleaming niche
#

changes name, plus can change the otuer.

eternal anvil
#

So I'm using rename, and was at first just passing nullptr to the name. Changing the outers though

rough cobalt
#

how would i make a multiplayer system to works cross platform? windows, mac, ios, android

winged badger
#

@eternal anvil @gleaming niche Outer doesn't replicate, but is rather assumed to be whatever Actor the ActorChannel replication came through belongs

#

so, Rename() won't work on clients out-of-the-box

#

and you can't use the Object itself to replicate Outer and Rename OnRep, because that replication will arrive through the wrong ActorChannel, too

#

and yes, that means if you have a replicated UObject with ActorComponent for an Outer after replication its Outer will be the ActorOwner on clients instead

#

so, Rename, sure, but should be done through the new Actor that will replicate it from then onwards

#

(its not enough to call it on Server, need to call it on clients manually as well)

eternal anvil
#

Thanks @winged badger! It was actually your comments I was referring to in cpp. Let me try to wrap my head around what you've said before responding

#

So here's what I'm doing (this is all psuedo code with fake types so forgive me. The general setup is the same)
I have Actor A with UObject* O and ActorComponent B with TArray<UObject*> OArray
Both A and B implement ReplicateSubobjects
A creates O like this NewObject<Type>(GetWorld(), NAME_None, RF_Standalone
At some point in the game B interacts with A
When this happens B adds O to OArray
When O is added, B changes O's outer to B on the server and client O.Rename(nullptr, this) // Called from withing B on server then again via client RPC
After a few seconds A is destroyed
The problem is that O is also deleted when A is destroyed

winged badger
#

is OArray UPROPERTY()?

#

and why do you explicitly set the World as Outer?

#

when creating them

#

and do you actually add it to OArray when you Rename?

eternal anvil
#

@winged badger The array is a UPROPERTY (even though I forgot to mark it as one in that paste ๐Ÿคฆโ€โ™‚๏ธ)

#

I set World as Outer because I saw someone mention that and the standalone flag to avoid garbage collection

lilac bear
#

sorry guys, I'm being a tad lazy while I search for this answer on the web. Answer if someone knows off the top of their head:
-Is there an easy way to access the before/after values of a replicated variable update during the "rep_notify" function?

winged badger
#

void OnRep_MyVar(VarType OldValue);

#

the engine code will check which overload of OnRep you declared and call the correct one

#

also, why it has to be a UFUNCTION

lilac bear
brisk parrot
#

Does anyone know how to fix the Incompatible_unique_net_id error when connecting to a dedicated server as i tried everything i could find on google but still cant fix it

lavish cypress
#

Is there a function that will be called in UObject on the client after the object has replicated to the client for the first time, but not each time its properties are checked

queen flower
#

just read the unreal docs about RPCs. Not entirely understanding why anyone would ever want to leave one as Unreliable.

#

why not just have everything as reliable?

twin juniper
#

how to use cull distance for bp actors?

lost inlet
#

you might want to use unreliable for less important things like effects since it's possible to overflow the reliable channel

#

when something is marked unreliable and the network is saturated, there's a chance it would dropped

meager spade
#

also filling the reliable buffer will cause the player to disconnect

#

Reliable == stuff the MUST happen

#

Unreliable == Stuff that does not always have to happen. Like player movement input, is all sent via Unreliable, cause who cares if we miss a couple of RPC's?

#

a player activating a skill or shooting a weapon, well that should really be Reliable

limber gyro
#

does any 1 know if theres a list of already built in URL options like "Name" somewhere? i wanna take look at that to make sure i dont overlap anything.

queen flower
#

I'm having an issue where a client player is not where the server player sees them. Is there a reliable checkbox for that?

#

Also, can I increase the size of the reliable channel?

#

Or reliable buffer? Both were mentioned above

twin juniper
#

guys, where I can read about fundamentals about accessing to characters by internal player id in multiplayer with Steam OSS or Epic OSS?
I need info about next criteria:
How works internal OSS player registration, its model..

twin juniper
#

assuming you are testing locally, I don't think Reliable/Unreliable will make a difference. If there's any desync locally there's some issue

#

is the client that's out of sync autonomous or simulated? also is this a custom setup or using UE Character?

limber gyro
#

@twin juniper theres not much documentation about that around, i am afraid ur gonna have to look into the code itself

#

The prelogin and login functions do some stuff with the player id, you can start there

twin juniper
#

@limber gyro I've an exp within srcds only, and only on sourcemod which provides simply methods.. but not understand how it woks in ue

limber gyro
#

@twin juniper documentation is lacking in that area man, theres not much you can do

queen flower
#

@twin juniper Im using the topdowncharacter from the topdown template. The only change is that I am using "addMovementInput" with arrow keys instead of the default passing left click through the controller. I am testing an 2 separate laptops on the same network, but sometimes am able to test with a buddy on a different network, form his home. He was sharing his screen and I saw my character at a different part of the level than my character actually was on my screen. I dont know about autonomous or simulated. I am using whichever is default I assume.

twin juniper
#

autonomous would be the character you play on your local client, and simulated would be other players on your local client that you don't control

#

looks like your desync is an issue with simulated pawns since your pawn is desynced on his screen

queen flower
#

The project is not super complicated atm so.. not sure how to prevent desync

#

I immediately assume it is because im running to many checks or inefficiently using event tick, but im not. I dont use tick for anything atm

#

but also having the same issue within the same network

stray crescent
#

Is there a difference when coding for dedicated server vs listen server?
I'm currently working on a standalone project to test proof of concept, soon I'll have to switch to networked game.
The game suppose to run on a dedicated server tho it's not needed early on, can I work on it as listen server and then port it to work as dedicated server?

#

I'm doing that because listen servers are much easier to setup

winged badger
#

@stray crescent very little for the intial dev phase

#

optimizing for listen/dedi is where it becomes significantly different

#

the big practical difference is that IsServer doesn't mean there are no local players present on listen server

#

but you can easily code so that it works for both

rich ridge
#

Is there a way to get notified when a player is added to PlayersArray in GameState???

#

At client side not server side.

twin juniper
#

do you have your own GameStateBase derived class?

#

in that case you can just override AGameStateBase::AddPlayerState(APlayerState* PlayerState) and do:

void ACustomGameState::AddPlayerState(APlayerState* PlayerState)
{
    Super::AddPlayerState(PlayerState);
    
    // custom logic here
}
rich ridge
#

Ohh yes, I will do the trick.

hearty loom
#

can anyone please help me with some problems..
i am spawning an actor from server and it is rplicated..and i am also calling a reliable netmulticast rpc from server ,just after spawning.the function executes on my listen server but the client does not receive this call. if i call the function on server after a delay after spawning..the client also execute the function..is this expected behaviour? should not the reliable rpc get called on client too after the replicated actor gets spawnned?

empty axle
#

@hearty loom I also experienced that. Don't know what your exact case is, but what I have done as a workaround to this was to:
after spawning that object on client I was doing an rpc to server to inform it that it can safely multicast to me and I will get that rpc

#

but maybe it would be better for you to switch into replicated properties?

hearty loom
#

uea @empty axle ..for my work i seitched it to replicated property..and its working..thank you very much for helping out..

analog rover
#

Quick question: when does a replicated property get replicated/where can I find more information about property replication timing?

#

Or I guess more simply: does a property replicate immediately when it is changed?

dapper hatch
#

Hey guys I really need help for a little something in my multiplayer first person shooter... When I shoot someone+ I can kill him and after 3 second, I spawn another "FirstPersonCharacter" and then I make a posses node but instead of being the person who just died to posses the newly created character, the server posses it...

#

If someone is willing to help me with that little problem, I can send pictures of the code

#

I'd really appreciate if someone could take the time to help ๐Ÿ™‚

#

(IT'S BLUEPRINT BTW)

lilac bear
#

@dapper hatch are you having the server's copy of the client's player controller call the Possess() function?

empty axle
#

@analog rover NetUpdateFrequency variable on owning actor defines what is the frequency of replication

#

So if you will have frequency on owning actor set to some high value then yes it will be replicated in the same frame that it changed

round star
#

Can someone help me out with world composition. So when you import a tiled landscape..there's no option while importing (or enabling after importing as well) to have edit layers. However.. ..if you create a landscape normally and enable edit layers..you can then just adjacent landscapes and they all have editable layers. My question is..does this somehow 'break' something if I use a tiled landscape with editable layers in my open world landscape?

#

just add*

winged badger
#

@dapper hatch yeah, don't use GetPlayerController[0] until you understand exactly what it does ๐Ÿ˜„

#

i would imagine you are sending an RPC, which then calls GetPlayerController[0] to do something with first controller

#

only, that GetPlayerController[0] if used from RPC is evaluated on server

#

not client

#

@empty axle @analog rover high net frequency everywhere is a good way to create network congestion

meager spade
#

if adaptive rate is on

winged badger
#

if you want to force replication immediately, use ForceNetUpdate() for that one update

meager spade
#

it will drop to min

#

if its not, it will use the normal value

winged badger
#

there is also NetPriority, each evaluation an Actor doesn't replicate, its NetPRiority gets a bump

#

and generally not all Actors will replicate right away if there is a lot of them

#

so, enter our game designer, plays with numbers a little, increases priority to 100 for one of the trash mobs, and when there are 50-60 of those in the level, it takes half a minute ++ for any other ACtor to panic enough to actually replicate

lilac bear
#

got another question about repnotify functions. If I have a TArray<UStruct> setup with repnotify, I presume this will call the repnotify function on all clients/servers for each assignment? Here's my crude code example:

UPROPERTY(ReplicatedUsing=OnRep_myUstructArray)
TArray<myUstruct> myUstructArray;
...

//in myClass.cpp
void myClass::myFunction()
{
   //assuming array length of 3
   for (int i = 0; i < myUstructArray.Num(); i++)
   {
      myUstructArray[i].myUstructInt = 8;
      myUstructArray[i].myUstructFName = 'test';
      myUstructArray[i].myCustomActorClass = someCustomActorInstance;
   }
}```

Would this call the OnRep_myUstructArray once, three, or nine times for clients (and server yes)?
winged badger
#

as you run that sync, once, all changes were done between 2 evaluations of its Actor for replication

#

i don't think i even use TArrays for replication anymore

lilac bear
#

oooh interesting, what would be your approach to something like this?

winged badger
#

FFastArraySerializer

#

docs and example in NetSerialization.h header

lilac bear
#

I saw UKaos mention those a week ago or so too

#

cool, I will look into it for sure right away. How would that change this rep call wise? (if at all)

winged badger
#

it has an array of FFastArraySerializerItems

#

each one gets an indivicual add/remove/change callback on client

barren moth
#

TMap replication is not supported in blueprints in version 4.20

Is there a good workaround for replicating TMaps with blueprints? My TMaps are [Int Vector, Int]

#

I don't need to "replicate" as much as I need to update the client's TMap based on the server's.

winged badger
#

its not supported in any version

#

make a struct with FIntVector, int32, then put it into an array and replicate that

analog rover
#

How would one "predictively" spawn an actor? In my case the character is equipping a weapon actor, and I want to try and set the character's weapon actor locally, send a RPC to the server, and replicate the equipped weapon back to the predicting client

#

It seems like there isn't really a way to synchronize a locally spawned actor and a server replicated actor, so I was thinking I'd need to spawn the weapon actor earlier on the server, some time before the character tries to equip it

round star
#

Hmmm. I'm trying to spawn an actor that replicates ..but only the client sees it. I have the actor to replicate but idk what else I need to do?

dark edge
#

@analog rover I know GAS can do it, I'm interested in how it's done tho, if even in the simplest form

#

@round star What machine is spawning it and from what actor?

round star
#

I am playing as the client..the player is spawning the actor from inside the player bp..the actor is just a weather balloon that goes up into the sky..only the owning person can see it but everyone should

dark edge
#

@round star Actors the client spawns will only appear to them. In the Character BP you need to add a run on server event that spawns the balloon.

#

That means that the Character on the Client machine tells it's server side duplicate to do the spawning

round star
#

ooooooooooooooooooooooooooo

dark edge
#

@round star Remember that input only happens on the client side, you need to relay stuff to the server side

round star
#

and that works now XD...I am new to anything networking related... >_>

gleaming niche
#

hrm, does anyone know off the top of their head, of a way to search for sessions WHILE you're already connected to one?

#

ah maybe it's another issue, nm.

kindred widget
#

@round star Just keep a simple concept in mind with networking. Anything the client does needs to be RPCed to the server in some way or form if you want to make a difference that isn't solely on the client. The server on the other hand, has the ability to both RPC to clients, and replicate variables/actors.

thin stratus
#

@dark edge Not sure they actually do that in GAS. They have some "We could do it here." comments, but the SpawnActor nodes in GAs do not have any prediction logic with them.

#

UT spawns projectiles predicted iirc. So one could open the UT source and look at that.

#

@analog rover

dark edge
#

@thin stratus From what I recall of looking through the UT code, they spawn projectiles then lerp to replicated one from the server when it comes over. I suppose what I'm thinking of is a generalization of that, and without having to route all logic through the projectile/actors owner.

winged badger
#

@dark edge i told you and Tank the only way you can spawn an Actor client side and have it networked to an Actor instance server spawned

#

it has to have a static NetGUID

#

and it has to be resolved via its Name

#

and if that doesn't match, all your clients get disconnected

#

you also have to spawn it on all clients if you're going to turn on its replication

#

otherwise you'll get all clients with exception of owning client disconnected

#

we use the technique to spawn an entire level - as long as nobody is using a laptop or a potato, 33k Actor procedural level is spawned, networked and ready for play in ~12 seconds

#

we do not use it after BeginPlay is called

#

basically comes to this - only replicated Actors that work and were not spawned by the server then replicated over are the ones loaded from package

analog rover
#

So it seems like my best bet would be to spawn the weapon actor server side some point prior to the character equipping it, but just hide it, and unhide it on the client when I'm "predictively spawning" it

winged badger
#

i would definitely not use the above approach for something spawned after BeginPlay

clever plinth
#

Anyone having trouble spawning particle systems on other clients?

chrome bay
#

In what way?

analog rover
#

@winged badger when you say the above approach, you mean trying to match locally spawned actors with the server spawned actors via NetGUID?

winged badger
#

yes

analog rover
#

๐Ÿ‘

harsh lintel
#

My RootMotionSource_ConstantForce works fine on the client triggering the force but it rubber bands on other clients, is there anything I can do?

round star
#

@round star Just keep a simple concept in mind with networking. Anything the client does needs to be RPCed to the server in some way or form if you want to make a difference that isn't solely on the client. The server on the other hand, has the ability to both RPC to clients, and replicate variables/actors.
@kindred widget Say a client moves a mesh but everyone needs to see that its moved. I can get the static mesh in an actor ..use switch has authority is either true and multicast.. or false and run on server (from client) ??

winged badger
#

@analog rover we also don't let server replicate its actors before our procedural generation is done for everyone... if it starts too early, those actors are still netaddressable, but their replication doesn't work

analog rover
#

Yeah, it honestly sounds like way more trouble than it's worth except in your situation where you're procedurally generating levels

#

It couldn't hurt too much to spawn a few weapon actors server side I suppose

kindred widget
#

@round star How you handle it is personal choice and based on the end result. If you're using a listenserver design, you can pretty much get away with just telling both clients and server to call a Server rpc and have that RPC do something. That way your logic remains consistent for the server player and all clients. In reality, you can probably do the same thing if you're using a dedicated server, since it won't have a personal controller itself. So the RPCs should function the same. In simple terms, if you want all clients to see that mesh move and make sure of that, replicate the actor that it's a part of. If you don't really care and also don't care if newly joined clients see it moved or not, then multicast is fine. From a lot of what I've seen though, majorly you should RPC to the server, and let the server replicate back. You'll usually get the best results that way instead of using multicasts a lot.

meager spade
#

@analog rover if its a few pickups etc

#

just spawn them server side

#

when your generating an entire level with a lot of replicated stuff, normal methods do not work

#

if the map is static and those actors were pre-placed its even easier

#

but our map is basically an empty shell so we couldnt allow 5000 replicated actors to spawn and go to every player

analog rover
#

I don't have the full mechanisms done yet, I was thinking of spawning from an inventory, but right now I'm just working on the attacks

meager spade
#

you on about equipping a weapon locally?

#

mostly every game, the weapon actor is spawned on the server

#

when you first pick it up/get given it

#

equipping can be done locally (like i do), but actual giving the weapon is done on the server

analog rover
#

Yeah, I was thinking of spawning it when it's added to the inventory or something

meager spade
#

thats what i do

#

its spawned, and just kept there

#

cause i use repgraph, it only replicates when the owner replicates, and when its not equipped its set to dormant

#

so my inventory never replicates on there own, only when the owner (the pawn in this case) replicates

analog rover
#

Interesting, I'm not using replication graph yet, dunno if it'd be worth it

#

(The idea is for the games to be ~4 players max)

meager spade
#

yeah we dont use it in work project

#

(the one with proc levels)

#

but we had a lot of fun doing it, some issues had me a Zlo stumped, honestly Unreal is full of pitfalls, you can easily fall into

wary wyvern
#

Guys, is it possible to make more than one multiplayer game in a single process instance? For example 2 games, 4 players (1v1 and 1v1), but 1 game instance. I'm asking because unreal instance is pretty heavy, I thought it would be better and cheaper if we just have multiple games in a single instance.

meager spade
#

you can't have 2 seperate worlds open

#

its one world per instance

wheat magnet
#

does it happen only once? it first compile on visual studio, when i try to build package, it again start compiling from start

#

why it happening each time

#

i'm using 4.25 source version

queen flower
#

I think that will happen even if you package any project

twin juniper
#

[Q] How do you trigger when a player is in range of replicated actror

#

what I mean is where can I have access to where that happens

#

so I can reset the values manually since I have a big data that is not needed for replication since it would be used for once

queen flower
#

sounds like a question for #blueprint then since this is not being replicated

twin juniper
#

not really

#

it is actually about replication

#

replicated data gets reset after its out of net distance

#

when it gets back I want to know when

winged badger
#

it doesn't get reset

#

non relevant replicated Actors that are not loaded from package are destroyed

#

and spawned again when they become relevant

rustic spruce
#

Hey guys i got a issue , i've made a weapon that shoot automaticly the problem is the shooting doesn't stop for the client when he release the button but for the server it work just fine

vivid seal
#

how accurate is Get Server World Time Seconds when called from a client? specifically wanting it to get timestamps for rewinding hitbox positions

#

read an article a while ago that said it can drift a noticeable amount, but im not sure how much that is or how old the article is

winged badger
#

not accurate enough

#

depending on your network load, it can be few seconds off

#

and worse yet, it changes only when gamestate replicates

#

you should occasionally send a server RPC with the clients timestamp to server, and have it respond with client RPC sending client's own timestamp and server timestamp back

#

from there you can calculate delta between server's and clients WorldTimeSeconds

#

and then you have as accurate a network clock as it gets @vivid seal

#

and it takes 10 minutes to setup

vivid seal
#

i had a similar system doing that in bp, been moving everything to cpp and was hoping there was something already doing that i could access, but thanks. do you recommend doing that inside the game state or inside the player controller?

winged badger
#

PC, GS can't send server/client RPCs

vivid seal
#

oh duh

winged badger
#

add a couple of static functions for easier access

#

accessing FirstLocalPlayerController via GI, then the server time delta from there

vivid seal
#

on a related note, for uobjects do you typically pass a world reference into constructor to give them access to game mode/game state/etc., or is there a better way to access those things

winged badger
#

just overriding GetWorld() will let you use the functions requiring world context

#

in BP

#
UWorld* UMyObject::GetWorld() const override
{
    if (HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject))
    {
        return nullptr;
    }
    return GetOuter() ? GetOuter()->GetWorld() : nullptr;
}```
vivid seal
#

ah okay

winged badger
#

when you press RMB on the event graph

#

BP calls the GetWorld

#

and in case of CDO (on which it will get called) it won't be a nullptr result, but something... else

#

i no longer remember what

#

in any case, nullptr is good enough

#

you still need to give them a sensible Outer when you instantiate them at runtime for it to work

#

ofc

quick flint
#

anyone here used ue4-docker to build dedicated servers? mine is stuck on this thing for almost an hour before im doing it on windows server 2019
ue4-docker build 4.25.3

#

mine is stuck on this

#

@waxen imp is the guy who made this right?

lost inlet
#

why would you change what worked?

lilac bear
#

@winged badger so to follow up on some of our last discussion yesterday regarding replicated variables the other day. Let's use the ustruct array again as an example which contains both atomic data types and pointers to class instances. When does this replicated variable have it's onrep() called when I am making numerous updates within a a single function? Is it after the function ends and before the next function is called or end of actor update, or what exactly?

You mentioned "... you run that sync, once..." and that the "changes were done between 2 evaluations" last time. I'm not sure I understand exactly what you meant by "sync" and "2 evaluations". Thanks in advance! ๐Ÿ™‚

winged badger
#

Actors aren't queued for replication, or replicated as soon as you change them

#

so you made 1, 10, or 5000 changes to it before its turn to replicate, it will replicate just once

#

and call OnRep once

lilac bear
#

perfect, that's precisely the behavior I'd prefer in this instance. So when can I expect the call to replicate? I presume it may vary?

#

I theorize that there is probably some set of phases that perform things like actor updates, physics updates, network updates etc. I'm not sure about those larger phases (what they are and the order of execution) but I would imagine if all actors perform their updates before network replication begins in a single tick/frame/update. At which point I can safely presume any number of function calls and assignments to variables that occur in this theoretical actor update phase will all be replicated at the end in a separate network phase update?

This is a lot of non-sense I'm spewing. i need to find some documentation about game update flow to give myself some concrete understanding. :S

regal drift
#

Guys question, is this a good practice to do like this (its a simple sprint function to set walk speed) for networking or there is more better way?

winged badger
#

that will jitter, badly

#

client RPC servers no purpose

#

you need to set max walk speed locally and call the server RPC

#

and you need to replicate the speed to other clients as well

regal drift
#

its not jitering like this

#

@winged badger for me this works fine on all clients, i just looking if there is better way

lilac bear
#

@taskhas if you don't see a jitter it must be due to you testing with little to no lag, once you introduce an unreliable connection you will see jittering occur with the start and stop of sprinting because the client will wait for a response from the server before he sets his own run speed. I agree with Zlo's recommendations

abstract pike
#

When you're in blueprint you can see which client you're on when debugging. Is there a way to see which client or server c++ code is running on??

kindred widget
#

@abstract pike You can put print strings in. It'll print what client or server it's running on. Eventually you'll just understand where events run from and it's easy to follow your execution line between server/clients.

abstract pike
#

@kindred widget I really just want to know which client, 0 or 1, so how do I print that?

kindred widget
#

@abstract pike Print String

abstract pike
#

@kindred widget I'm talking about c++

kindred widget
#

You can use the same print. Just need the UKismetSystemLibrary. You can call it with UKismetSystemLibrary::PrintString(this, "PrintThisText"); Barring that, if you really want to write it out manually, you should check out that print function's definition. It shows how it decides which to print. Basically switches on NetMode and appends the strings after.

shrewd tinsel
#

hi guys, if i change a replicated variable in clients pc, will it replicate to other clients?

kindred widget
#

@shrewd tinsel No. It will stay that way on the client until you change it on the server, then it'll overwrite whatever is on the clients.

#

Only replicated things changed on the server will ever replicate to clients. Much the same as multicasts, they need to be ran on the server to multicast to all clients.

exotic spindle
#

@shrewd tinsel So what you would want to do is to change the variable locally, but also send an event to the server to change it on there, so that it replicates to everyone

shrewd tinsel
#

alright nice thanks

exotic spindle
#

Or optionally, only send it to the server and don't set it locally, but let the server do it. Depending on whether you want "client side prediction", but thats a more advanced topic

waxen imp
quick flint
#

@waxen imp ended up doing that and let it run overnight, interestingly it got past that but said that there wasnt enough disk space and crashed, although i check the disk and i have over 100 gigs left

quick flint
#

how do i get rid of this docker container lol

still cape
#

What was that new update for prediction that was being worked on?

quick flint
#

@waxen imp i tried to run ue4-docker clean --all and i still didnt get my disk space back lol, i have 400 gigs last night, now im at 100 gigs

chrome bay
#

@still cape still being worked on

#

Probably won't be in a mass-useable state until UE5

#

Sort of useable already though

still cape
#

do you know where the repo stuff was @chrome bay? I used to have the repo and was messing with it but lost it somewhere

chrome bay
#

It's in their master branch on github

still cape
#

oh right it was a plugin

chrome bay
#

actually I think it's in release now, but the more recent versions require chaos to be compiled in I think, so master branch for latest

#

Though it probably does work without Chaos still, but the two do interop now

#

For the rollback physics anyway

steady musk
#

Hey, guys. Do you know a good way of refreshing Widget when smth changed on server side? Like, Ive opened player's inventory and smth changed in it so I need to show changes in opened Widget

chrome bay
#

Widget should probably just tick and query inventory for changes

#

Trying to drive UI from gamecode directly is always a clusterfuck from a design/maintenance POV

still cape
#

Do people just implement their own networked physics right now?

#

I'd assume so I guess

chrome bay
#

Nobody does networked physics and lives

still cape
#

lol

#

I've read through the gaffer on games stuff and such

chrome bay
#

gaffers articles doesn't really apply to UE

still cape
#

somewhat understand it

chrome bay
#

largely due to the way physics engine is implemented

still cape
#

hmm

waxen socket
#

The Smooth Sync plugin claims to work on physics.

chrome bay
#

Two approaches in UE, currently:
-> Server auth, deal with the input lag and rubber banding
-> Client auth, implement your own anti-cheat checks.

steady musk
#

Widget should probably just tick and query inventory for changes
Hmm, looks like you are right, 1 ticking widget wont make player's PC suffer ๐Ÿ˜„

chrome bay
#

You can always broadcast events that the UI subscribes too, that's a common pattern

#

"OnInventoryChanged" etc.

steady musk
#

I thought about it too. Just Multicast some things

chrome bay
#

Well for UI you want to avoid using any network commands, it's not neccesary

#

Anything is better than that

#

I can't ever recommend making direct calls to UI from game code tbh

#

Just let the UI sit on top of the game and query it for info and/or bind to relevant events

steady musk
#

RepNotify on variables, how about that? UI will redraw on changes then

chrome bay
#

rep is fine, just broadcast events

#

This is just my opinion but in general, I find it's never worth the effort of polluting the game code with UI code.

steady musk
#

Same thoughts, thats why Im here ๐Ÿ˜„

waxen socket
#

So, are you saying you use a lot of event dispatchers for directing UI, Jambax?

chrome bay
#

Just gets completely un-maintanable once the UI get's complicated enough

#

Yeah that or just tick the UI, and have it grab info itself

waxen socket
#

Tick? Really? I've been warned off of Tick, and bindings so much I never use them anymore.

chrome bay
#

Tick in UI is fine honestly

#

HLL is an insanely UI-heavy game and, the whole thing is ticking, and it's not even remotely close to being a bottleneck

waxen socket
#

Huh... I wonder why everyone's always warning about it then.

chrome bay
#

talking multiple hundreds of user widgets on screen at a time

steady musk
#

But how can you rotate UI to the player w/o Tick?

chrome bay
#

Tick is honestly fine, it can just be a good way to kill performance if you're doing something heavy with it

steady musk
#

Talking about Ui in world in this case

chrome bay
#

Well exactly

#

depends how you do it I guess. If you use widget components they do whatever the component says

#

If you're using 2D widgets but projecting them to screen based on world positions, we tend to hijack the AHUD tick, since it's one of the last things to run in the frame

steady musk
#

@waxen socket Also have you ever used "Bind" in UI? Cause if so - its a Tick too (just in case)

chrome bay
#

Bindings are worse than Ticking

#

In every way imaginable

waxen socket
#

I used bindings a lot because tutorials sprinkle them all over the place. Then I was warned off them and now I never even think about using them.

chrome bay
#

But, unless your UI is actually a bottleneck - sod it, use em if it makes life easy

#

Ticking > Bindings always

steady musk
#

But why? I thought its just like Ticks

fathom dust
#

is there a handy delegate or something for handling map load failed? I'm calling ClientTravel and I want to know if it doesn't work

chrome bay
#

HandleNetworkError maybe?

#

can't remember the exact name, but game instance binds to it

fathom dust
#

oh nice, yeah. in that file: HandleTravelError

#

ty

steady musk
#

Jambax, one more q, if you dont mind ๐Ÿ˜„ Have you ever tried to launch a lot of AI in multiplayer?

chrome bay
#

not that many ๐Ÿ˜„

#

Oh actually.. sort of

#

for bot testing

steady musk
#

What amount of them?

chrome bay
#

95-100

#

They're not really actual AI agents though

steady musk
#

Yeah, I know that its hard for computer anyway, just thinking what will be with network if I will try to launch 100+ AI's ๐Ÿ˜„

chrome bay
#

very hard

#

100 players is a massive struggle, whether AI or players

steady musk
#

Yeah, you are right, will need to think about it too anyway :/

chrome bay
#

have to squeeze everything you can

steady musk
#

Kinda sure that I will end up editing Movement components ๐Ÿ˜„

chrome bay
#

FYI paragon doesn't use characters for it's minions

#

They're just little agents stuck to the navmesh

#

*didn't I guess... RIP

steady musk
#

Lol, there are games with lots of minions, so they have a workaround for sure ๐Ÿ˜„

#

Thanks for advises, going to edit my UI again rn ๐Ÿ˜„

waxen imp
#

@quick flint to completely remove everything I'd suggest manually untagging the container images you want to get rid of using docker rmi <IMAGE> and then running docker system prune to remove any remaining intermediate layers.

novel hemlock
#

Hey i have a problem with calling Server RPC. Basically It's an RTS like so I have multiple units owned. On client I don't have the AIController but on Server I have it.

#

So i created a ServerMoveTo function inside the unit

#

Basically on the Server I can move the server units

#

But from client the RPC is not getting called even though I'm owning the unit

#

I checked the owner on the server and its pointing to the correct one (the client controller)

regal drift
#

@taskhas if you don't see a jitter it must be due to you testing with little to no lag, once you introduce an unreliable connection you will see jittering occur with the start and stop of sprinting because the client will wait for a response from the server before he sets his own run speed. I agree with Zlo's recommendations
@lilac bear ok i will try to test it and redo it maybe

shrewd tinsel
#

can clients rpc to server through gamestate?

#

can i rpc from widgets?

kindred widget
#

@shrewd tinsel Not likely. I wouldn't try it either. Gamestate is usually reserved for game level data that all clients need to see.

#

And definitely no on Widgets. UI should be entirely client side. It should only ever get information from or call events on actors that exist on that client.

shrewd tinsel
#

thank you for answers

novel hemlock
#

How can a client own a pawn that have an AIController?

#

If I spawn from server a pawn and assign an owner to it on client side its not calling the rpc, if the AIController is not spawned then it's called

dark edge
#

@novel hemlock what are you assigning as owner? You should assign PlayerController? as owner server-side. I think.

novel hemlock
#

@dark edge I tried both ways and by assigning the PlayerController without spawning the AIController it worked. The problem is that like that I am not able to use the features of the AI Controller. Behaviour trees, MoveTo functions and so on

quick flint
#

@novel hemlock cute profile picture

winged badger
#

@novel hemlock replicate the AIController, set PC Owner for the AIController and set AIController as Owner for the Pawn

#

note: if you want a predicted movement using pathfollowing component, you have plenty of overriding to do, CMC is hardcoded to work with Character that is AutonomousProxy and a PlayerController

harsh lintel
#

I'm applying a root motion constant force but it rubberbands in other clients, is there a way to fix this?

novel hemlock
#

note: if you want a predicted movement using pathfollowing component, you have plenty of overriding to do, CMC is hardcoded to work with Character that is AutonomousProxy and a PlayerController
@winged badger Yep i said a pawn but its actually a character, anyway idk the solution didn't work for me :C

#

I replicate the controller and set the owner of that with my PC

rich ridge
#

@harsh lintel this is more of a GAS.

random nymph
#

Anyone here has experience with steam ISteamMatchmaking interface? I'm a bit lost in sending and decoding chat messages

meager spade
#

what's the problem

random nymph
#

Problem is that I'm not familiar with working raw c++ pointers and binary data and I don't have a good idea where to start sending custom data with the message

meager spade
#

gimme sec, ill show you how i handle sending chat messages over steam

random nymph
#

Can I convert a class to binary to be send in the message and then cast that binary data back to be that class/struct?

meager spade
#

not for the faint hearted tho ๐Ÿ˜„

#

why you sending a class?

rich ridge
#

You want to serialise your class

random nymph
#

Feels like the best structure for data

meager spade
#

you mean for text chat?

random nymph
#

text chat + sending a message when matchmaking is started and a message when match is found and the connection info to that match

#

And whatever else I need in future

meager spade
#

well

#

i just take in a string

#

convert it to a tarry of bytes

#

and send it along

#
    FMemoryWriter Writer(Buffer, true);
    Writer << Message;
    Writer.Close();``` like this
random nymph
#

What about serializing a class that has for example following fields: textMessage, EnumMessageType, connectionPort etc. and sending that. Then I could construct that class from the binary data?

rich ridge
#

there is already a function in engine to convert string to bytes and vice versa StringToBytes(Fstring, TArray<uint>, Size);

meager spade
#

you have this right

#

virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0;

#

which sends the lobby chat message

random nymph
#

Yeah

#

And I can't figure out how to use SteamMatchmaking()->GetLobbyChatEntry

meager spade
#
    FMemoryWriter Writer(Buffer, true);
    Writer << Message;
    Writer.Close();
        Steam->SendLobbyChatMsg(LobbySteamID, Buffer.GetData(), Buffer.Num());```
#

this will send a chat message out

#
void USomething::GetLobbyChatEntry(CSteamID SteamIDLobby, int32 MessageID, uint64& SteamIDUser, FString& Message, int32 MaxLength, EChatEntryType& ChatEntryType)
{
CSteamID TempSteamIDUser;
TArray<uint8> Buffer;
Buffer.SetNum(MaxLength);
int32 Length = Steam->GetLobbyChatEntry(SteamIDLobby, MessageID, &TempSteamIDUser, Buffer.GetData(), MessageMaxLength, &ChatEntryType);
SteamIDUser = TempSteamIDUser.ConvertToUint64();
FMemoryReader Reader(Buffer, true);
Reader << Message;
Reader.Close();
}``` i mean this will get a lobby message
#
``` when supplied into this function
random nymph
#

Where do you get the MaxLength or is it just something you hardcoded?

meager spade
#

you supply it

#

i normally supply 4092

random nymph
#

Okay

#

Can that FMemoryWriter be used to write any type of data to the buffer?

#

Is that FString that you feed to the Write with << Message?

#

So according to that I should be able to serialize/deserialize custom ustruct with memorywriter and reader just like that string message?

#

But at least I got sending a text message working now. Thank you so much!

#

By the way have you had problem where the steam callbacks are always called 2 times?

wheat magnet
#

how to port forward without router for testing dedicated server?

dull lance
#

from windows or linux?

fathom dust
#

I'm trying to get at UGameMapsSettings::ServerDefaultMap from a client, so that I can choose to host a P2P game over steam and it'll use whatever map is specified for dedicated servers

#

They've unfortunately made it private and not given an accessor outside of dedicated servers

#
    UPROPERTY(config, EditAnywhere, Category=DefaultMaps, AdvancedDisplay, meta=(AllowedClasses="World"))
    FSoftObjectPath ServerDefaultMap;```
#

Is there a way for me to read this value using the UPROPERTY system, bypassing the private access in the class?

floral crow
#

Is there any way to prevent a Client or Multicast RPC from running before BeginPlay has ran on the client?

#

Something similar to bAllowTickBeforeBeginPlay?

fathom dust
#

Turns out there is a way to read that, I'll post it here for posterity:

FString GetDedicatedServerMapPath()
{
    UClass* GMSClass = UGameMapsSettings::StaticClass();
    for (TFieldIterator<UProperty> PropIt(GMSClass); PropIt; ++PropIt)
    {
        UProperty* Property = *PropIt;
        if (Property->GetNameCPP() == TEXT("ServerDefaultMap"))
        {
            FSoftClassPath* ServerDefaultMap = Property->ContainerPtrToValuePtr<FSoftClassPath>(UGameMapsSettings::GetGameMapsSettings());
            if (ServerDefaultMap != nullptr)
            {
                return ServerDefaultMap->GetLongPackageName();
            }
        }
    }
    return FString{};
}
wild frost
#

I'm having a weird problem with multiplayer. I am trying to use the find session node and then connect to hosted sessions. It reports that it is connecting but the level does not change to the hosts, am I doing something wrong?

#

I was trying to use the multiplayer shootout for reference

#

NVM, just figured it out, needed to put "listen" in the options for the level I open. Doh!

random nymph
#

Has anyone using steam api directly had a problem where the steam callbacks are always called twice?

charred scroll
#

Any tips for making a battle royale

raw quarry
#

just updated from UE 4.18 to 4.25. When I start my game server with the -log argument, it does open a command prompt (this is windows) but the window stays blank even though the server starts up sucessfully.. any ideas?

lilac bear
#

bummer, having another issue. So when doing the following:

--in AmyClass.h
UFUNCTION()
  virtual void OnRep_MyRepFunction(TArray<UmyUStruct> myOldArray);

UPROPERTY(ReplicatedUsing=OnRep_MyRepFunction)
  TArray<UmyEnum> myArray;

--in AmyClass.cpp
void AmyClass::OnRep_MyRepFunction(TArray<UmyUStruct> myOldArray)
{
  //do some processing here comparing myOldArray to myArray and execute logic for various transitions of state in myArray...
  //this needs to get executed by both client and server for any side affected vars or function calls that may be performed in this function.
}
void AmyClass::foo()
{
  AActor myActor = doSomeAssignmentHere;
  //assuming the myArray variable is not Empty
  myArray[i].myActor = myActor;   //this will allow the OnRep function to be called on all clients
  if (ROLE_Authority == ENetRole::ROLE_Authority)
  {
    //Since OnReps are not called on servers, we need to call this function manually,
    //however I'm looking for a better way to transmit the old myArray value when calling on server (something similar to how the clients do it?),
    //rather than manually storing a copy and passing in as the oldValue.  Is this possible?
    OnRep_MyRepFunction(TArray<UmyUStruct> oldValue);
  }
}

Any ideas on how to pass the oldValue into the manually executed authority/server call to OnRep...()? Apologies for the lengthy example code, replication is hard ๐Ÿ˜ฆ

fossil spoke
#

There is no alternative as far as im aware.

lilac bear
#

I was afraid of that, but no worries, deepcopy it is then ๐Ÿ˜„

rose egret
#

@lilac bear can't you use static array instead ?

raw quarry
#

anyone seen these errors before when launching a server?

#

the file does exist there, just not with the "PROFILE" suffix

#

I'm assuming something is messed up in build configuration or something somewhere, but not sure how to find what

lilac bear
#

@rose egret I assume you mean to use static AmyClass::myArray? Sorry, I'm a bit of a static noob (in practice) so you may need to give me a bit of an example of that use case?

rose egret
#

@lilac bear you know the whole TArray is replicated when you change / add an item ?
there are some easy tricks if your array size is short and static.

UPROPERTY(ReplicatedUsing=OnRep_Func)
FmyUStruct InventorySlot[8];

void OnRep_Func(const FmyUStruct* pre)
{
}



struct FInvNumeric
{
    UPROPERTY()
    FmyUStruct Slots[8];
};

UPROPERTY(ReplicatedUsing=OnRep_Func2)
FInvNumeric Inv;

void OnRep_Func2(const FInvNumeric& pre)
{
}

not sure if the first one can handle OnRep_ ๐Ÿค”

random nymph
#

Has anyone using steam api directly had a problem where the steam callbacks are always called twice?

lilac bear
#

@rose egret Yep... I'm very noob at wielding const and static classes but that looks interesting. Sadly, in this case myArray is dynamic for my purposes :/ but I will keep your method in mind for the future, thanks! ๐Ÿ™‚

rose egret
#

@lilac bear there is also FFastArraySerializer ! see NetSerialization.h

lilac bear
#

hehehe, yep UKaos, Zlo, and you have referred me to it ๐Ÿ˜‰ that is forthcoming while I get my head wrapped around it, that'll be version 2.0 XD

vagrant grail
#

Could anyone help me please : I'm following a tutorial on how to make a multiplayer game using Steam and I'm stuck at the second episode because my main menu doesn't show up in game, and in the videos it does and I don't understand why as like 1 hour ago it was showing and I followed everything step by step : https://www.youtube.com/watch?v=y0DKAV26mgw

Welcome to Part 2 of my UE4 Steam Multiplayer course, where we're redoing the old Epic Blueprint Multiplayer tutorial by Wes Bunn from way back in 2016.

In this video, we'll be continuing with the creation of the Game Instance class and building out first widgets. We'll get t...

โ–ถ Play video
#

And here are all the tabs I use, tell me wich one do you want to see and I will screenshot to help you to find the problem please

#

Pelase ping me

lilac bear
#

@vagrant grail I may take a crack at helping you there Diversity but it is a bit late for me, if you're still having this issue tomorrow after 7pm CDT feel free to give me a ping and we can maybe step through. There are quite a few pros here though who can probably beat me to the punch tho.

thin stratus
#

@vagrant grail Your best bet is to start breakpointing your code or put print strings up.
Somewhere you are adding the Widget to the Viewport. Put a Breakpoint or PrintString on it. If that doesn't call, go one level upwards, check what calls this AddToViewport (e.g. via find references) and put a Breakpoint or PrintString on that. You should at some point find a part of the code that calls, and a part afterwards that doesn't call. The problem then sits in the middle of that.

#

Us explaining you your problem is not a good way to learn

leaden crag
#

Question for people here, I don't exactly know where to put this in so putting it here. Im trying to find a way to make a system where I can place a file in the user's dedicated server once they verify it to allow it to show up in the server browser. Does anyone know of a way to do this? Im not sure if there is a function in UE that allows placement of files or potentially just modifying a file to place a key in that server. If someone could let me know if you have ideas and ping me that would be great!

#

Wanting to setup some sort of system that makes users verify their server before being allowed to show up on the server list and unsure of the best way to do it.

vagrant grail
#

@thin stratus First I have this that I can't solve and can't play the game to test my print strings

gleaming niche
#

rename your event, because something called LaunchLobby already exists.

#

as the error says

vagrant grail
#

but in the tutorials he calls it like that

#

check exactly at the time code set by the video

thin stratus
#

That's an Interface event though, so it comes from an Interface class.
Do you have another LaunchLobby function in the GameInstance itself?

#

I also wonder what the Interface is for

#

It's not like you will have more than one GameInstance....

gleaming niche
#

wondering the same myself.

#

i just for the hell of it, made a bluepint and the same thing

#

no problems.

#

now to delete.

thin stratus
#

Guess it's a typical tutorial of someone who hasn't figured it out themselves yet. But I guess it's nice there are tutorials at all

#

Just not that the user now thinks "Oh it's totally normal to make an Interface for a singleton class."

vagrant grail
#

@thin stratus Don't think so, where in the GameInstance exactly should I look to see if there's another one ? He explained why he uses Interface class in his video, He tried to create an updated version of the multiplayer tutorials made by Unreal years ago, but updating it in some ways that he thinks are better and works in 4.24 and 4.25 (as the Unreal Tutorials were made for the 4.11 in 2016)

thin stratus
#

I won't watch the video, not having the time for it. The Interface doesn't make sense to me. You are free to write me his explanation of why he would do that.

For the "where to look": In your GameInstance BP on the left side you have a list of Functions. Check if one exists with that name.

real yacht
#

Agree with @thin stratus

vagrant grail
#

On the SteamGame Instance or BPI_GameInstance ?

thin stratus
#

Steam

vagrant grail
gleaming niche
#

interface makes absolutely no sense on gameinstance.

#

since you cannot actually change the class.

#

you can only ever have one gameinstance

vagrant grail
#

Why did he do interface on his tutorials tho ?

thin stratus
#

Because he doesn't know better? You should always have in mind that the person teaching you doesn't know what they are talking about.

#

Everyone can make tutorials. Doesn't mean they are correct.

#

Check if you have another LaunchLobby somewhere in your event graph

#

Or try to refresh the node via rightclick

vagrant grail
#

True but I was looking for one for the 4.25 as the one made by Unreal was for 4.11 and it was out in 2016

#

Already check but none is there

opaque kelp
#

Hi , somebody who are into multiplayer , can shade some light on me, I am working on my custom physics simulation , few years already , I was made pretty nice SP demo , next reasonable step will be to people can drive cars, in MP, I know MP for vehicle is P in the A, but i wanted to go step by step . My question is , what was change in term of MP from version 4.17 ? , in which I still doing my things, I am not doing any prediction yet , and in 4.17 my vehicle have smooth movements, in 4.22 it have choppy movements.

Thnx

kindred widget
#

@vagrant grail Unfortunately in BP, a lot of people are relying on interfaces because they don't understand class inheritance and casting or for some reason find it confusing. They think it's easier to use interfaces to get around casting despite that it's more or less the same thing. You'll see it quite often in the blueprint channel.

vagrant grail
#

@kindred widget The guy in the video talked about Interfaces being more performant than casting and stuff like that

#

And now I'm stuck as I followed this video and made alot of changes, is it possible to go back and remove everything I did following these videos ?

chilly mist
#

Interface being more performant? ๐Ÿ™€

vagrant grail
#

Yeah he said that

kindred widget
#

That is a dumb myth propagated by people who don't do their own testing to understand things and just repeat what they've been told. Casting doesn't affect performance in the slightest. The Isvalid check in the cast does, but pure casting does not. And even the isvalid cast is still faster than interfaces in blueprint. You can test it yourself by making a simple loop that casts to a class to get a variable, or calls an interface function to get the same variable type. Interfaces are slower.

vagrant grail
#

Yeah some other people told me that, so I unsubscribed from this guy

#

Is it possible to go back when my project was a bit cleaner ?

kindred widget
#

Not without source control. Or luck. How many different classes did you change?

chilly mist
#

2 anti-patterns here:

  1. Using interface for the purpose of performance. Interface is not related to performance at all.
  2. Premature optimization.
    So yeah if that's what's in the tutorial, run.
vagrant grail
#

@kindred widget I think I have 2 BP that are changed, but they were majorly created only for this tutorial

kindred widget
#

If you want to revert them back to the way they were, you can check out your saved folder. There should be a Backup folder in there. Can check if you have a backup of that class at a date/time before you started.

#

I'd save what you already have though just in case.

vagrant grail
#

but isn't it possible to backup the whole project instead of separate files ?

kindred widget
#

Sure, but not automatically. Not without a backup program that'll do it for you.

vagrant grail
#

oh damn, why Epic Games didn't add this feature tho ?

kindred widget
#

Source control is kind of a rite of passage for developing anything. There's not really a point for Epic to do it, because most people are just going to use their own methods anyhow. Bear in mind that most serious projects are worked on by multiple people on multiple machines. There's already quite a few solutions to that available. Not really a high priority I'd assume.

#

For Solo developers, it's as easy as just right clicking your project folder and sending it to a new zip.

vagrant grail
#

Yeah but automatic saves and no third party softwares required would be awesome

kindred widget
#

I wouldn't complain. But I can definitely understand why they don't bother.

chrome bay
#

Interfaces are a design thing btw, not a performance thing.

random nymph
#
Has anyone using steam api directly had a problem where the steam callbacks are always called twice?```

I think I figured this out. The STEAM_CALLBACK macro functions were also called on some engine object that wasn't added to any other class
queen flower
#

Is there a solution for when your clients character is at a different location on the server than where the client has moved their character? Had a moment where a friends character was next to mine in-game, but according to a screenshot, he was on the other side of the arena.

#

The character is set to replicate. Even upped the priority by 1. Beyond that, don't know what else to try.

raw quarry
#

I'm at a loss for what to try. Whenever I launch my server executable (4.25) I get errors loading PhysX libraries:

#

however, all the files ARE in the correct location, they just dont have the "PROFILE" suffix:

waxen socket
chrome bay
#

Integers are, names are not

#

Int = 32 bits per element

#

FName = replicated as a string essentially

quick flint
#

anyone have any statistics on unreal's multiplayer system

#

like benchmark tests

#

and network tests

#

or straining the network connections with thousands of actors

#

for example?

chrome bay
#

Probably nothing useful. Usually any network related profiling is entirely dependent on your game

clever plinth
#

I have this weird thing where a reference to my custom character class isn't being properly set and is somehow null on both client and server when playing on client

#

However, when playing on just the server, everything works okay

waxen socket
#

Thanks, Jambax. Do you think replicating that struct every ten seconds give or take would be fine then?

chrome bay
#

Well your first issue is that TMap can't replicate

#

TArray is the only container with replication support

quick flint
#

u should rly never want to do that lol

#

replicate a tarray

#

any of u read about basic Big O stuff lol

#

think about how expensive that is

chrome bay
#

replicating an array isn't necessarily a problem, UE is quite smart about it

#

But it's not fast. And if the length of the array changes, the entire thing is sent

waxen socket
#

I don't need to send it every tick. Probably just once a match.

chrome bay
#

There's FFastArraySerializer but it's C++-only

#

One-off data packets I wouldn't even worry about

#

But you probably want to RPC them rather than replicate them

#

No point having the Server constantly checking properties that only send once

#

Or, if it's an "initial" property, use COND_Initial on it

waxen socket
#

It constantly checks them eh? I guess it has too...

chrome bay
#

Yeah, and individually per connection at that

#

So if your actor has a net update frequency of 100hz, all properties are being compared against their most recent changelist state at 100hz, for each connection

waxen socket
#

Okay. I'll look into doing it with an RPC. Thanks!

chrome bay
#

If it's one of those "the match is over here's all the info you need" kind of structs, then yeah RPC makes sense

quick flint
#

trying to figure out why when i pass my character reference to a player controller client rpc

#

the argument is nullptr