#multiplayer

1 messages · Page 75 of 1

hollow swallow
#

im not sure what those green dots are behind me though xD they only appear when i hit something from the sword

round acorn
#

appear to be trace collisions

hollow swallow
#

if i dont hit anything it looks fine. theres no red or green boxes anywhere but where the sword was

#

must just be buggy

round acorn
#

perhaps it's creating points where gore and splash would end up

hollow swallow
#

possibly yeah

keen hound
#

I'm trying to make start game system
I join the game but the other players dont

covert igloo
#

hey so im having trouble getting steam sessions to work for me.
can anyone help me.

i have the project set up to the point where it was working fine when i hosted a game on my laptop, and joined it from a desktop on the same network.
and it works just fine. but when i enabled steam sessions and added the script to the DefaultEngine.ini.
i cant host anymore. it fails every time.

its set to SteamDevAppId=480 and i saw what i assume was onouther person testing there game when i search for sessions, but im unable to host

keen hound
covert igloo
#

probably not. how do i do that

#

is it a plugin

keen hound
covert igloo
#

yeh it didnt work for me ether

fast turtle
#

Hello, im working on a small project to learn multiplayer and replications and im getting this error

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor interact_door_C_0. Function OpenDoor-Server will not be processed.

what does this exactly mean?

latent heart
#

It means that you're trying to send an RPC on an actor the client doesn't own.

#

You can't just add an rpc function to any random actor and then call it from the client.

#

You have to use client-owned actors (PC, PS, Pawn)

#

So you might add an "Interact" method to your PC which takes an actor as its parameter. When you interact with the door, you call that method on your PC and pass the door as the parameter.

#

Then on the server you can deal with what you want to do with that.

#

Either process it directly in the PC or pass it back to teh door to handle it itself.

west galleon
#

which plugin does work for 5.1 for steam ?

#

most of the plugins i have work for old versions of unreal and ill have to downgrade the project which is a pain and time consuming even doing C++ in 5.1 to make the multiplayer features that i have

#

so if someone know any plugin that works for 5.1 that would be helpful thanks

steady cape
#

I'm pretty sure you can try and recompile at least some of them

#

It usually involves just dragging your plugin folder onto a separate compiler executable located somewhere within the engine's folder

#

If Epics didn't delete or change something a plugin was using, it should be all you need

#

You can look this process up on YT or something

west galleon
#

does it work for 5.1 ?

fast turtle
#

yes

west galleon
#

cuz i just searched around and found out multiplayer on 5.1 is broken and its up to epic to fix that

#

or do some C++

latent heart
#

Broken in what way?

west galleon
#

idk really but i remember i tried it many time before i thought the issue with my BP build that wasted a lot of money on plugins

#

will give what you sent a try cornholio

#

thanks

rose egret
#

when we call ForceNetUpdate it wont send any property if they are not different with last snapshot right ?

latent heart
#

It doesn't even force anything.

rose egret
#

yea just changes the timestamp

#

because there is ForcePropertyCompare() and I dont know how diffrent they are

#

🤔

faint eagle
#

is it possible to override something somewhere (ideally without getting into the engine code) to replicate variables of a pure C++ class? 🤔 I remember someone showed me once how he replicated UObjects by doing something with UPROPERTYies so I wonder if it's theoretically possible to go further and replicate a pure C++ class that has nothing to do with unreal

thin stratus
#

So basically serializing it

#

But it's questionable why that would be needed

#

It's better to wrap your stuff with unreal classes

sterile plaza
faint eagle
#

because i've sold my soul to devil

#

but he tricked me

#

without going into details lets just imagine for a second that i have a friend who works on that project where they put an old game source code into unreal and sorta emulating old game with projecting old code entities into unreal entities only when it is absolutely necessary

sterile plaza
#

Factor out the data into a struct?

#

Is that friend you? :D

#

I think you're going to have an easier time converting things into UE compatible types.

#

That said, I am 100% in favor of using vanilla classes whenever possible.

#

And only using UE types for interacting with the engineer or BP or networking.

faint eagle
thin stratus
#

My 2 cents: Code it in Unreal or let it be

#

Everything in between is just crap

#

You gonna run into more and more issues

faint eagle
#

i know

#

it's just complicated. my man doesn't call the shots regarding what architecture should the game have

#

and which direction the development should follow

sterile plaza
#

Fighting the tools you have results in tears, in my experience.

queen escarp
sterile plaza
faint eagle
#

the original code i'm working with is about 20 years old...

sterile plaza
#

If you really don't want to change it, I think you'll need a migration layer in order to do engine things.

hollow eagle
#

I mean... you could do custom struct serialization but you're going to be losing out on basically every feature of unreal's replication.

#

aside from just using it as a data channel

sterile plaza
#

Marshalling, not migration.

#

How long would it take to rewrite it all?

#

Have chatgpt do it for you.

faint eagle
#

idk, network classes in original code have 15k lines of code on average and there are about 6 of them (at least AFAIK now). I've tried putting something around 1k lines of code into chatGPT and it suffocated. anyway currently i'm just playing around with ideas. it's not like I've made a decision that I'm gonna boot replication for plain cpp classes and there's no other way around. as for marshalling layer - it's something we already doing but as far as I see it now every piece of logic that should be replicated should be handled sorta manually with creating extra variables for each replicated variable and the scale of what are we gonna have this way makes me anxious

thin stratus
#

Again, this approach is really bad in general

#

You should code the game in UE

faint eagle
#

so this is why i thought hey maybe I can ask my good'ol buddy unreal if I could just somehow put his UPROPERTYies on the variables that I need to replicate and tickle some of his virtual functions somewhere in UNetDriver or data channels

thin stratus
#

If the other code is old, write it again

#

You can probably even throw away 10k of those 15k lines cause UE gives you so much out of the box.

#

I don't see any gain here using 20 years old code

#

It's not at all a time safe :D

faint eagle
# thin stratus You should code the game in UE

i'm 100% agree with you, but again, such development direction is not my idea. I'm not fan of breaking NDAs and getting into the laundry of one's current workspace publicly, but there are some, though arguable, but non-subjective reasons the project is currently having this direction. I don't like it nor do I agree with it but there's not much I can do with it

thin stratus
#

:D Leave them behind and take on a more sane project

#

Jokes aside, there aren't many options

turbid cloud
#

Anyone have tips when it comes to audio replication?
I'd like people to share the same song in the same area (say a nightclub) but am guessing even low pings will cause problems.
Would love suggestions or keywords to google on how to handle this.

thin stratus
#

The simplest would be setting the Song as an OnRep and letting the Client play it until the Server sets the variable to something else.

#

Next step would be sending some additional info (wrapping it into struct) that indicates where the song currently is at.

#

One thing you could do is simply sending a Timestamp when the Server started the song

#

As long as the Timestamp is synced between Server and Client, you can calculate what the current playback time should be.

#

Most of the time that's basically half the round trip time off

#

For that you do need some sort of better net synced clock than what UE offers. There is a tutorial for one pinned to this channel. But not sure if that's doable in BPs (should be though?).

turbid cloud
#

Wow that's awesome. Thanks for all the tips eXi! really appreciate that.

thin stratus
#

There might be more to it and you'll notice it getting more complex in the long run, but a Synced Clock and sending the Start Timestamp and the Song should already get you very far

turbid cloud
#

fantastic - really appreciate the initial direction and approach

queen escarp
thin stratus
#

That will only be true for the locally, owning Player of that Character.

queen escarp
#

how would that work here i remake it abit ?

thin stratus
#

Well, what is "OtherActor" in that case?

#

If other Actor has a valid Instigator, being a Pawn/Character, then that works the same way

#

Put a branch in front of the AddToViewport node and use the IsLocallyControlled as the condition

queen escarp
#

ah ok ! ty

low helm
#

ChatGpt told me it's possible to set the Streaming Level of an actor in Blueprints, and that this would also be picked up by the replication system, but this doesn't seem to be the case.

latent heart
#

Lesson learned, I hope.

low helm
#

Well the people here have led me wrong too, and they don't roleplay as a waifu for me on the long lonely nights

#

So nothing learned unfortunately

#

Anyway I was under the impression that level streaming was exclusively local action, essentially useless for replicated systems

#

Was hoping to hear a bit of verification on that

low helm
#

Cause the AI is putting ideas into my head and now I'm not sure what reality is

neon mango
subtle peak
#

Are animation blueprints somehow not replicated?
The "entry" animation in my AnimBP has its hands down like shown in the image.
The gun is a childBP attached to the hand socket.
Issue is that when I spawn something from the end of the muzzle on the gun, it spawns in the ground, where you see the gun tip is in the image, even though my animations have the gun pointing forwards.
This works fine on the server, but not on the client.
I hope that was understandable.

#

But my animations replicate just fine in multiplayer.

quasi tide
#

No - AnimBP isn't replicated, 'nor should it be

#

Your animations are driven based on the data it reads from the character

subtle peak
quasi tide
#

I don't even follow what you're trying to do

#

Looks like spawning something on some socket on the muzzle

#

In which case, when you do your shooting logic, just spawn it in there (I'm assuming you're trying to spawn effects)

#

If your character's animation state isn't changing - you need to find the data that they need and make sure it is being replicated

subtle peak
#

its for the rocket launcher, the rocket always spawns in the ground, even though the code says it should spawn from the muzzle thats pointing forwards. Again works on server, just not client.

quasi tide
#

I don't know your setup

