#multiplayer

1 messages ยท Page 153 of 1

thin stratus
#

It's more or less the code that was in the CMC, just generalized I guess

lost inlet
#

Not really?

thin stratus
boreal wadi
#

There are some examples in their blogs. Iโ€™ve reached out for an evaluation license so I can see what the code looks like. Iโ€™m only really interested in the fixed net simulation rate as well as the render being separate from that sim.

thin stratus
lost inlet
#

NPP even has that but you would need to implement the local interpolation yourself (as it is now)

snow trail
#

does it work for physics prediction too?

burnt hinge
#

How can i play enter & exit animations in a passenger vehicle? the anims can only reference one character at a time & idk how to pick the right one eather

burnt hinge
# lost inlet show what you're doing

there is nothing special to show. setting character ref when interacting in the vehicle bp and playing montage on that mesh. The issue arises when there are more than 1 character. Not sure how to make it for multiple characters

lost inlet
upbeat basin
#

Do I need to use APawn::OnRep_PlayerState() to get the playername from other clients? Since AGameState::PlayerArray doesn't have an OnRep function, I tried to create my own replicated playerstate array by overriding AGameState::AddPlayerState and AGameState::RemovePlayerState but newly joined player's name doesn't seem like it's set yet when my custom array's OnRep function runs on clients

burnt hinge
lost inlet
#

why is the vehicle the one reponsible for this?

#

and I'm sure you have individual seats right?

burnt hinge
#

no i don't. I just have a passengers array & attaching the characters to the vehicle

upbeat basin
snow trail
#

does the Event Tick get called on both server and client?

dark parcel
#

just like any normal function

snow trail
# dark parcel yes

so if im running some physics calculations (various add forces) and i want the server to be the one calculating all the physics, can i simply use a Branch with Is Server as condition?

thin stratus
#

Yes, or HasAuthority (not entirely the same, but for a replicated actor it would be true for server)

snow trail
#

i see, thanks!

meager tiger
zenith parcel
#

I'm wondering what would be required to make a seamless hosting option.

E.g. player is playing a game, decides to allow a friend to join.

Minecraft does this by ALWAYS being a server, and only opening communication when asked to.

As far as I can tell unreal requires that the appropriate networking interface is prepared when setting up an online world, so I couldn't start a world in singleplayer, and then subsequently simply "open" my game to the network without doing a "UWorld::ServerTravel" at the very least.

Am I missing something?

solar stirrup
#

It'll start a listen server

#

You can probably run that in single player and just prevent connections until you open up, but I don't think you can switch from fully standalone to a listen server on the go

zenith parcel
#

But that requires the appropriate networking stack be booted at that point, yes?

solar stirrup
#

Depends what you want to use

zenith parcel
#

Cool, thats what I had worked out

#

EOS/EOSPlus was the plan

solar stirrup
#

You will need to be connected to EOS, and then you can open the map with ?listen

#

Then if you decide to open up to players you can create the EOS session

#

@zenith parcel

#

If you are offline at the time of starting the "server" it will probably not work

zenith parcel
#

Thanks @solar stirrup thats roughly what I had surmised.
It will however, work just fine and its a small usability hit for the benefit of making the process seamless-ish

dark edge
#

Just have single player = listen server

solar stirrup
#

What I said mmLul

zenith parcel
#

Well now I know TWICE AS HARD.

Thanks guys, appreciate the help

strong fable
#

hi, if I create a dedicated server with the unreal source build, is there a way to find that server on the clients like FindSession? Ik that I can join by typing the specific IP address but if there a way for me to browse that?

fleet scarab
#

DogWave hello, I have a simple beginner question:

Is there any high level difference between implimenting client/server communication when it comes to dedicated server vs listen server?

#

I'm trying to figure out how I should think about multiplayer when I'm working with blueprints. Even with listen-server, should I logically treat it as though every client is just a client, and the server is a separate thing?

I'm confusing myself because with listen-server, one of the clients is also the server.

solar stirrup
#

You'll have to be careful with that, there's some pitfalls in logic

#

On a dedi your server and client(s) are always separated, but on a listen server one of the clients is also the server

#

