#multiplayer
1 messages Β· Page 418 of 1
they are only replicated when they are changed, and an owner is present
how are you changing owner?
via possessing
yeah more specifically
my PlayerController calls Possess with the specific pawn as argument
I don't know if 'owner' is the right term here, btw, but since the condition is called 'COND_OwnerOnly'
I was referring as the player connection as the 'owner' π
yo how would you update the server character mesh to clients if I set it on begin play of the character to clients that login after ?
@distant pier could you just re set those properties after its possessed
It's an array of stuff, so I would rather not
but I think unreal checks properties for replication by seeing if the value changed, so that probably also would not work?
unless I actually change the value
you could change the condition once the owner picks it up
using DOREPLIFETIME_ACTIVE_OVERRIDE
okay, this is killing me. Can anyone tell me simply where the best entry point is to handle the moment a client pawn becomes LocallyControlled?
I'm in C++, I've got PossessedBy overridden but it doesn't seem to ever get run on client
hmm, good tip
just dug through the code and found this:
GetPawn()->Controller = this;
GetPawn()->PawnClientRestart();
if (Role < ROLE_Authority)
{
ChangeState( NAME_Playing );
meaning PawnClientRestart actually should get called around the same time
should work π
which... just calls Restart()
side note,
huh
any idea if this would actually tell me if the owner of an actor is locally controlled?
not sure how you'd do it in c++
also - here's the note I found : https://api.unrealengine.com/INT/API/Runtime/Engine/GameFramework/APlayerController/BeginPlayingState/index.html
Pawn has been possessed, so changing state to NAME_Playing.
instigator should be a pawn, so I think so
but only if you're actually setting instigator
i don't think it gets set automatically when you set owner
if your owner is the pawn though you could just cast it
this function runs the controller vibration
don't wanna cast at the fire rate of the weapon
might as well just run the event on local RPC instead of running this check
i cant really test this though, the problem is i don't want other players to feel the vibration
if I grab an item and set owner on it, then run a local RPC
will it know which client to run it on?
@open cape Sorry, I am trying to implement the PreReplication function, but I have to set the condition to COND_Custom. Can I use DOREPLIFETIME_ACTIVE_OVERRIDE in combination with OwnerOnly condition?
thanks
@unique thunder what do you mean by local Remote Procedure Call
also I could be wrong but i don't think casting on tick is much of an issue. if you're really concerned about it you cast it on SetOwner and save it out somewhere
(or just use instigator)
actually I'm curious about casting on tick as I do it all the time... I wonder if its the cause of some cpu performance issues
yeah casting is expensive, on tick would be a really bad idea
only place I cast on tick is in the AnimBP
and only cause I have to
should only be casting in one-off events, things that aren't constantly triggered. If they are, cast to the player actor, set a local variable and then re-use it.
hmm
do you think that applies to c++ as well? I've been thinking of it as a cheap operation because I heard somewhere that C casts are basically free... but I guess Cast<T> isn't actually a C style cast
@distant pier the custom condition should let you write your own closure. so you could just check if itβs possessed, and if so, check if the controller is the owner, then return true
oh, @unique thunder yes if you set an owner pawn/controller that is properly initialized and call a client RPC on the thing it'll run on whoever's machine owns Owner
however that might be unnecessary network load if you're doing it a lot
not a lot, but its important when it happens
whenever a player picks up a weapon, the owner is set
and when they fire the weapon, the rumble event triggers locally
to vibrate only their controller
@open cape Does PreReplication provide a way to see which controller is considered for replication? Right now I am checking !IsLocallyControlled(), but I think that this will still replicate to every client in the game
why donβt you check the owner?
@unique thunder according to https://docs.unrealengine.com/en-us/Gameplay/Networking/Actors/RPCs Client RPC's run on a client will run on the invoking client, meaning you'll still have to check your owner because it'll spam everybody. You could call the RPC server-side to get it to run on only the owner, but you'll get a lag which may or may not be acceptable
sorry, I think I am confused.
DOREPLIFETIME_ACTIVE_OVERRIDE takes in a boolean that indicates replication, but whatever check provides the 'true', the property will still be replicated to ALL clients, since the COND_OwnerOnly is no longer used, right?
@high heart how do I still check the owner inside a client RPC?
if you call it on a non-owning client it'll be run the same way it would on the owning client. you'd just have to call it from the server
all i's saying is you couldn't exploit it client-side to get around checking that the owner is local
@distant pier because that value can change on runtime, so youβd just have your ownership logic in there. but, iβm reading now that this isnβt supposed to be used on a connection by connection basis (should apply to everyone). worth trying but maybe this isnβt the case itβs designed for
right, that was what I suspected
either way, I have currently fixed my problem by sending an RPC with the updated properties to the client when the owner changes
I want to try and see if I can maybe force a replication on controlle change via my replication graph later but that will take more time
thanks for your help
Hello I have an issue with seamless travel. So I create a session with a dedicated server , players join the server and are directed to a lobby , game starts (the players travel to the map using seamless travel) , and they successfully join the map. The issue is that when I'm calling Get Player Controller on a client in the new PC blueprint , the function returns the old PC , not the new one. How do I solve this by calling the new one?
The lobby map has a "LobbyPC" and when I do seamless travel the player opens a map that has "GameplayPC" . Both maps have distinct gamemodes aswell
but if i use GetPlayerController inside a widget blueprint for instance , will it reffer to the new PC ?
Hello ! I'm searching a way to debug my ue network in real time. We have already tried the network profiller which is a bit helpful.
I've found a class nammed : "AServerStatReplicator". I've spawn it from a manager and display in and out rate in the tick but it displays only 0.0
Is that normal ? Can I use this class for that ?
Thanks in advance π
Can anyone help me with a Destroy Actor issue I'm having? When I run the code for a client (using a Server RPC with a reference to the pawn passed through), pretty often, both the pawn AND theserver's pawn get deleted..... any tips on this issue? Cause sometimes I do want the server to delete themselves right, so I don't want to prevent it 100% of the time
@proper olive RPC is getting called on the server too, just check HasAuthority()
I tried that, didn't stop it
I'm running an RPC on client to get controlled pawn, then sending that pawn to a server RPC to destroy it and various attached actors... (I tried putting switch has authority -> true at the start of the RPCs, tried them one at a time and together, did manage to prevent it from happening all-together, but not making it only happen correctly)
when the server pawn gets destroyed tho, the attached actors and other stuff don't get deleted
just the pawn itself
hmmm I do have a bunch of Fail outputs wired up tho for the Casts, let me just clean it up
@proper olive ahh. Right, well with Pawn it gets trickier. Because the Pawn is partially owned by the client.
But you'll want to make sure you delete all the attached stuff first, otherwise when you delete the Pawn you're probably losing your reference to everything
does anyone know if theres a way to change owners of an actor on the server from a different player controller? for instance if theres a persistent actor that a player spawns, then that player disconnects, i want him to be able to come back later and pick it up
my assumption is no, and that ill have to respawn this object since i wont be able to call any rpc's
You can call SetOwner() on the server at anytime
And the once updated the Owner will be able to call RPC's
Well in your scenario above, the GameMode, which only the Server holds has OnPlayerLogout() - which you can extend, and reference who that player is in there, then the GameMode also has PostLogin() function, which you can also use to do SetOwner() when they join agian
not on the client only
the problem is that the server is also playing the game and their character gets deleted too
The you probably do a GetPlayerPawn/Character or GetPlayerController somewhere
Which would refer to the Server if called on it
so can you just quickly explain what I have to do to filter out the server's pawn when I'm just trying to get the client's pawn through the server RPC?
I mean usually it works, and it's working for the destroy attached actors which is on the same code
it's not deleting the server pawn's attached actors
altho I did manage to make this stop happening when I log in as clients, which was the original bug
I'm still using the destroy as a playtest for my kill function and just wanna make it work π
here:
client is destroyed correctly
but server's pawn is destroyed, but his attached actors aren't
client's attached actors do get destroyed
there's a lot of code involved which is why I'm looking for good tips like these you guys have provided instead of analyzing everything
there's often common dilemmas buried under the complex stuff
bc I am analyzing everything myself π
but if anyone wants to see screens of my BPs feel free to PM I don't wanna clutter up too much
@calm hound so yea itd have to come from GameMode in that case. but another case might be that another player would be able to pick this actor up
thered be some validation to whether or not a player can interact with this actor, but ideally any player could meet that criteria
yea
@thin stratus you mean like this GetController node? It's not destroying the server's "hand models" tho
so you mean like if it didn't have a blue wire plugged in
or just used the pure "get player controller" to self
oh the get index one? I never use that
@open cape so i can call from the actor the owner right ?
cause im spawning a knife right
and inside the blueprint i wanna reference the owner
spawning it on the server?
wich is the pawn
spawning on the server or client
oooooh does this return the actor as well as the attached actors? since it's returning actors attached to the component??
@zinc zealot you might need to also SetOwner on the client if you're spawning on the server. i usually have to do that
thx @open cape π rly helped me!
@open cape - What you want to do, is create the functionality inside the Player Controller. That way you can call an RPC from the client to the server inside that when you need manual control, which would (on the server version) do all that you need to set ownership of the Pawn. From there, you would use GameMode and the PostLogin/Logout stuff to grab the PlayerController, cast to your player controller, and call the same functions
@proper olive I would imagine so. Best way to test is to use Print String and list off all the actors it returns
What is a good way to attach a character to a moving actor and replicate its movement smoothly? I have a cart that a player can jump into. The cart's movement is replicated and it's moved along a spline on the server within tick. When the player jumps inside of it, I attach the player's character to the cart and disable the CMC via DisableMovement. When I do this and use p.netshowcorrections 1, I get a constant stream of corrections.
@calm hound right, but im saying to have another, random player take ownership of the actor (which wouldnt use PostLogin etc at all, since state wouldnt help you in this case)
@jolly siren - If AttachTo() isn't doing enough, you'll probably want to use AttachTo() while setting the initial relative location of the Pawn and replicate it across all players, and then just use simulate the movement on the client with the server throwing some updates down if the player can run around freely?
@open cape - That's why you put the code inside Player Controller. Player Controller will always be present. Then all you have to do is call the function inside the controller, whenever this Random Player would take over
but random player's Player Controller could set ownership on the actor? even though it cant fire rpcs?
Player Controller can always call RPC. It's always owned by the player
you can't call it from the Pawn until you own it, but you always own the Player Controller.
@calm hound I would like to have the player be able to move freely within the cart. But currently, to simplify, I am disabling the character's movement and attaching. But it isn't very smooth and the corrections are rendered non-stop for some reason.
yeah but call it on a separate actor?
@jolly siren Player Movement has built in simulation on the client, so it only needs updates now and then. Disabling that is disabling your prediction code. So that's why you're now getting flooded with replication updates and corrections. You need some sort of simulation to avoid it
@open cape - Like what? And why? I don't know what you're doing, but whether you're trying to interact with an object by looking at it and pressing E, or you're using UMG/UI to "spawn character", you always can get a reference of your own Player Controller. So all you have to do is get a reference to the actor you want, IE: The pawn, and send the request to the server using your PlayerController
yeah, basically having any player be able to walk up and pick it up
so you could sent the request to the server using PlayerController, then let playercontroller set the owner of the actor?
Once you send the request
the server has full access to everything to decide, you can then set each actor up to return a yes/no on the server side
but you have to do it on the server side, only way to send info to the server is through an RPC, only way to send an RPC is to have ownership, only way to make sure you have ownership is the PlayerController
oh thats great. i thought only the owner's player controller could call functions on the actor, even if the random player controller was on the server
gotcha
so as long as its not an rpc, everyone can call anything on the server actor
(as long as theyre also on the server)
The Server is master
so the server has the master version of ALL Player Controllers in it
That's the version that matters
the Client, has 1 Player Controller. Their own. Which they can do whatever they want to it, but in the end the Server's version is the one that dedicates the game
dictates*
right, i was just confused as to what the server's version had control over
if it was restricted at all
Nope, everything.
The client's version is literally just a fake version
There's a lot you can do with this fake client version, IF the server doesn't need to know about it. Like for example, UI stuff
yeah i knew that, i just figured that certain controllers didnt have control over random actors no matter what, even if theyre on the server
so thanks, good to know
no problem!
how would I make an actor where I can place multiple of them to use as spawn points
APlayerStart ?
well yeah but can you respawn on one?
Of course
oh
wait so
when I spawn the actor how would I do that with spawn transform
to get the player start
For respawning, you get a playerstart actor reference by using ChoosePlayerStart() or something custom, then spawn your new pawn, set the transform of it to be the transform of the selected player start, then possess it.
I looked up how to override the playerstart thing but I dont see it
where to get the choose playerstart
Declare and define virtual ChoosePlayerStart_Implementation() in your game mode
There you can pick out a custom actor to spawn on
oh I have to use c++
Yes
You can use the super class call of it to determine a default player start if your custom code doesn't decide on any player start
I have no idea what that is
Do you understand how virtual functions work?
Right click -> Add Call to Parent Function is the equivalent of Super::MyMethod()
where do I right click
also no I dont really know how virtual functions work
I am kinda new to this
I thought spawns would be simpler than I thought since there arent many tutorials
Right click on the function node
It is simple, I was just asking if you knew what you were doing
Calling that will return the default implementation for picking a player start
oh
So you can use that as a safety net
If you don't find a player start, then you can use that as a backup to ensure you find one
For picking a player start yes, you don't even need the parent function.
For a whole respawning system you obviously need more
I have a respawning thing kinda set up but I was using the playerstart as the location
if that makes sense
so how would I get the playerstart location now
like to put into the transform thing for spawnactor
@bleak lily Get the transform of the actor returned by ChoosePlayerStart
why do clients play the sound notfiy from the animations twice?
i dont know how i could debug that, its just a sound notify. how can i control it besides the settings for the notify itself=
?
if i play the game with 1 server and 3 clients on a local machine the clients have double sounds
How are you playing the animation on the clients? Is it played locally, played on the server, and then multicasted to other clients?
There are plenty of things going on besides "just a sound notify"
Are you using anim montages?
its a normal running animation and the sounds are the footsteps
so i guess its the movement component handling that, and that is replicating by default right?
however, if i just have the server and 1 client, there is no double sound
How would I make movement fully client side but make client send the updated location to Server. Im basically trying to make so Client receives no lag
on what kind of actor
Pawn
Ive done this
I dont want Servers to simulate physics
I want only the client to and then send its new location to the Server for other clients to see
But it seems a bit glitchy ?
is there anything indicating when the pawn has stopped moving
Yea!
Actually I think I just found my issue
Yeah π€¦ Multicasting is doing it
Because Im ticking to server of my own transform and then doing it on Multicast which is just giving it back to all clients incl me and its interfering
replicating something as large as FTransform on Tick to server, and then Multicasting it is a terrible idea
also, in this case you might to implement the smoothing yourself
could use something like AddImpulse
reliable RPC to Server also doesn't help any, in this case
@winged badger Yeah but what I am doing is only a small mini game that just replicates other peoples movement so everyone can see eachother.
you can ignore the owner when you multicast too, if you wanna go that route
But yeah it is a bad idea
CMC does networked movement simulation out of the box
nevermind
I think I got it
@winged badger @open cape Thankyou guys for the answers π
Solved many of my problems so far.
Keep up the good work π
hello I have an issue with players connecting to a server that has already servertraveled to a map. If a server executes the command servertravel and seamlessly travels to a map , how can I make a client join the server and be brought to that map as it should in nonseamless travel?
@winged badger @open cape Though not doing a tick and just doing linear velocity physics which is much better for stability, it has an easy chance of having the ball desync and the client will be in another location to where the server sees them.
As seen here
if you're going that route you need to constantly be updating the velocity to the new position
interpolate between your old velocity and the new one coming in
Waht do you mean by that ?
So not use a tick ?
Everytime I launch I set my location again or something?
oh this is on sending, not receiving
i was saying, you could generate velocity based on previous positions
yeah so instead of that, you could send position, then generate velocity from the last 2 positions when you get a new one
and keep moving in that direction until you get an update
thats pretty basic prediction modeling
Sounds a bit confusing π€
could improve it a lot
I dont know how to do that as that sounds a bit complicated?
client A -> send position
client B -> receive position, get velocity from subtracting position from last seen position
client B will then move with this velocity on every tick, until client B receives a new position, and update the velocity again
Ah so I found out what caused the desync
When running into other physic simulated objects, pushing them and then you moving away is where it all starts.
But if none ever make contact, all is fine and in sync.
Having a desync with Lag Compensation for variables..... When i'm in a laggy test environment - and i am running AnimStateMachine based on replicated variables from the character class - my local client is actually running animations 2x over due to server RPC's being behind.
I need my client responsiveness to have priority - because i'm favoring the client - and pre-calculating based on client input which should almost always be right (unless of course hacking - which is why the server RPC is there in the first place...)
How can i pull this off so i can have the responsiveness favoring the client and not have a 2nd animation run again?
Animation instances shouldn't need any replication, all the information you should need is already replicated in ACharacter and UCharacterMovementComponent
Animation is a representation of the current state, nothing more
so lets pretend that i got the whole animation incstance replication thing down - it aint the first time :)
Variables are replicated in the character class (as clearly stated above) and are retrieved in the animbp to set local variables to the animbp.... this is the way animation replication is handled.
my problem (again) is with the lagged otu RPC event of the server RPC's to run the code needed to replicate to networked clients - not to self.
Same diff, anything affecting the movement needs to be built into the prediction
i've tried SKIP SELF on the replicated variables - no difference
You're not sending or replicating input are you
That's a big no no and so many (wrong) YouTube tutorials do it
It's already replicated and built into the prediction
Under GetCurrentAcceleration
forget character movmemtn componnent for this plz
as were not talking about character movement
these are custom animations in an animation state machine
not based on movemnt.
IE: Aiming, or custom AnimMontages
so
InputAction::Aim() is fired
RepNotify?
i mean, are you using it right now
its currently at REplicated - becasue that works. but yes i've tried RepNotify
because it has that funny thing where you can set the variable on client locally and then watch it trigger its own OnRep function
blueprints only
either way i've tried RepNotify
in code or BP?
the problem is the server is running code on an RPC that is delayed due to the simulated lag
BP
there is a big difference between the two
It's running on the owning client that's already run it locally?
yes vaei
exactly
i need to stop this - and i've tried bool locking i tout
with IsLocallyControlled
Eh you've done something strange then
the only times i've seen that is
1 - animation runs locally, also fires a server RPC that runs a multicast without a filter
2 - BP RepNotify
(one state replicated implies a change in another state, which is also replicated with Notify, causing the OnRep to fire twice)
the c++ ReplicatedUsing will not trigger OnRep on the machine setting the variable locally tho
ReplciatedUsing wont fire unless you tell it to run - its not automatic like BP's is simulated....
server doesnt partake in replication.
this is UE4 documentation quote lol
so when you set a variable as server - you have to manually call OnRep funct (in c++)
which is a good thing
i agree
that is what the Setter functions are for
its just ass backwards to BP's
as BP's are automatic
anyhow
thats here nor there....
π¦
you can try a local backup of all replicated variables driving the anim states
saving the value in a backup at the end of OnRep
and not letting it run at all if the current value == backup value
i dont know how thats possible in BP's
trust me if i could
i'd have this project have been C++ from the beginning
unfortunatly - thi sisnt my baby... . i'm just working on it now
all OnReps have this
if (CurrentValue == BackupValue) { return; }
and on the very end BackupValue = CurrentValue;
you can gimmick the Multicasts to do something similar
you don't need return value, just Return node
What would you return?
get out of the function
without executing its code
well, its BP or just run it if Backup is different
and do nothing if its not, sorry, i tend to think c++
yah i'm not following you
and that was so coherent its obvious i need sleep
are you thinking of RPC in C++ - _Validate() ?
no, im thinking unless your BackupValue is DIfferent from CurrentValue
you do not execute the rest of OnRep
or Multicast
i'm not doing anythign in OnRep at all....
downside is having the backups, ofc
not for this function
and backups - is this a 2nd version of the same variable (local only? )
is that whaa tyour referring to as backups?
yes
ok i can understand that
i use that approach when OnRep code is heavy, like say creating an ActorComponent
i'd rather have an extra variable then run the code when there is no point to run it
i'm off, gn and gl
thnaks man - its stressfull doing client prediction β€
appreciate the feedbkac & help!
Oh
@worthy wasp you are doing client prediction stuff? I think I might have been solving same issue as you did MAYBE
It sounds remotely like it
What's the issue?\
I was doing clientside extrapolation for switches, buttons and other animated controls in our game
this kid that programmed this funct.....
was setting a bolean to false after setting it to true
And I had to figure out how to make replication system play along with the fact that I have to selectively accept or deny some updates from server while extrapolation is happening
i took that out - and put the false part of it on the RELEASED portion of the input
and it seems to behave appropriately now....
i have the same setting on ALL MY OTHER INPUTS
and they all behave the same
in a LAGGED environment....
the damn shit is run 2x
because of hte server desync
Yeah
but taking this out.... and putting it on the RELEASED portion toggle of the input....
seems to fix this
i retract all above statements.... lol
still problem π¦
I'm running a client RPC in 2 different ways but only one works for some reason.
- On BeginPlay > Delay > Client RPC
- On AnyDamage > Client RPC
Only the first works. Any idea why?
that it is - but the TARGET of AnyDamage - is a delegate..... there is no owner - so an RPC wont be able to be ran from it - right?
in order for an RPC to run - proper ownership of the object needs to be established.... the object needs to be owned by the caller of the RPC in order to run it.
@unique thunder what do you need to do locally on event AnyDamage() ?
my bad guys - I fixed it π
well - what was it?
I had a couple objects that I had pick-up logic happen on client since they're client-auth but when I tried to drop them on death (via AnyDamage), the server wouldn't see the drops no matter how I called them. I had to server RPC > multicast these few special grip situations and multicast the drop as well.
so you were pickign up these objects as client?
and not replicating your ivnentory (it sounds like) ?
does anyone know if i can reset the server time?
Is the actor owned by client or server
@cloud ledge This actor is owned by the client & the projectile is owned by whatever client fired it
ah I see the issue
π
I guess if I own the projectile and you own your character and the projectile executes a local RPC, we both hear it?
Character is owned by server and so everyone hears it I think
Even though you own the projectile on client
@cloud ledge how do I trigger a sound effect only for a single player but from the projectile BP (with owner set to player who shot it)?
Not actually sure right now
multiplayer ownership gives me a headache tbh
sometimes it's hard to keep tract of who does what
well it's not that hard
Ownership is really just that: Who owns the Actors.
It's like you owning your PC, or the TV owning the Remote.
The owner is allowed to send RPCs to the Server.
The owner can receive RPCs from the Server (multicast obviously always works).
When spawning an Actor from the Server (replicated Actor), you can specify an owner.
You can also do this after spawning later to adjust the owner.
Typically ownership starts at the PlayerController, as this is the class that represents the physical player.
Ownership is always recursively checked, so if a Class is Owned by the PlayerController, you can use it to own another Actor. (e.g. use your Character to own your Weapon).
But you do good using the PC in most cases.
Not specifying an owner or placing an Actor upfront into the Level makes it basically owned by no-one or the server, however you want to see it.
hello I have an issue with players connecting to a server that has already servertraveled to a map. If a server executes the command servertravel and seamlessly travels to a map , how can I make a client join the server and be brought to that map as it should in nonseamless travel?
@thin stratus got it thank you!
@gusty spire Assuming you are using the Session system, this should be handled automatically for you
You parse the URL when you join the server, and use that to join the map. Check out the Multiplayer Shootout example from Epic which uses sessions.
is it a command I'm supposed to execute as a client when joining the session? In nonseamless travel all I need to do to be brought to the map and play is just join the session
Strange. Everyone should first travel to the transition map, then the server should tell everyone to travel to the play map
SeamlessTravel should also work without Sessions
- the map the Server is on should be parsed like TheJamsh said
Check your logs and see what the Browsing line shows
Hey folks, I've been having a hard time trying to figure out how to setup a simple two-way voice chat between an host and a client.
I changed the config files, trying both Null and Steam subsystems, with pushtotalk on and off. I tried connecting with normal sessions, advanced sessions, calling the advanced sessions node "Start Networked Voice", nothing worked.
I looked into the ShooterGame sample to figure out was I was doing wrong, but I couldn't.
Am I missing something obvious?
okay i need help to understand what i am doing wrong here and why i am getting this error, I've tried to search the internet to help me find the answer but nothing .. So im trying to save a info for players plus there steam ID. this info would then be added to the online players where through the lobby UI you could invite them to your lobby. the blueprints would use the advanced sessions plugin to get the users steam ID and then also see that player a invite via their steam ID . my problem is that on the server side of player saves it gets and error with not being able to read the loaded Net ID. as seen in the image.
hey guys
if i open a session
play with 2 players on a map
and change maps
do the changes in the first map like picking up weapons continue for example if i went back to that map ?
@zinc zealot Only if you make the actors that manage the inventory persistent
i dint mean inventory wise
i meant in the map
for example if you break something
or pick an item
when you re enter the map
is the thing still broken
or the item not on the floor anymore
It will reset the map, so any changes you did will not persist
thx ^^
hmm something weird is happening
im very new with networking anyone on to help ?
what's the matter ?
well im gonna try to show some code and explain
ntw thx @cobalt steeple
π
So this is whats happening
I host a session
players can connect
when i destroy session and open a different level
and try to host again
it fails to create a session
want me to show some code ?
Are you sure that destroying the session was successful
no
i might have been doing something very very stupid
i have to destroy session on the server xD
lol
but i dont think thats the only thing
well its kinda working
now i can open the session again
but now it fails joining xD π
maybe you have to destroy the precedent session you joined
just check the output of "IsServer"
so i have a bp that swaps foliage instances with actors, then the actor swaps itself with an instance again. i made a simple bp to count instances and actors in an area. server always says the same amount of instances, no actors. client instance count keeps rising, also no actors. is the server even aware of instances?
and i guess overall i dont need/want it to replicate, id rather it be client based as long as the client can be aware of the swapper blueprint in others. doesnt need to be perfect its just for environment, not gameplay critical
if you want some help (i probably wont be able to) you should show some BP's
Btw it still fails to join
i did this
it successfully destroys the session
the picture i sent was from the in game menu like when your playing
not the main menu
it finds a session
when i try to join
Fails to join session
@steady briar Can you show us how you're swapping the instances with the actors? It sounds like the issue is in there
well ive done it like a hundred ways i get the same result. the most recent version looks a bit weird but ill post what i got, its in 2 parts
Can I ask what you're swapping for? To get foliage interaction or something?
its a multisphere trace that gets the array
yep
i have a crap ton of garbage in the middle let me break up the actor part
Yea I don't think swapping would be the way to go for that, there's an interactive foliage actor somewhere that seemingly nobody knows how to use, I would imagine you use that.
basically store its into in variables, destroy it...
this versions cluttered because i keep chopping things to try to get it to work. because duplicate instances = more actors spawned next time
100 instances turns into 1000 actors fairly quickly
i figure it can only be destroyed once, so it cant make more instances than it destroyed (1) so i dunno
and as for interactive foliage actor, no idea... havent seen it o.O
i think the first thing you should do is organize your BP so its easier to read XD
i think really its a matter of the server and client seeing instances differently. i dont really want the server to know. i just need the client to know about the 1st bp in other people and do the swapping on the client
If you pooled the foliage actors it might be a reasonable approach
yes i know my bp is ugly i just woke up and ive been changing this bp for a while, its ugly
pooled?
the reason i wanted the swapper to spawn the actor and then never care about it is incase the swapper gets destroyed/player dies etc
Create the actors once and store them in a pool, then when you're ready to swap you get one of those preregistered actors from the pool, set it up for this specific instance, and render it
i used to add the instance in the swapper, but destroying swapper meant the instance never came back
this works fine in most cases, its really just on very small ones im testing how to break my bp
but im sure it means theres a flaw that will break on larger foliage eventually and build up to be a problem
im just curious how i can destroy 1 instance and replace 1 instance and have a different amount.
Concerning my issue mentioned above, I checked if the engine code was executed successfully.
Nothing seems out-of-the ordinary, I got this far:
The bot is blocking my screenshot
Well here's the stack trace, the bot thinks the code image is sexual
Vyktori
So everything seems fine, correctly initialized. But I can't hear the sound from the other computer
do you mean that you are destroying one instance and when you replace spawns like 2 or more ?
@steady briar
Same setup works well with the ShooterGame
its not always a consistent number, but it seems like when the actor spawns an instance, it spawns more than 1
its a difference between server and client
cause that happened to me hundreds of times
ya thats what im trying to figure out, in this channel not bp
Showing debug boxes. Check actor count in outliner.
but what i understand
this is it working on larger foliage tests
is when you spawn
depending on like who you are telling to spawn on server may be missing so you get null ptr or something
what im telling is its probably the way youre replicating
i know it is, thats why im here
i dont really want it replicated at all
i just need Client1 to know Client2 has the swapper attached to it, run all that stuff per client
im trying to make it so when i hit an instanced static mesh, it swaps it with the equal skeletal mesh to it has physics, then swaps it back for an instance
because my pc would burst into flames
skeletal meshes costs like a bajillion times more than an instance, especially in a dense area
where are you running the BP ?
the swapper itself is an actor spawned and attached to each character
the swapper spawns the skeletal actors, skeletal actor swaps itself back to an instance
did you set the swapper to be owner by the character ?
in that vid u can watch the actor count go up and down
yes, seems to have no effect
what bugs me a lot of the time is things i want replicated dont replicate, but things i dont want replicated... do <_<
i really dont need the server to know about hundreds of foliages being swapped, that seems bad
i wanted to be able to attach the foliage swapper to things that might not have a bp
like a rock static mesh, stick that swapper bp to it and bam, foliage smashing rock
i would only need to know that it is attached to the object
ye but
if the swapper isnt replicating
and is attached to a rock
it means it would only show to the server right ?
depends how u build it
if i attach the swapper to 2 characters, the server only needs to tell me that its attached to the characters
why ?
Client1 should be the one who knows about Client1 and Client2s foliage. Client2 should know about Client2 and Client1
because if someones half a mile away, i dont need the server telling me whats going on
yes, as it is currently.
but...
you don't care about what you can't see?
im pretty sure that makes it impossible to do it with out replicating to the server
cause
@winged badger i care about it, just not enough to kill a server
i mean, is the solution where you have foliage swapped only on screen acceptable?
or is that too large a radius?
its like... if Client1 has the swapper and it doesnt replicate, only client1 sees the swapping. ok... spawn a duplicate on Client2 so that Client1 sees both as if theyre his. Server need not know
i was hoping to have it not swap small foliage based on distance. i dont care about a tiny shrub at 200yds, but a small tree or bush prolly should.
if you put a foliage swapper as an actor in the level
having functionality in someone elses bp doesnt really work
you can teleport it around where you need it
what is it thats not working after all
and you can even reference if over network without it being replicated
the instance count is different between client and server, thats my #1 problem right now
if its just the characters the "physics foliage" needs to react to
each character can spawn one on BeginPlay
have it teleport after him in 0,5 sec interval
it executes everywhere so every machine would have a swapper for each character
well i made it a separate bp so that i could attach it to anything
i would just make it on the player and replicate XD
but its like.... ok imagine a particle. the server tells you where it is, but doesnt tell you where each particle goes
there is no need for networking here at all
well ya all i was saying is i need to know that they have the swapper. i dont need to know everything it swaps through the server
well im gonna proceed with my work good luck xD
thx π
are the conditions of something having a swapper entirely predictable?
not sure about entirely
how many swappers are we talking about 2? 10? 500?
characters probably yes, except maybe random people in a town i know they wont be running through the woods
i would say in the hundreds
which is why replicating what the swapper does is not only too difficult, its not what i want
the way to replicate it
is replicated swapper actor that doesn't replicate movement, does its work only locally and replicates only the reference to its attached owner
still far from ideal
best way if you can manage it, is to figure out which actor classes need the swapper
then have them spawn their own, and let the thing teleport after them and do its stuff
can i get some help next ? XD
well currently the character spawns it and attaches it to themselves. the swapper itself has just an invisible cube that i use as an origin for a multispheretrace
it can do the swapping only if its close enough for effects to be seen on camera
that is easy an filter to do
the frequency of the trace is based on the speed of the swapper, so it slows down when stationary, faster when moving fast
@winged badger well thats the goal i think. but for that to work it would have to be not replicating its function right?
also isnt that a hell of a lot for the server to replicate in general?
even if it was a replicated actor it would not need to replicate its function
Tick executes everywhere, in case its replicated - that would be fine
in case its not - also fine
so far i dont have anything on tick
well, you don't want it doing swapping every frame
no i have delays
but tick can accumulate DeltaTime until its time for a trace, then call a function to do it
i adjust the delay based on speed
when stationary it swaps every .4seconds (swap also tells skeletals to stay skeletal), when moving normal speed ~.2 seconds, fast moving caps at .125
(each machine that has it)
can someone help ? i think my problem's simple
still avoiding the Compendium?
yeah, if you read it right away, you'd know how to fix basic problems by now
ive read a bit
i get tripped up by that thing too <_<
mainly because i dont know whats already done in the background
this is the only thing that covers my problem
so basically the server is rejecting my connection ?
likely ?
cmon @winged badger π¦
rip
for connectivity issues, read your logs
this came out
LogOnline: Warning: OSS: Session (GameSession) already exists, can't join twice
LogBlueprintUserMessages: [MainGl_C_36] Failed to Join Session
anyone ?
ok its probably because im using the same pc
lol
what is this ?
LogNet: Warning: UIpNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_167
@zinc zealot I had the same warnings last night
I think it's because you unpossessed your character and some logic ran afterwards
It's generally fine, you just won't be able to run any logic that depends on a playercontroller being present.
The characterBP will continue to tick & run events
thx ``
btw @unique thunder but do you know why does it happen
cause im actually having problems because of that
@zinc zealot Are you running the 'Unpossess' node in your character at any time?
nop
@zinc zealot I see it says ThirdPersonCharacter_167, are there a lot of other character blueprints of that type in your level when you test?
These warnings (and the ones you mentioned earlier) are typically okay to ignore when you're testing locally on a single PC. At least from my experience, they're common but I don't fully understand them and I have no issues in real multiplayer scenarios.
Does anyone have an issue with walking up hills and a jitter?
@twin juniper It's a common issue and likely not multiplayer-related, do you have the same stutters walking up-hill testing solo local?
Sinn is just that i tought this might be related to one of the errors i was having
like
i have a pistol
the bullet is spawning from the character BP
but sometimes it doesnt get to the server well
something like that
depends on how you're replicating the firing action (also make sure that the bullet can't collide with the gun on spawn. change the collision logic in the spawn node to always spawn and ignore collisions - could also go as far as to disable collisions between the bullet and the gun completely).
ye i did that
you always have to spawn actors on server, it'll replicate this way - are you doing that already?
I'll show you how I'm firing my projectiles, but on a side note - one cool thing to know:
Saves you lots of space and both must be true to pass
thx π
how does it go to the others ?
you arent spawning a projectile
Event on Used > FireGun + Fire Gun Local (both of those get executed). That "FireBullet" event leads to a projectile spawn
The one set on a looping timer event
and that works fine for multiplayer ?
So: Event On Used > FireGun + FireGunLocal. FireGun triggers the FireGunServer multicast and the FireGunLocal triggers the projectile spawn
Yeah it works every time π
That's because it's an automatic gun, the FireRate will determine how quickly the event re-triggers and it'll keep looping and firing off the FireBullet event until I stop firing (which uses the 'invalidate timer by handle' node to stop the timer from ticking and firing the event)
xd
when i did an automatic weapon
i did a custom event
a branch if i was clicking
a delay
@unique thunder I think so yes
I haven't tested though. How do I fix this issue?
thx ^^
can you send the rest of the bp btw ?
it doesnt show where you spawn the projectile
@zinc zealot The timer I'm using is exactly the same as a Delay but I heard that it's more efficient than just a regular delay. Apparently regular delays will continue running other logic and then return back to itself on complete to resume. It might present some rare replication bugs, not sure.
Yeah sure
I'll PM it to you, will take a few screenshots
thx π
ahh finnally will complete this tiny game XD
well that and the knife still have to finish that
@twin juniper If it also happens offline when you play on your own then it's probably a collision problem with the mesh you're trying to climb. Think of the hill as a staircase with very small steps and your character is sometimes running into steps instead of climbing them. If that is the issue then smoothing out the landscape you're climbing might do it if it's too rigid
It's a landscape
It doesn't seem too rigid to be honest though.
Is there a way to do some sort of "smoothing?"
@unique thunder
he's sending me the screen shots xd
@twin juniper Yeah, open up the landscape tool - it has a smoothing tool you could use, just make sure the strength or whatever it was called is set to something very low so that it doesn't over-do it π
The landscape is too big
No, the smoothing tool lets you paint over the landscape so you only smooth out a very small area. (you'll need to rebuild lighting though, this is similar to moving a static object)
Im going to make sure
its not happening in single player first
i mean make sure it is
yeah it's only in multiplayer
who would ur landscape need to be 50km?
so
this happened
LogNet: Warning: UIpNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_167. Function Tick will not be processed.
hmmm
ok i think i understand
its the unposess thing again
at least ur getting somewhere. ive made negative progress <_<
oof
sry
anyone know this
LogNet: Warning: UIpNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_167. Function Tick will not be processed.
LogNet: Warning: UIpNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_167. Function DeadServer will not be processed.
Is there a chance
its because im running on the same machine ?
no
its because you are running a Server RPC on Tick without any filters
which would be pretty terrible even if it did work that way, RPC on Tick = bad
._.
oof
i guess the problem wasnt rly ticks
were they
xD
f****** no connection :-:
which is UIpNetDriver for you ran a Server RPC from an object not owned by your PlayerController
?
hmm
but
so the problem is im running an RPC on an item i dont own ?
theres only one thing i dont own
i think im running a RPC
this should do the job right ?
post where your PickPistol function is called
the "No owning connection" part
you mean this chapter
Ownership.................................................................66
Actors and their Owning Connections.
that is just part of your problem, but i am sure the answer is in there somewhere π
a Server RPC
will be dropped if a Client calls it on an Actor that he does NOT own.
right?
dont i own it though ?
did you set the owner on the server or the client?
you should spawn just on the server
and itll replicate to clients
as long as it is set to replicate
fffffff
no, it replicates on clients
but looks kinda glitchy
need to replicate in the owner too
yeah itll still replicating, but its also spawning on the clients
which you shouldnt do
?
after you changed something? or as it is in your screen shot?
if i change from multicast to run on server
@winged badger
it comes down to this right ?
i hope i havent broken this beyond repair xd
you probably need to also then SetOwner on the client
thx u too
This function plays a sound at location but through a client RPC, why can everyone hear the sound?
@unique thunder Unless SoundBulletWhiz() does something I can't see, other players can't hear it. Are you just testing this in editor?
"Are you just testing this in editor?"
That's why
All nearby clients can hear it on server as well
Not sure how that's possible if I'm running it on client RPC ;/
You're probably sending that rpc to other players
It happens when a projectile overlaps a player's collision sphere around their head. Overlap triggers this client RPC and plays sound
I know the overlap happens on server but I don't see why the sound plays on all clients if it's executed inside the player it overlapped through a client RPC
@unique thunder both projectiles and players exist on both client and server?
when we spawn a new replicated actor on server all its replicated properties will be send for the first time am I right?
I saw AActor::GetLifetimeReplicatedProps ant it has lots of properties which I need just owner :)
my actor is actually a bullet which I generate a lot of them :)
so my question is how do I improve my net bandwidth here ?
My collegue Chimyx and I made a lot of researches on the web and even deep inside the Unreal Engine core without success with our issue :
We're attempting to setup a simple voice communication between two computers using the sessions system to connect each others.
We even digged into the Shooter example's code from Epic.
It works as intended with this project, but not with our nearly empty project.
We added the following to our ini files :
DefaultEngine.ini
[Voice]
bEnabled=true
[OnlineSubsystem]
bHasVoiceEnabled=true
DefaultGame.ini
[/Script/Engine.GameSession]
bRequiresPushToTalk=false
Also we're working with cpp so we do not need to use "Advanced sessions plugin".
If anyone who ever succeeded to make this work was willing to spend some time with us it would really be appreciable π
Depends on who spawned it
If it's not specified on spawn (default behavior) it's the server
@ember jasper Are you ever calling StartTalking or whatever the PlayerController function is?
@thin stratus Do you mean StartNetworkedVoice ?
Idk if they renamed it
But the function to enable talking was "StartTalking" on the PlayerController
Has to be called once at the start if not using ptt
Or when the player presses the talk button
Yeah, that's what we call
(code from APlayerController in the engine)
StartTalking calls ToggleSpeaking which calls StartNetworkedVoice
We tried both
We checked that the code was actually called
youre on different comps when testing it? seem to recall it not working on same comp
Going step by step in debug mode we found that everything was working fine
yes differents comps
ShooterGame voice chat works well on the same setup
Thanks @thin stratus @manic pine !
It must in fact be something obvious we are missing here, but it's neither the "StartTalking" function call nor the amount of computers we are using (currently two) unfortunately.
what happens to PlayerState when a player controller leave the game?
what happen at all when player leave ?
I only have this in addition to bHasVoiceEnabled VoiceNotificationDelta=0.2
Everything else seems the same
Idk about your other Settings for OnlineSubsystems
@ember jasper
Well and LogVoice vebose to see what's going on
And then all I do is call "StartTalking"
How do you turn LogVoice verbose ?
[Core.Log]
LogVoice=VeryVerbose
Something like that
Don't have it at hand right now
Is it safe to increase NetServerMaxTickRate= to 40. Will my computer crash?
My computer overheated a while ago.
Almost caught fire
@zinc zealot please be safe, my friend lost his computer to unreal
it overheated and caught fire, the same almost happened to me!
holy
i tought that was a joke
fuk
guys
LogNet: Warning: UIpNetDriver::ProcessRemoteFunction: No owning connection for actor Bullet_C_1. Function ShotServer will not be processed.
shouldnt this be working ?
is the rpc shot server
being invoked by the client or server ?
liquid cooling can help when running unreal
oofXD
i recommend getting it
like i had money for that
liquid cooling will help a lot!
new computers don't catch fire when they overheat, the cpu has thermal cutout which will cut power to it when it gets too warm
well modern cpus, and gpus all have thermal cutout
unless your using a crap powersupply which shorts or you spill something, it ain't gonna catch fire.
you dont know what to say about what i just said do you XD
glanced at the vodka and made a drink, nope nothing
xD
wuu wuu i think i fixed all the replication errors i had XDD
Yeet
sry
its workiiing
hmm
LogScript: Warning: UGameplayStatics::BeginSpawningActorFromClass: can not spawn an actor from a NULL class
what does this mean
it could not be more clear
where you have an input pin for the actor class, you have a null pointer
also its a #blueprint question
gg on reading the output log tho
its rly helpful im doing all the time now XD
fixed all my other problems btw π
almost alll of them XD
at least the ones who were game breaking
so thx @winged badger
so, did you figure out why you had "No owning connection" ?