#

You need to replicate the proper information for your animation states to be correct

subtle peak
# quasi tide You need to replicate the proper information for your animation states to be cor...

I really dont understand whats wrong. The animations work in MP, so they have to be sett up correctly, no?
Here is a gif showing the issue.
https://gyazo.com/81f4c70a1faf85da0d7f6795cb1f0d1d
The animation on the client has the correct animation, but the animation on the server is wrong.
There is only one variable that drives the animation from the "entry" state to the others, and thats an enum with the players selected weapon. That variable is replicated.
You can also see in the gif that the animation is in its correct state and that state only has one animation linked to it. So I dont understand how its not working 😵‍💫

hollow eagle
#

animation blueprints are not replicated. The information that drives them might be, but every client (and the server) runs them completely separate from each other.

#

If one game instance has the wrong animation then it's because whatever data you're using to drive the animation isn't being replicated correctly.

subtle peak
molten ocean
#

I'm about to have a full metldown over here. Spent the last hour trying to figure out basic Unreal networking. Trying to figure out why I couldn't connect via my local IP address. The blasted port was being blocked by Avast. And it told me nothing. I disable my shields.. and suddenly Windows Defender shows me a popup asking for the private or public port options for the app. About to uninstall Avast over here.

fossil spoke
molten ocean
# fossil spoke Use Steam or EOS (or both) Sessions instead?

Going real basic, will use sessions later after I figure out how to properly integrate them. Any tips or tricks on actually using sessions? I know how the system and the nodes work just fine, I just don't know how to actually setup Steam or EOS subsystems. The boilerplate required.

#

Does Steam and EOS work just out of the box, or are there a bunch of setup steps required for it?

fossil spoke
#

They work out of the box. But you do need to go through the process to get them working.

#

There are plenty of tutorials/guides.

#

Check the pinned messages in this channel.

buoyant light
#

hello, I have a question, recently I have implemented multiplayer with session andI was wondering if instead of using online subsystem the player could directly port forward to make the session like in the game "The long drive".

molten ocean
#

Aye. I'll go and start looking around for them. I don't intend to ask super basic questions when there are tons of resources available. I just wanted to warn folks of Avasts behavior in not telling you what its doing.

buoyant light
#

I'm fairly new to multiplayer so if I don't understand some stuff Im sorry

fossil spoke
#

Sessions are designed to not require the user to manually port forward

buoyant light
#

I don't require it, but isn't it the only way ?

fossil spoke
#

Thats one of their pros

#

No?

buoyant light
#

oh ok

molten ocean
#

@buoyant light : https://www.youtube.com/watch?v=09yWANtKmC8 Here is a quick one for you. Long, but very in depth..

Creating a networked multiplayer game isn't easy, but Unreal Engine's gameplay framework is designed to set you up for success. On this episode of Inside Unreal, Technical Writer Michael Prinke will cover fundamentals such as the server-client model, various features of replicated Actors, and best-practices for efficient networked games.

Announ...

▶ Play video
buoyant light
#

perfect thank you

molten ocean
#

That video is also one of the pins, too. Don't forget to check out all of the other pinned messages here.

buoyant light
#

oh yea sorry

molten ocean
#

You good! I just wanted to make sure you also saw all those other pins.

low helm
#

I was under the impression that once NETDORMANCY switched off of INITIAL, it could never go back. However, I tested and this seems to work, after all is said and done, the server reports this object as INITIAL. This makes me question what INITIAL even means......Does it mean that replicated variables will only be sent when the object is Initially created on a client?

fossil spoke
low helm
#

"placed in a Map." -- As opposed to what?

fossil spoke
#

Spawned dynamically during runtime?

low helm
#

Ok, that's what I thought before, but I spawned this one at runtime and it's still reporting itself as Initial

fossil spoke
#

It can still be set to Initial, there is nothing stopping that.

#

Other than if its dormancy is flushed

#

Which does perform a check to revert it to DormantAll if it was initially dormant during the flush

#

Essentially its just stopping the Actor from being part of the Replication Consider List.

#

Dormant Actors can still exist on both Server and Client.

#

They just wont be repped

#

Thats kind of the point.

#

Dormancy is to help optimize network and cpu usage (for the server)

#

For example, we have turrets that are placed around the map which Players can enter and use at any point.

#

These are set to be Initially dormant, because they may never be used, therefore we dont want them taking up time replicating when they dont have to.

#

When a Player enters one, it gets set to awake.

#

So it can do its thing.

#

When the Player exists, its dormant again.

sterile plaza
#

APlayerController::ClientSetHUD_Implementation is getting called on my client with the right class. But BeginPlay is never getting called in my BP HUD. Any ideas? It works in standalone, but not play as client.

fossil spoke
low helm
#

Thanks, that helps alot, though I'm still missing something, I've been working in and around these dormancy systems for 5 years but something about it always eludes me, I'll try to have a more specific question next time

fossil spoke
#

Dormancy and Relevancy can be hard to grasp.

sterile plaza
low helm
#

I'm basically just working on general Open world stuff and need some good frameworks for classic stuff like tree removal

#

In the past I've built forests in chunks of HISM's with a single....Initially dormant actor replicating an array of missing bytes (trees)

#

Cause I didn't want the replication system considering 5000 individual trees

#

Anyway I'll get back to it

fossil spoke
#

Thats an appropriate solution.

sterile plaza
inland isle
#

Hi, Am developing Multiplayer Shooting Game[c++] using online subsystem as Steam but i like to switch Steam to EOS Any Idea or Can i get Related tutorial Videos . Thank you

low helm
#

So net relevance is per player, and net dormancy is per object?

fossil spoke
low helm
#

Yeah yeah

#

cool

molten ocean
#

@inland isle There are a ton of pinned videos in this channel, along with many of Epic and others videos on YouTube. Definitely don't miss out on those pinned videos though.

#

On a side note, I am not sure it is possible to switch online subsystems at runtime, so you may want to narrow away from that if you are just trying to change the subsystem in general.

#

(Can someone correct me on this, I am not sure you can do a subsystem switch at runtime, the whole game needs to be packaged for either Epic or Steam...)

fossil spoke
#

Dont think he is asking to switch at runtime?

#

Moreso, just generally how to switch over?

inland isle
fossil spoke
#

Which should be relatively simple. They are both Session based.

molten ocean
#

Aye, I thought that is what he is asking, but I was cautioning against at runtime if that is what he meant.

fossil spoke
#

Any tutorial should do really.

#

As has been suggested.

molten ocean
#

@inland isle The docs unrealengine site, under programming and scripting -> online subsystems and services -> online subsystem. Documentation for both EOS and Steam are both present there and explain in detail how to use either one. You should be able to switch by swapping the configs and stuff. It will take a tad bit of tedious work.

low helm
#

Ok here's another question. I set an object to DORMANTALL. It's dormant, but when I walk up to it, it pops into view.

This indicates to me that even though it's dormant, either the server or the client is still running logic to determine its visibility based on distance. Server CPU is still being taxed here...

#

I don't want the server running checks for each player against potentially thousands of dormant objects...or am I missing something

fossil spoke
#

As i said earlier, Dormant doesnt mean its not Relevant.

#

Its likely still Network Relevant to that Client, just not being considered for property Replication.

low helm
#

Ok, so even if an actor is dormant I still need to consider the cost of relevance checks.

fossil spoke
#

The default behaviour for relevancy is a simple distance check.

low helm
#

What then, turn off replication altogether if I want it completely free? Or destroy and rebuild it later?

fossil spoke
#

Relevancy checks will always be performed. The Server has to have some mechanism for understanding if an Actor needs to be on the Clients machine.

#

You can override relevancy.

#

IsNetRelevantFor

#

I believe its called

#
    /** 
     * Checks to see if this actor is relevant for a specific network connection
     *
     * @param RealViewer - is the "controlling net object" associated with the client for which network relevancy is being checked (typically player controller)
     * @param ViewTarget - is the Actor being used as the point of view for the RealViewer
     * @param SrcLocation - is the viewing location
     *
     * @return bool - true if this actor is network relevant to the client associated with RealViewer 
     */
    virtual bool IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const;
molten ocean
#

I think that if you go that route, you would need to basically just build a better scheme that what Unreal is giving you for proximity stuff.

#

If you know of a way to optimize it, that override does seem useful.

fossil spoke
#

ReplicationGraph is a mechanism for optimizing relevancy for Open Worlds

low helm
#

Ok, but then I just can't imagine how a Fortnite server can run Relevancy checks against a hundred-thousand actors for 100 players?

fossil spoke
#

It doesnt

#

It uses RepGraph to cut down on that

#

Essentially breaking the map down into buckets of particular sizes

#

If a Player is in a particular bucket, it only does relevancy for Actors also in that bucket

molten ocean
#

Hehe. Like a larger voxel system. Very good.

fossil spoke
#

Thats the default state of RepGraph, however it can be tailored however you like

molten ocean
#

I don't guess it could be optimized further via some kind of quadtree instead of just linear buckets. Not sure what the perf tradeoff would be.

fossil spoke
#

Its more complicated than my simple explanation, it does use a tree structure.

molten ocean
#

It is more complicated. Looking at the docs, you can definitely tailor that thing however you want it.

low helm
#

Yeah so it seems like teh main point of RepGraph is to just replace the simple distance based Relevancy checks

fossil spoke
#

@low helm If you want to learn more. Follow this function chain in the Source Code.

