#multiplayer
1 messages · Page 630 of 1
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)
Just try it. Non replicated actor, with child actor component, which spawns a replicated actor.
yeah that one obv works
I do have LOD set up, probably just incorrectly
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?
I am re-examining that during my work too
@limber mortar What does the material complexity view of your scene look like?
standalone cooked build
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
hi guys, i have question, whats best way to replicate changing skeletal mesh?
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 :/
I'm able to see the steam overlay before packaging when I right-click my .uproject file and use the "Launch Game" option
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
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.
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
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?
I would hazard a guess that you're getting current players on client side rather than on the server
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
I will look material complexity and get it posted 😄
Is it multiple unique steam id's in the session? I know with Oculus subsystem it's only going to ever think there's one player if you're not testing with multiple different user logins
The fire looks good
I'm using the Steam OnlineSubsystem, so each player have a different steam account (and id)
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
Server travel loads a new map and takes everyone with them, but sounds like you're trying to do something different
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
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
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.
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
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
Are these the only BP nodes available for session handling, or epic added more in the later releases
Describes the different kinds of Online and Error Related Blueprint Nodes.
Steam advanced sessions plugin opens more access through visual scripts
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
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?
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)
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.
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?
Oh no that should be fine
Is it fine to update netculldistance on the repgraph's class info, at runtime?
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?
you replicate desired rotatoion
and have every machine just do its own interp towardds it
oh, alright, I think that involves a multicast
oh yeah, that makes more sense
they aren't shooting lasers out their eyes =))))
What's the best way to grab the instance of a replicationdriver?
How can I keep the player state name through maps? Is there any other way to do it with replication? Thanks
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
Player name which I am setting on a textbox on my menu
So long as you're calling SetPlayerName you should be fine
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
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.
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
@chrome bay So should I activate seamless travel on my game mode?
Thanks for your help, will take a look at that
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)
should probably clarify, but its SetOwner in any case
and it really doens't matter if its a blueprint or not
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
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?
No there's only the server and the client
Also - think about the timing, you said ‘after a minute’, is there anything on a 60-sec delay?
Hmm let me do a global search for delay
Most likely in one of the classes i mentioned above
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
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
could that cause the issue to getPawn rather than getOwningPawn ?
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
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
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
Makes sense
Here's im just logging on tick
Imma try to disable features one by one til it stops happening
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
Ah really
Calling GetOwningPawn() from a widget btw is only ever going to return a local pawn.
I did suspect soemthing like this was hapening
tbh
Widgets are "owned" by whichever controller has them on screen.
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.
So X fails on network disconnects client?
But would client still receive updates from the server? Because here it does
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
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
Anywhere you “get player controller”, use the “get owning controller” instead
So at least I know where Im looking
That’d be a good place to look
Yes that's better than "looking accross 20 BPs" 😂
Usually with dedi server, its only the replicated ones that will thorn you.
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
Im not much help with ai, i use bp logic instead of blackboards.
Something about linear logic vs binary logic....
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
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.
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.
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 😄
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
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
You will need logic to handle obstacles, changes in paths
Sure true
Althought is that really managed by the nav mesh
I'm only going to rewrite Move To
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
Yeah that’s it my plan is, I have a grid of points, I run A* and move the pawn along the path
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
good luck 😄
Small price to pay 😄
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.
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
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
Gravity....... hmm check anim bp, calling a variable named “IsFalling?” (maybe something there)
Ah true true
@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
This is some interstellar shit
If unset this variable returns the device name (pc name). If set it should return what you set it to
How can I set it? I cant find any node to do that
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
@wind wedge Can't find a set string node by ref, could you share a screenshot?
type set in the search, should be at the bottom
Make sure you drag off the return value
oh yes, thanks, will try it
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.
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
Gotcha. Thanks. Because I need to replicate pointers to these data objects, and I think Actor is needed for that.
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
I tried it, but I still get my pc name, doesnt seem to get updated
SetString by ref doesn't make sense there
@chrome bay do you know how should I update the copy properties?
Cast New Player State to your custom one, then set the value of the Player Name property to match your current one.
for PlayerName this seems very wrong
i think Epic put in a function in GameMode to rename them
Yeah you really should just be using the built-in player name functionality for this.
And replicating FText is also not advisable
I actually collect their pc name as-is for my logs. Their “name” is a seperate variable for me
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().
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?
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)
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
you changed all of your casts to the owner casts?
@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
I didnt find a wrong cast, may be not looking for it the right way
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?
using a separate actor in game for that? no
your character can hold another USkeletalMesh*
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
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.
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’
@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
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
It should if you are replicating the character
For what you are doing you shouldn’t need to setbreplicates for each component
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)
The default 3pbp char, you can swap the meshes out at runtime and everyone sees the changes.
replicating the SkeletalMeshComponent is not advisable though
can create severe jitter combined with CMC
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
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 )
@brazen sluice check your killz if you havent set that
it is set
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
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
Are you on the ground up that high? Like a mountain?
how many event ticks are you using
@wind wedge i was reading what you were saying about "swapping a mesh at runtime and all clients update"
that is not true.
Well it works fine on my server
As in how many actors tick?
I mean as in how many eventtick functions are you calling
let me test your theory in a fresh project
OK Fun fact: retest with gravity off, actually still steals it... it just took longer tlast time and I thought it didnt do it
Like.. main characters, spawned actors, the main level, etc?
Sorry not sure I understand the q.
@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.
but he was not asking that though
he was saying "Pickup a armor piece and change it on the player"
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.
Possibly, if you do something simple like swap the material of the UE4 mesh, does that also have this issue?
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.
Well i for sure do not have the “component replicates” checked on the skeletal mesh
even if that was ticked, it would not change it
And that function is running on server and reliable
Server RPC only tells the server to change it
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
you still need to tell all clients, "look i have changed the mesh"
Yes if you only change it on the client the others wont see
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
Yes toi much traffic. Thats why i stay away from the chaos stuff on the chara
its component replicating its position and overwriting the CMC interpolation
where did you read that nonsense?
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.
@wind wedge i do not wish to argue, but if it works for you, great, and your lucky.
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.
you made false asumptions, and assume i know nothing about UE4 multiplayer.
But theres litterally a hundred ways to donthst
Listen server works differently
no it does not
You arent a real server
so what am i then?
Your a client, serving
so i am a server?
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
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.
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
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.
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]
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
@wind wedge again you are saying nonsense 😦
@brazen sluice what is the issue ? got lost in the above
@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...
You don't use tick anywhere? how does your player move? how does your game even function?
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)
@brazen sluice right... and what relevant information should we know?
don't forget we can not see your code or your game
@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.
Like a delay on the tick, but it still happens when I remove the ticking of my character and it's the only big one
Again, also wrong 😦
It says this in the docs
link me
Well I tried disabling most thing with no success, the server has a secondary TCP IP socket on another port for streaming level but disabling it doesnt change result, and I could also remove the issue by disabling gravity (Being far from the ground is what is preventing the issue )
At least it SEEMS to prevent it
Setting up networked games for multiplayer.
As in ground is too far to load
@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?
Yeah kinda except it's not really cause I can still do things
Like it's possessed by 2 people
could that happen?
It doesnt actually lose control from client perspective
UK - what happens when you repnotify that same evemt
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.
On a dedi server you dont need to do that
Explain one thing to me: How does client know to change the skeletal mesh?
You can also run as standalone with 2 clients and see what i am telling you
i did 
Because the server replicates that just ad it does the movement. If you change the mesh on the client its post rep
how does the server replicate it? Where?
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
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.
CAn confirm isLocallyControlled does return true on both client and server
As it should
No server only returns true after 10sec
when the bug starts happening
Before that it's false
it should be false on server, correct
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
@brazen sluice you know how to use Data break points in VS?
yeah
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
Ok so why then are they both true
cause he has a bug..
I get the same result
And i dontnhave that bug at the moment though i have from many reasons
No but when the game "work" server is false, it only switches to true after ~15sec
^
I mean if it was normal it would be true from the start I aassume
correct
but its not normal for it to be "true"
I mean that wouldnt make sense anyway, you need ONE THING to tell you whether or not smtg is remote
Server should return false for Locally Controlled unless that pawn is a listen server
For each, respectively, it shoudl be true to their own self for the char they control
Referencing the client owned pawn yes
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
If the server has your player controller- again check where you ate casting to this
@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() );
}```
Use get owning controller instead of get player controller
{
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
Yup thats one of the parts i was talking about ^^ see how the listen server is just a modified client?
@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.
The actual server is headless, and doesnt have to ask itself wether or not it has authority. We have to adk IT
But I'm never really casting the player controller, only once on show hide cursor and that one is fine it does not fail
@brazen sluice need to know why server is returning true
your controller is likely doing something weird
Yep let me take a look thanks
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
IsLocalController is virtual where can I find the implementation to put a breakpoint?
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.
to a hammer everything looks like a nail
Hm but I really cant find a broken cast, I've searched project-wise multiple times
Unless I'm missing an info
Theres really only those few blueprints, i listed at the begining (and sometimes others you reference to them) that cause this
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
@wind wedge please stop with bad information, i understand you are only trying to help, but its really a hinderance.
Two conversations Zio
Azu is having a control issue, UK was controlling me trying to help someone set their mesh
i was not controlling, i pointed out you gave bad information, just cause what you did worked in your game.
Actually if you had listened, what i gave him works in Steam, which dos NOT run as listen server
again, nonsense information.
even if you were correct, azukar started searching for Cast nodes because of what you typed
Best of luck Mr. 8yr.... i’ll probably have launched my 20th game by them
Zlo - he Should be checking that
Remote role is always ROLE_Authority before & After the bug occurs
Shouldnt be, right?
Depends whats causing the bug
@brazen sluice blueprints only, or c++ involved?
C++ involved
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
Where is this code Zlo? I can only find headers from the editor
is it listen serveR?
void AController::SetPawn(APawn* InPawn)
{
RemovePawnTickDependency(Pawn);
Pawn = InPawn;
Character = (Pawn ? Cast<ACharacter>(Pawn) : NULL);
AttachToPawn(Pawn);
AddPawnTickDependency(Pawn);
}
Yes I dont know how to access AController.cpp, as in where is it
Never had to do so before
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 ?
This code is really odd :
if (GetRemoteRole() != ROLE_AutonomousProxy && GetLocalRole() == ROLE_Authority)
{
// Local authority in control.
return true;
}
I logged each value, local and remote, and they do not change on the server/client
that means that controller is Server and has control
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?
that code makes sense
@night tartan it can
it can make a server rpc
okay I am getting a warning out about a lack of ownership
let me get the exact situation...
What I meant is, it seems the "true" value is coming from somewhere else
that is because you used BeginPlay or Tick to RPC
Althought it's nether client or standalone
but that also runs on all PlayerStates
trying to send info to the GameMode
if a variable on the PlayerState changes, I'd like for it to get sent to the GameMode
but if it changed via OnRep
only server can change it tho
server already has the information
so can just set it there without doing RPCs
@brazen sluice assuming you're testing with 2 Pawns
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?
Yes the server player pawn and the client one
no
you're expecting SetPawn breakpoint to hit twice on server, and once on client
I dont seem to find the file to set a breakpoint
only server can change a replicated property in order for it to replicate
you have flawed logic
I do, I know lol
can you show us?
@brazen sluice you have editor symbols for debugging?
it looks like he does not have the engine headers
engine source code from the launcher*
go to your laucher where you installed UE
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?
and from dropdown/options, select editor symbols and install them
yeah ok I dont have the source only the debugging symbols
make sense
let me install that
that is fine
@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
okay thanks
but you should (for now) limit yourself to calling that RPC from BeginPlay only if your GetOwner is valid
why should I limit to BeginPlay?
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
what about in situations of CopyProperties/OverrideWith
thats related to seamless travel mostly
right
if you're doing seamless
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
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
yes, yes you are 😛
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
RPC's (client/server) make a lot of sense in the controller tho
I have "control" stuff there, and yes, it has a ton of RPCs
Kaos and i are actually on the same team and there are plenty of RPCs in PlayerStates 😄
but I'm trying to have specifics more spread out
there is, does not mean i like it 😄
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
if you haven't already
there is a network compendium, top pinned message on the channel
OK I have instlalled it, but VS Still doesnt find it
yes, I have that open haha
@brazen sluice going to need to generate project files
@brazen sluice might need to restart VS
Done already ^^
and that
I read it and refer to it constantly, and remind myself of things I forget over and over haha
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
possibly
try symbol search (Ctrl + T)
instead of solution explorer
like in screenshot above
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?)
no, its VS
OK May be I downloaded VS retard edition
and i never changed that shortcut
Because I dont have it ^^
OK i found it in the explorer and openeed it, placed a breakpoint let see
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
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
@brazen sluice its not 30gb btw, its 30gb unpacked, but its way smaller than that for download
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
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?
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%)
bIsLocalPlayerController doesnt change either
But somehow the result of that function does 😄
What do you mean
that is a Controller functions
yes
you are more interested is your Pawn IsLocallyControlled
pawn asks the controller tho @winged badger
But that's the function that makes isLocallyControlled return true if I'm not mistaken
yeah, but the theory was that the Pawn is no longer possessed
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
for the same (supposedly) pawn
Without notifying the client it did that
I dont know if that sounds plausible or what
i have never experienced that
in 3+ years
this is 100 percent down to your game code somewhere
not even vorixo's little experiment came close to that level of breaking stuff
when a new controller is possessing a pawn the old owning controller gets automatically cleared and told to unpossess 🤔
yeah, but someone is missing engine symbols
unless... give me a sec
Almost there sorry for delay 😄
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
Rider taking its sweet time to open 🕐
Can anyone give me some advice I have a minimap and it works fine with single player but in multiplayer the map only moves with one character. https://youtu.be/0zZ2ypxs6NE
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
@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
^
any actor that can spawn/anything you can think off?
could see with the debugger where the calls are coming from
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
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.
But it is called when client disconnect
I mean if server assumed pawn was local it wouldnt bother doing that would it
start the game, and data breakpoint Role and RemoteRole in AActor
I need a watcher in the profiler right ?
If not then no I dont 😄
Ahhh just googled it ok got it
right click on the breakpoint and it should allow you to add a condition in both rider and VS
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());
I was using BP so I dont have to recompile on every change to the logging
My Character is BP
put that log above i said, and pastebin me the result
only the rest of the project is C++
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
Yep
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
it doesnt have GetNameSafe replced by GetName
Well I mean my callstack would have been my tick anyway
no?
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 😄
?
This is the result of the log
And bIsLocalPlayerController is true when i go down the stack
im setting a break on it
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());
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
ok
variables in GameMode don't need to be replicated because that's only a server entity, yeah?
Ah yeah?
open that pastebin
Is it the apparel stuff because if yes ima kill myself
and go to line 1426
okay
2 lines above the locally controlled is fine
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
Yes that's because I'm logging the line AFTER the refresh UI function
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.
So you see the first broken UI error before the first broken isLocallyblabla broken log
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?
like the same frame
Well I should log BEFORE refreshing the UI see if that's still the case
Because it could just be the order of execution
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
yes
then next frame, the server is correct
now
these errors appear
and look at the last line
this is client on the server
Yes
it returns true for IsLocallyControlled
Yes
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?
This is like a riveting murder story 🍿
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 :
feels like I'm watching the the docking scene from interstellar 😆
😭
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"
At least I'll get to feel better that today it wasn't me 😛
Consider it a community service...
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)
no
@brazen sluice is this still the mysterious case of the unpossessed pawn?
your roles look suspect to me
Just making sure you've tried breakpoint on OnPossess right? Is it being possessed by something or just unpossessed?
Oh yeah sorry the log with the remote one sec
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
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 ?
can you do that and pastebin
@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.
i want client and server printing that log
why?
mine does not crash with 2 instances..
@vestal tulip there is a way to make things client-authoritative instead but it is not mecessarily any easier to design and program it.
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
@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.
@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.
or i completely missed the issue 😄
@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
@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
Premature optimization is the root of all evils
@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 ?
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
@vestal tulip Fortnite do that 😄
you send a reduced packet size
the smaller the data you need to send the better
@meager spade Does fortnite have local multiplayer on mobile ?
either way you need a rpc at some point.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
local multiplayer?
Line 3728
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
What Im wondering in this case is not just minimising data transfers but data processing too
I dont see the client logging tho is that normal
Might have forgotten a condition..
because of the nature of my game having like 100+ projectiles at the same time + multiple players and traces ... etc
@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.
@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.
@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
@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.
@twin juniper Yep
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.
@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
@twin juniper Not possible for my case
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. 😄
@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
Projectiles aren't that nice for multiplayer in general most times.
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
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
Im watching right now this playlist so I can understand whats ahead of me : https://www.youtube.com/watch?v=TEojA3VBXG8&list=PLemTaQ_N519DocM4AqiK08GfsUSnxRPdv
❗ 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.
📹 ...
I would use an RPC for spawning projectile though.
@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
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.
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
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.
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 !
what was it
i DONT KNOW
:/
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
well
accessing gameobjects from another thread, you could have blocked something crucial
what that is i do not know
but it could be enough to confuse the entire system
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
Btw was so exhausted forgot to thanks you @meager spade so thanks!! 😄
doe anyone know what server console argument I can pass in to specify the map to startup on?
Hey guys
How do I can create a session in a dedicated server before any client can connect???
What is a simulated and an autonomous actor?
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
autonomous = yours (from client perspective)
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?
When you say running it as listen server, how are you setting that?
Is this in or outside of editor?
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?
they are separate pak files
that is a problem
since you are not going to be sending SkinnedMesh assets over the network
how'd you go about it?
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
and delete it after the session?
you don't delete anything
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
gotcha
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 😄
Is there a way without sharing the dlc?
nope
Outside of downloading all of that DLC content everytime you join a session, which would be horrible to manage.
thx
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
makes sense
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
ofc you can
TryGetPawn->Cast->DesiredRotation
and animate towards it
or interpolate it in Character BP then pull the current rotation from Anim BP
Wait, so I need 2 variables?
anim BP always needs to have its own
so it can run animations off thread and remain thread safe
yes, I know, so I have a replicated variable in the player which represents the control rotation yaw and another variable in the anim bp which is set to the one in the player
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
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.
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?
i solved my problem from yesterday, so the bone position dont refresh on tick, so a klick on mesh and switch from always tick pose to &refresh bones solved it for me
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?
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)
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
engine already has the mechanism
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...
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 😉
Is your client damage predicted?
or in some way it has instant feedback on the score
No, i'm just using the event anydamage on the pawn (Blueprints btw)
And handle the damage / health in there
Like this
This damage function is in the playerstate?
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 ;))
That's sort of all screwed up.
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
Ye I removed the whole rpc stuff
So client side, whatever happens, damage is never applied. Server side, it checks, yep it's the server, then it does it's thing
It;s like this now
Then all you have to do is replicate the score variable
It's always called on the server since it's only called from within event anydamage