#multiplayer

1 messages · Page 630 of 1

dark edge
#

You still haven't said how you are launching the game

eternal briar
#

If I add a child actor component to another actor and I want the child actor to replicate, should the parent actor has to replicate? (I know that the parent actor has to replicate for a normal component to be considered for replication, was just confused because the child actor is, well, an actor)

dark edge
high current
#

yeah that one obv works

limber mortar
#

I do have LOD set up, probably just incorrectly

severe spear
#

hey how's it going?
not super experienced with multiplayer. just wondering, if a fairly simple login system is enough to prevent people from playing our game online, without subscribing to Patreon?

limber mortar
#

I am re-examining that during my work too

dark edge
#

@limber mortar What does the material complexity view of your scene look like?

high current
#

we have the session wrapper which cant find sessions on two different machines but can if you do two instances on one machine

#

and then we tried the open levelname?listen

#

and open IP for the joiner

#

that did not take either

#

but ping ip in CMD works

#

soo my guess is ports

real nimbus
#

hi guys, i have question, whats best way to replicate changing skeletal mesh?

twin sable
#

Does anyone know how to get the steam overlay before packaging? You used to be able to run standalone and get it but it seemed they removed the ability. Even my standalone doesn't work until I've deployed it with steampipe

#

I was gonna use a virtual machine to test steam connection things but it seems like I'm going to have to package and upload the game before I can test things :/

blissful dome
#

I'm able to see the steam overlay before packaging when I right-click my .uproject file and use the "Launch Game" option

twin sable
#

hmmm thats weird then it doesnt for me. Does anyone know why the overlay might not show up. Steam also doesn't seem to think its running the game. I've set the app id in the ini file and it worked, including multiplayer when I deploy it to steam

#

ok nvm it seemed online subsystem steam had been disabled for some reason lol

#

thank god I didn't ship that build lol

wind wedge
#

Does anyone have a good understanding of what generates the IPNetDriver=#####?
I have seen many people using =0
Mine is always some long string of numbers depending on the build. However, if i edit ANY of the C-code, when i try to build again, the client and dedicated server end up with DIFFERENT IPNetDriver=####’s and become incompatible. (message: client is out of date).
Currently i am only able to launch a dedicated server built in blueprints only. I have to leave the code untouched so the netdrivers match.

#

This is mostly fine, blueprints can do almost anything, but there are a few things i would like to change in the code.

meager spade
#

you need to setup your custom build version

#

without it, everytime you change code, it will change the build id, and clients will not be able to connect, look at Network version override ue4 on Google

rigid zinc
#

GetCurrentPlayers for Steam Sessions always returns 1, even when multiple players are in the session, is it an expected behavior or a bug? How to get the number of players in a session?

pallid canyon
rigid zinc
#

Yeah, on client side I'm doing:

#

And adding the results in a array, then I click on one of those to join it in a widget

#

So far it works, and allows me to join sessions, but I want to limit sessions to 2 players using the Get Current Players yet it does not work

limber mortar
#

I will look material complexity and get it posted 😄

pallid canyon
limber mortar
#

The fire looks good

rigid zinc
snow seal
#

Does anyone have experience or know if it is possible to change an already loaded level to a listen server and host a session without having to reload a new level? I've tried searching but every multiplayer tutorial is always - open session, set to listen, load level

pallid canyon
#

Server travel loads a new map and takes everyone with them, but sounds like you're trying to do something different

snow seal
#

Correct - A player is effectively playing in a single player mode, but has the option to open up the game to multiplayer as a listen server. I'd like to start a sessions and have other be able to load in without interrupting the original player's experience

pallid canyon
#

sounds like a lot of work with a transition map and melding it to make it seem like it never happens.
Or every player starts their own host session by default and then when others join they were already a listen server

#

would mean other players map travel still, but doesnt interrupt that host's session

meager spade
#

Yeah you want it to be listen by default. Then its just a matter of creating a session to allow others to join the game. Player is already setup to host.

#

It's super simple.

snow seal
#

Hmm that makes a lot of sense. I'm giving it a shot now - I did leave out that I'm trying to do it from the start menu where the player can make a lobby and players can join while they are still have full access to the start menu. I switched the start menu to listen by default so we shall see!

#

Although the same idea will be available mid-game. Thanks folks. I'll see if I can get it from here

fallow quail
#

Hello! Anyone here knows how to use the Update Session from Steam Advanced Sessions? Where should I call this function if I want to update the sessions current player number

twin juniper
#

Are these the only BP nodes available for session handling, or epic added more in the later releases

sinful egret
woven sinew
#

Why would my dedicated server's sessions work in DebugGame Editor mode but not when packaged ?

#

I mean I can't find the session from the client when the server is packaged

#

the only thing different in the log is the SteamNetDriver_xxxx where xxx is 0 when in debug game mode and a big number in packaged

potent cradle
#

From what I hear, the replication graph needs to have a dependant actor removed from it before it is destroyed, otherwise crash. Can I just bind a delegate to OnDestroyed and remove it when I get the event?
Or is that too late?

chrome bay
#

IIRC you won't get a crash but an actor dependant on a parent that isn't in the graph just won't replicate. It also silently fails if the parent isn't already in rep-graph which is kind of annoying, you have to code around that (I put them into a temporary list)

potent cradle
#

Aaah 🤔

#

Maybe outdated info that I heard

chrome bay
#

I don't think I've tried it tbh, I think in my cases the child actors always end up being removed anyway before the parent is destroyed

#

E.g, destroying an inventory prior to destroying the owner etc.

potent cradle
#

Oh, the way I understood it it was exactly that same thing you're sketching. A child being removed, not the parent

#

The example was a weapon pickup

#

If weapon is destroyed, and it has always relevant tied to the character that picked it up, that would crash?

chrome bay
#

Oh no that should be fine

potent cradle
#

Is it fine to update netculldistance on the repgraph's class info, at runtime?

distant wave
#