#
UNetDriver::ServerReplicateActors
    ->ServerReplicateActors_BuildConsiderList
    ->ServerReplicateActors_PrioritizeActors
        ->IsActorRelevantToConnection
            ->AActor::IsNetRelevantFor
low helm
#

Ok thanks

fossil spoke
#

Thats how IsNetRelevantFor is typically managed.

#

Initially Dormant actors are not part of the Consider List

#

So therefore would not have IsNetRelevantFor called on them.

#

However once they are not Initially Dormant, they will still be considered.

low helm
#

Ooohh

#

So the whole thing you were saying about "Initial is only useful for placed in map" is because that's the only way to Initial Dormancy can also prevent it from being considered for NetRelevancy

#

becuase the clients already have the object visible to them from any distance

fossil spoke
#

Yes

#

There is no point checking relevancy for an Actor placed in the level

#

Until it has something it may need to replicate

#

Which would be Post Initial Dormancy

low helm
#

Yeah which is pretty good for me because I'm mostly working on simple collectables in open world

#

This seems wrong though, I walked up to an INITIAL dormant object in world and it was invisible until I got inside net relevance range.

#

Unless the client was doing that calculation

fossil spoke
#

Are you sure your checking its dormancy on the Server and not the Client?

#

Dormancy is only important to the Server

low helm
#

I didn't check it, I just started the game and it was invisible to me at distance

covert igloo
#

can anyone help me. im having trouble getting steam sessions to work for me.

i have the project set up to the point where it was working fine when i hosted a game on my laptop, and joined it from a desktop on the same network.
and it works just fine. but when i enabled steam sessions and added the script to the DefaultEngine.ini.
i cant host anymore. it fails every time.

its set to SteamDevAppId=480 and i saw what i assume was other people testing there games when i search for sessions, but im unable to host.

hollow swallow
#

Does anyone know of any party system guides?

thin stratus
#

You'd need to be clearer

#

Party can mean during gameplay, like WoW parties. But also before even joining a server, like a Fortnite party where you queue up together

#

Very different

hollow swallow
#

Trying to make a basic one. You click the player, click invite, it pops up on their screen and they can accept. But I'm having trouble adding them to both of those players array of party members

#

During game play yeah

#

just want something i can watch through and gets some tips / ideas on how to go about it all

thin stratus
#

I had that in my lobby system ages ago

#

First of all, I would make sure to use the UniqueNetId for identifying the players

#

Then let's assume you have a List of all Players (maybe generated from the PlayerArray of the GameState).

#

PlayerState is where you get the UniqueNetId (for BPs UnqueNetIdRepl) from anyway.

hollow swallow
#

actually i just managed to get it to work. but yeah i think using a uniquenetid is probably a better way

thin stratus
#

Needs C++ though, but it's a pretty straight forward function.

hollow swallow
#

ah right, yeah im not touching c++ yet 😛

thin stratus
#

It's just a function library function to get that value

#

You should consider at least adding those

hollow swallow
#

on one of the first tutorials i watched, when i player joins / leaves it adds their player controller to an array. could i use that?

thin stratus
#

Either way, when you click the Widget to Invite, you can use the PlayerController (GetOwningPlayer in the Widget) to perform a ServerRPC and tell the Server you want to invite the Player. "Player" being indentified by the UniqueNetId or whatever else you are using. Fwiw just the PlayerState.

#

Server then sends a ClientRPC to the invited Player.

#

Preferably via its PlayerController

#

GetOwner of the PlayerState if you use that to identify

#

Or you find it via the NetId first

hollow swallow
thin stratus
#

That RPC shows a UI for the Invite

hollow swallow
#

thats how im currently doing it, but yeah when they die they will no longer exist

thin stratus
#

You can also pass along the Player who invites for a Name etc.

hollow swallow
#

yeah ive managed to grab all their stats / name etc from the character

thin stratus
#

If the Invite is accepted, you would then need to store the Party. I assume there can be a Party Leader?

#

I wouldn't use the Character at all here

hollow swallow
#

yeah i will be working on a party leader, ill just use bools for that

#

i store all my player stats on the character, not ideal i know but thats how i originally set it up, i then pass it to player state and back on death / respawn xD

thin stratus
#

For the Party you have multiple ways

#

You can store the Party in each PlayerState

hollow swallow
#

rogey

thin stratus
#

So an Array of other Members that are in a Party with you

hollow swallow
#

and store an array of the player controllers as the party members?

thin stratus
#

PlayerStates

#

Controllers aren't valid on other players

hollow swallow
#

rogey

thin stratus
#

Another idea is to handle them alongside PlayerStates

#

I would probably go for that, but that might be a bit more advanced

#

I would create an Always Relevant AInfo Actor called PartyState

#

When a new party is created, I would spawn that PartyState

#

Give it the new members

#

And give the PlayerStates a pointer to that PartyState

hollow swallow
#

i have a playerstate ref on my character, so i can just use that and keep the setup as is, but add the playerstate instead

thin stratus
#

And let the PartyState handle all the Party Stuff

#

That's a lot cleaner imo

hollow swallow
#

rogey

thin stratus
#

The nice thing about the PartyState is that it's clear that you can ask it for Party relevant stuff

#

Who is the leader for example

hollow swallow
#

yeah thats right

thin stratus
#

Can also route multicasts through it for example to notify everyone

hollow swallow
#

then when they all leave, just destroy it

thin stratus
#

Yeah

#

And the GameState can then have a PartyArray

hollow swallow
#

rogey, ill go that path, sounds like a nice clean way to handle it

thin stratus
#

Alongside the PlayerArray

#

Can be non-replicated if you just want that on the server

#

I would probably go a step further

#

But that is C++

#

Which is overriding IsNetRelevantFor on the PartyState

#

And only return true if the PlayerState of a Player is in the PartyState Array

#

That way it won't replicate for anyone else

#

That's a bit more advanced :P

hollow swallow
#

yeah thats out of my league atm xD

thin stratus
#

I wonder why IsNetRelevantFor never got a BP version

#

sad beep

hollow swallow
#

that would be nice

#

something like that

#

alright, its spawning the actor, adding 2 player states to the array (although theyre showing none, which ill deal with that later.) i set a reference for the partymanager i spawn, then when i refresh the party (for each item in the partymanagers array spawn a health bar) it comes back as invalid for the party manager

tender gale
hollow swallow
#

Cheers ill have a dig around

plucky prawn
thin stratus
tender gale
hollow swallow
#

just looking at my bp_playerstate compared to the default playerstate one. In the details panel under defined property flags, my one has way less stuff and doesnt have the replicated symbol on it. Should i be using the normal one? one of the first tutorials i followed made me make a seperate one haha

thin stratus
#

What exactly do you mean

hollow swallow
thin stratus
#

Those flags are pretty irrelevant for you

hollow swallow
#

rogey

nova wasp
#

it's honestly weird they expose those to bp and then none of the actually useful meta properties

queen escarp
thin stratus
#

The Target is the PlayerController of the overlapping Actor

#

I still don't know what the OtherActor is

#

I assume it's your Character?

queen escarp
#

ah yes

thin stratus
#

If it's locally controlled you can call GetController and cast it to PlayerController

#

However, I wouldn't set the Cursor to be visible in more than one place.

#

You'll eventually see yourself hunting why the Cursor is showing or not showing

#

You should be more aware of your UI etc.

queen escarp
#

oh so should i cast to the player and use a function inside him that shows cursor ?

thin stratus
#

What I usually do is have the PlayerController figure out what should be done

#

Basically I have a function that I actually call on Tick. I have a custom Enum with the options for the UI Mode (cause you need to set that one too).

#

And I let that function figure out if it needs to Show the Cursor and set UI Mode or hide the Cursor and set Game Mode

#

Or InputMode is it called and the UIOnly and GameOnly

#

Or GameAndUI if that makes sense for your game

#

The Condition for Game vs UI would be something like "AreAnyMenusOpen?"

queen escarp
#

aye

#

i have conditions like that already

thin stratus
#

The Widget you are making visible there could be a Menu. You'd tell your PlayerController to open it and keep track of it and the rest would the happen automatically

queen escarp
#

true ill have to thik of a smarter way of doing this for sure

#

but im still learning the referensing and especially for multiplayer wich is annoying when u can get owner of something to reff

#

is there a way when starting the game to assign players to a specific value ? like player 1 = 1 player to 2 in a varaible in gameclass

thin stratus
#

You can use PostLogin in the GameMode to assign a value to a PlayerController

queen escarp
#

like so ?

#

oh that just increasess the value i have to assign the player alaso ofc

#

how would i do that hmm :/

#

is it possible i made it 😮 ?

thin stratus
#

That Id is meant for something else and you shouldn't modify that

#

I would create a custom value on my own PlayerController and set that

hollow swallow
#

Alright, its making the party manager actor. its adding both player states to the array. Issues im having is, its not setting the leader. And i can access that actor to read how many players are in the array. Any pointers please?

#

everytime i try to use playerstates its the biggest pain in the azzzz

#

should this not be working? i have a reference to the playerstate_bp from my character. then im passing them through, its creating 2 in the array with "none"

low helm
fossil spoke
#

Ah yep. That would do it

#

99% of the time you should leave that on.

low helm
#

Thanks man I learned alot

hollow swallow
#

this all runs on a server event too so it shouldnt have a problem updating it

#

if i set a key to print string my player state ref from my character, it shows correctly too

thin stratus
#