So you might spot some issues, especially in C++ (i.e. rep notifies in C++ don't execute on the server, whereas they do in Blueprints)

#

that one is one of the easy ones to fall into

fleet scarab
#

My current understanding of multiplayer (engine agnostic) is this: the client has code A, and the server (dedicated) has code B.

With listen-server, do I need to put both A and B into my client?

solar stirrup
#

Unreal doesn't work like that

#

Server and client have the same code running (mostly)

#

Up to you to check if you're the server, or a client, or both in your logic

#

A single player Unreal game is basically a server with one player on it (you)

fleet scarab
#

I think I'm followig

#

so with listen-server, the client hosting literally IS the server, in the same way Unreal is a singleplayer server. So it's up to me to have the logic in my game figure out if it's the server or a client, and treat it as such

solar stirrup
#

yep yep

fleet scarab
#

I basically have to make "all in one" blueprints that can handle it all

solar stirrup
#

You have net modes in Unreal for that:

  • NM_DedicatedServer
  • NM_ListenServer
  • NM_Client
#

That's an easy way to check if you're a server or client, as well as local & remote roles (authority checks)

fleet scarab
#

In my head it'd make sense to split logic between graphs then right, to keep things tidy in my blueprints?

#

Server logic and client logic

#

that sorta thing

solar stirrup
#

For example the GameMode class only exists on the server

#

Clients don't get it replicated to them, so it never runs any logic on clients

fleet scarab
#

Yeah the key here for me is explicitly understanding that with listen-server, the hosting player is basically just playing on an omega interactive server

strong fable
solar stirrup
#

Both have a way to query sessions

#

Steam would mostly be the master server for dedis

strong fable
solar stirrup
#

I don't know if they have an API you can query for stuff like that but maybe

strong fable
#

okay so I would have to integrate either eos or steam first

#

so the default subsystem works only for listen servers?

fleet scarab
#

probably not during testing, you would have a known IP to connect to

solar stirrup
#

OnlineSubsystemNull is just a test subsystem afaik

#

EOS is free, Steam is "free" if you use the Spacewar app 480

#

It's basically a development app to allow devs to test their online connectivity with Steam's API

strong fable
#

eos is completely free?

solar stirrup
#

Yep

#

To my knowledge, never had to pay anything to get it setup and running for my projects

fleet scarab
strong fable
#

alright thats very helpful

grand kestrel
#

Thought so! I might check master and PR the comment

solar stirrup
#

I mean Steam expects you to have your own appid at a certain point if you're gonna use them for a game

fleet scarab
solar stirrup
#

So yeah it's free during development but you'll want to pay the steam direct fee if you wanna release a game on Steam and then use that appid

grand kestrel
strong fable
#

yeah its for a uni project, so i guess its fine

solar stirrup
#

I bought one just for my prototypes, I just re-use it if I make a new one heh

fleet scarab
#

EOS isn't actually a bad stopgap if it's free

#

and sets you up for the epic store too, I guess

solar stirrup
#

EOS is pretty good, albeit a little lacking notably in stuff like the Steam Workshop

#

What's good is the cross platform support though

strong fable
#

you pay 100USD just once right or is it for each game

fleet scarab
#

oh true, you can still sell on steam and just use EOS

solar stirrup
#

On Steam you'd still connect to Steamworks but also EOS

#

and then you can just do crossplatform that way

fleet scarab
#

aah

fleet scarab
solar stirrup
#

EOS doesn't require an account for just connecting using a Steam auth ticket

fleet scarab
#

since they have their admin/overhead to do on your application, and also get filthy rich

solar stirrup
#

It'll ask players to make an account for crossplatform however

solar stirrup
#

My latest proto only uses Steam though because it doesn't seem like the UGC stuff for EOS is there yet

#

And i'd rather just have the Steam workshop heh

#

But in testing, EOS is pretty damn good overall

#

Especially with plugins like RedpointEOS that handle Steam, Epic, console online services etc for you

fleet scarab
#

whats your thoughts on how early to start integrating steam?

#

do you do it fairly early?

solar stirrup
#

It's the first thing I do when I need multiplayer

#

It's super easy

#

If you just want Steam you'd use the OnlineSubsystemSteam and SteamSockets plugins

#

Assuming C++, if Blueprints you'll need to grab a marketplace plugin that exposes those to them heh

strong fable
#

and for hosting dedicated servers, can you do it on steam or you need some other service like playfab or aws?

fleet scarab
#

steam can't host afaik

solar stirrup
#

If you mean renting servers, you'll need another system on top

#

Steam only gives you a master server for a server browser

fleet scarab
#

yaya

strong fable
#

I see

#

so i would need to host my servers on some other service and then use steam to browse those servers

#

im really new to multiplayer programming, hence these questions

solar stirrup
#

Yep

#

It's why I mostly use P2P or want to go with community hosted servers for my prototypes heh

strong fable
#

yeah p2p is fairly easy in unreal, but my uni is offering the highest marks for master servers

#

smh

fleet scarab
#

do they expect you to shell out and pay for hosting?

#

seems like a weird way to grade, are you sure they dont just mean dedicated server in general

solar stirrup
#

You can do a "server" browser and have it list publicly advertised P2P sessions

#

EOS would suit your requirements in that case

fleet scarab
#

yeah at the end of the day it's all fairly similar stuff

#

anyway thanks for your help @solar stirrup that stupid little piece of info was all I needed for everything to start making sense

solar stirrup
#

o7

strong fable
#

our professor doesnt have much knowledge of ue

fleet scarab
#

I wonder if you could just get a digitalocean droplet on the super cheap

#

and host it there

#

not like you're gonna have a 100 player battle royale running on it

#

but yeah id just host a dedi server at home on my pc and leave it running LOL

grand kestrel
#

In theory, if my FFastArraySerializerItem has uint8 uint16 uint32 float properties, if I never actually modify them, they should incur no cost? They wouldn't do an initial replication of the 0 value? Just thinking of a simple way to have float compression that they can select via BP without having to make 4 different versions of my structs just for the different data type

tame kraken
#

Hmm, how come my Game State is not returning valid in my widget's event construct?

#

I'm not being backed by this promise ๐Ÿ˜…


With all that being said, this leads us to our exceptional guarantee:

GameState is guaranteed to be valid when any Actor on client calls BeginPlay.```
#

I think it might be because I'm creating the widget prior to begin play

lost inlet
grand kestrel
tame kraken
thin stratus
#

Cause there are things in UE that fail silently

thin stratus
#

Which by the name of it should mean that not changing the other values should be fine?

grand kestrel
#

That's what I figure too
And I suppose I can always just run the debugger and see if it ever triggers for unused values

distant talon
#

Does anyone know of a way to make the demo net driver for replays ignore a particular actor and not record it's network data? Trying to make it ignore a voip related actor as it chokes on the data and i dont want that stuff recorded to begin with.

daring gorge
#

i have a question,
if i were to make anything replicated run on a looping timer that lets say runs fast or anything run on tick, or lets say even a minigun shooting that is allowed to shoot really fast and has a lot of bullets- how are the packets handled? are we sending those many packets out there at the same time? what if theres more players with minigun now, is there a method to optimize this idea of sending so many packets or messages" of information or does the engine does this by itself?

sterile prism
#

Anyone ever get this error before "Assertion failed: !bPostTickComponentUpdate". Saw some forems on it but not answers.

#

Happens on client side during a RPC event. Game closes after it receives it.

icy jetty
#

Havenโ€™t seen that before but UE-ByeBye Game seems appropriate

open wave
#

if I am taming a creature would I be better of referencing the BP player or bp player controller?

tall coyote
open wave
#

ahh yes cheers.

snow trail
vagrant grail
#

I have 2 cameras on my player to switch between FPS and TPS view, so I'm supposed to handle all of this on the client however, I need the active camera to start a Raycast when I left click to attack, so should I repNotify my variable named "currentCamera" that contains the current active camera ?

Also should I also handle the camera switching (beween FPS and TPS view) on the server too as if I set my variable to repNotify it has to be set on the server and also to avoid cheating (even that I don't see how can the client cheat with this).

grand kestrel
#

@thin stratus is there a way to avoid the byte cost of replication on a UActorComponent, I understand they send an additional uint8 to identify which component on the actor is replicating. For my plugin I can't avoid the use of components, but I'm wondering if there's a workaround. I will shamelessly add in the readme to just duplicate all of the code into your actor instead if there isn't though ๐Ÿ˜„

fossil spoke
#

CMC does this.

#

For example.

#

They have proxy RPCs on the Character class to avoid the overhead created by the component.

grand kestrel
#

Yeah, that's actually how I learned about it ๐Ÿ˜„

#

I was hoping there might be some workaround to avoid it, but it's fine if there isn't

fossil spoke
#

If there was wouldnt you think CMC would use that instead?

grand kestrel
#

I'll provide components and for anyone who really wants the best possible optimization they can manually move the code to their actor

grand kestrel
#

I didn't think there was, but there have been times I missed something like that

fossil spoke
#

Fair enough.

grand kestrel
#

Thanks for confirming ๐Ÿ™‚

glad cloak
#

Any idea why this inventory component on this container is empty when a client opens it after the server puts an item in it?

#

(I have used print string to check this is the case as well as the debugger)

fossil spoke
#

Are you attempting to replicate UObjects you created dynamically?

glad cloak
#

I know default UObjects dont replicate

fossil spoke
#

UObject does not support replication by default

#

Well then you should probably verify that you have setup replication for them correctly

#

Because it absolutely looks like thats the issue

glad cloak
fossil spoke
#

@glad cloak Are you using UE5++?

fossil spoke
#

Follow this

#

You are using an old method

#

This post outlines a new method for doing subobject replication

glad cloak
fossil spoke
#

I dont think so, but the new method I believe is much easier.

glad cloak
fossil spoke
#

Literally that topic

#

It shows directly how to do it

#

Should look into the documentation as well.

glad cloak
#

Also, if the old method is technically still working, why wouldn't it just work in my case?

fossil spoke
glad cloak
bronze glade
#

Hey everyone! Really basic question I think, how do I pass variables from the game mode through the game state in a way that the clients will get them as well? I am trying to pass a seed into a world generator. Gamemode passes in the seed, Gamestate then calls a multicast to spawn the generator. On the server it has the seed, but on the client it is always 1. I'm sure it's something simple, but what am I doing wrong?

fossil spoke
#

@bronze glade Why are you just not marking the WorldGenerator Actor as Replicated and set the Seed also as Replicated?

#

There is no need for these RPCs

bronze glade
#

WorldGenerator is replicated. I think I made the seed variable replicated let me look

#

Could I just call it straight in the game mode if that's the case or do I still need to do it through game state?

fossil spoke
#

Then you do not need to call a Multicast to spawn a different version of the generator on all Clients

#

Just spawn the Generator Actor from the GameMode and call it a day.

#

If its replicated, it will be created on the Clients

#

With the correct Seed

#

@bronze glade You should go read through the Network Compendium linked in the Pinned Messages

#

Its a very thorough document that sheds light on all things Network and Replication related.

#

Actor and property Replication are important concepts that you should get a full grasp on.

bronze glade
#

Ha, I had them all checked as replicated except I missed the seed lol. Thank you, I will definitely read the compendium!

wintry crane
#

so i call from my widget to my gamestate from host and it works, then when i try to call the same thing on the client it doesnt fire SVR populate names? why?

fossil spoke
#

@wintry crane The GameState cannot call and RPC to the Server from a Client

#

It is not owned by a NetOwningConnection

#

Only a PlayerController or an Actor that is Owned by a PlayerController can call on RPC to the Server

#

Actors that are owned by a PlayerController are the Pawn its possessing or the PlayerState

wintry crane
#

ohhh

#

so only those

#

ahgh i am pretty sure i read that somewher

#

e

#

information is just flying out of my head sometimes

fossil spoke
#

I think ive told you this before

wintry crane
#

i think at the time i thought that things that pc owns that would include created or spawned by the player

#

didnt know possessed pawn and player state are the things conidered to be own by pc

#

mb mb

fossil spoke
#

Owner is a property of all Actors

wintry crane
#

yeah it makes sense

#

thanks again

serene sparrow
#

anyone know what happens if I send an RPC on an actor that is not yet net relevant?

thin stratus
glad robin
#

Got a more editor QOL question. Is there any way to have the Outliner->ChooseWorld option automatically select the Server world? Would love to save that 3 seconds of clicking every time I am checking things haha.

twin juniper
#

The wallrunning bool inside the ABP itself is not replicated, but it is being set each tick, based on a variable in the pawn, that IS replicated.

#

I checked with print, and the Pawn variable is replicating correctly to everyone.

#

But the character tilts only on it's own client's screen, the rest can't see the tilt.

thin stratus
#

Have you considered the fact that the data that drives the tilt is not replicated

twin juniper
#

I hadn't xD

#

thanks

rocky kestrel
#

Is there way to take my client bandwidth usage realtime? I would want to set UI text based on that so I can easily see it when I am test playing on server.

chrome bay
#

You can get the info you need from UNetConnection

#

InBytesPerSecond, OutBytesPerSecond etc.

rocky kestrel
upbeat basin
#

Is it a good practice to have authority checks on non RPC functions that are planned to be used from authority context?

elder shale
#

So I'm working on a multiplayer game with multiple streaming levels, each with it's own lighting. I'm trying to find a way that directional lights do not overlap, and only affect each light's specific level. Is there any way to set bounds for directional lights? Another approach I've tried, with limited success, is by setting visibility on individual directional lights from each character at the client level. I'm sure this isn't the first game with multiplayer using streaming levels, but after days of searching i've yet to find any solutions.

crisp shard
#

would player XP for skills be something best stored in the player state or on the character itself? i could also make a skill component and put that on the character

finite spindle
#

Hey, how games like candy crush handle sessions ?

#

they create a new session for every player, but in unreal engine do i have to create a new server for every player ?

opal pulsar
#

Is it normal for only the server to get the clients control rotation replicated to them?

#

Does this mean only the server? DOREPLIFETIME_CONDITION(APlayerController, TargetViewRotation, COND_OwnerOnly);

#

OwnerOnly in this context is the server right? or is it local player?

chrome bay
#

local player

#

Well, whoever "owns" it

opal pulsar
# chrome bay Well, whoever "owns" it

Yeah which in the case of APlayerController is the local player right? What use is the local player getting their own replicated rotation back to them?

#

All other clients have the rotation for other clients as a static value, only the server is getting the replicated rotation, do you know if this is normal by any chance?

#

I would assume not because then client side VFX stuff would be useless since its not able to reflect the correct rotation for client A of what client B is looking at

#

I did an empty project to prove my hypothesis and it also had only the server with all the clients control rotation values

tardy fossil
#

yeah thats weird.. it makes no sense TargetViewRotation is COND_OwnerOnly

#

youd think it would be COND_SkipOwner

#

well actually other clients only see their own playercontroller so that wouldnt do anything either

#

personally i just convert the control rotation Pitch value to a uint8 and replicate that and have the clients smooth it out

chrome bay
#

The comment above it explains why it's replicated

#

The idea is when you're looking through a pawn that isn't yours

tardy fossil
#

oh for spectator reasons?

chrome bay
#

presumably yeah

tardy fossil
#

ah makes sense

chrome bay
#

Or perhaps vehicles or something

#

Must be ancient, since the comment says "new condition system"

#

Might be legacy crap

opal pulsar
#

I guess i am manually going to need to replicate it and create some GetReplicatedRotation function that just creates a FRotator from it instead of trusting camera rotation stuff

tardy fossil
#

yeah it might be one of those things epic thought was better to leave up to the dev to decide if they want to replicate it or not, since not all games would need to have to know other clients control rotation

chrome bay
#

The APawn::RemoteViewPitch is so you can reproduce other clients' aim, which is pretty common for any character based game really.

#

But APlayerController::TargetViewRotation is just so you know the view rotation of the object that's your current viewtarget, since it might not be your pawn

#

E.g, might be your vehicle, or another players' pawn etc.

#

Turret etc.

twin juniper
#

Hey, is there any way i can do:

ForceNetUpdate();
AfterUpdate.Bind(DoSomething());

My current code is something like:

AItem* ItemAdded;
// Add item on server
if (Inventory->Server_TryAddItem(ItemActorClass, ItemAdded))
{
    if (ItemAdded)
    {
        // Update widget on client
        Inventory->Client_AddItemWidget(ItemAdded);
        return true;
    }
}
return false;
#

I use it to update my inventory widget. I just have a lot of problem with my inventory system, because when i do any action, like adding an item, it will add on the server, then call an RPC back to the client to update widget. However when the RPC arrive, the variables used to update the widget is not replicated yet.

opal pulsar
sick sphinx
outer moth
#

Any fixes for rubberbanding?

twin juniper
pallid mesa
#

I have a predicted property in my cmc called Blah, and Blah gets mutated using input, through the saved moves and so on. How can I mutate Blah authoratively given a server flag? So far I've made an authorative setter and passed this flag through ServerFillResponseData and its analogous Serialize. But I'm finding some desyncs on Blah. I've assumed they are normal, as I seem to be doing everything through the ClientHandleMoveResponse function. Besides the flag I'm thinking that i should also set Blah when my flag is set in ServerFillResponseData.

chrome bay
twin juniper
#

Let me try to use OnRep_Owner(), since it gonna update the whole thing, instead of put rep notify on every single item variable.

chrome bay
#

No idea what you're doing, but if every item stores it's own hotkey etc, how are you going to avoid conflicts?

#

Sensible thing to do would be to just have the UI listen for changes to the inventory and update itself accordingly

twin juniper
#

How do i make the UI listen to the C++ items? I store widget pointer in each item and that worked for me

chrome bay
#

Put an event on whatever stores the inventory, broadcast that event when inventory updates

#

Have the UI bind to it

twin juniper
#

But in order to bind that event, the inventory still need to get the widget

chrome bay
#

It doesn't - the widget gets the inventory

#

Gamecode talking directly to UI is cursed

twin juniper
#

it is very cursed indeed

solar stirrup
#

Make your widget bind to your inventory's delegates on construction

#

and unbind on destruction

twin juniper
# chrome bay Have the UI bind to it

But i don't get it. The structure design is still the same. When i changed something, like a quantity of an item, the source of the change still come from C++. Then you can broadcast a delegate and the widget would change.
So it's like Item -> Widget.

Instead of doing that, now i am storing a direct widget pointer. When i change something, i just call straight on the widget.
It is still Item -> Widget. The only difference is the representation.

The only way the structure could change to Widget -> Item is some kind of tick behaviour, when the item never have to tell the widget when and what to change.

#

Tell me if i am wrong lol

chrome bay
#

This is more of a code design thing, but generally speaking it's preferred to have your UI code separated from your game code, such that it sits "on top" of the game code. Otherwise, your gamecode needs to be aware of the implementation details of the UI

#

UI is explicitly designed to represent something , so it's more appropriate to have it know gamecode details than gamecode know UI code details

#

Also, UI is usually complex in it's own right - it becomes a bigger problem if say, somebody opens the pause menu and your widget gets destroyed - then what?

#

Gamecode can push events without caring about who is listening for them

twin juniper
#

yeah that make sense

chrome bay
#

In practice it is quite difficult to achieve complete separation, but it's a decent thing to work towards

twin juniper
#

I just hate c++ delegate in general. The syntax burn my eyes

chrome bay
#

It doesn't have to be an event, the UI could tick the entire state each frame if it wanted - just not very performant to do that I expect

#

When my inventory changes I broadcast an event with a changelist, so it only updates relevant elements

twin juniper
#

A changelist? Like a log? That's pretty cool

#

How you do that?

#

That has to be my sanest way out of this

#

Like a FInventoryChange

quasi tide
#

I have a small inventory, like 4-6 items max. I just broadcast that something has changed and then rebuild the inventory in the UI. lol

chrome bay
#

Not that easy to explain, but the gist is store the inventory state before making a change, then make it, then broadcast the change when the operation completes.

My items are identified with ID's and have a scoping system for it so it's relatively cheap/easy to do.

quasi tide
#

Was super duper easy and fast to implement and won't hit any perf issues for my scenario

twin juniper
#

now i am too deep into this stuff, can't back out lol

solar stirrup
#

I just use the fast array serializer for my inventory

#

I get add/change/remove events and just fire delegates

#

easy to bind for UI

solar stirrup
#

You'll learn along the way

quasi tide
#

Don't guess. Ever.

twin juniper
#

Serialization is basically just archive right?

#

WinRAR kind of thing

solar stirrup
#

Serialization in Unreal can be for save games but also for networking

#

Amongst other things

#

Google the fast array serializer for Unreal if you wanna see what it does

twin juniper
#

yeah we dont even have a single document page for anything serialize related

sick sphinx
# twin juniper now i am too deep into this stuff, can't back out lol

Based on my experience, even if it would cause a full rewrite of the feature, you will save time by rebuilding it rather than sticking to a design that bottlenecks your progress. Of course in production (especially if the game is already out and customers are expecting frequent updates) we rarely have the benefit of doing this.

gleaming solstice
#

For a simple MMO where the only replicated stuff is character location/movement and occasionally triggering animations (like when a player starts dancing or does a high-five emote), do you think UE's multiplayer is good enough for 200+ players in one room/world or would you recommend using something more basic like Websockets?

solar stirrup
#

You're not getting over 100 players in Unreal

#

At least with a vanilla engine

#

100 players is already pretty tough to achieve

stray crescent
#

lets say that my game is built for a listen server do I need to change anything for it to work as a dedicated server? (aside from being built from source)

quasi tide
#

As long as you handled the scenarios that are applicable to dedicated servers, should be fine.

stray crescent
#

do dedicated servers support blueprints?

cursive steeple
cursive steeple
stray crescent
#

lets say that we have a chest that is written entirely in BP, it has a replicated variable that indicate if its opened\closed
lets have another class of chest written in C++ does the same thing and we will inherit a blueprint from it for the visual stuff
would the DS build have both BP versions of the chests or just the first one? (the second one will use the base class of the chest)

#

as in it will omit the BP for the second one because it doesnt contain any replication code

cursive steeple
twin juniper
#

How does a delegate work over the network? Like it can just send data everywhere?

#

Doesn't make any sense

#

Say i have a delegate on my inventory, then i bind an event in the server to it, then i broadcast the delegate from the client, how would that turned out?

#

Doesn't seem like a delegate is replicated either

solar stirrup
#

they're not

#

you just broadcast them on server and client

twin juniper
#

That's like magic

#

wtf am i crazy

#

they just literally worked

upbeat basin
#

What would be the best way to carry the character class to spawn for game map with seamless server travel from a menu map?

blazing spruce
knotty aspen
#

Hey, I dont know if this is the right topic for this question.
Im trying to make a Local Multiplayer game, where a new player can be detected in the menu, if they press a botton on a new gamepad. How can I archief this?

wintry dirge
#

Hello, I have an issue that only got reported yesterday, on a project I'm releasing at the end of the month and hoped anyone could give me some go to checks

Over long distance (UK to US) character movement is very choppy / corrective and unplayable

I'm just using regular wasd > add movement input on a replicated player character bp

wintry dirge
silent valley
# wintry dirge Will do once I'm home

Use the built in network latency emulation mode in PIE, it will show most issues up. Its actually good practice to run with it enabled as standard during dev.

wintry dirge
#

I do have it enabled by default on 'bad'

#

I.e. I'm able to reproduce the issue

I'm currently trying to diagnose why it's jittery, and identify a solution

#

Wondered if there were any 'gotchas'

solar stirrup
#

Depends on your code

wintry dirge
#

Maybe there are some command line debugging options for drawing correction

solar stirrup
#

The output log might give some warnings

#

there is

#

p.NetShowCorrections 1

wintry dirge
#

Ah brilliant

#

๐Ÿ™

#

I will share the logic in about 4h once I'm off work

gleaming kite
#

is there something that clients can bind to for when the gamestate is replicated? I suppose I could do some notify on state change/begin play on the game instance and bind to that for remotes but didnt know if there was a more proper way

solar stirrup
#

You should handle it in your custom game state class

gleaming kite
solar stirrup
gleaming kite
#

well yes, but my question was accessing the GS from other classes. Didnt know if there was a built in spot to do that besides handling a delegate broadcast manually

fossil spoke
gleaming kite
#

i thought that wasnt 100% reliable. Maybe im misremembering a conversation i had with someone prior

fossil spoke
#

It should be reliable.

#
void AGameStateBase::OnRep_ReplicatedHasBegunPlay()
{
    if (bReplicatedHasBegunPlay && GetLocalRole() != ROLE_Authority)
    {
        GetWorldSettings()->NotifyBeginPlay();
        GetWorldSettings()->NotifyMatchStarted();
    }
}

void AGameStateBase::HandleBeginPlay()
{
    bReplicatedHasBegunPlay = true;

    GetWorldSettings()->NotifyBeginPlay();
    GetWorldSettings()->NotifyMatchStarted();
}
#

The OnRep handles Clients, the function at the bottom handles the server.

gleaming kite
#

ah, yeah. thank you. I apologize. definitely misremembered something.

#

also I eventually found a fix to that voice talker bug. Persisting the actor in seamless travel didnt work because the underlying audio component that the synth talker (what plays the voice packets) was transient. So unless you heavlily modified the default implementation of a synth component to supply your own audio component to play all of the packets through thats owned by the persisent actor, it would crash each time. The fix was just to pause all incoming packet processing (the same as muting a player, but global) and unregister all talkers and clear the voip packet buffer. After that, no issues.

fossil spoke
#

Seems like an oversight on Epics part really.

#

In that they didnt consider Seamless Travel transitions

gleaming kite
#

Still unsure why epic marked it as "wont fix" unless they just saw what they would have to untangle with the synth component and gave up. Considering VOIP talker is basically legacy

fossil spoke
#

That maybe why, if its obsolete then they wont fix something they arent going to keep around or update in the future

torpid lantern
#

I could use some advice on a data storage method.

I am thinking of creating a server object - this object will be responsible for tracking all of the spawned actors during a play session, and then saving the actor's state (location, GUID, & reference). When the game server starts, it will load all actors (and re-associate references based on GUID).

For this data object, is it okay to store actors as an array? If so, I expect several hundreds/thousands of array elements. Is this okay, is there a better way?

#

example: Player builds a house, I want that house to persist through a server reboot.

  • At the time of spawn, the house is added to this custom object.
  • At the time of server reboot, the object saves its actors to a save game.
  • At the time of server start, the object loads from save state and respawns all actors that it knows about

Can I just write these actors refs into an array on the custom object?

modest coral
#

oh really well your a smart guy right ? ? you look like a smart guy so what's that then ?

#

can some one talk to me about the login ? and its it needed to control a rpg mmmo BP only game xD

fossil spoke
#

@torpid lantern You wont be able to "save" an entire Actor.

#

You need to instead save out the data on that Actor you want to keep.

#

When you go to load it, you need to recreate the Actor with that data.

#

It is tedious.

torpid lantern
#

I get that part. My question was more around managing a large list of actors at the server-level. What's the best method to track that data and save/load in bulk?

fossil spoke
#

You might want to break it up into different lists, but Array can store lots of elements

#

Its not an issue

#

Unless you want to replicate that list

#

If it has hundreds of thousands of elements

#

Replicating that as it is would not work

#

If you are using C++ you can serialize all of the properties of an Actor into a byte array and store that instead.

#

That makes it much easier to rebuild it on load.

modest coral
#

yeah ok so ,,, then if the exe can still be triggers if not use a launcher . that fix can be done with a method i use but i need first understand something about players acc and in open world if player save there data on there side then i not think game needs login . but i am all ears

#

and can it be possible to fuse external php registration to open on cmd with unreal engine after player register on the form ?

indigo brook
#

For local multiplayer, how do you guys get around the 5.3.2 bug for keyboard player 1, controller player 2 issue?

snow trail
#

how can i run this exclusively on the local player pawn, and not on every pawn?

twin juniper
#

Hey guys, what does last value mean? It mean the current value on the server or the value before that?

#

So confusing with Unreal doc

dark edge
#

"Hey your Health changed, here's what it was before it changed"

twin juniper
#

so i change my health from 0->100 on the server, the last would be 0? How do i get the 100 then?

dark edge
#

current is 100

#

Health = 100
LastHealth = 0

That's your state when the onrep fires

twin juniper
#

but how do i get the current, what is the syntax

#

because the document only show the last value

#

i just remove Last from the variable name?

dark edge
#

it'll be what the actual replicated variable is

twin juniper
#

oh,

#

ty

#

but the "HealthValue" doesnt even need to match variable name though, as in the doc it is "HealthValue1"

#

such a weird design

dark edge
#

link the doc right quick

burnt hinge
#

how can i reference characters for a passenger vehicle. I need to play animations for them but the anims only take one reference so i need to reference the right one.

quasi tide
dark edge
#

ThingHappened -> for each SeatedCharacter -> play anim

#

I would just have an event on your Character though, Event HitBumpWhileSeated or whatever

twin juniper
quasi tide
twin juniper
#

I am trying to reuse OnRep for multiple variable

quasi tide
#

In your code it would be HealthValue, because I don't know why you'd have one character with 3 different health values.

#

Don't

burnt hinge
quasi tide
#

0->100:

The param value will be 0. The current value will be 100.

#

Don't try to reuse OnRep functions

#

KISS

twin juniper
#

alright,

#

ty

dark edge
#

However you do it, you tell all the characters "hey, something happened"

dark edge
#

some set of variables?

snow trail
#

hello, how can i control axis values over the network?
what i mean is, how do i do this without just having the Set Throttle event be a RoS?
cause rn it sometimes just seems to lose input and it breaks, not sure why
im also not sure how performant it would be to constantly send RoS from every client like that

dark edge
#

run on server is the correct approach, assuming Throttle isn't already handled for you inside VehicleComponent, whatever that is

#

The only way to tell stuff to the server is with a Run on Server event

snow trail
#

i see

burnt hinge
dark edge
orchid eagle
#

can someone please check my replication for my combo attack system
thing doesn't work fine there and im not sure if i did it right or i missed something

dark edge
#

good god my dude

#

any particular reason you're not using the replicated play montage nodes?

orchid eagle
#

what is that

dark edge
#

I think Character has some stuff for that

orchid eagle
#

im searching everywhere and applying what i learn and never saw that

dark edge
#

Anyway, there's no way anyone can debug this just from looking at it, you got tons of stuff going on

orchid eagle
#

yep i know, is there a way or something i can do to give a better info
like i can screen share if you want to

modest coral
#

are these bots ?

orchid eagle
#

?

modest coral
#

seriously wtf is goin on here 0% health yayaya daa bee beep and ref to nothing was this ?

#

i went for tea and come back there is a random wild chat ?

snow trail
#

what are you on about lmao

modest coral
#

that seem E = mc is not a square but fry egss was more intriguing to talk about here

snow trail
#

first of all its E = mcยฒ

#

second of all what does that have to do with anything

#

why are you so mad

fossil spoke
#

@modest coral Please stay ontopic and remain constructive.

modest coral
#

oh great his here and got what he wanted ok dude

twin juniper
#

Hey, is there any way to 100% create an inventory widget? First i create the inventory struct in the server and let it replicated down. To create the widget i need a pointer to the actual struct, so i can't just do a client RPC, because the RPC will run before the pointer is replicated. I can try to create the widget in the inventory struct BeginPlay, but there would be no PlayerController there.

It has to be something to do with OnRep, but idk which OnRep to call. Tried on Rep on the inventory pointer but that didn't work.

void UInventoryManager::TryCreateInventory()
{
    if (!IsValid(InventoryStorage))
    {
        InventoryStorage = GetWorld()->SpawnActor<AQyStorage>();
        InventoryStorage->SetOwner(GetQyCharacter());
    }
}
void AQyStorage::BeginPlay()
{
    Super::BeginPlay();

    if (TryGetQyPlayerController()->IsLocalController())
    {
        // Create the widget
        TryGetQyCharacter()->GetInventoryManager()->OnAddStorageDelegate.Broadcast(this);
    }
}
modest coral
#

ok so anyone can tell me about login ?

#

or is this question to easy for the intellectual minds here ?

twin juniper
#

you ok bro?

solar stirrup
#

Yeah Logout is harder

#

(ask your question)

modest coral
#

well maybe you didn't see it from all the stuff ....got over it

#

i lost my mood see ya

solar stirrup
#

Indeed I did not, you should re-post it or link it

#

Welp

snow trail
modest coral
#

if use launcher but nah you guys can continue i be fine

#

i snot first ime and then get mute for a week ?

#

user that help me once got ban ?

#

yeah ok see ya

orchid eagle
#

<@&213101288538374145>

snow trail
#

lol

fossil spoke
orchid eagle
#

this guy is trolling

fossil spoke
#

@modest coral I asked you earlier to stay ontopic and be constructive

#

This is your last warning

solar stirrup
#

I'm guessing language difference tbh, but yeah

solar stirrup
#

Just ask your question and we'll see if we can help

burnt hinge
#

or how do i select the right character to play the anim on

dark edge
#

do you have which seat or which character?

#

choose the seat -> find in array -> set character to be that index in character array, now it's lined up

burnt hinge
dark edge
# burnt hinge

Why do you have an array of bools? You can just have an array of whatever a seat is and a corrosponding array of characters

#

a pointer can be null, that can encode "Who's sitting here? Nobody"

burnt hinge
#

Seats are just tags. Better to use bools

solar stirrup
#

Probably better to just have an array of player character references

#

So you know if a seat is occupied and who occupies it in one array

dark edge
#

However you do it just have some data structure that you can query for WHO is sitting in a seat

solar stirrup
#

Seems like they have multiple arrays for that purpose

dark edge
#

It could be as simple as an array of fixed size with character references, or can be 2 arrays in parallel, or a map, or an array of structs, or whatever

solar stirrup
#

that's why I'd use an array of player character refs instead for both purposes, and tbh, personally I'd have a struct with all the data needed heh

burnt hinge
#

This array stuff is not important. The result is the same. i just need to know how to play the animations for the right characters

dark edge
#

If you know the seat, you know the character. If you know the character, you know the seat.

#

If you know the seat, you presumably know where the seat is on the vehicle

#

If you know a location, you can figure out which seat is closest

#

etc etc

burnt hinge
#

The seat is irrelevant to the animation. i need to get the right character from the array when the event fires

solar stirrup
#

Ignoring how the setup is iffy at best, you can just pass the character reference or seat index as a parameter in MC_EnterVehicle

#

Also mixing RPC and replicated properties is bad: you have no guarantee one will execute before the other

#

You're basically rolling a dice to determine if it'll work or not

dark edge
#

My first draft of this would have a socket or scene component per seat. That represents the WHERE for each seat. Then slam them all into an array on begin play, and make another array of character refs the same size. Now you have 2 arrays, one representing the seats, and one representing the sitters.

Character.TryEnterVehicle would query the vehicle for the appropriate seat, and call EnterVehicle with parameter representing the seat to enter for.

solar stirrup
#

Would be easier to have the seat & sitters be in a single struct

#

All in one place, guaranteed* to have all the data you need to play cosmetics in the rep notify

*only if the characters have replicated to you before the vehicle did

dark edge
#

On a successful enter, you set Sitters[index] = CharacterThatJustSat

#

yeah i mean this whole thing is a disorganized mess lol

#

it should all be driven by repnotify IMO, but you'll have to do some sanity checks so driving into an area and making a new vehicle relevent doesn't show a bunch of characters getting in while it's driving lol

burnt hinge
#

how is it disorganized if i have literally the same thing you just wrote

solar stirrup
#

You have two arrays

#

It's bad design

#

@twin juniper moving here since it's multiplayer: replication order is not guaranteed, so it can always change

dark edge
solar stirrup
#

You have to write networked logic that is resilient against different orders of execution

twin juniper
#

ia coroutine?

dark edge
#

hell no don't bring coroutines in to this now lol

solar stirrup
#

It's one way of doing it, in a coroutine you'd be able to wait for all the actors you need to be replicated, but it's complicated

twin juniper
#

i just cant find a way to do network logic that make sense

solar stirrup
#

and if you haven't gotten the basics of multiplayer in Unreal, maybe skip that for now

burnt hinge
solar stirrup
#

Your best buddies in multiplayer are BeginPlay() and rep notifies

dark edge
solar stirrup
#

BeginPlay/EndPlay call when an actor spawns from replication or gets destroyed from replication, rep notifies for property changes

dark edge
#

Yes, honestly I'd just delete every multicast from your project and force yourself to do things with repnotify until you know when it's appropriate to multicast

burnt hinge
#

idk who is talking to who bruh

solar stirrup
#

My three messages were to Flow

#

Adriel is talking to you

burnt hinge
#

im using reps too

solar stirrup
#

RPCs should not be used for stateful stuff, so in your case you'd only wanna use replicated properties and rep notifies

#

Not both: that's a recipe for disaster

burnt hinge
#

i just need to get the stuff to work first and worry about other shit later

dark edge
#

I'd set up this system to work without the animation, just using onreps to go from walking to sitting in a seat. Do that, then later you can add the transitionary animations however you want. You can do that with onreps too, or maybe use a multicast if it ends up being appropriate.

solar stirrup
#

Well believe us, your stuff won't work like this

dark edge
#

The STATE of being in a seat shoudl be an onrep either way

solar stirrup
#

And if it does, add a sprinkle of latency and it'll break

burnt hinge
#

the seat stuff already worked with teleporting. now i just need to add the anim part

solar stirrup
#

In your rep notify you can determine who just entered or left the seat and play animations

#

Would literally make it easy for you to add anything you want then

#

animations, sounds, UI stuff w/e

dark edge
#

Get it to work with no multicasts

burnt hinge
#

server

dark edge
#

uh

#

the request to sit should be a run on server event yes

#

but the thing that drives what people see should be a repnotify

burnt hinge
#

i can switch to rep in 2 seconds. its not important

dark edge
#

ok so to start, play the anim in the onrep

#

IDK if you have access to old values in BP onreps so it'll be breakable but it should be visual only, not anything game breaking

#

Basically, assuming you have access to old values. You want to play an animation when the inhabitant of a seat changes. If it goes from nobody to somebody, that somebody plays the getting in animation. If it goes from somebody to nobody, that somebody plays the getting out animation.

#

or the other way around. If Character.MySeat goes from Nothing to Something, then play the sit in that seat animation. And the opposite when it goes from Something to Nothing.

solar stirrup
#

I don't think Blueprints allow you to access old values in rep notifies, however you can just keep a local copy of the array

#

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

burnt hinge
#

Are you guys happy now? i made them on rep wohooo.

solar stirrup
#

Hey if you wanna make a game that runs on flimsy netcode you're free to, we're just trying to help ya get better at multiplayer

#

:p

burnt hinge
#

i cant pass the reference to the event with onrep.

solar stirrup
#

You have to determine what happened

#

Here's a quick rundown of what you need to do:

  • In the rep notify, keep a copy of the previous value of the array (local copy, not replicated)
  • Compare the previous array to the current array, you'll need to loop to see which seats got emptied and which seats got occupied
  • You can then do whatever you want for seats that got occupied and for seats that got left
burnt hinge
#

How do i do the first one. I'm not that good with arrays

twin juniper
# solar stirrup Your best buddies in multiplayer are BeginPlay() and rep notifies

I know some mutliplayer basic but i have a problem that's can't be solve by those anymore. Basically i just spawn an actor on the server and have a replicated pointer somewhere. And i want to use that pointer to spawn a widget to the player. The player is in client side.

So in order for this to work, i need both the actor pointer + the player controller exsist at the same time client side.

  • If i call an RPC from the server to spawn the widget, it would fire too fast and the actor pointer wouldnโ€™t be there.
  • If i use BeginPlay() of the actor in client side, the PlayerController is not there.
  • If i use BeginPlay() of the PlayerController in the client side, the actor pointer is not there.

So either i am wrong or i need something else like coroutine to continue

solar stirrup
#
  • RPC is a bad solution, replication order is not guaranteed
  • Literally wait for both to BeginPlay
twin juniper
#

you mean do 2 if

solar stirrup
#

This smells like bad design from your part but that's another problem

With your current situation, I'd just check if the actor is there in your PlayerController BeginPlay and if the PlayerController is there in your actor's BeginPlay

#

One of those BeginPlay calls will have both actors there (duh)

#

Order resilient

twin juniper
#

but that's so bad

solar stirrup
#

You can fire a delegate when your PC begins play, a bit tidier

#

That's a problem with your design, but it's also inherently of Unreal's networking works

#

You have no guarantee for replication order

twin juniper
#

so with that case, is it better to have coroutine

solar stirrup
#

Coroutines make this "cleaner" if you write it clean

#

You can have a coroutine wait for the PC to be there through a delegate you call when the PC begins play

#

Thanks to UE5Coro it's pretty easy to do

twin juniper
#

ok, thanks a lot

#

I'm not sure its because i have a bad design though. The need to initialize thing in BeginPlay is quite normal?

gloomy tiger
twin juniper
#

I think i should post my whole problem so you guys can help me decide whether it's a bad design or not

gloomy tiger
#

Before you do that

#

APlayerController exposes a method (C++ only) called AcknowledgePosession. What it does is pretty simple: whenever a player controller was given a pawn (via Possess), that function is called. The juice here is that it happens on client/local instances.

gloomy tiger
twin juniper
gloomy tiger
#

Sorry, I don't know. Been fond to AcknowledgePossession and it covered all my use cases.

#

The gist is: AcknowledgePossession would replace your BeginPlay for situations where you want to do something only when your PC has a Pawn. It's guaranteed your client has a pawn by the time the function is called.

twin juniper
#

Yeah doesn't matter anyway, since my problem not related to a pawn but a different actor

#

appreciate the help bro

wintry dirge
# solar stirrup show code

Architecture>

  • player is given abilities 'ga_crouch, ga_walk, ga_sprint' with corresponding enhanced input actions
  • when the ability is activated on the server, authsetmovestate is called and rep'd down via OnRep_MoveState
  • OnRep_MoveState will call update move speed, which uses the variables to determine a move speed for all connections
  • Native Character start/end crouch also trigger a move speed update because crouched is a condition in the logic
solar stirrup
#

Yeah you cant use replicated props and rep notifies to affect movement, the server will apply those before the clients and they will get corrections

#

No C++? You kinda need it to modify the CMC and route all this through it for proper prediction

#

@wintry dirge

wintry dirge
#

Ok, c++ required, noted thanks

Yep it's a BP only project.

#

The gameplay ability can be set to predictive and apply the change locally also which may help

solar stirrup
#

If you use the GAS it does have ways to handle movement in abilities

#

Which might be what you're looking for

wintry dirge
#

Oh

#

I'll do some googling on gas for movement ๐Ÿ‘

solar stirrup
#

o7

soft flare
#

Yo guys anyone can help me out ? im trying to do chloth painting but for some reason the cloth looks for all the clients like this (bandana)

#

the top right window is what the client is seeing

jade ibex
#

is there any useful resources on using the VOIPTalker? besides setting it up for the player... for example, how can i modify send/receive volume of certain player for a client?

#

google comes up with nothing

#

seems under documented

short arrow
#

It's really not good iirc, it has most basic functionality and not recommended for anything serious

jade ibex
#

damn...

#

ok

#

thank you

#

i can make do

dark parcel
jade ibex
#

thank you

upbeat basin
#

Neither CopyProperties() nor OverrideWith() seem to be called upon my level change with ServerTravel(). I've seen it should be a seamless travel for them to work and I'm travelling like GetWorld()->ServerTravel(GameLevelName). Is there any obvious mistake that I'm doing about these?

#

Ah after setting AGameMode::bUseSeamlessTravel to true, it seems like now using seamless travel. I was able to get the APlayerState::CopyProperties() being called on my lobby player state with the input being the game player state

rocky kestrel
#

What is correct way to spawn muzzle flash? I want to spawn it locally so it doesn't have any latency. Then I want to spawn it to other clients "non reliable". (in image that first event is called after input event)

chrome bay
#

Surely most of that information is already available to every client? No need to pass it via the RPC

#

I'd consider using an incrementing counter with COND_SkipOwner instead, and I would definitely determine the parameters independently client-side. Shouldn't be any need to send attachment information, or the emitter template etc.

#

Also, I'd drive all this from existing "firing" RPC's/logic if you have it

chilly haven
#

Is there any form of delegates that works across multiplayer, or has anyone tried implementing that? e.g. client sends out a message, server listens for it

#

i.e. going beyond strict reflection/RPC model

#

should be easy to implement

chrome bay
#

There isn't no

upbeat basin
#

If I would like to have two separate tagged group of PlayerStarts, would I need to provide my own logic to pick a random start point for the team player belongs to?

#

ChoosePlayerStart gets one of non occupied PlayerStarts without checking tags and FindPlayerStart only seems to check the tag and not if the space is occupied or not. Is it up to us to combine these logics?

nocturne quail
#

is this a good idea to store all !DeadPlayers info in the GameState?

lost inlet
#

!Dead? as in... alive?

nocturne quail
lost inlet
#

why not just call it that then

nocturne quail
#

alive players

#

๐Ÿ™ƒ

lost inlet
#

also the GS is typically for information you want to broadcast to all clients in the server

#

so if that's something you want to do then, do it I guess

#

if it's something for the server, then you can just store it in the gamemode

nocturne quail
#

all players will know how many players are alive

lost inlet
#

well do they need to know how many, or the specific players are alive

#

because that's slightly different requirement wise

nocturne quail
#

in the top right corner the numbers of total players alive

lost inlet
#

then just add the number to the gamestate? you don't need a TArray of playerstates to give you that

nocturne quail
#

perfect

#

Thanks very much

shrewd carbon
#

I have a ServerRPC on my Pawn, and am trying to call it from my PlayerController..
It does not appear the RPC is running on the server?
Pawn header

UFUNCTION(Server, Reliable)
void SrvMoveLocation(FVector2D Input);

UFUNCTION(NetMulticast, Reliable)
void CltMoveToLocation(FVector2D Input);

Pawn Source

void ATempoCharacterBase::SrvMoveLocation_Implementation(FVector2D Input) {
  UE_LOG(LogTemp, Warning, TEXT("checkingAuth"));
    if (!HasAuthority()) return;
  UE_LOG(LogTemp, Warning, TEXT("AuthHas"));
    if (!bCurrentlyMoving) {
        CltMoveToLocation(Input);    
    }
    
}

void ATempoCharacterBase::CltMoveToLocation_Implementation(FVector2D Input) {
  UE_LOG(LogTemp, Warning, TEXT("Movin"));
    MoveUnit(Input);
}
#

CltMoveToLocation never gets called

lost inlet
#

weird to prefix a multicast with a contraction of "client", a bit of unnecessary code golf going on. however, is the pawn here one your player controller is actively possessing?

shrewd carbon
#

Yea admittedly its only because I said "srv" and then felt the need to make a 3 letter shortening of client. and really its a multicast so it feels even worse, apologies for the poor quality.

#

and it should be the one my playercontroller is possessing..

lost inlet
#

well you haven't shown the controller side of this yet

shrewd carbon
#
void ATempoPlayerController::OnMove(const FInputActionValue& InputActionValue) {
  const FVector2D val = InputActionValue.Get<FVector2D>();
  UE_LOG(LogTemp, Warning, TEXT("Startin"));
  Cast<ATempoCharacter>(GetCharacter())->SrvMoveLocation_Implementation(val);
}
#

I'd hate to dump the entire controller and spam is there anything specific that would be to look out for?

#

oh .. Am I not supposed to use _Implementation when calling.. only defining?

upbeat basin
#

Define normal, implement and override _Implementation, call normal

shrewd carbon
#

๐Ÿ˜ฎโ€๐Ÿ’จ its wild because the servermovelocation function i do it properly to call cltmovetolocation..

#

its been a long night. Thanks all ๐Ÿ˜ญ

upbeat basin
#

Is it normal that I can't see the widget I added from the LevelBlueprint of my transition level, while seamless travelling? If I open the TransitionMap as the target map, then I can see it

#

If so what are the supposed addition and removal places for loading screen widgets during seamless travel?

slim jay
#

Looks like it's firing but actor never destroy in game

blazing spruce
burnt hinge
solar stirrup
#

Then don't compare if this is your first rep notify

#

If it's your first rep notify the vehicle just got relevant to you for clients and you don't need to play cosmetics, or you're the server and in that case you know you can play cosmetics for anyone that's now seated

blazing spruce
# upbeat basin Hmm I see, thanks

If you have a quick google you'll see some posts about the same issue where people cant use the transition map to display widgets just not sure if its by design or a bug lol im also funnely enough having an issue with my loading screen now since updating to 5.3.2 from 5.1.1 where it just displays the loading screen for a second and then it just removes itself without ever calling Remove from Parent somehow lol so you might have to play around with it to find a solution that works for your case

jade ibex
#

Is GetSessionIDStr the same as SessionName?

#

Im unable to join a session if so... and get UnknownError as the result, with the resolve connection string failing

#

so I guess not?

#

but then I cant actually get the session name from the search result, as far as Im aware

primal trellis
#

Hello! Iโ€™m working on my first multiplayer project in Unreal Engine 5. However, Iโ€™m facing a small issue. I want that all the players, when they enter a lobby, to be โ€˜teleportedโ€™ simultaneously to the next scene. I managed to make this work in the editor, but when I create the executable, this specific part of โ€˜loading the next sceneโ€™ doesnโ€™t happen.

I have a video showing how it currently works in the editor: players search for a match, and if they donโ€™t find one, they create one and join. After that, the game loads the next scene(the red one), taking both players to it.

#

In the executable, it only works up to the first partโ€”players entering the same matchโ€”but it doesnโ€™t proceed to load the next scene as it does in the editor.

#

Iโ€™m using a Steam subsystem and their test server. Upon entering the scene, I have the Player Controller I created cast to the GameMode of that scene, sending its PC. The GameMode then adds this to an array, which is later used to check the number of players. If itโ€™s complete, an event is triggered to travel to the desired scene on the server

jade ibex
#

Are you using ServerTravel?

primal trellis
jade ibex
#

that teleports all players to the map the server wants to load

#

Ok

primal trellis
dark parcel
#

y multicast?

#

never done server travel but shouldn't the server calling it is enough

#

everyone will auto follow afaik

jade ibex
#

yeah something like that

primal trellis
dark parcel
#

the event will get called everytime a new player join (On server)

sweet sage
#

On a mmorpg is a data only blueprint good for items? can unreal handle like 300k UObjects?

primal trellis
jade ibex
solar stirrup
#

You're gonna hit issues with 100/200 players as well

sweet sage
#

No matter how

#

Even if i need to modify unreal source

#

And strip things from CMC that i don`t use

solar stirrup
#

Using the CMC for an mmorpg is already a bad idea

sweet sage
#

No, it will work, i will make it work even if i need to edit but ty for the tips

solar stirrup
#

You can't just one up people and think it'll just work, I'm already surprised by their claim of 150

#

But hey, hope you manage though

#

Sounds like you're pretty determined and that's cool hah

sweet sage
#

Yeah

#

My other mmorpg had 1200 players on a single map

#

I need to make it work with 200 lol

solar stirrup
#

5.4 has Iris

#

Which might help, but it's experimental and not released yet

sweet sage
#

I`m already using Iris and push model

solar stirrup
#

You can check the ue5-main branc-

#

Ah well then potentially yeah

#

Dunno how far Iris can be pushed but Epic seems to want it to support larger player counts

#

Good luck!

#

As for 300k UObjects the GC is probably gonna halt to a crawl with reachability analysis and the sort

sweet sage
#

It will quantize data a single time and send to all peers avoiding a lot of cpu overhead

#

This is how i did on old mmorpg

solar stirrup
#

Might have to disable lots of it and modify the engine quite a lot

sweet sage
#

But the bottleneck is CMC at this point

solar stirrup
#

I'd use your own movement component

#

If you're gonna go for 200

sweet sage
solar stirrup
#

Go for as little UObjects as you can I suppose yeah

#

There's also the new Mover plugin on latest git

#

It's Epic's new movement system aiming to replace the CMC

primal trellis
solar stirrup
#

Worth a look perhaps

sweet sage
#

by somewhere i mean cpu cycles

solar stirrup
#

No idea

#

Would have to profile CMC vs Mover

sweet sage
#

Im already not playing animations on server. it is only a capsule, i hope mover dont need animations on server also

solar stirrup
#

Nobody has done that yet

#

Dont think it does

sweet sage
#

I will switch to USTRUCT for individual items, easier for GC

hybrid veldt
#

Hey. I have a Fuel Canister which the players can interact with and detonate which works as intended across the server and both players see it was interacted with and that it explodes, however when I try to make it so that the player that interacted with the Fuel Canister has -2 subtracted from their Energy Gauge, it subtracts -2 from both Players. Ive been messing around with it for a while today, but thought id ask incase anybody knows. Happy i got other things to work across server but having objects set things on individual players I don't quite have down

hybrid veldt
#

I've been trying to access the player in diff ways to set just their variables individually with no luck. The Rep Notify you see on screen is just to change the material on the server, that works correctly.

#

So right now those nodes remove -2 from BOTH players when they have 2 gauge or more each, I tried getting the player controllers etc to remove the -2 from jsut the player interacting

velvet kettle
#

Instead of using GetPlayerController0, pass the player controller through that interface call that used the canister then subtract the points

lost inlet
# hybrid veldt

getting a player character by index is almost always wrong. how does event interact get called if you're a client?

blazing spruce
hybrid veldt
hybrid veldt
lost inlet
#

well I guess you don't have single player or listen servers then

#

but yeah, you'll have to pass the interactor (character, player controller, whatever) to provide context

hybrid veldt
#

I knew it was to do with the controller just didnt know best way to access the info, im sick today so brain not exactly firing on all cylinders ๐Ÿ˜›

lost inlet
hybrid veldt
# lost inlet well if you support single player, pressing the key will do nothing there. if yo...

This was my fear when i followed the tutorial, i followed various approaches 1:1 and they didnt work, but this approach did work and i understood why, but the tutorial showed to switch to the Play As Client so thatit worked properly and that worried me as before that I ran the Net Mode as 2 player Listen server. I am due to test with a friend later so i see interacting wouldnt work properly now with my Hosted listen server approach if i understand that correctly :/

#

Its for a Co op 2 player game

#

From my understanding this approach im using to interact specifically works for say hosted Dedicated Servers that clients connect to then

#

Which won't be of use for now, as I just am hosting own listen server when create game

upbeat basin
hybrid veldt
jade ibex
#

having an understanding of networking principles is crucial, more so for UE as it is server authoritative focussed

#

following a tutorial to do X and Y with no explanation is following blindly

#

and setting yourself up for failure, and a lot of pain in the near future

hybrid veldt
# jade ibex do you understand the host <-> client interactions and calls required to communi...

I do in parts, I just started the multiplayer project a few days ago, first time doing MP. For example I'm able to say have my player execute an ability and have it be sent to listen server and show for all clients and deduct their resource if executed from the player themself. That interact interface tutorial i followed was actually one of the first things i did so i'll have to go back with fresh eyes to do that

#

I only just returned back to UE after years away (been trying all major engines), and I know i shouldn't jump straight into multiplayer but im enjoying it ๐Ÿ™‚

hybrid veldt
jade ibex
#

it is very fun to develop for sure, but can be head bashing at other times - as long as u understand server is the only place to execute the actual action, and clients simply "watch" the changes, ur at a good start

hybrid veldt
#

Been trying to think to send to server only absolutely what is necessary and thinking about what i may add in the future and what data that would actually need to read

hybrid veldt
jade ibex
#

to answer the original question though, about the subtraction of energy points affecting multiple players, you can store that data anywhere. For my project, I store an arbitrary number (like health) in the character class - to me that makes sense. Character status goes in the character class. You should make the non-server clients send a request to the server to execute the action, and with that action you subtract the server's version of said players energy. And replicate that value back to the client. The convenient part is if you pass the client's character to the server, the server will know exactly which client's character to change.

#

and thats it

jade ibex
blazing spruce
# upbeat basin 5.3.2

Ahh you might have the same issue as me then, it looks like they've made server travel remove all widgets just before it travels which they must of updated at some point after 5.1.1, but you also cant use the transition map to display the loading screen so no idea how to get it working atm

hybrid veldt
# jade ibex to answer the original question though, about the subtraction of energy points a...

Cheers will bare that in mind. Yeah its all about how you pass over the data to other parts of your game, certainly something I am going to focus on understanding and getting better at until i feel very confident with it. I always found how games communicate info with all various types and elements of your game to be the hardest part in game engines really.. Making abilities themselves or other things i found that alot easier

#

So i will focus on my weaknesses ๐Ÿ‘

upbeat basin
#

Hmm is it normal that if I spawn and possess a character in PostLogin, BeginPlay is called after Possess is completed. But if I do the same thing in HandleStartingNewPlayer_Implementation, BeginPlay runs between spawn and possess, which causes the IsLocallyControlled check in BeginPlay to return false, sinde the controller is null

mystic zodiac
#

I have a question, i have created a multiplayer mod and i have a save game rotation on that. It works fine But the server has performance issues while saving the game. is there a way to say the engine "do this stuff with low priority" or somthing to save performance while saving?

upbeat basin
#

So PostLogin can work before BeginPlay for listen servers standalone game? Interesting

hybrid veldt
#

@jade ibex I'm curious how often you use the Reliable replication setting? By instinct I just switch it on

#

I assume it hogs more packets

dark edge
#

Spamming inputs on tick at the server -> unreliable

#

since by the time you notice a missed one it's way too late anyway

#

Some important input that has to not be dropped and isn't being spammed -> reliable

#

AimDirection -> unreliable
Readying up to start the game -> reliable

hybrid veldt
#

๐ŸคŒ

heady copper
#

hey guys good evening

#

please a quick question

#

whats the diffrence between client build and the main game build am curios if there are the same or diff

dark edge
#

depends on the game

#

If the game has no single player then you might want to not ship the serverside code. Stuff like Path of Exile or League of Legends would maybe do that.

heady copper
dark edge
#

I mean it's totally up to you

heady copper
dark edge
#

Sure, if there's no single player or player hosted listen servers

#

If you have to ask then you won't be doing this sort of stuff.

heady copper
#

in a nutshelll just build the dedicated server and the client and leave the main game exe file

#

since the server will be hosted online and dosent need to be a client on its own

#

and the client will just be clients and do what client do ...join matches

#

rights?

dark edge
#

Pretty much

#

Dedicated Server -> serverside code
Client -> clientside code
Standalone or listen server (probably just do this) -> server and client code

heady copper
woven bramble
#

what is the difference between "is server" and "has authority"?

#

Even though I know the difference in definition, I can't explain it with a concrete example. Does anyone have an example to provide?

heady copper
solar stirrup
#

that aren't replicated from the server

#

is server would be false but they'd still have authority

quasi tide
#

HasAuthority pretty much means "which machine spawned this actor". Unless you go out of your way to change authority at least. But if you're doing that, you already know what HasAuthority means

nocturne quail
#

which functions should be replicated to other clients?

#

i think ammo related stuff should not be replicated, since it only need by the owning client to know how much ammo she has

solar stirrup
nocturne quail
woven bramble
# quasi tide HasAuthority pretty much means "which machine spawned this actor". Unless you go...

Thank you very much.
So, in what exact situations we should use this? When do we need to perform authorization checks? If I need to show a widget only to the person who creates the session (so the server), I use 'is server', and if I want to apply an operation only on the person who performs it, I use 'is locally controlled'. So, could you provide an example of when I would need 'Has Authority'?

dark edge
woven bramble
twin juniper
woven bramble
dark edge
#

That'll work on one of the paths

quasi tide
dark edge
#

The widget should only be spawned by some authority gated code anyway

dark edge
quasi tide
#

True

twin juniper
#

i tried

dark edge
#

or use an onrep

twin juniper
#

how about a timer?

dark edge
#

what variables are they?

#

sure same difference

quasi tide
shut vigil
#

Can anyone help me with something?

#

Full project with extras: https://www.patreon.com/PrimevalForest
If you want to help my development, wishlist: https://store.steampowered.com/app/1908530/Raise_Your_Tribe/
Discord: https://discord.gg/DcktP5mfXM

Please comment any suggestions to improve the tutorial series in the comments section. Additionally, feel free to ask any questions you...

โ–ถ Play video
#

Im following this tutorial

#

(ive been following the whole series)

#

and at the part when he makes it do damage to the other play I followed the totorial

#

and its not working

dark edge
#

we have no idea what your code looks like unless you show it

shut vigil
#

Basic health he did

dark edge
shut vigil
#

I had a node in the wrong place

dark edge
#

that's a pretty bad design though, why is ApplyDamage a run on server event, clients shouldn't be telling the server how much damage got applied

shut vigil
#

MB

blazing spruce
#

So since it looks like they've made it so all widgets are removed when server travel is used.. and transition maps cant be used to do loading screens, how am i supposed to do a loading screen when using seamless travel?

#

I had it set up so the loading screen would be displayed just before server travel and then removed at a later point once the map had finished loading in but now i cant do that apparently after updating to 5.3.2

#

Is there a way to access where server travel is called in C++ and stop it from removing all widgets or something?

#

I don't understand how they expect us to make loading screen now.. or am i missing something?

lucid badger
#

This phrasing is ... weird. My understanding of how this works is that it's null when CALLED BY remote clients (and then only if you're not calling it on your OWN player state). The phrasing implies CALLED ON, but that obviously can't be the case hmm

#

Maybe by "remote clients" it means "other clients when you are a client" but that's a stretch

hollow eagle
#

If the object the function is on represents a remote client it'll return null. If the object represents you then calling the function from a remote client will return null.
Both cases can be true.

lucid badger
#

What if the server calls it

#

Server has remote clients, that's why it's weird phrasing

#

The server has everyone's PC so surely it works

#

Unless "remote client" is some term of art and there's a separate technical term for "clients from the server's perspective"

hollow eagle
#

the server knows about all players

fossil spoke
#

Sure they probably could have said "or null on remote clients".

lucid badger
#

Yeah I'm just trying to make sure this isn't going to surprise me heh

fossil spoke
#

But you are looking to far into it, think about what is available to the server

lucid badger
#

Yea

fossil spoke
#

Not what a comment says

#

Never trust comments

lucid badger
#

I get paranoid ๐Ÿ˜…

fossil spoke
#

Then read the code behind the function instead.

twin juniper
#

Hey guys, if delegate is not replicated, does that mean each actor in client and server have its own delegate?

fossil spoke
twin juniper
#

so in order to use a delegate i have to use RPC

fossil spoke
#

What do you mean? If you need a delegate on another network context to be called, then sure, you need some mechanism to get it to be called in that context.

#

If an RPC is what does that for your use case then sure

twin juniper
#

Like i add the item on the server, but the delegate that have the widget binded to it is in the client

#

So the delegate in the server have nothing binded to it?

#

I guess RPC would do

fossil spoke
#

If you want to think about them as separate then sure. I can see how you might see it that way.

#

Delegates have nothing to do with networking

#

Same way functions dont

#

Calling a Delegate on the Server does not automatically call it on Clients

#

Thats your responsibility

#

To call the Delegates where appropriate.

twin juniper
#

yeah that's FStruct so it kinda make sense now

#

thanks for clear that out

snow trail
#

hey there, im trying to spawn a widget locally on every client that shows speed and other info
since BeginPlay runs on both client and server for every actor of this class, how can i know which one is the one i'm controlling and only spawn it once?

i tried IsLocallyControlled but that didnt seem to be it

i also tried doing it without a branch and it works but it seems to spawn the widget on the server instead?

fossil spoke
#

OnPossessed is only called on the Server

#

See the little Icon above it to the right

#

Thats the "Authority Only" icon

#

Which means its only executed on the Server

snow trail
#

ooooh

#

i see

fossil spoke
#

So none of that will be called on clients

snow trail
#

makes sense

fossil spoke
#

Try using the HUD class

#

To manage Widgets

#

Also if this is a Pawn

#

You probably want to use the ReceivedRestart event

#

I think thats what its called

#

I forget

snow trail
#

this one i think

fossil spoke
#

That one

#

Essentially its a better version of BeginPlay for Pawns

#

Move your code to that and try again.

#

You will want to add back the IsLocallyControlled node to

snow trail
#

yup, works!

#

for some reason, only the server is updating its speedometer though

#

in case i didnt specify it, the widget in question is a speedometer

fossil spoke
#

Widgets should only really be reading and displaying data

#

So if it isnt displaying correctly

#

That would suggest your data isnt updating

#

Just a guess

#

But I cant debug it for you

#

Thats on you

snow trail
#

mhm, thanks!

cosmic yoke
#

Hello, what is the best place for a client to be notified that the game state is replicated when it connects to the server?

cosmic yoke
#

But with a delegate?

fossil spoke
#

Are you in Blueprint Only?

cosmic yoke
#

C++

fossil spoke
#

I doubt there is a delegate for that

cosmic yoke
#

I know, i was saying to create one

fossil spoke
#

Probably the WorldSettings

cosmic yoke
#

But that would need to be placed outsude

#

Game instance is not great

#

Because you could have different game states for your game

fossil spoke
#

I said the WorldSettings

#
    /**
     * Called from GameStateBase, calls BeginPlay on all actors
     */
    virtual void NotifyBeginPlay();
#

Specifically this function

#

Override this

hollow eagle
#

I'd ask what needs to know when the gamestate has been replicated

#

because if the answer is an actor, it already has a callback for that

#

BeginPlay

fossil spoke
#

^^

hollow eagle
#

BeginPlay isn't called on anything until the gamestate has replicated.

fossil spoke
#

Which is managed by the WorldSettings

cosmic yoke
#

I already have a custom world settings, but when you define its class iirc is used for all maps

hollow eagle
#

it is, but again - what needs to know when the gamestate is replicated

cosmic yoke
#

UI, player character and voip stuff

hollow eagle
#

and if any of that is driven by any kind of actor(s) then you already have that information

#

BeginPlay

#

again, BeginPlay isn't called on anything until the gamestate has replicated. You do not need to listen for a delegate anywhere, you just override beginplay in any actor you want.

cosmic yoke
#

And i can check if actorhasbegunplay to see if its good?

hollow eagle
#

to see if what's good

#

there's nothing to check, if BeginPlay has been called on an actor then the gamestate has been replicated. End of story.

cosmic yoke
#

Some logic might execute before beginplay

#

So if actorhasbegunplay is false

lost inlet
#

What

cosmic yoke
#

Or just check the game state

#

Then i can defer that

fossil spoke
#

The GameState wont exist prior to BeginPlay anyway

hollow eagle
#

if you want to avoid executing OnReps or other logic until BeginPlay is called then yes, you can check ActorHasBegunPlay

fossil spoke
#

So how do you suppose you will use it before that point?

cosmic yoke
#

I wont, thats why i say to defer

fossil spoke
#

So then wait for BeginPlay...

cosmic yoke
#

Yes but it might be valid or not valid

fossil spoke
#

Huh?

lost inlet
#

The only annoying thing in the engine is that there's no delegate for the player state becoming valid on the client. At least you have the begin play guarantee with the GS

cosmic yoke
#

There are things that replicate before game state is valid and sometimes they replicate when its not valid

#

You cant guarantee order

lost inlet
#

So? You account for that

cosmic yoke
#

So you have to account for the 2 cases

lost inlet
#

At least begin play is guaranteed to have a world with a valid game state

cosmic yoke
#

That doesnt happen with the player controller, which is another dependency, so i would need to validate both

#

But its just a matter of syphoning to the same place and make sure both are valid before executing the logic

#

Ill do some tests

#

Thanks for the help

cosmic yoke
lost inlet
#

That's not a delegate

#

I can put one there