hey guys, is there a way to have a replicated rotator which updates every tick (player's head rotation) without it lagging the whole game?

winged badger
#

you replicate desired rotatoion

#

and have every machine just do its own interp towardds it

distant wave
#

oh, alright, I think that involves a multicast

winged badger
#

then you don't have to do it on tick

#

no, onrep

distant wave
winged badger
#

unless they are shooting lasers out of their eyes

#

this will be accurate enough

distant wave
#

they aren't shooting lasers out their eyes =))))

potent cradle
#

What's the best way to grab the instance of a replicationdriver?

soft jewel
#

How can I keep the player state name through maps? Is there any other way to do it with replication? Thanks

chrome bay
#

The object name or the players' name?

#

Player name already comes accross with seamless travel IIRC. Object name you can't preserve

#

Even on seamless travel new actors are created

soft jewel
#

Player name which I am setting on a textbox on my menu

chrome bay
#

So long as you're calling SetPlayerName you should be fine

soft jewel
#

I have a custom player state with a name variable and I am setting this one with my textbox value, but from what I saw Player state gets destroyed when you load a map

#

So not sure how to do it

chrome bay
#

Oh, in that case then no

#

You can only preserve data when using seamless travel between maps

#

Then you can copy properties to the new player state by overriding CopyProperties

#

But you're probably just better off using the existing player name variable, instead of having two replicated strings.

brazen sluice
#

OK I have the weirdest issue...
After a minute of multiplayer gameplay, the server TAKES OVER the client, like hey im the captain now, and the client cant move anymore... Also isLocallyControlled suddenly returns true for server on the remote pawn, a literal hijack
No idea what's causing this, happens even if I do nothing

soft jewel
#

@chrome bay So should I activate seamless travel on my game mode?

chrome bay
#

check the docs

#

It requires some setup to use

soft jewel
#

Thanks for your help, will take a look at that

brazen sluice
#

Any function could cause a server to take over the blueprint actor's ownership? (If yes at least I know what I could be looking for)

winged badger
#

should probably clarify, but its SetOwner in any case

#

and it really doens't matter if its a blueprint or not

brazen sluice
#

Hmm removed all the setOwners I could find no difference unfortunately

#

LIterally even if I dont click any button it just does

#

Any other function I could look for? Couldnt find any "posses" either

wind wedge
#

Open the following: character bp, player controller bp, gamemode bp, and your HUD class

#

Check the code carefully, then begin placing debug (print string) nodes in key places

#

Try to find the point where controll is switching

#

On a side note - are any OTHER clients logging in while this is happening?

brazen sluice
#

No there's only the server and the client

wind wedge
#

Also - think about the timing, you said ‘after a minute’, is there anything on a 60-sec delay?

brazen sluice
#

Hmm let me do a global search for delay

wind wedge
#

Most likely in one of the classes i mentioned above

brazen sluice
#

Im going to create a macro like name == "clientname" && isServer && isLocallyControlled, and place it everywhere to try to see which one logs first

#

But I'm afraid it wont do much if it's unreal itself doing this

#

for any reason

wind wedge
#

I know for my server, i have events on the character and HUD that wait a bit to begin. If theres a bug in one of those things wont break until the delay has occured.

#

Casting is a bit different on dedi server as well. There are basically 2 versions of your character: the real one (server), and the replicated one (client).
When you do anything that casts to the player’s version of their character - you want to use the ‘get owning char’, ‘get owning pawn’, ‘get owning controller’, etc

brazen sluice
#

could that cause the issue to getPawn rather than getOwningPawn ?

wind wedge
#

Absolutely

#

Generally the cast fails, but if it succeeds its not the object you intended to cast to

#

You can print string off if cast failed

brazen sluice
#

But I would have to do something weird with that object for it to cause the server to take over the actor

#

Like assigning some thing

wind wedge
#

Multiple issues can occur, the main one is the cast hits the fail branch i stead of the execution pin and whatever you were trying to do simply doesnt happen

#

The other thing, if you are referencing the server version of the player pawn, it will return server as its owner

#

A lot of these things become more visible when you start logging in multiple players. You see how things are trying to replicate

brazen sluice
#

Here's im just logging on tick

#

Imma try to disable features one by one til it stops happening

wind wedge
#

Another issue i have found that will do this is:
Broken logic loops, timer by (x), or event tick functions.
If the client gets overloaded trying to run a foul loop the server takes control and basically disconnects you, although you still see the game goingg on

brazen sluice
#

Ah really

chrome bay
#

Calling GetOwningPawn() from a widget btw is only ever going to return a local pawn.

brazen sluice
#

tbh

chrome bay
#

Widgets are "owned" by whichever controller has them on screen.

wind wedge
#

If you use a looped function (one that repeats or fires every x time) such as event tick!!! Make sure its correct and isnt trying to pass data it cannot access.

brazen sluice
#

But would client still receive updates from the server? Because here it does

wind wedge
#

Its more as if the function or event is NOT “reliable”, and repeats the same garbage over and over - the server just ignores it

#

And yes, successive network fails are one of those things

#

i would check your casts first. Thats usually what happens to me

brazen sluice
#

Because I do have a TMap that is trying to replicate and the server is like nope, but I just couldnt find where it was from so I ignored it

#

OK I hope I am not being overly optimistic but it seems if I un-pin the character tick, I do not have the issue anymore

wind wedge
#

Anywhere you “get player controller”, use the “get owning controller” instead

brazen sluice
#

So at least I know where Im looking

wind wedge
#

That’d be a good place to look

brazen sluice
#

Yes that's better than "looking accross 20 BPs" 😂

wind wedge
#

Usually with dedi server, its only the replicated ones that will thorn you.

brazen sluice
#

Yeah I never use dedi server because the mob AI are broken on it

#

I suspect the nav mesh or some other thing not generating

wind wedge
#

Im not much help with ai, i use bp logic instead of blackboards.

#

Something about linear logic vs binary logic....

brazen sluice
#

Well AI work just AI movements, mobs just stay still that's why I was thihnking about navmesh

#

But I'm not worried because I'm goign to build my own navigation system later on

#

completly removing the Unreal one

#

So I wont look into fixing that

wind wedge
#

i dont have my navmesh bounded

#

Didnt want to sit here and make a million mavmesh bounding boxes across an open world, so the server generates nav everywhere.

brazen sluice
#

CAn you do that?

#

mine is just 1 million UU size

wind wedge
#

I havent tested it beyond the maxsize (my map exceeds this).
And theres a bit of a hiccup if you relocate or teleport the ai before it reaches its destination. The clear destination function is bugged.

brazen sluice
#

My main issue is perf wise, the world updates a lot, and everytime the navmesh is trying to synchronously adapt

#

Thta's why I'd rather skip the nav system and build my own that relies on data rather than mesh

#

Surely A* Wont be to hard to implement 😄

wind wedge
#

Like most things in the engine, theres several ways to approach this. Basically you’re looking at a combo of target points and locational logic.

#

Its a lot of work because you are basically replicating most of what the navmesh is there for

brazen sluice
#

Yes but the diff is that I already have a "grid" of points, since my map is fully procedural

#

And that grid is also way more accurate than the navmesh

#

So it doesnt make sense to compute it twice

#

All i need is to run A* in that grid

wind wedge
#

You will need logic to handle obstacles, changes in paths

brazen sluice
#

Sure true

#

Althought is that really managed by the nav mesh

#

I'm only going to rewrite Move To

wind wedge
#

Thats mostly what the navmesh does: draws a navigable path between 2 points

#

Yes move to should be fine, you cant use aimiveto though

#

The aimoveto requires the mesh

#

One app i used sort of how the player controls are set up, except instead of input it was event-triggered, and vectored towards the target points

#

This was done on the level bp, using the target points referenced from the world outliner

brazen sluice
#

Yeah that’s it my plan is, I have a grid of points, I run A* and move the pawn along the path

wind wedge
#

Yup. Maticulous, specially in large worlds, but doable

#

Problem is something in the way, the character hits it and runs in place

#

Im about to implement a new system on a live server this afternoon. I’ll let you know how it goes

#

I need ai animals to run around the world. So thats my task for the day

brazen sluice
#

good luck 😄

brazen sluice
wind wedge
#

Im ‘anti-blackboard’. It seems to be a limited tool.

#

This new system i found uses enums and events on the ai char to drive the logic, animations, sounds and everything i need.

soft jewel
#

I have seamless travel now, but can't figure out how to use the event copy properties to get the name on the player state

wind wedge
brazen sluice
#

OK I was being overly optimistic with the character tick.. it's just that when gravity is off, the problem does not occur.... which is kind of a weird observation

wind wedge
#

Gravity....... hmm check anim bp, calling a variable named “IsFalling?” (maybe something there)

brazen sluice
#

Ah true true

soft jewel
#

@wind wedge This one is to get the steam/pc name right? I am using a textbox on my game menu to set my name

brazen sluice
#

This is some interstellar shit

wind wedge
#

If unset this variable returns the device name (pc name). If set it should return what you set it to

soft jewel
#

How can I set it? I cant find any node to do that

wind wedge
#

Print string and see what it returns

#

Havent tried it but this may work for you

#

No never mind that doesnt work give me a sec

#

Ok come out of the getplayername node and call a “SetString (by ref)

#

Then pass your variable into the value

#

You probably want to make that authoritative or something

soft jewel
#

@wind wedge Can't find a set string node by ref, could you share a screenshot?

wind wedge
#

type set in the search, should be at the bottom

#

Make sure you drag off the return value

soft jewel
#

oh yes, thanks, will try it

sullen kernel
#

Is it common to have Actors with only data (no physical representation in the world)? It feels odd to "spawn" the actor when it doesn't have a physical existence in the world.

wind wedge
#

Yes that is quite common. Myself, i make them part of the scene because i like to be different.

#

For instance, my chat server is an actual computer server model in an office building

#

Usually they are ‘hidden in game’ or invisible

sullen kernel
#

Gotcha. Thanks. Because I need to replicate pointers to these data objects, and I think Actor is needed for that.

wind wedge
#

Actor/pawn/character all can do these things, or even simply a static/skel mesh.
The logic is mostly the same. Depends on what yur doing i suppose

soft jewel
#

I tried it, but I still get my pc name, doesnt seem to get updated

chrome bay
#

SetString by ref doesn't make sense there

soft jewel
#

@chrome bay do you know how should I update the copy properties?

chrome bay
#

Cast New Player State to your custom one, then set the value of the Player Name property to match your current one.

winged badger
#

for PlayerName this seems very wrong

#

i think Epic put in a function in GameMode to rename them

chrome bay
#

Yeah you really should just be using the built-in player name functionality for this.

#

And replicating FText is also not advisable

wind wedge
#

I actually collect their pc name as-is for my logs. Their “name” is a seperate variable for me

sullen kernel
#

What do you mean simply a static/skel mesh? I need clients to see when I change a skeletal mesh. But the skeletal mesh component doesn't replicate the changes when you call SetSkeletalMesh().

brazen sluice
#

Is it possibleof the network is too slow for a little while that the server just decides to take over the client and if yes how could I detect that?

wind wedge
#

I just meant generically, to have a ‘thing’ in the world to hold/manipulate data.
Yes if you want to change skelmesh (without destroying it and spawning a different one), then it needs to be in a container such as a pawn

#

@brazen sluice seems more likely to be a logic issue. When things like that happen to me its 90% an improper cast, 10% is broke my logic, either by error or forgot to plug a pin in (or plug it to the wrong thingg etc)

brazen sluice
#

I would normally agree, but literally nothing is happening when that occurs

#

no animation, no mob, no nothing

#

So I just cant find something that would cause this

wind wedge
#

you changed all of your casts to the owner casts?

soft jewel
#

@chrome bay I dont really get it, this is my custom player state, and then I get the player name inside my player and set it to my widget

brazen sluice
#

I didnt find a wrong cast, may be not looking for it the right way

sullen kernel
#

Well my character has a SkeletalMeshComponent. My player takes an action in the game and I want to change the skeletal mesh. So I made another Actor class to hold a USkeletalMesh* value and replicate the pointer to that class. When clients call OnRep_Pointer() they locally call SetSkeletalMesh() to change the skeletal mesh. So that was my question earlier about the actor. It mainly holds the new USkeletalMesh* value but needs to be replicated so clients know the mesh changed and to update their mesh locally. Does that make sense?

winged badger
#

using a separate actor in game for that? no

#

your character can hold another USkeletalMesh*

wind wedge
#

Why not just getowningpawn -> cast to playercharacter -> set skeletal mesh

#

The character is already replict

#

I have a switch-on-int, that holds 100 skel meshes, and the int controlled by 2 buttons (Inc/Dec), each leg of the switch sets the mesh and i can scroll through all 100 characters. But to donit this way and have all the animations etc, they all need to use the same skeleton and anim bp

sullen kernel
#

Well different items in the game have different skeletal mesh values. For example a modular character equipping a piece of armor on his torso. I have a separate skeletal mesh showing the armor on the character. So the skeletal mesh value depends on the item he is equipping. The player needs to know that the skeletal mesh changed and which new mesh to set it to. So I don't know if putting the USkeletalMesh* on the character will work.

wind wedge
#

Yes, it should and you dont need to rep or notify, because the character itself is already replicated

#

Just like changing clothes

#

Just add another mesh component to the character in each location you want a piece of armor/clothing. And they have to all “fit” in that exact spot without the need to adjust its location (or you need to work out those numbers and make each adjustment)

#

Usually you want to assign it a default value (basic armor class?) and can set to invisible if you want then make it appear when they ‘get their first armor’

winged badger
#

@sullen kernel you really want to keep the number of replicated Actors down as much as possible

#

takes a while for server to figure out what to replicate, more Actors, the worse it is

sullen kernel
#

So for the armor example. The character has a separate skeletal mesh component for his chest and it starts off as a naked chest. Then the player picks up an armor in the game and how do clients get notified to change their local skeletal mesh? Some variable needs to replicate on the character so the clients know to update thier skeletal mesh right?

#

Because calling SetSkeletalMesh() on the server won't replicate the changes to client

wind wedge
#

It should if you are replicating the character

#

For what you are doing you shouldn’t need to setbreplicates for each component

winged badger
#

Character has SkeletalMesh variable, Replicated + OnRep

#

it has SetSkeletalMesh function that sets the SkeletalMesh Variable, and also calls SetSkeletalMesh on its SkeletalMeshComponent

#

and it works

#

OnRep sets the SkeletalMesh on the Component

#

(by "has" i mean after you add them)

wind wedge
#

The default 3pbp char, you can swap the meshes out at runtime and everyone sees the changes.

winged badger
#

replicating the SkeletalMeshComponent is not advisable though

#

can create severe jitter combined with CMC

wind wedge
#

Theres only certain cases where you want to replicate each component explicitly (CHAOS destructor for instance), but for normal stuff, just replicating the character itself handles the rest for you

brazen sluice
#

OK SO it wasnt related to gravity, it's just that when you were too high up (cuz no gravity) level doesnt load actual meshes

#

(just empty sky )

wind wedge
#

@brazen sluice check your killz if you havent set that

brazen sluice
#

it is set

wind wedge
#

are you testing in PIE or building and pushing it to anlive server?

#

One thing you should get in the habit of when you test in PIE - when you hit play for the first time after making changes - close all client instances, but let the server load all the maps once. When its done close it then hit play again. This gets around a bug in the editor PIE. It becomes more and more necessary the larger your maps get.

#

If the PIE clients load faster than the server all sorts of bugs happen that have nothing to do with your code

brazen sluice
#

im testing in right click > launch game

#

never in PIE cuz it crashes when trying to open the map (never knew why)

#

(after I hit stop on another map than the inital main menu)

#

This is driving me nut, what is a god damn difference between me being 5km up the sky and being 1m up the sky

#

The only diff is im generating meshes

wind wedge
#

Are you on the ground up that high? Like a mountain?

brazen sluice
#

No no

#

both flying

#
  • falling in place lol
wind wedge
#

So for 1 min you can move around

#

Then it steals it from you

brazen sluice
#

yep

#

or even if I stand still

#

more like 10-15 sec

wind wedge
#

how many event ticks are you using

meager spade
#

@wind wedge i was reading what you were saying about "swapping a mesh at runtime and all clients update"

#

that is not true.

wind wedge
#

Well it works fine on my server

brazen sluice
wind wedge
#

I mean as in how many eventtick functions are you calling

meager spade
brazen sluice
#

OK Fun fact: retest with gravity off, actually still steals it... it just took longer tlast time and I thought it didnt do it

brazen sluice
#

Sorry not sure I understand the q.

wind wedge
#

@meager spade after logging in, i getowningpawn, cast to char, set mesh to (whatever). And it replicates to all the other players. Thats how i am setting their characters.

meager spade
#

but he was not asking that though

#

he was saying "Pickup a armor piece and change it on the player"

wind wedge
#

It is the same

#

Your character can have 30 meshes if you want

#

Which is why i suggested the switch, switch on type of armor, then set the mesh accordingly.

meager spade
#

so am i missing something?

wind wedge
#

Possibly, if you do something simple like swap the material of the UE4 mesh, does that also have this issue?

meager spade
#

It just feels like you gave erroneous information out, i have been doing UE4 multiplayer for 4 years, i know it would not work like you said, even changing materials is not "automatically" replicated.

wind wedge
#

Well i for sure do not have the “component replicates” checked on the skeletal mesh

meager spade
#

even if that was ticked, it would not change it

wind wedge
#

And that function is running on server and reliable

meager spade
#

Server RPC only tells the server to change it

sullen kernel
#

My understanding was that it worked that way for Static MeshComponent but not skeletal. Because if you look in code for static mesh, it is set to replicate already

meager spade
#

you still need to tell all clients, "look i have changed the mesh"

wind wedge
#

Yes if you only change it on the client the others wont see

meager spade
#

you should also never replicate the skeletalmesh component and any components attached to it on a Character, as it causes "jitter"

#

due to the way CMC interpolates the mesh during movement

wind wedge
#

Yes toi much traffic. Thats why i stay away from the chaos stuff on the chara

meager spade
#

its not traffic

#

also not related at all to chaos.

winged badger
#

its component replicating its position and overwriting the CMC interpolation

wind wedge
#

No but the new chaos stuff needs component replication to work

#

Is what i was saying

meager spade
#

where did you read that nonsense?

wind wedge
#

Ive tested the destructor, if component not set to replicate it only destroys the clients mesh

#

Like your dog

#

When everyone logs in inhave the same ue4 char like you have. Once they select a character, everyone sees them change.
I didnt touch the template char. Simply made a copy, assigned my custom skeleton and anim bp, and everything is done through a simple cast to char

#

If you set the mesh on the client, thats the same as going into your install and changing the jpg for your own. Its cosmetic to you only. Collision/physics/nav will all still be using the mesh assigned to the server’s version of your character.

#

Change THAT - and it replicates, because the character is replicating

#

Set to reliable, because if too many players are setting up their char (or changing armor/cmothes/weps) at the same time you dont want it to skip anyone.

#

You can do the same thing with a vehicle, have one vehicle and set whatever skel mesh to the vehicle in your inventory as you scroll through them, everyone sees your cars change when you click the button. (planes, boats, pets, whatever). I have only a handful of ‘things’, but an instance of that thing can be anything of that category.

#

The 3ptemplate examples are (for the most part) ready for networking as-is. If you need something specific, setting those up in the same way will work.

meager spade
#

@wind wedge i do not wish to argue, but if it works for you, great, and your lucky.

wind wedge
#

I cant see your code, but with the dog in your example, it looks like you are casting to the client instead of server when you set the mesh

#

In which case, nothing is replicated because the client is on the back end of the replicating process

#

I took the simple route to handle this: in my gamemode (which the clients never access) -> (IsServer?)->Branch. That way everything is the server when i run the event or function.

meager spade
#

you made false asumptions, and assume i know nothing about UE4 multiplayer.

wind wedge
#

But theres litterally a hundred ways to donthst

meager spade
#

that skeletal mesh was changed only ON the server

#

not on the client

wind wedge
#

Listen server works differently

meager spade
#

no it does not

wind wedge
#

You arent a real server

meager spade
#

so what am i then?

wind wedge
#

Your a client, serving

meager spade
#

so i am a server?

wind wedge
#

You have to repnotify or run standalone

#

Standalone the server repnotifies the clients

#

It will run a server in another window

#

Running byitself, both client instances should see the change

#

Where is this mesh variable set

meager spade
#

eh?

#

this sets the skeletal mesh on the skeletal mesh component.

#

I am no longer discussing this, but please, create a new project, and just set the skeletal mesh only on the server, and tell me if it works. If it does i will apologize for being wrong.

wind wedge
#

in the character bp? And how are you casting to the char?

#

I have it working already in a live server, thats why i suggested doing it that way

#

The server should be referencing the correct owner (not index 0), get the reference to your character, tell the server to set its mesh. Its pretty straight forward

meager spade
#

Very well, but remember giving bad information is worse than giving no information. There is no way simply setting a skeletal mesh on server only will replicate it to other clients. There is no way, its impossible. /** The skeletal mesh used by this component. */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Mesh") class USkeletalMesh* SkeletalMesh; is not replicated at all. Just making you aware, not being rude or obnoxious, or thinking i know it all.

#

Your game is likely using some other replication path or replicated property. That will be specific to your game and its structure.

wind wedge
#

When the mesh component is inherited by a replicated character (as the ue4 3pbp char is), you dont need to replicate the mesh. You just need to set the correct mesh - the one on the server.
[in the case of a client package running as listen server this is different - you have to repnotify to other clients]

brazen sluice
#

Seriously cant I just write a code like onTIck => client posses the pawn to make sure server isnt hijacking it 😭

#

There's just no logic, whatever I do

meager spade
#

@wind wedge again you are saying nonsense 😦

#

@brazen sluice what is the issue ? got lost in the above

wind wedge
#

@brazen sluice having too many event ticks (specially on the character , hud, etc) can cause you to lose control. I would try to limit the event tick, it runs 16-ish? Times per second? i dont use tick anywhere...

meager spade
brazen sluice
#

After a few seconds (10-15secs) the server hijack the client's pawn, as if it was some locally controlled pawn. After that,

  • the client can almost not move (the server is rolling baack the movement, but for some reason it still moves a little)
  • isLocallyControlled suddenly returns true instead of false on server
  • The client is still connected and still receives updates (like hey you got hit)
meager spade
#

@brazen sluice right... and what relevant information should we know?

#

don't forget we can not see your code or your game

wind wedge
#

@meager spade it all really depends in your approach to networking. 3pbp example is set up for the server-client model, not client-to-client. Doing it that way DOES require additional code to replicate. Because you are not truly “authoritative” as a client, but rather forcing your client to have authority over all others. It is really a different thing.

brazen sluice
wind wedge
#

It says this in the docs

meager spade
#

link me

brazen sluice
#

At least it SEEMS to prevent it

wind wedge
brazen sluice
#

As in ground is too far to load

meager spade
#

@wind wedge that is ambiguous, show me where you exactly heard that nonsense?

#

@brazen sluice so client looses control, his role changes, like he has been unpossessed?

brazen sluice
#

Yeah kinda except it's not really cause I can still do things

#

Like it's possessed by 2 people

meager spade
#

could that happen?

brazen sluice
#

It doesnt actually lose control from client perspective

wind wedge
#

UK - what happens when you repnotify that same evemt

meager spade
#

i know how to make it work, that is not the issue

#

the issue is with you saying you only have to set it on the server.

wind wedge
#

On a dedi server you dont need to do that

meager spade
#

Explain one thing to me: How does client know to change the skeletal mesh?

wind wedge
#

You can also run as standalone with 2 clients and see what i am telling you

meager spade
#

i did crylaugh

wind wedge
#

Because the server replicates that just ad it does the movement. If you change the mesh on the client its post rep

meager spade
#

how does the server replicate it? Where?

wind wedge
#

If its cast properly the server will take care of everything for you

#

The ue4 cheracter bp, click on the root at the top, and it should come pre-set to replicate. I see yours already is because the other client seees the movement

meager spade
#

Look i am done, clearly you know more than me, and you are adamant i am wrong. I am seriously not going to be discussing this any further.

brazen sluice
#

CAn confirm isLocallyControlled does return true on both client and server

wind wedge
#

As it should

meager spade
#

why should it?

#

server does not have local control.

#

(unless its listen server)

brazen sluice
#

No server only returns true after 10sec

#

when the bug starts happening

#

Before that it's false

meager spade
#

it should be false on server, correct

brazen sluice
#

And nothing happens when the switch occurs, litereally not moving, everything is on hold

#

Tried disabling my RPCs, my ticks, etc... still happens

#

Unless I disable the whole world all together

meager spade
#

@brazen sluice you know how to use Data break points in VS?

brazen sluice
#

yeah

wind wedge
#

Thats deep, but i’ll give it a try:
So if you reference self and is locally controlled- this returns true. You have control over your character. If you reference the servers version of your character (on the server) islocally controlled is true because the server controls your charater (authoritatively) then updates your ‘true’ location to the client

meager spade
#

data breakpoint the role in AActor

#

@wind wedge again that is wrong.

wind wedge
#

Ok so why then are they both true

meager spade
#

cause he has a bug..

wind wedge
#

I get the same result

#

And i dontnhave that bug at the moment though i have from many reasons

brazen sluice
#

No but when the game "work" server is false, it only switches to true after ~15sec

meager spade
#

^

brazen sluice
#

I mean if it was normal it would be true from the start I aassume

meager spade
#

correct

wind wedge
#

Yes

#

Again referencing the char. Are you checking yours or the servers

meager spade
#

but its not normal for it to be "true"

brazen sluice
#

I mean that wouldnt make sense anyway, you need ONE THING to tell you whether or not smtg is remote

meager spade
#

Server should return false for Locally Controlled unless that pawn is a listen server

wind wedge
#

For each, respectively, it shoudl be true to their own self for the char they control

#

Referencing the client owned pawn yes

brazen sluice
#

Yes of course their own pawn return true

#

But the server start returning true for client controller

#

the one that's not local

#

the remote one

wind wedge
#

If the server has your player controller- again check where you ate casting to this

meager spade
#

@brazen sluice you need to find out why the server is returning true, and it does that via the PlayerController btw

#
{
    return ( Controller && Controller->IsLocalController() );
}```
wind wedge
#

Use get owning controller instead of get player controller

meager spade
#
{
    const ENetMode NetMode = GetNetMode();

    if (NetMode == NM_Standalone)
    {
        // Not networked.
        return true;
    }
    
    if (NetMode == NM_Client && GetLocalRole() == ROLE_AutonomousProxy)
    {
        // Networked client in control.
        return true;
    }

    if (GetRemoteRole() != ROLE_AutonomousProxy && GetLocalRole() == ROLE_Authority)
    {
        // Local authority in control.
        return true;
    }

    return false;
}```
#

if (NetMode == NM_Standalone) Standalone non networked, always locally controlled

#

if (NetMode == NM_Client && GetLocalRole() == ROLE_AutonomousProxy) this is a client, and the controllers local role is autonomous (normal client)

#

if (GetRemoteRole() != ROLE_AutonomousProxy && GetLocalRole() == ROLE_Authority) Listen server

#

so @brazen sluice somehow one of those gates is returning true

wind wedge
#

Yup thats one of the parts i was talking about ^^ see how the listen server is just a modified client?

meager spade
#

@wind wedge please don't push me. I have not spent 4 years working on an 8 player co-op game with no networking knowledge.

wind wedge
#

The actual server is headless, and doesnt have to ask itself wether or not it has authority. We have to adk IT

brazen sluice
#

But I'm never really casting the player controller, only once on show hide cursor and that one is fine it does not fail

meager spade
#

@brazen sluice need to know why server is returning true

#

your controller is likely doing something weird

brazen sluice
#

Yep let me take a look thanks

wind wedge
#

a bad cast to player character will also do this, because the controller is inherited

#

any of what i call ‘single player casts’, can break things in this way

brazen sluice
#

IsLocalController is virtual where can I find the implementation to put a breakpoint?

wind wedge
#

Hard to debug without seeing something, but it works at login, which tells me theres a loop, timer, tick event, ect. Possibly that clutters up after several iterations.

winged badger
#

to a hammer everything looks like a nail

wind wedge
#

Yes

#

Ive broken the engine in more ways than the internet covers

brazen sluice
#

Unless I'm missing an info

winged badger
#

broken cast would not result in your symptoms

#

so you can stop looking for it

wind wedge
#

Theres really only those few blueprints, i listed at the begining (and sometimes others you reference to them) that cause this

winged badger
#

for Client's pawn to return true to IsLocallyControlled on server

#

it has to be possessed by either AIController or listen server's PC

#

Cast has nothing to do with this whatsoever

meager spade
#

@wind wedge please stop with bad information, i understand you are only trying to help, but its really a hinderance.

wind wedge
#

Two conversations Zio

#

Azu is having a control issue, UK was controlling me trying to help someone set their mesh

meager spade
#

i was not controlling, i pointed out you gave bad information, just cause what you did worked in your game.

wind wedge
#

Actually if you had listened, what i gave him works in Steam, which dos NOT run as listen server

meager spade
#

again, nonsense information.

winged badger
#

even if you were correct, azukar started searching for Cast nodes because of what you typed

wind wedge
#

Best of luck Mr. 8yr.... i’ll probably have launched my 20th game by them

#

Zlo - he Should be checking that

brazen sluice
#

Remote role is always ROLE_Authority before & After the bug occurs

#

Shouldnt be, right?

wind wedge
#

Depends whats causing the bug

winged badger
#

@brazen sluice blueprints only, or c++ involved?

brazen sluice
#

C++ involved

winged badger
#

start DebugGameEditor target from VS

#

put a breakpoint in AController::SetPawn

#

see what hits

#

that function runs both on Server from Possess and on client from OnRep_Pawn

#

so it will hit for both Server (if listen) and client Pawns on both client and server

#

but as client doesn't have server's controller

brazen sluice
#

Where is this code Zlo? I can only find headers from the editor

winged badger
#

is it listen serveR?

#
void AController::SetPawn(APawn* InPawn)
{
    RemovePawnTickDependency(Pawn);

    Pawn = InPawn;
    Character = (Pawn ? Cast<ACharacter>(Pawn) : NULL);

    AttachToPawn(Pawn);

    AddPawnTickDependency(Pawn);
}
brazen sluice
#

Yes I dont know how to access AController.cpp, as in where is it

#

Never had to do so before

winged badger
#

type Controller.cpp in Solution explorer

#

or press Ctrl+T and type it there (faster)

#

can do that too, from Ctrl+T

#

is it listen or dedicated server @brazen sluice ?

brazen sluice
#

listen

brazen sluice
meager spade
#

that means that controller is Server and has control

night tartan
#

I'm curious about PlayerState and its ownership...am I correct in understanding that a client cannot make a Server RPC call on the PlayerState due to lack of ownership?

meager spade
#

that code makes sense

winged badger
#

@night tartan it can

meager spade
#

it can make a server rpc

winged badger
#

and GetOwner returns a PlayerController

#

from PS

night tartan
#

okay I am getting a warning out about a lack of ownership

#

let me get the exact situation...

brazen sluice
#

What I meant is, it seems the "true" value is coming from somewhere else

winged badger
#

that is because you used BeginPlay or Tick to RPC

brazen sluice
#

Althought it's nether client or standalone

night tartan
#

no, I used an OnRep_Notify to call a Server function

#

is that illegal?

meager spade
#

onrep to call a server function?

#

not illegal, just weird

winged badger
#

but that also runs on all PlayerStates

night tartan
#

trying to send info to the GameMode

winged badger
#

including not your own

#

(from a perspective of single client)

night tartan
#

if a variable on the PlayerState changes, I'd like for it to get sent to the GameMode

winged badger
#

but if it changed via OnRep

meager spade
#

only server can change it tho

winged badger
#

server already has the information

#

so can just set it there without doing RPCs

#

@brazen sluice assuming you're testing with 2 Pawns

night tartan
#

I see, so I don't need to explicitly change the variable up on the server, a client, if they set a replicated variable, will get it up to the server?

brazen sluice
#

Yes the server player pawn and the client one

meager spade
#

no

winged badger
#

you're expecting SetPawn breakpoint to hit twice on server, and once on client

brazen sluice
meager spade
#

only server can change a replicated property in order for it to replicate

#

you have flawed logic

night tartan
#

I do, I know lol

meager spade
#

can you show us?

winged badger
#

@brazen sluice you have editor symbols for debugging?

meager spade
#

it looks like he does not have the engine headers

#

engine source code from the launcher*

winged badger
#

go to your laucher where you installed UE

night tartan
#

so, I have a struct that holds PlayerInfo on the PlayerState. I made a function for SetPlayerInfo() that calls a Server RPC to send and set the info serverside. Is that correct so far?

winged badger
#

and from dropdown/options, select editor symbols and install them

brazen sluice
#

yeah ok I dont have the source only the debugging symbols

#

make sense

#

let me install that

winged badger
#

that is fine

meager spade
#

@night tartan Player has the info, does a Server RPC with that info, Server sets the Property, then sets the info in the game mode

#

that is all that needs to happen

night tartan
#

okay thanks

winged badger
#

but you should (for now) limit yourself to calling that RPC from BeginPlay only if your GetOwner is valid

night tartan
#

why should I limit to BeginPlay?

winged badger
#

it gets called once, and for now, the timing is good enough

#

and your GetOwner being valid means you have a PlayerController locally

#

so its the PS from that client, which means it can RPC

night tartan
#

what about in situations of CopyProperties/OverrideWith

winged badger
#

thats related to seamless travel mostly

night tartan
#

right

winged badger
#

if you're doing seamless

meager spade
#

though i dislike having RPC's on the PlayerState, personally i like to keep all RPC's on the controller for that stuff :D, i am just weird

winged badger
#

your info should had been set on lobby map

#

and would had persisted, so there would be no need to send it again after seamless

night tartan
#

gotcha

#

thank you

night tartan
#

I'm trying to not have everything in the PlayerController lol

#

I see that a ton on Udemy and YouTube, and it's bugging me

meager spade
#

RPC's (client/server) make a lot of sense in the controller tho

night tartan
#

I have "control" stuff there, and yes, it has a ton of RPCs

winged badger
#

Kaos and i are actually on the same team and there are plenty of RPCs in PlayerStates 😄

night tartan
#

but I'm trying to have specifics more spread out

meager spade
#

there is, does not mean i like it 😄

night tartan
#

thanks so much guys, this is my first dive into networking and while I've successfully gotten the actual Steam Subsystems/NULL to work and connect, the flow of game start is a huge swamp

winged badger
#

if you haven't already

#

there is a network compendium, top pinned message on the channel

brazen sluice
#

OK I have instlalled it, but VS Still doesnt find it

night tartan
#

yes, I have that open haha

winged badger
#

read it @night tartan

#

k

meager spade
#

@brazen sluice going to need to generate project files

winged badger
#

@brazen sluice might need to restart VS

brazen sluice
#

Done already ^^

winged badger
#

and that

night tartan
#

I read it and refer to it constantly, and remind myself of things I forget over and over haha

brazen sluice
#

I stopped re-generated and satarted

#

But tbf this guy doesnt even find Controller.h even tho it's literally opened

#

So probably search is just broken

meager spade
#

possibly

winged badger
#

try symbol search (Ctrl + T)

#

instead of solution explorer

#

like in screenshot above

brazen sluice
#

what's the folder path to the source ?

#

That'd be faster prob

#

(CTRL + T does nt do anthing for me, is it a VS code shortcut?)

winged badger
#

ugh

#

VS code

#

😦

brazen sluice
#

Im using VS, just asking if CTRL +T is VS code

#

not the other way around lol

winged badger
#

no, its VS

brazen sluice
#

OK May be I downloaded VS retard edition

winged badger
#

and i never changed that shortcut

brazen sluice
#

Because I dont have it ^^

#

OK i found it in the explorer and openeed it, placed a breakpoint let see

winged badger
#

you expect 2 hits on server

#

1 on client

#

first 2 will be server side

#

if it hits the 2nd time on client

#

then something is possessing your client Pawn

#

and you described the symptoms correctly

brazen sluice
#

OK I dont have the symbols for 4.26 only 4.25 that's why it wasnt finding it

#

nice only 30gb to wait for ;__;

#

Is there a way for me to log the Net Mode ? Based on the code insde the controller, if the Role didnt change it must be the net mode ?

#

Otherwise the return would still be false

#

This is how desperate i am 😭

#

hope the 30g will come quick

#

Actually I could also debug the function by pasting it in my own code and calling my own

meager spade
#

@brazen sluice its not 30gb btw, its 30gb unpacked, but its way smaller than that for download

brazen sluice
#

Hmm so if I copy the function content to my own code, and log it

#

It does not switch

#

..

#

so the code executed is not that one it seems

night tartan
#

Got another quick question, is "GetUniqueId()" a reasonable way to differentiate unique players? Or is there a better method? Since I've made my own struct of PlayerInfo I need some decent and useful property to compare for overloading == so I can use things like Remove or Find on arrays of the struct

#

"...could be different on the client vs the server, so it’s not a good candidate for identifying objects if you need these values to be the same across all machines."

Answered my own question...hmm

#

APlayerState.PlayerId <---- this is a good one?

brazen sluice
#
bool APlayerController::IsLocalController() const
{
    // Never local on dedicated server. IsServerOnly() is checked at compile time and optimized out appropriately.
    if (FPlatformProperties::IsServerOnly())
    {
        checkSlow(!bIsLocalPlayerController);
        return false;
    }
    
    // Fast path if we have this bool set.
    if (bIsLocalPlayerController)
    {
        return true;
    }

    ENetMode NetMode = GetNetMode();
    if (NetMode == NM_DedicatedServer)
    {
        // This is still checked for the PIE case, which would not be caught in the IsServerOnly() check above.
        checkSlow(!bIsLocalPlayerController);
        return false;
    }

    if (NetMode == NM_Client || NetMode == NM_Standalone)
    {
        // Clients or Standalone only receive their own PC. We are not ROLE_AutonomousProxy until after PostInitializeComponents so we can't check that.
        bIsLocalPlayerController = true;
        return true;
    }

    return bIsLocalPlayerController;
}

So either NetMode becomes Client on server for a pawn or bIsLocalPlayerController is set somewhere, but a search throught the code find nowhere where this would be set

#

(DL is 50%)

winged badger
#

NetMode is a propertly of UNetDriver

#

it never changes once set

brazen sluice
#

bIsLocalPlayerController doesnt change either

#

But somehow the result of that function does 😄

winged badger
#

but you're interested in Pawn

#

not the controller

brazen sluice
#

What do you mean

winged badger
#

that is a Controller functions

brazen sluice
#

yes

winged badger
#

you are more interested is your Pawn IsLocallyControlled

meager spade
#

pawn asks the controller tho @winged badger

brazen sluice
#

But that's the function that makes isLocallyControlled return true if I'm not mistaken

winged badger
#

yeah, but the theory was that the Pawn is no longer possessed

meager spade
#

but its returning true on both client and server

brazen sluice
#

I mean tbh it sounds like the server is re-possessing the pawn with a new player controller that is local, while the client is still possessing with its own controller

meager spade
#

for the same (supposedly) pawn

brazen sluice
#

Without notifying the client it did that

#

I dont know if that sounds plausible or what

meager spade
#

i have never experienced that

#

in 3+ years

#

this is 100 percent down to your game code somewhere

winged badger
#

not even vorixo's little experiment came close to that level of breaking stuff

signal lance
#

when a new controller is possessing a pawn the old owning controller gets automatically cleared and told to unpossess 🤔

winged badger
#

yeah, but someone is missing engine symbols

signal lance
#

unless... give me a sec

brazen sluice
meager spade
#

as it happens consistently

#

10-15 seconds into the game

#

makes me think some timer is running or some event happens, that does something with a controller/pawn

#

too early for a GC cycle

#

and actors don't just get gc'd

signal lance
#

Rider taking its sweet time to open 🕐

runic sable
brazen sluice
#

I have the symbols ! Ready to debug the woooorld

signal lance
#

what you describing sounds like you are somehow possessing it locally on the client and when the server possess it the server is not aware that the client has possession and it can't properly clear it
But for that you would have to explicitly set bCanPossessWithoutAuthority on the controller otherwise it will only ever run on the server

meager spade
#

@brazen sluice one thing, are you aware of any timers in your game that do anything with the controller/pawn?

#

as you say its consistently 10-15 seconds in

signal lance
#

^

meager spade
#

any actor that can spawn/anything you can think off?

signal lance
#

could see with the debugger where the calls are coming from

brazen sluice
#

I could think of some but I disabled them all, things like mob spawning and what not

#

My computer just froze, had to hard reset lol, running the game twice is just a chore

#

2nd try

#

SetPawn is not called when the value turns true @winged badger

sullen kernel
#

hey @winged badger going back to what you suggested earlier, replicating the USkeletalMesh* on the character for changing clothing/armor on the modular character. If my armor has stats like durability that has to show on the player UI, then that data has to stay with the armor in case the player drops it or gives it to another player. Maybe in that case it would make sense to stick with an Actor class for the armor then? Even though we should be minimizing the number of actors replicated, the armor itself has instance-specific data like durability.

brazen sluice
#

But it is called when client disconnect

meager spade
#

yeah that is normal

#

@brazen sluice you know how to use data breakpoint right

brazen sluice
#

I mean if server assumed pawn was local it wouldnt bother doing that would it

meager spade
#

start the game, and data breakpoint Role and RemoteRole in AActor

brazen sluice
#

I need a watcher in the profiler right ?

#

If not then no I dont 😄

#

Ahhh just googled it ok got it

signal lance
#

right click on the breakpoint and it should allow you to add a condition in both rider and VS

brazen sluice
#

But btw the value of the role doesnt change

#

I logged it before

meager spade
#

ah you checked

#

ok

brazen sluice
#

Yeap with a log

#

both remote and local

meager spade
#

can you show the log line

#

for IsLocallyControlled you are doing?

#

in your character c++, on tick, put this: UE_LOG(LogTemp, Warning, TEXT("%s : Role: %d, NetMode: %d, IsLocallyControlled: %d"), *GetNameSafe(this), (uint8)GetLocalRole(), (uint8)GetNetMode(), IsLocallyControlled());

brazen sluice
#

I was using BP so I dont have to recompile on every change to the logging

#

My Character is BP

meager spade
#

put that log above i said, and pastebin me the result

brazen sluice
#

only the rest of the project is C++

meager spade
#

mm

#

c++ player controller?

brazen sluice
#

I can put it in a static library and call it

#

no Controller is BP too

meager spade
#

put that into a library then

#

and call it on tick on player, but you will have to pass in the pawn

#

and call those functions on the pawn

brazen sluice
#

Yep

meager spade
#

if you had c++ tick, we could have done a nice way for you to get a callstack

#

when IsLocallyControlled returned true on the server

brazen sluice
#

it doesnt have GetNameSafe replced by GetName

#

Well I mean my callstack would have been my tick anyway

#

no?

meager spade
#

yeah but its possible we could have to something, doubt it tho

#

anyway GetNameSafe is a global lol

#

UE_LOG(LogTemp, Warning, TEXT("%s : Role: %d, NetMode: %d, IsLocallyControlled: %d"), *GetNameSafe(Pawn), (uint8)Pawn->GetLocalRole(), (uint8)Pawn->GetNetMode(), Pawn->IsLocallyControlled()); does not matter tho 😄

brazen sluice
#

Ah my bad

meager spade
#

?

brazen sluice
#

This is the result of the log

#

And bIsLocalPlayerController is true when i go down the stack

#

im setting a break on it

meager spade
#

i wanted it to print the entire log

#

not skip stuff

#

and for you to pastebin it

#

anyway

#

role and net mode does not change

#

oh

#

we didnt do remote role

#

UE_LOG(LogTemp, Warning, TEXT("%s : Role: %d, Remote: %d NetMode: %d, IsLocallyControlled: %d"), *GetNameSafe(Pawn), (uint8)Pawn->GetLocalRole(), (uint8)Pawn->GetRemoteRole(), (uint8)Pawn->GetNetMode(), Pawn->IsLocallyControlled());

brazen sluice
#

Ahhh

#

one sec posting the whole log

#

Line 1451 is the switch

#

You see a whole lot of errors about UI because isLocallyControlled returns true and it tries to access the UI which obv doesnt exist

#

(also sorry for the crap about the BP_Pickup_C needs fixing later )

#

Adding the remote now

meager spade
#

ok

night tartan
#

variables in GameMode don't need to be replicated because that's only a server entity, yeah?

meager spade
#

yes

#

@brazen sluice i see something interesting

#

in your logs

brazen sluice
#

Ah yeah?

meager spade
#

open that pastebin

brazen sluice
#

Is it the apparel stuff because if yes ima kill myself

meager spade
#

and go to line 1426

brazen sluice
#

okay

meager spade
#

2 lines above the locally controlled is fine

night tartan
#

I'm curious about a bug I can't solve...I'm trying to print an array length, and I'm getting a bizarrely huge value:
Warning: ConnectedPlayersInfo Array Length: 1429610152

meager spade
#

then your character ends up with issues

#

then it returns 1 on the server

brazen sluice
#

Yes that's because I'm logging the line AFTER the refresh UI function

night tartan
#

UE_LOG(LogTemp, Warning, TEXT("ConnectedPlayersInfo Array Length: %i"), *FString::FromInt(ConnectedPlayersInfo.Num()))

Is there something wrong about this line of code I'm missing? I've printed array lengths before. This is new to me.

brazen sluice
#

So you see the first broken UI error before the first broken isLocallyblabla broken log

meager spade
#

but the locally controlled is correct

#

up until the UI errors

#

then its changed

dark edge
#

Does anybody here have any good resources on how to set up a game using sessions that is completely agnostic to the back end? Anyone here done cross-platform?

meager spade
#

like the same frame

brazen sluice
#

Well I should log BEFORE refreshing the UI see if that's still the case

#

Because it could just be the order of execution

meager spade
#

something happens on that frame

#

that breaks kit

#

it*

brazen sluice
#

Tick() {
refreshUI(); // already broken but not logged, will throw since UI is not there
log(isLocallyControlled) // only here log broken bool first time
}

#

You see what I mean?

#

But could also be a symptom so let me just put the log at the begning of the log to see which one it is

meager spade
#

i mean look here

#

the first 2 lines are the previous frame

brazen sluice
#

yes

meager spade
#

then next frame, the server is correct

#

now

#

these errors appear

#

and look at the last line

#

this is client on the server

brazen sluice
#

Yes

meager spade
#

it returns true for IsLocallyControlled

brazen sluice
#

Yes

meager spade
#

that is the same frame all these errors happen

#

you tried to access UI on the server so maybe that can give you a clue where to start looking?

potent cradle
#

This is like a riveting murder story 🍿

brazen sluice
#

Yes I do that because isLocallyControlled returns true,
What I meant is isLocallyControlled breaks the UI not the other way around, I just happen to refresh the UI before doing the logging so it appears in that order in the log, but if I invert the two, then the log looks different :

meager spade
#

we need to catch that frame

#

something happens in it

signal lance
#

feels like I'm watching the the docking scene from interstellar 😆

brazen sluice
#

😭

meager spade
#

shoosh

#

intense debugging going on here

#

wait

#

hmm

brazen sluice
#

The worst part is that the solution is probably going to be SO anti-climatic

#

like "yeah man you just forgot to untick the "break my game" button in the config"

potent cradle
#

At least I'll get to feel better that today it wasn't me 😛

#

Consider it a community service...

brazen sluice
#

Can calling GetPawn on the server do that

#

(if that looks like desperate shots in the dark, it's because those are desperate shots in the dark)

meager spade
#

no

dark edge
#

@brazen sluice is this still the mysterious case of the unpossessed pawn?

brazen sluice
#

yep

#

:

#

THis novel is getting famous

meager spade
#

your roles look suspect to me

dark edge
#

Just making sure you've tried breakpoint on OnPossess right? Is it being possessed by something or just unpossessed?

brazen sluice
meager spade
#

i mean

#

these are roles in our listen server game

#

for server and 1 client

brazen sluice
#

I was gonna say where the fuck is HeroCharacter coming from xD

#

Well you also have Role is 3 for both pawn on server

#

So it's the same here

meager spade
#

which is why i wanted you to print that log

#

and not skip anything

rain ledge
#

hi, i have a problem with listenserver, that if he not looking to the player the dmg dont count, so i try to check alwayrelevant and try to overrider IsNetRelevantFor so it give always true back for my maincharacterbase oder enemybase but it doesnt help, my problem look like this (https://www.youtube.com/watch?v=zKZUvO6iR0U) and my override try is to see in the image, is it possible to give the listen server player a 360° view or somthing like this ?

meager spade
#

can you do that and pastebin

peak star
#

@vestal tulip Unreal is built around the idea that the Server's world and the statebof things in it are the source of truth for everyone else, on things that are replicated.

meager spade
#

i want client and server printing that log

brazen sluice
#

AH

#

Hmm im not sure if I can do that let me try

meager spade
#

why?

brazen sluice
#

Cuz PIE on two instances is broken sometime

#

crashes

meager spade
#

mine does not crash with 2 instances..

peak star
#

@vestal tulip there is a way to make things client-authoritative instead but it is not mecessarily any easier to design and program it.

brazen sluice
#

Yeah i just have non thread safe code going on and something is not meant to be run twice but that's what Unreal does when launching 2 instances

#

I guess

meager spade
#

@rain ledge the issue you have is your ASC lives on the player

#

it should be on the playerstate as that is always relevant.

#

or make your character always relevant.

peak star
#

@vestal tulip so if you want to do an instant hit line trace then you can choose whether to have the client do the trace and tell the server the enemy was hit, or you can have the client tell the server to do the trace.

#

You will get a different result during laggy conditions with each. The second way is more responsive to the player but allows cheating.

meager spade
#

or i completely missed the issue 😄

vestal tulip
#

@peak star thats what I thought, but cheating is not something Im concerned for this project.

#

so Id rather go for the most optimal sollution, to minimise data transfers

meager spade
#

@vestal tulip just have the client send the hit data to the server and let the server process it

#

Fortnite does it for 100 players every bullet is a RPC.

#

client gets responsiveness and it works

dark edge
#

Premature optimization is the root of all evils

vestal tulip
#

@meager spade What about having the game be online between PC and Mobile, would this be too much for a mobile phone to be the host in this case ?

dark edge
#

If you were concerned about performance above all else, you would have a hand built engine using ECS, not this object-oriented spaghetti s*** show

#

And your development time will be about 10x

meager spade
#

@vestal tulip Fortnite do that 😄

#

you send a reduced packet size

#

the smaller the data you need to send the better

vestal tulip
#

@meager spade Does fortnite have local multiplayer on mobile ?

meager spade
#

either way you need a rpc at some point.

brazen sluice
meager spade
#

local multiplayer?

brazen sluice
#

Line 3728

rain ledge
# meager spade or make your character always relevant.

that was what i try to do, i checket the AlwaysRelevant to true for the character and enemies, but nothing change, at first i think its gas, but i found it crazy that it works if the listenserver look .. so i try to found a way that is it relevant even if the server dont look, but im a newby in multiplayerprogramming things

vestal tulip
#

What Im wondering in this case is not just minimising data transfers but data processing too

brazen sluice
#

I dont see the client logging tho is that normal

#

Might have forgotten a condition..

vestal tulip
#

because of the nature of my game having like 100+ projectiles at the same time + multiple players and traces ... etc

dark edge
#

@vestal tulip well, the minimal set of data about a shot is where the shot started, and in what direction it went. Or the minimal set of data about a hit is what got hit, and by what.

brazen sluice
#

double checking

#

Yeah im stupid my bad

kindred widget
#

@vestal tulip Compression generally means extra processing. What do you mean by "Local" multiplayer though? Same device, or Lan? Cause Local multiplayer on mobile sounds odd.

vestal tulip
#

@dark edge What about having a timeline running, which scale the projectile overtime

#

@kindred widget I intend to do both

#

@kindred widget Think like Terraria, you can play it on local multiplayer over wifi

dark edge
#

@vestal tulip If you really want to be a speed freak about it, have projectiles just be structs in an array and have a subsystem update the all at once. Firing a projectile is just adding/activating one in the array.

vestal tulip
#

@twin juniper Yep

kindred widget
#

Like, two people playing on one phone? O.o Cause that's what Local Multiplayer means in Unreal. Like two people playing split screen Halo on a console.

vestal tulip
#

@kindred widget no xD, That would be possible only on PC/Consoles, when it comes to single screen multiplayer, but its each player on a mobile device over wifi

brazen sluice
#

I was assuming this starts a server and a client is it wrong?

vestal tulip
#

@twin juniper Not possible for my case

kindred widget
#

Definitely. He just mentioned a mass of projectiles. I was trying to imagine what kind of game that was with two people on the same phone. 😄

vestal tulip
#

@kindred widget That would be pure chaos xD

#

@twin juniper I managed to do It on mobile, and its pretty smooth, but its only single player for now

#

I was wondering how I would aproach multiplayer

kindred widget
#

Projectiles aren't that nice for multiplayer in general most times.

vestal tulip
#

In my case, the game is not competitive so it dosent matter if the player can cheat

#

@twin juniper what do you mean by RPC im pretty new to replication

peak star
#

Remore procedure call. It is when you in blueprint call a Server event

#

Or when the server does a multicast or client specific call

#

@twin juniper I often use Repnotify to have data changes trigger actions though

vestal tulip
#

Im watching right now this playlist so I can understand whats ahead of me : https://www.youtube.com/watch?v=TEojA3VBXG8&list=PLemTaQ_N519DocM4AqiK08GfsUSnxRPdv

BRY

❗ DISCLAIMER: Re-uploaded due to the original video being somehow magically deleted (I didn't do it..) 😭

👋 Welcome to the Replication Series! This series covers how Unreal Engine handles Replication from the ground up starting with what replication is and how Unreal's Client-Server model works and then moves on into more advanced topics.

📹 ...

▶ Play video
peak star
#

I would use an RPC for spawning projectile though.

vestal tulip
#

@peak star so its on the server side then

#

then I assume i should use multicast to let the other clients know

#

@twin juniper thats what i need cause I have like a timeline that change the projectile velocity overtime

#

there are too much variables on the projectile movement alone that I need to replicate its movement everytime

kindred widget
#

If you don't care about cheating, you'll find it really easy to just let the client shooting do the logic for hit detection and only spawn a visual effect on other clients. This will make it feel nice for the person shooting. Server can also do some checks when clients say they hit something to stave off a bit of cheating.

#

Projectile speed matters too. Faster projectiles should be converted to traces with a visual effect instead of spawned as actual projectiles. Slower ones can use a PMC somewhat okay.

#

Reason being is that faster projectiles can literally spawn, live, and die, by the time the server manages to replicate to a client. So no sounds or visuals get played.

vestal tulip
#

Yh, I can imagine that, but ill need to try it out myself to see the speed limit iguess

#

The only issure im facing right now is to figure out what to change about the overall game architecture to support multiplayer properly, like for example how i should isolate the various managers for either local or remote operations, like setting current animation or figure out if the actor got hit or not

#

I cannot start doing changes right away but I intend to do so eventually, the issue is the more features I add without knowing how I should make them to support multiplayer the harder it gets later on, and I cant Implement multiplayer right now to avoid over complicating things up early (the game is pretty complex already)

#

I guess ill have to work on a small project to figure things out

kindred widget
#

If the object is meant only for local use, it doesn't need to replicate. HUD is a great native example of that. It's meant to manage the player's UI stuff. It's completely non replicated. If at any point you think that the server will need to update an object, it needs to be replicated. Of course clients can do things locally on these replicated actors or objects all they want, but anything replicated will overwrite local settings.

#

So as far as Managers go, I'd wager the majority of them should be replicated. Manager generally is something that controls the state of things. Server has the real state of things, so you'll want to make sure that clients fall in line.

#

UI is a rare exception to that. Since UI doesn't replicate and only displays the local state of everything. So it's manager doesn't need to be replicated.

vestal tulip
#

I'll watch some tutorials to get more in depth, I hope I'm just over reacting over the changes I think I'll have to do, thanks the help !

brazen sluice
#

omg I THINK I HAVE DONE IT

#

FINALLY

meager spade
#

what was it

brazen sluice
#

i DONT KNOW

meager spade
#

:/

brazen sluice
#

OK not fair I kinda have an idea

#

But in a nutshell

#

nothing we could have found with a stacktrace

#

I was basically calling player->GetComponents<UCameraComponent>(CameraComps); on the client and server

#

but on a thread

#

and for some reason

#

that produces black magic

#

removed it (wanted to move it to main thread but on the main thread it always return empty even on local pawns...)

#

And now it's not breaking anymore

#

the vooodoo is gone

meager spade
#

well

#

accessing gameobjects from another thread, you could have blocked something crucial

#

what that is i do not know

brazen sluice
#

Exactly

#

Hence my answer

meager spade
#

but it could be enough to confuse the entire system

brazen sluice
#

I do not know what it was

#

just knew I fucked that part up

#

I know I shouldnt access UObject on thread but I have so much code I sometime forget some function is not executed on main thread ^^'

#

Also that used to be server-only where it was not breaking, only when I called it on the client it did

#

Server was happy all along

#

That's why I did not realise right away

#

oh my.. and I thought I was done debugging this kind of hardcore issue after I closed the ticket about world gen

#

11h with a half an hour break, not bad

#

Im going to drink now

#

xD

brazen sluice
#

Btw was so exhausted forgot to thanks you @meager spade so thanks!! 😄

timid moss
#

doe anyone know what server console argument I can pass in to specify the map to startup on?

ivory lintel
#

Hey guys
How do I can create a session in a dedicated server before any client can connect???

distant wave
#

What is a simulated and an autonomous actor?

distant wave
#

I also read on the UDK docs that "When the actor's RemoteRole is set to ROLE_AutonomousProxy, it appears to be a Simulated Proxy for everyone but the owner of the actor."

#

so basically autonomous = unpredictable and simulated = predictable

#

right?

#

but then COND_SkipOwner isn't kinda the same as COND_SimulatedOnly?

#

because if a replicated variable is sent only to simulated actors, it should be sent to everyone except the player, right? because the player itself is autonomous

winged badger
#

autonomous = yours (from client perspective)

gloomy tiger
#

Hey guys. Question.

IsServer stopped "working" suddenly. I mean, probably I've done something but can't record what exactly.

#

Pretty much it is now returning false when previously it was returning true.

#

I'm running the game as ListenServer, and it displays the message Server: false when I Print the return of IsServer

#

Any clues?

chrome bay
#

When you say running it as listen server, how are you setting that?

#

Is this in or outside of editor?

twin juniper
#

I'd like to change clothes and morphs on my characters, that other players might not have(clothes can come in as DLCs). If I use a RepNotify or an RPC, would other players be able to see my clothes? If not, how can I share assets in multiplayer sessions?

winged badger
#

you need to package them

#

regardless of DLC

twin juniper
#

they are separate pak files

winged badger
#

that is a problem

#

since you are not going to be sending SkinnedMesh assets over the network

twin juniper
#

how'd you go about it?

winged badger
#

i'd update the original game with the assets and lock them programmatically

#

so they can't choose them, but can still see others that have the DLC using them

twin juniper
#

and delete it after the session?

chrome bay
#

you don't delete anything

winged badger
#

no

#

put the assets in original game's .pak

#

just prevent players from using them if they don't have the DLC

#

their game will still be able to display other players that have the DLC properly

twin juniper
#

gotcha

chrome bay
#

OT: I remember years ago when Xbox started introducing this sort of thing, players would complain that "it's already on the disk so what am I paying for" when buying skins etc 😄

twin juniper
#

Is there a way without sharing the dlc?

chrome bay
#

nope

#

Outside of downloading all of that DLC content everytime you join a session, which would be horrible to manage.

twin juniper
#

thx

chrome bay
#

In our game we have it setup so that the user requests cosmetic items, tells the server, server checks if they are allowed to use them, and if not sets them to default and replicates that - otherwise sets them to what they requested.

#

On Steam at least, you can check whether a player has given DLC keys via the entitlements interface

#

Some cheater might be able to hack it so that they use whatever they want locally, but remote users are never going to see it, so it's kind of pointless

twin juniper
#

makes sense

distant wave
# winged badger autonomous = yours (from client perspective)

remember when I asked how to replicate a variable that updates on tick without lagging the whole game and you said I should use rep notify? well, it was a good idea except that I can't rotate my player's head inside the On Rep, I do it in the animation blueprint based on that replicated variable so I can't really use rep notify in this case

winged badger
#

ofc you can

#

TryGetPawn->Cast->DesiredRotation

#

and animate towards it

#

or interpolate it in Character BP then pull the current rotation from Anim BP

distant wave
winged badger
#

anim BP always needs to have its own

#

so it can run animations off thread and remain thread safe

distant wave
#

and interplorates to it in the anim bp

#

my question was: if the variable in the player is rep notify: what should I do inside the On Rep function

#

it's pretty hard to explain, idk if u understand what I am saying

terse iris
#

Hey there! is there any way to debug further problems with Join Session/Find Session node?

It seems to be not working and the only log i'm getting is a warning that says:
Warning: Script Msg: FindSessions - Invalid player state

any ideas how can i further dive into it? I've also added logs to the game instance with the network/travel error and prints from the blueprint system but that also gives out nothing.

young thunder
#

Hey, I got a problem with replicating velocity and transform on dedicated server. It works fine for listen server, but the velocity / transform on the dedicated server always defaults to the servers default velocity / transform. It’s for a grenade throw with projectile movement btw. Any tips?

rain ledge
bronze summit
#

Hey, I want to keep all player characters on disconnect so when they reconnect I can just make the player reposes the initial character. Now when the player disconnects the character is destroyed. Is there a simple method to prevent this from happening or should I just create a copy of the class and its components?

winged badger
#

i just stash the data i need to recreate their character in the struct in their PlayerState

#

during APlayerState::OnDeactivated() override

#

then respawn the Character

#

even if you keep the Character, you'll need the PlayerState to recognize it during HandleStartingNewPlayer

#

to repossess it

#

(when a player disconnects the PlayerState goes into InactivePlayerStates array for 5 minutes by default, if he reconnects with same net ID, which in our case is SteamID, engine will recognize it and replace the PS PlayerController spawned during its PostInitializeComponents() with the one you had previously)

bronze summit
#

Ah so I should handle this from the PlayerState?

#

Because I had this in mind

#

Which adds a pointer to map on server to recognize based on uniqueid

winged badger
#

engine already has the mechanism

bronze summit
#

Thanks for the heads up, ill look into playerstates. UE4 has such a big infrastructure that i sometimes don't know where to implement it...

normal violet
#

hmm talking about PlayerState, I noticed it updates only once per second (which I get because of the ping which changes often). But I want my HUD to update my score instantly instead of having to wait for max 1 sec after i kill someone (it just feels wrong :P). Should I just repNotify my score then so it get's updated when it's called? Or is there a better way to show my current score on my HUD (actually just a widget ;)). Setting the PlayerState net update frequency to 100 solves the problem, but feels like a really wrong workaround for the problem 😉

bronze summit
#

Is your client damage predicted?

#

or in some way it has instant feedback on the score

normal violet
#

No, i'm just using the event anydamage on the pawn (Blueprints btw)

#

And handle the damage / health in there

#

Like this

bronze summit
#

This damage function is in the playerstate?

normal violet
#

No it's on the pawn

#

The score is in the playerstate as a custom variable

#

Which is getting set in the Update Score

#

Like this. (it's still a bit overcomplicated because of a mistake made earlier ;))

dark edge
#

You are checking if it is the server, then you are calling a run-on server event, which makes zero sense. What you should do, is when damage is implemented, check if it's the server. If it is, then do everything after the damage

normal violet
#

Ye I removed the whole rpc stuff

dark edge
#

So client side, whatever happens, damage is never applied. Server side, it checks, yep it's the server, then it does it's thing

normal violet
#

It;s like this now

dark edge
#

Then all you have to do is replicate the score variable

normal violet
#

It's always called on the server since it's only called from within event anydamage