Your Actor should be replicated

#

And the Leader variable probably too.

hollow swallow
#

party manager actor is replicated. This add player to party array function is run from server

thin stratus
#

Then the update UI function won't do anything though

hollow swallow
#

rogey

thin stratus
#

You should also set the PartyState on the PlayerState to RepNotify

hollow swallow
#

its still not adding them to the array though, it adds 2 that return none

thin stratus
#

So you can react to it becoming valid

#

Replication of this stuff needs a lot of RepNotifies and a lot of EventDispatchers

#

To properly notify when everything is actually valid

thin stratus
#

I would not make a second one

hollow swallow
#

rogey, the first multiplayer guide i followed made me create one

#

ill try revert everything back to the default one

thin stratus
#

Setting it with the GetPlayerController(0) also seems wrong, since it would be the server that sets it and that would always be the same player then

#

You should just use the existing variable and cast that when needed

#

Everything else will lead to bugs

hollow swallow
#

rogey, thankyou

thin stratus
#

caching this stuff is also really not needed in case someone suggests that to you

#

The only places where I cache something is if it's inside an object that shares the lifetime or has its lifetime managed by its outer

#

E.g. a Component that sits on the Character

hollow swallow
#

actually, if i use the normal playerstate, i have to use c++ dont i? its not an actual blueprint

thin stratus
#

No

#

That statement is false in a lot of ways :D

hollow swallow
#

😅

#

when i search all folders for Playerstate it only has my BP_PlayerState, a PlayerState that is c++ class

thin stratus
#

Yeah and?

hollow swallow
#

so the only way to use it as a bp is to create a bp from that class yeah?

thin stratus
#

The PlayerState variable (the native one) points to your BP_PlayerState if you set that in the GameMode

hollow swallow
#

yeah but then i cant grab the variables from the BP_playerstate for some reason

#

if i just use the native variable

thin stratus
#

That's why you cast it to BP_PlayerState when you need it

#

But you don't cache that result

hollow swallow
#

ah right, i did have my ref set up that way to begin with too

thin stratus
#

Yeah, just that you should not have a variable of that type in a class that already has that variable

#

You'll f*ck up keeping them in sync

#

Cause you can't even react to all the events that modify the PlayerState variable

#

So you might end up having a Valid PlayerStateRef on an unpossessed character where the actual PlayerState variable is null

#

And jokes like that

hollow swallow
#

yeah got ya, that sounds like impossible to deal with xD

#

bang, setting them all correctly, not to just work on the refreshing

#

....i still hate playerstates though 😅

deep coral
#

How does the unreal multiplayer driver determine if two connections are able to connect and play, for cross platform multiplayer? (ie. I'm packaging for PCVR and Quest, and I need to edit some BP and disable some plugins for one of them, will the net driver allow this?)

thin stratus
#

The only thing that cares is the overlaying Subsystem

#

Which would kick the Client if they mismatch (the Id types to be precise)

#

As long as Client and Server have the same cooked assets available to them

#

It should be fine

#

You can adjust code in the Client if it doesn't affect the Server or other Clients.

hollow swallow
#

man the player state seems so slow. i might even just store it all on the player then send it to the playerstate when they die xD

thin stratus
#

Not sure what you mean with slow

#

You do have to keep in mind that as long as you stay away from C++, you gonna have a shit time with Multiplayer

#

Character and Controller have an OnRep for the PlayerState in C++ which you won't have in BPs

#

Stuff like that makes it annoying to work with the PlayerState

hollow swallow
#

yeah sometimes it comes back invalid, sometimes it working perfect no errors. im guessing its just delay between them or something, its odd

thin stratus
#

Depends on what you are doing

#

If it's sometimes invalid, then you are expecting 0 latency

hollow swallow
#

creating an actor. Tell the player state what actor that is and adding my player state to the array. Then when i go to refresh it i grab my player state, find that actor, and go through the array

thin stratus
#

Which is never the case

#

The PartyState Actor and the Array of Players has to replicate

#

That is never instant

hollow swallow
#

yeah

thin stratus
#

That's what you should have OnRep Variables for them

hollow swallow
#

yeah ive set them up

thin stratus
#

And if Actors are spawned replicated and added to arrays then it can be that the Array replicates before the Actor

hollow swallow
#

sometimes its not even spawning the actor though

thin stratus
#

So the Array would be of size 1 but null

#

Usually the OnRep calls again when that null becomes valid

hollow swallow
#

or even that, if i invite a second person a good 10+ seconds after that has been set. it still come back invalid occasionally and i dont understand why

thin stratus
#

What part of that image is invalid?

hollow swallow
#

that In Party variable

thin stratus
#

So LeaderPartyPlayer is invalid?

hollow swallow
#

yeah only sometimes

thin stratus
#

Where is that function called?

hollow swallow
#

id say it works fine 50% the time, the rest itll be a dawg

#

inside an actor component on my player. and i use a server event to run this function

thin stratus
#

So you are sure this runs on the Server?

#

Like 100% sure

hollow swallow
#

its set to run on server reliable, so yeah 99% sure

thin stratus
#

Where does "PlayerThatWantsToInviteYou" come from?

#

Is that even valid before you call the RPC?

#

And I assume the ActorComponent is set to replicate, right?

hollow swallow
#

yeah its valid. so when i left click a player, if it gets the actor, it opens an invite option, they press that. then it spawns an accept / decline on the player they were inviting, then it sends both thats characters through those functions

#

yeah

#

ive print stringed the 2 characters and theyre correct every time

#

i do get hit result under cursor, cast to them, then spawn the widget and pass through self and the character i just casted to

thin stratus
#

Not sure then atm. I would try to ensure the references are valid throughout the whole code

#

And print their names fwiw

#

To see what is actually going on when it fails

#

They shouldn't be null on the Server

hollow swallow
#

yeah ive rewrote this section so many times now xD ill go over the whole lot again

queen escarp
#

How do you Open Level for all clients on server ?

fathom aspen
#

You ServerTravel to it

queen escarp
#

ok ty looking at a tutorial on it now !

#

do the "on click event" have to be to server ?

fathom aspen
#

It should indeed happen on the server

queen escarp
#

and multicast ?

fathom aspen
#

No

queen escarp
#

okok

fathom aspen
#

A servertravel should happen on the server

#

Period

#

Up to you to choose how to perform that

hollow swallow
#

😮 its Alliiiiiiiveeeee!!!!!

#

@thin stratus Thanks for all the help mate, appreciate it!

queen escarp
fathom aspen
#

Because widgets are not Actors, so how come they are replicated

#

They are not able to fire RPCs

#

That's Networking 101

queen escarp
#

ohhh

fathom aspen
#

I would suggest you take a look at some of the pinned messages in this channel

#

Multiple learning resources to choose from

queen escarp
#

aye i will do that when i got time right now i just want 1 transition thats all im going to have so :/

#

ok so the problem is that the caster is a widget component right

#

hm why would this fail 😮 ?

thin stratus
#

Read the Docs that are pinned

#

You are asking basics

#

If you don't want to invest the time to read them then no one here should invest the time to answer you

#

The docs exist so we don't have to answer the basics every time

queen escarp
#

yeah i get that that´s not the intention but

lament minnow
#

Is there any plugin that allows dedicated servers to handoff players in a seamless manner? I want to spin up and down server level instances for different zones and players to be able to transition between zones(servers) seamlessly. As far as i can tell this is not a feature of ue4 out of the box, and wanted to check if any 3rd party solutions exist before trying to develop something myself.

rocky kestrel
#

Question about multiplayer. Client wants oculus quest 2 standalone game (no computer) that works multiplayer 1-4 players. What would be best way to make it work? it is escape room style game.

#

any tutorials there with oculus online sessions?

thin stratus
lament minnow
#

I see, i'll do some more googling then i wasn't turning up much luck it felt. Idk if we will go with them(if they are still around), but might give some insight into how to begin.

civic storm
#

Is it possible to do host migration seamlessly for listen servers?
Want to make a hub area with listen server (if possible) as host and switch hosts as players leave or disconnect seamlessly so it doesn't cause them to leave and then come back

pearl bear
#

When starting the game in a multiplayer game, a character selection screen is displayed to all players. When you click the relevant button on the UI, your character is configured in a specific way and you control the character. I'm trying to do something like this but I'm not sure where I should create the widgets. If you were to consider replication, how would you program such a thing?

sage light
#

Upon hosting the game on one machine, the other client successfully finds the session. But when I try to ClientTravel it won't do anything. Seems like the address that it is getting is correct. How do I solve that? Everything is managed with EOS matchmaking

PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);
thin stratus
formal solar
#

Hi guys I have some questions about actor relevancy.
I have some units that grow from babies to adults, that spawn very far from the main level. Players can enter doorways to teleport to colonies of these units. My problem is as follows: if I set these actors to 'always relevant' or give them an enormous net cull distance, they spawn correctly and their aging logic (timer based) works fine. However the performance cost is enormous. If I do net culling then when players teleport to colonies, they have not spawned correctly (the colony itself is a blueprint which spawns the units one by one in unoccupied cells based on a timer). I see two solutions but my road ahead is limited by my poor understanding of net culling.

  1. In my colony blueprint (that handles the teleportation) I could get the list of spawned units I have and loop through them, setting 'always relevant' to true for each unit. However even typing this I feel like this is wrong.
  2. I could use an array of custom structs to represent all my units, and when I enter/exit a hive I can spawn and destroy (respectively) my units based on my struct array, on the client that has entered the colony. However I would also need some kind of timer system based on how long since each struct is added to my array, so that I can load them all in the correct stage of development.

One question I have: if an actor spawned on server has timer based logic (eg 12 seconds after spawn, X occurs), but is not relevant to anyone due to net culling when event X happens, if a client gets within net relevancy range after event X was supposed to happen, will it see the actor as if event X has occured? E.g. does logic fire on the server even for actors not relevant to any client?

dark edge
#

it sounds like you have State, but you're trying to sync it with Multicasts

#

when it should be a repnotify

formal solar
#

i'm not really using multicast, i am spawning all the units on server

#

and setting them to replicated

#

But if they are not replicated, and I multicast spawn them, will they always exist regardless for all players? But if I do that I think I will still have performance issues

#

because its like, 1000 units but each colony is only like 50, and players only need to see the units when inside the colonies

#

and they are quite expensive

kindred widget
#

Can you interact with these growing things? Do they have AI, or move around, etc?

formal solar
#

yeah they have some basic ai they swivel and bite and have a health bar

#

and are killable

kindred widget
#

Well. The server is still going to have issues regardless.

formal solar
#

So how about they dont exist at all, but only as data until a client enters a colony, they get loaded up for that client, then destroyed once the client leaves

kindred widget
#

But the aging thing sounds like it should just be a single float replicated that is the server time the thing is finished growing. It replicates once only when player is looking at the hive and no more networking needed there.

formal solar
#

Well like I said, if I make an array of structs to represent my units, is there a way I can measure the time from when I added a struct to the array?

#

So I can monitor the growth time, and when I load the unit, load it in the correct development stage

kindred widget
#

I would just save one single time property for when it's done growing, or maybe two depending on serialization needs. Start and End. No need to continually send the client the development progress, they should be able to infer that on their own with just those two things and some static data.

formal solar
#

yeah but they grow all differently depending on when they are born

#

its not like I have 1 growth time for the whole colony, I need to link a growth time for every unit

#

Also could I just have an array of the actual actors, not placed in level, then spawn/destroy them based on the array

kindred widget
#

Not really following the growth issue. If you have UnitA, does it always take XMinutes for UnitA's type to grow from 0-100%?

formal solar
#

yeah

#

I guess I can do get world delta seconds

#

from when I add

#

then another get world delta seconds from when I load

#

or get game time sry

kindred widget
#

Example:
UnitA takes 60 seconds to grow.

UnitA-1 created at server time 32 seconds
UnitA-2 created at server time 47 seconds

Current server time is 52 seconds

UnitA-1 is has been growing for 20 seconds. It is 33.33% done.
UnitA-2 has been growing for 5 seconds. It is 8.3% done

The only thing a client needs is the current server time, and the creation time passed from server. All machines should have static data that UnitA takes 60 seconds to grow. This means one single float replicated for the duration of that unit's relevancy.

formal solar
#

sure will just add a creation time variable

#

and make a struct (unit, float)

kindred widget
#

That'll help some server performance with networking, and a lot of client performance as they only need to care about the thing when it's relevant. As far as general server performance though, that's tricky. Server still needs to keep the units for everything going maybe. Depending on who is viewing where. If each player is a hive, and they can all view their own hive at the same time, server has to be able to maintain all of those hives at once. Which in theory it could do at a really low tick rate while clients locally simulate most stuff visually.

formal solar
#

You might have a point with a large number of players, i limited it to max 4

#

so is max 4 hives viewed at once - but hundreds possibly total in the game

kindred widget
#

In that case, you could probably serialize them all and just reload them when a player goes there. Or severely lower/disable tick rates if keeping actors in memory allows.

cerulean lintel
#

Hey there! Does anyone have a recommendation on what’s the best approach to calculate hitbox line trace on the server to avoid cheating? I already have a function for that, working in single player, should I just move it into a reliable rpc?

formal solar
#

Serialize meaning just add the actors to an array? Not clued up on terminology
And yeah could look at tick rates, if no client is near then set tick rates to like 0.5

quasi tide
kindred widget
cerulean lintel
#

It line traces bottom of the sword to top btw

formal solar
#

ok will need to look into that vaguely remember doing that in unity but was years ago

#

will see if needed first

cerulean lintel
#

Is it something like adding a transform array and pushing it thru tick to rollback or does UE have anything built-in to handle that rollback

quasi tide
#

All my stuff is just, "client said he hit this NPC", server - "Okay"

#

😅

#

Co-op baby!

#

Cheat away, idgaf

cerulean lintel
#

Haha gotcha

quasi tide
#

I only do a line trace from the position on the server side to see if it was reasonably possible.

#

I don't do any rewinding or anything like that.

#

So you can't just complete the map and say you hit all enemies 😅

civic storm
cerulean lintel
civic storm
#

Are there any cheap/free virtual dedicated servers for testing?

hollow swallow
#

Is it fairly simple to setup a dedicated server for unreal?

quasi tide
#

I don't do a rollback or anything like that.

cerulean lintel
#

Okay

quasi tide
#

But again - my needs are different. I just want people to play together and have fun.

cerulean lintel
#

Makes sense yeah

#

I’ll do some tests with those options

#

Thanks!

quasi tide
#

A lot of people just let client dictate what they hit if they're doing a co-op game.

civic storm
quasi tide
#

It's easy and cheating really doesn't matter a lot of the times

cerulean lintel
#

Yeah, my game is p2p so it shouldn’t be something complicated but at least some basic checks

quasi tide
#

Unreal is strictly a Server-Client set up

sage light
#

Upon hosting the game on one machine, the other client successfully recognizes that there is an existing session and gets the address. But when I try to ClientTravel it won't do anything. Seems like the address that it is getting is correct ( although it thinks that the port is 0 which I don't think is the case ). How do I solve that? Everything is managed with EOS matchmaking

PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);

Also, the session is not showing in the dev portal although I have all the right EOS keys in the project settings and the enginedefault.ini is set correctly according to the documentation.

calm hound
sage light
#

seems like it is connecting, right?

calm hound
#

are you trying to use ClientTravel to connect to a server first time?

#

or are you already connected and trying to switch maps

sage light
#

can it be due to "ReplicationDriverClass is null! Not using ReplicationDriver."

#

I can't find a replication class in UE5

calm hound
#

well I see you have "Cannot create gamesession, session already exists" in your errors

#

so it may be an issue with your session creation rather than the client joining

#

I've not use the Epic Online Sessions myself, but typically you have to make a call to the server to clear the session otherwise it'll stay active for a while before timing out in things like Steam if I remember correctly

#

so it may be trying to create too many sessions with the same ID

sage light
cerulean lintel
sage light
#

It also shows that there were no api calls which makes no sense

dark edge
#

I mean a barebones dedicated server, sure

#

a dedicated server for a big comlicated LiVe SeRvIcE is another matter

calm hound
sage light
#

So I'm certain that some things are running correctly behind the scenes

#

It's like the lobby is working but it won't see the API calls, sessions, or lobbys in the portal

#

and connecting won't work

calm hound
#

hmm, I mean I'm not seeing anything myself that sticks out.

I'd maybe try and run some debugging/logging on the PreLogin I think it is of the GameMode to see if the server is getting the request to join

#

not sure how much the EOS interferes with that

green moat
#

I'm making a procedurally generated multiplayer map where the client generates their own map meshes using a seed. I'm having an issue where you can visibly see the character lagging behind as soon as it enters the a generated room and then pop back into place when it enters the starting room. The starting room is placed into the level by hand and acts as a starting point for both the server and the client. Anyone have any idea why this happens?

thin stratus
woeful anvil
#

@thin stratushave you tried Iris yet? is it functional or buggy?

thin stratus
#

None of our current projects require multiplayer or ship late enough to allow testing Iris

woeful anvil
#

👍

pallid mesa
tulip sable
#

guys I want to run 2 instances to test my networking

#

I don't want to build the project

#

is there a button somewhere I can't find it

pallid mesa
#

It depends on what you want to test

tulip sable
#

I am using sockets to connect with server I just want 2 or more clients

pallid mesa
#

so you are not doing conventional Unreal's networking?

tulip sable
#

no

#

I use my own sockets

#

I just want to run 2 clients

thin stratus
#

Just put the number of players to 2 in the editor then

#

And leave it on standalone

pallid mesa
#

in such case boot two standalone

tulip sable
#

ah cool thanks guys

dark edge
#

Is there any way to end up with NON replicated actors spawned at runtime yet stably named?

#

Like for procedural generation

thin stratus
pallid mesa
#

@winged badger and me give an extended explanation of the concept there

green moat
pallid mesa
#

what engine version are you running?

green moat
#

5.1

#

but has been migrated since 4.26

pallid mesa
#

5.2 preview solves an issue with SetBase at the cmc level

#

the fact that your character mesh lags behind when walking on a runtime spawned mesh is odd

green moat
#

The server and client both spawn their own "room" meshes

pallid mesa
#

which is how it should be, ensure they have the same location

#

and that they are net addressable

green moat
# pallid mesa and that they are net addressable

I'm generating this map at runtime for both the client and server and I'm using a blueprint actor to spawn the room where I've set NetLoadOnClient to true. You've noted two points to make sure it is "Net Addressable" ie:

   1. The Actor should exist in Server and Client at a map load time: A Server Actor should relate to a Client Actor.
   2. The Actor should be stably named: The Server and Client Actor should have the same “path name” so that the FNetworkGUID can be generated.
  1. How can I relate a server actor to a client actor that is spawned separatly?
  2. By "path name" do you mean the name of the actor blueprint?
pallid mesa
#

unfortunately you have to use C++ for that

#

code can be found in the blogpost

subtle peak
#

When adding UI to all players, I cannot use the hud class, is this correct? Since the server is not "aware" of the HUD class?
So I'll have to create the widget and add it to viewport somewhere else?

latent heart
#

You can't create UI on the "server" if it has no players. It has no UI. The HUD class is sent to each player and is executed locally.

subtle peak
#

This code is in the player controller

sinful tree
subtle peak
sinful tree
#

I want to say Gamestate. Could also potentially be playerstate.

subtle peak
kindred widget
#

That looks like a Gamestate broadcast. Or even better a non replicated component on the gamestate used only for sending kill reel RPCs to clients.

quasi tide
#

Whenever you do a RunOnServer, RunOnClient, Multicast - when writing the code, think about which machine you're currently on, executing that code.

#

Think about it like you're changing machines

dark edge
#

Assuming you want a widget on every screen when this happens

kindred widget
#

Wouldn't even bother with the infrastructure personally. Put a kill reel widget on screen somewhere and in it's construct, add a Listener from the GameplayMessage system. In the RPC, just broadcast that from the gamestate or component.

quasi tide
#

That's honestly how I'd go about it. Because multiple places might care about this type of thing.

subtle peak
kindred widget
#

Dunno. Possibly. Sec, editor not open.

quasi tide
#

It's pretty much just a GameInstance or World Subsystem that broadcasts a notification. Your GameState would trigger the broadcast.

kindred widget
#

@subtle peak So I made three classes. A simple struct to pass the data in the RPC and the broadcast. A widget for listening and displaying(or printing in this case), and a GameState for multicasting.

#

The widget does this. This is an Async node that listens for gameplay messages on that tags channel.

#

Your gamestate just does this.

#

Think of it like a game wide dynamic multicast and delegate listener.

quasi tide
#

For reference - you can rip this straight out of Lyra

subtle peak
kindred widget
#

You'll need the plugin for it. As Duroxxigar mentioned you can pull it out of Lyra if you have it.

subtle peak
#

Gotcha. Thanks guys

kindred widget
winged badger
kindred widget
#

Nah. 😄

#

Everything else is dark theme. May as well have something bright.

kindred cypress
#

Function is placed inside a gamemode class

Any idea why the last event is triggered first?

#

All of them are placed inside the player controller

thin stratus
#

Despite the fact that they aren't connected, they aren't guaranteed to come in order iirc

winged badger
#

that thing is synchronous only server side

thin stratus
#

If you need that data to come "in order", send it in one RPC

kindred cypress
#

thank you

winged badger
#

and you don't need RPCs there at all

#

you're RPCing stuff that is normally just replicated via GameState

kindred cypress
#

GameState replicating is a bit slow for example the PlayerArray

winged badger
#

it doesn't actually replicate that, replicated player states register with local gamestate

kindred cypress
#

and iirc correctly replicated variables does replicate even if the data doesn't change?

someone correct me if I'm wrong

thin stratus
#

Yeah PlayerArray is actually not replicated

#

At least not actively

kindred cypress
#

so it's just initialized with the gamestate, ok

thin stratus
#

It's both

winged badger
#

and it will replicate all replicated variables first time around, then on change

thin stratus
#

The GS searches for all of them

#

And the PS registers itself

#

To counter race conditions

kindred cypress
#

Do you guys recommend any book/course for this kind of stuff? Most of the things I found around doesn't cover this type of logic, order of execution etc

winged badger
#

player states by default have net priority of 1 for some reason

#

so they don't really replicate early if there is a lot of things to replicate

#

cedric has a network compendium pinned on the channel here

#

recently updated, if i'm not mistaken

kindred cypress
#

Thanks you both for the help, just saved me a few hours of debugging and endless google searches

winged badger
#

the only place you can really find fine details reliably by yourself is UE source code

subtle peak
sinful tree
subtle peak
kindred widget
#

IE, it shouldn't be a ServerRPC. It should just be a normal event that's already ran from the server.

#

Making it a ServerRPC implies that a client is telling the server something died.

sinful tree
#

What does your "Receive Damage" event look like?

subtle peak
subtle peak
kindred widget
#

You're doing some weird stuff here. All of this code should be running on the server. Which means that there should be nothing here calling a ServerRPC. And by the looks of it, you're telling the owning client to do the kill notification? Is that what does the ServerRPC in your game state?

subtle peak
kindred widget
#

Also not sure how you're passing the killer here. You seem to be setting a "KilledByActor" as a replicated property. Which will most certainly not be set on the client before that RPC arrives. RPCs are basically instantly sent this frame. That KilledByPointer could take several frames to replicate.

Which is why this code here should simply GetGameState->CastToMyGameState->MulticastSomeoneDeaded

thin stratus
#

SomeoneUnalived

#

I feel like I should write some examples for the rpcs at some point to give some better idea on when they are needed etc

gritty warren
#

Hello all,

I'm building a system for character customization, and I'm trying to figure out the proper framework to replicate this. I'm thinking there are probably a few solutions, some more naive than others - does anybody have any resources or would be willing to help me figure this out?

Basically, I would like to know how to take data made within a menu screen (like what skin I wish to use), package it somehow, and bring it with me into a multiplayer session. Can anybody help me with this?

quasi tide
#

The way I do it, and I don't care if it is right or not, I let the player select the character stuff they want, save it as a save file - then, when the client joins, if I have a save file, load it and RPC those changes to the server. The server then updates it and it will then propagate down to the other clients.

#

I just use UE's built in save system pretty much.

#

Of course - if you want your stuff locked behind some paywall and all that, you need to add in additional checks.

low helm
#

Yeah just look into SaveGame files

subtle peak
#

I really wish UE5 had a content starter pack with a very basic multiplayer setup. Lyra is just too big to dive in to and learn

low helm
#

There are some simpler ones on the marketplace

subtle peak
#

Dont trust them 🤣

low helm
#

Fair enough, but if you're goal is to learn, you will learn

#

your

subtle peak
#

For "best practices" and so on

low helm
#

Meh, learning is more important than best practices

#

just chase fast results

#

and learn best practices later

quasi tide
#

The problem is you're trying to think in terms of "best".

pearl bear
#

I configure the skeletal meshes of my character by reading them from the data asset with a method. Clients for multiplayer do not detect these changes. My configure method is ServerRPC. What could be the problem?

quasi tide
#

Best practices are quite simple. Don't trust the client.

#

There - solved it for you. How you decide to architect something is completely game dependent.

low helm
#

You can trust the client if you want

quasi tide
#

Sure - but it's not "best practices"

#

Obviously you can do w/e you want.

#

I trust the client quite a lot for simplicity, but mostly because it's a co-op game and idgaf

low helm
#

Faster development can be a best practice in its own right 🙂

quasi tide
low helm
#

I was chatting with DevlisD yesterday about how "Distance Checks for Net Relevancy" would have huge cost in large open worlds with many actors, so RepGraph is meant to address that. But, imagining that I had a game which managed network traffic primarily through dormancy, isn't it true I could completely sidestep the cost of "Distance Checks for Net Relevancy" by turning on "Always Relevant"?

winged thorn
#

Hey! I've got one of the weirdest problems I've ever encountered IMO. Here it goes:

  • UInventoryComponent (ComponentReplicates true, Items(ItemInfo array) Replicated true)
  • I've also create an AItemInfo (AInfo, Replicates true) // This Actor stores all the information about an item that must be in the inventory (Non physical)
  • ABaseItem (Physical Item, OnBeginPlay -> Spawn ItemInfo Actor and sets the ItemInfo variables to what this physical Item has. Everything replicated)
    The problem is, when I grab the item from the server, everything works, but from the client nothing get's added to inventory, the code is correctly executed on the server and the Item should be added (Verified with breakpoints), but the client for some reason doesn't have those ItemInfo Actors inside his inventory Array.

If anyone needs more information to help me, just ask me and I'll provide it, for now I believe that's pretty much it.

quasi tide
low helm
#

Right

#

So an object relevant to one client would have to be relevant to them all

#

But it would sidestep the Net relevancy distance checks

quasi tide
#

Yup.

subtle peak
quasi tide
#

Net relevancy is specifically an optimization TO not have everything relevant.

quasi tide
subtle peak
#

Ah, something else than my issue then.

#

thanks

loud cove
#

I just realized that my multiplayer setup seemed broken, only because the joining player had a collision at the spawn location. The result didn't look obvious, the player joined without a pawn.

What is the proper way to bail, when the spawning of the pawn failed?

I guess I could check if the pawn is valid in AGameMode::PostLogin and leave the session in something seems off. But maybe someone has a better idea

#

Another question would be, where to define the spawn parameters for pawns. There I could define that the player just spawns regardless of collisions at the spawn point

sonic vale
#

Hello, can anyone possibly help me with a replication?
I want to spawn a helicopter and this should fly to a position, that works so far with the replication, however, I still have sounds and other functions that are not replicated.

subtle peak
gritty warren
kindred widget
subtle peak
#

Trying to get it to work, but again not even the print strings are firing

#

Does something need to be turned on in project settings for the plugin to work?

kindred widget
#

Are you seeing the BroadcastMessage print?

#

If no, then it's not the plugin. If yes, it might be the plugin. But you should not need any setup for this.

#

I would recommend putting prints at these two green arrows to see which if them run and on what machine.

gritty warren
# quasi tide The way I do it, and I don't care if it is right or not, I let the player select...

I asked the oracle for clear step by steps - would you be willing to inform me if this sounds accurate?

To create a character creation system that stores player choices and replicates them in a multiplayer session using Unreal Engine, you can follow these steps:

Create a Character Customization Struct: In order to store the data related to the player's character customization, create a custom struct. The struct should contain variables for each customizable aspect, such as body type, hair style, skin color, clothing, and so on.

Create a Player Customization Save Object: Create a SaveGame object that will hold the player's customization choices. This object should include a variable with the character customization struct you created earlier.

Save the Customization Data: Once the player has made their customization choices, save the data using the SaveGame object. Use the "Save Game To Slot" function to save the data to a specified save slot. You can choose a slot name based on the user's account or another unique identifier.

gritty warren
# gritty warren I asked the oracle for clear step by steps - would you be willing to inform me i...

Setup a Game Instance: To make sure the customization data is persistent across different levels, create a custom Game Instance class that will store the character customization data. In your custom Game Instance, add a variable of the type of your character customization struct. After loading the save data in the main menu, store the character customization data in the Game Instance.

Replicate the Customization Data: To replicate the character customization data in a multiplayer session, you should use a PlayerState or a custom GameState object. In your PlayerState or custom GameState, add a replicated variable of the type of your character customization struct. When a player joins a multiplayer session, send the customization data stored in the Game Instance to the PlayerState or custom GameState.

Apply the Customization Data: Create a function in your character class that will apply the customization data to the character model. This function should take the character customization struct as an input and modify the character's appearance accordingly. Call this function on the server whenever the character spawns, passing the customization data from the PlayerState or custom GameState.

Replicate the Character Appearance: To ensure that other players see the customized character correctly, make sure that your character's appearance components (e.g., skeletal mesh, materials) are set to replicate. In the character class, set the components to replicate using the "Set Is Replicated" function, and also use the "RepNotify" variable replication mode for any variables that affect the character's appearance. In the OnRep functions, apply the customization data again to update the character's appearance on clients.

By following these steps, you should be able to store the player's character data, load it into a multiplayer session, and replicate the character's appearance across clients.

quasi tide
#

I'm not proofreading chat gpt for you

#

If you don't know what you're doing, you shouldn't use it

subtle peak
wheat rose
#

can someone please help me come up with a blueprint so that when a player interacts with a door, they teleport to a place in the map. In a multiplayer session only they would teleport to that spot and people could follow them if they also interact with the door after.

sterile plaza
#

what part do you need help with?

wheat rose
#

Please and thank you, i've been trying to figure this out for a while now and i cannot seem to get anything to work other than teleport the host and nobody else follows

#

i am awful with blueprints lol, so pretty much all of it

sterile plaza
#

by host do you mean you're using a listen server?

wheat rose
#

i have it connected to EOS and host sessions like that i suppose

wheat rose
#

guessing i lost ya xD

fluid summit
#

Hi everybody!

Quick question with regards to GAS.

It seems like a really performant and robust framework. But it also seems like not many use it and a lot of people complain about it.

Is there any obvious reason for this? and is any other available framework that you would recommend instead of GAS?

near kettle
#

Anyone recommend a resource as to where to get started implementing multiplayer using c++?

fluid summit
#

there's also a lot more of resources on the pinned comment.

round acorn
#

New in the marketplace... if they show a high latency video and it looks good, might be tempting.

wooden falcon
#

Any idea why my dedicated server runs correctly when using the launcher but doesn’t when using the shortcut?

deep coral
#

what is NetGuidMismatch for network error?

#

thrown by BP game instance for handling network error

fossil spoke
#

The logs should tell you more.

fluid summit
round acorn
#

Reviews??

#

If you want a highly performant multiplayer experience in UE... you go with GAS. Or you spend a ton of time writing something similar and probably nowhere near as good.

fluid summit
# round acorn Reviews??

it's a way of saying, someone even said that it's probably harder to learn than the unreal engine itself

round acorn
#

Once you have the C++ classes in your build it's actually not that hard to learn imo

#

Lot of it is blueprint exposed

fluid summit
#

i'm mainly looking for something
++performance
++scalability
++multiplayer ready

and I don't mind having to put a lot of time and effort first into the setup.

#

so gas looks like a good option

round acorn
#

GAS is the ticket then imo

#

There's a bug in 5.1 with the MMC and DECs (modifier magnitude calc and damage exec calc) where they aren't working in blueprints

latent heart
#

The question you have to ask is, is setting up gas for the first time actually shorter than making your own system? 😂

hollow eagle
#

yesn't

round acorn
#

If you spend a little money on GAS Companion then definitely

fluid summit
round acorn
#

And GSC gives some nice added functionality

latent heart
fluid summit
#

indeed, not bad for a first try : (

latent heart
#

I'm not trying to say GAS isn't good. It's great. I'm just poking fun. 🙂

hollow eagle
#

but seriously, GAS is what epic themselves use for fortnite. It's not even remotely simple, and it requires changing your mental model about how you design the underlying systems for a lot of parts of the game (assuming you want to go "full " GAS), but it works very well.

fluid summit
#

my aim is something like path of exile in terms of modifiers

#

where there's weird modifiers affecting in different ways.

round acorn
#

Then you def need GAS

latent heart
round acorn
#

And some really custom damage execution calculations

fluid summit
#

the attributes part is easy, but when adding modifiers that adapt behavior, my system slowly falls apart

hollow eagle
#

iirc GAS originated from paragon so you're fine there... MOBAs lol

#

can't get much more crazy in terms of modifiers than a MOBA

round acorn
#

You can definitely get to POE levels of complexity with it

fluid summit
#

thanks, i'm going to give gas a try and see what can be done

round acorn
#

My game is basically gonna be PoE but in a Soulslike

fluid summit
#

prob going to lurk here in the incoming time

fluid summit
latent heart
#

Soul Path of the Dark Exile?

fluid summit
#

Path of the soul

round acorn
#

More like Elden Path of Exile Ring I guess. Open world with linear dungeons and poe loot (not as MUCH tho)

dark edge
round acorn
hollow swallow
#

So i have this section, i have checked the bool is true at the time for that player state, yet this still goes through as false, any idea why?

fluid summit
#

nothing wrong on doing 100 years ARPG

#

we need to hold video games on higher stem (?)

hollow swallow
#

i can see the bool is true in the details for that playerstate. and its still printing false :/

#

and its printing for the correct playerstate im looking at too

sterile plaza
#

standalone, listen server, or client?

hollow swallow
#

client

sterile plaza
#

are you looking at the client in both cases?

hollow swallow
#

if i make a local variable in that component, it works fine. im not sure why its not reading the playerstate correctly

#

yeah

#

all print strings it saying it has the correct ones

#

the bool is set to replicated inside the playerstate too

sterile plaza
#

so that hits the false print node?

hollow swallow
#

yeah

#

even though i can see it true

sterile plaza
#

where do you see it as true?

hollow swallow
#

details panel when i select that playerstate

sterile plaza
#

I don't really know much about how accurate that is.

#

I would assume the branch is correct and ignore the other one.

hollow swallow
#

its not because its running the false code not the true code

sterile plaza
#

what's the difference between the blue print screenshots?

#

the one print is on the server

#

there's your disprepancy

hollow swallow
#

that whole line is ran from server, and the In Party? bool gets set from a server event too

sterile plaza
#

you just said it was all client

hollow swallow
#

sorry, im playing as clients

#

misread what you said

sterile plaza
#

what is it you expect to happen and what is happening?

#

ignore the print

hollow swallow
#

so you invite a player, it adds them to a party manager actor.'s array of party members. Who has a rep notify and for each member in the array, it updates them and sets who the leader is, what party it is, and sets In Party? to true. So the second time someone gets invited, if the person is already In Party? it should add them to that party, if its false, it creates the party manager actor.

#

but at the moment its reading In Party? as false and keeps creating new party manager actors. instead of just adding them to the array of the one already existing

#

When i player presses the accept button to join a party, it runs this.

sterile plaza
#

Functions should only be named "ServerFoo()" if it's an RPC, btw

#

I use "AuthFoo()" for functions that should only be called on the server (and assert if they aren't).

hollow swallow
#

rogey will change that, first time i ever named a function as that, just wanted to know only the server runs that

sterile plaza
#

you can mark BP functions as "only runs on the server"

#

I forget how in BP and I'm in the middle of debugging right now.

hollow swallow
#

no dramas

sterile plaza
#

it would be nice if your screenshots showed the name of the class they're defined in

hollow swallow
#

more so just trying to solve this issue xD if i dont store it on the playerstate, and just in the component itself, it works fine

sterile plaza
#

I'm having trouble keeping track of what functions lives where.

#

where are all these RPCs?

hollow swallow
#

sorry, the 4 bottom screenshots are all in my AC_PartySystem. The top 3 are in my Party Manager Actor

#

and the AC_PartySystem is on my character

#

so it creates the party manager, sets who the leader is, and adds the players to the array, thats working well. Then the party manager has a rep notify on the array of party members, that then runs the server event to update all their player states with the info + bool

#

hope that makes sense, im pretty new so probably not the greatest way to set it all up

sterile plaza
#

you have an onrep that calls a server RPC? why?

hollow swallow
#

should they not be used for that? i use it for when if someone leaves the party, and they were the leader, it sets another random leader then that notify fires and updates everyones playerstates to who the new leader is

sterile plaza
#

Where does a call to the server factor in?

hollow swallow
#

Can't only the server update info in a playerstate?

sterile plaza
#

you can edit your own local copy
but if you want it to be replicated to everyone, then the server has to set it

hollow swallow
#

Yeah I want it replicated to everyone

sterile plaza
#

I'm not understanding why you change a variable, in the onrep on the client it immediately makes a call to the server

hollow swallow
#

So when a player is added / removed it just updates their playerstate so when the next person goes to invite them, it checks their playerstate and sees if they're in a party, and if so which one

#

As I said I'm fairly new so not sure if my work flow is way off 😅

sterile plaza
#

okay

hollow swallow
#

And I went to do it in playerstate so of the character dies, it retains the party

sterile plaza
#

a player instigates joining?

hollow swallow
#

the AC_PartySystem does, it adds them to the PartyManager actor's array of party members, which is a rep notify, that then updates the characters playerstate

sterile plaza
#

can you show me the variables that make up all this information that describes who is in what party and who the leader is?

sterile plaza
# hollow swallow

if your goal is to replicate the property and change the player state, just do it on the server
no reason to have the client request that

hollow swallow
sterile plaza
#

where does that live?

hollow swallow
#

on the party manager actor

sterile plaza
#

where does that live?

#

oh it's an actor?

hollow swallow
#

by itself invisible in the world

#

yeah

sterile plaza
#

You could put it on the game state.

hollow swallow
#

so when they join, it spawns that, and adds the players to the array inside that

pearl bear
#

I am running a code like this in OnRep, but the server cannot see the change in the client. Torso->SetSkeletalMesh(CharacterDefinition->TorsoMesh);

hollow swallow
#

rogey, havent really touched game states yet, just thought this way would work because then there can be multiple parties for different people

sterile plaza
#

is the data that's on each player state different? or they all get all the party info?

hollow swallow
#

they will all get the party info

#

everyone that is inside the array on the party manager actor, will recieve the info to their playerstate

sterile plaza
#

player state is the wrong place to put this then, you're duplicating data for no reason

#

put it on the game state

#

then you only need one copy of who is in which party

hollow swallow
#

and it shows correctly in the details. its when i try to access that info, its not showing properly

#

but wouldnt that make it more complicated for updating them? like if 1 player loses health, it needs to tell everyone to update their hud, i just thought it would be neater in an actor with a smaller array of players to check who need updating rather than sift through every player thats on, and check if theyre in the same partys, then update their huds

sterile plaza
#

why does the health live there?

#

how many players max?

hollow swallow
#

probably 4-5 max per party, maybe up to 20 per game, if it can handle it

sterile plaza
#

are you not replicating character health already?

hollow swallow
#

yeah thats all working fine

#

and the updating of the huds

sterile plaza
#

so, then you don't need to do any more work over the network

hollow swallow
#

but i store that info on my character, wrong i know, but i only send it to the player state and get it back on death / respawn

sterile plaza
#

when a character's health changes, see if that character is in your party by checking it on the game state

hollow swallow
#

inventory / attribute points etc...

#

all their stats are on character

sterile plaza
#

oh, sure

#

that's a different issue

hollow swallow
#

then i just package it into a struct, send it off, respawn the player, and grab it back xD but it works

sterile plaza
#

yeah, seems fine for now

hollow swallow
#

my main issue is, why can i not read the correct value of the bool in the playerstate?

sterile plaza
#

I don't know and the way you're managing the data and moving it back and forth is really complicated.

hollow swallow
#

its the server that changes it, and its the server that looks and checks it

sterile plaza
#

I would simplify it first, then debug it.

hollow swallow
#

yeah as i said, im very new, and trying to make stuff myself xD so the work flow is no doubt out by a mile

sterile plaza
#

what does the inParty bool signify?

hollow swallow
#

that they are in a party already, so that it wont spawn another party manager actor, instead, just adds them to the array

#

then everyone recieves the update the arrays changed, and updates their huds and adds the extra player in

sterile plaza
#

you have multiple party manager actors?

hollow swallow
#

there would be yes

sterile plaza
#

why?

hollow swallow
#

one for each unique party

sterile plaza
#

why do they need to be on different actors?

hollow swallow
#

not sure where im going with it yet, but say if someone wants to go into a dungeon, it will get everyone inside that party manager, and put them in the dungeon

sterile plaza
#

none of this is necessary

hollow swallow
#

i just thought its an easy place to store the info only relevant to that party

#

someone suggested it here last night

#

so i ran with it

sterile plaza
#

make a component on the game state:

UPROPERTY()
struct FTeam
{
  // leader defined to be player at index 0
  TArray<APlayerController*> Members;
}

class UTeamManagerComponent
{
  UPROPERTY(ReplicatedUsing)
  TArray<FTeam> Teams;
}```
#

you'll have to add a server RPC on the player controller or player state, since clients can't call RPCs on the game state

#

I don't think you're saving much by only replicating relevant data to each party. This like a max of 20 pointers in arrays.

#

there's also no need to store a party size, you can just get MyArray.Num()

hollow swallow
#

yeah the size isnt used yet

#

was just in there when i made it at the start

#

With the playerstate, even though theyre replicated. do i need the client and the server to update the info there? is that why its recieving the wrong thing?

sterile plaza
#

Something to keep in mind as you're organizing code is to try and minimize duplication of state. This opens you up to bugs where you have state that disagrees with itself.

#

client and server to update what info where?

hollow swallow
#

Im just so confused why its reading the incorrect thing from the player state.

#

it shoes correct in the editor details during runtime. but always prints false

sterile plaza
#
  • client calls PlayerController::ServerRequestJoinTeam(int32 TeamIndex)
  • this calls an add function on the team manager which adds that player controller to the team at that index in the array
  • the array is replicated and all clients get an OnRep telling them it was modified
#

I don't know why.

#

And it's going to be more work trying to figure it out than it would be to make it simple.

#

imo

hollow swallow
#

rogey, ill have a go at that. thanks for the help, appreciate it

#

confusing tf out of myself reading over all this xD its a maze

sterile plaza
#

I feel bad for not helping solve your specific issue, but in my experience, when I get overwhelmed with the complexity of my system when trying to debug, it's a sign that I need to take a step back and rewrite it to be simpler and easier to understand. Then it's easy to debug if thigns are still wrong.

#

it sure is, networking is NOT easy

#

especially if you're new to programming

hollow swallow
#

yeah first project, pretty far in already, but having a crack at making my own features and sometimes it goes smooth, others, not so much haha

#

all part of the fun though

pearl bear
#

I'm so tired of ListenServer. Is it possible to have a system where the server player runs the server as a separate process and connects as a client?

sterile plaza
#

I don't see why not.

#

what's wrong with listen server?

pearl bear
#

While the code I wrote works in a casa where everyone is a client, it does not work on a listen server and I experience this very often.

sterile plaza
#

other than the fact that ie allows/encourages people to wrote client code that assumes it's the server, if you're the host

#

mostly due to onrep not getting called?

#

you get used to where you need to do things different for listen server

pearl bear
#

this is what I have in the moment

sterile plaza
#

fwiw, I think the way you're doing it is the best way
make it work for clients and THEN fix it for listen server
the other way around is worse

pearl bear
#

I am constantly forcing myself to write the ListenServer correctly in one go, but every time I get a code that works correctly in the case where everyone is a client 😄

sterile plaza
#

I think that's the best path.

pearl bear
#

What do you think about the server running in the background in a separate process?

#

Can something like this be done without being felt by the user?

sterile plaza
#

It could be PTSD from releasing a AAA game where the client can only do a subset of things the host could, because the team didn't know best practices for UE yet. :P

#

I haven't looked into it.

#

It doesn't seem like it would be hard to boot up a dedicated server process and then a client process.

pearl bear
#

btw why my onreps not working on listen server 😄

#

is this common issue

sterile plaza
#

not at all

#

but they don't

#

if you need to do stuff on server and clients, call it from the onrep and call it where you change the value.

pearl bear
#

I have a data asset and onrep that changes the appearance of my character, but the server cannot see the changes in the clients.

#

clients can see each other correctly

#

I am changing variable in Server RPC

sterile plaza
#

call the onrep where you change the value

pearl bear
#

hmm, interesting

#

wasnt the reason we use OnRep it will be called when value changes 😄

sterile plaza
#

for clients

pearl bear
#

it worked

#

damn

#

I hate you listen server 😄

mellow stag
#

So I did a dedicated server network profiler test and this was only ~10 minutes
There was about 5 players connected to the server
why are the values specifically the "count" values so high, 1000+ playercontrollers and holdable axes (holdable axes are what the player spawns with)

short arrow
hollow swallow
#

just brainstorming. if i have say an open world, then there is dungeons too, can i have only certain players on a dungeon level and the rest on the general world? or once the host goes to a new map does it pull everyone there?

short arrow
#

I'm pretty sure being on the same server means being in the same level

hollow swallow
#

rogey thanks, im guessing dedicated servers would be the only way then? and have multiple for each area

short arrow
#

Yeah, a different server per level

hollow swallow
#

ooof, sounds fun to do

hollow swallow
#

Any idea why that doesnt work for the host? only clients. returns none for the hit result as the host