#multiplayer
1 messages ยท Page 398 of 1
Well you would actually ask Devero
Yeah, I have his plugin
James is great overall, but Devero did the plugin after all
Devero made the Steam Party plugin
But to answer the question anyway @meager spade Are you talking about a Party where you invite Friends from Steam and then queue up for a game
Like Overwatch, LoL, etc.?
The actual "party beacons" however don't work in UE4 out of the box, you need your own OSS to talk to them. But you can use the other beacons and kinda "fake" it
Or an InGame Party, what most RPGs have?
There are some already existing Beacon classes, that implement some basics for Lobby or Party
Okay it's just I have been scouring the source code and see that there is a class called party beacons and was just wondering if that's what it is
Yeah exactly like that
Lobby Beacons that was the one
Like overwatch and fortnite etc
But you can also go one step back and inherit from the parent of these
And implement your own
Party Beacons are unusable, they need some kind of custom server backend to make them work. Lobby Beacons work well though, that's what Steam Party uses
Just imagine a Beacon as a steady connection that allows to replicate data and send RPCs, but doesn't need the players to be on the same server/Map
Party Beacons are typically used for matchmaking too. UT uses them for that.
Yeah in the End, Lobby or Party beacons just have some code for you already to toy around with
You can, as said, just do that yourself
It's zero magic involved
If you understand C++ and the general RPCs stuff, then Beacons will work for you
Beacons + Steam can be a bit annoying though
cedric I accidentally gave an Incorrect screenshot this is where my weapons are spawned the other one was just swapping between them.
So I need to be looking into lobby beacons not the party beacons
Specially since the Subsystems find it funny to put header files for types into private folders
@hollow pulsar Ah awesome, you are already assigning an owner
Is this 100% called only on the Server?
I think its only called by the client
Then you can technically skip steps 2 and 3
Well then please make sure it's called on the server
And also adjust your "EquipWeapon" functions
You NEED to move from Client to Server
Not other way round
Server calling a ServerRPC is okay, as it will call it like a normal event
But generally, INPUT happens on Clients
So a button press is always a client (or listenServer, but that's special case)
And if you want something to happen for everyone/server, you need to call a ServerRPC after the Input
You can handle some stuff already local, to limit the lag delay for the client who pressed the button
but most stuff goes over to the server who then calls your important code and replicates it to everyone
Anyway, gotta go. Pets need attention
ty for the help ๐
isn't it great how failing to connect to a server destroys the main menu and reloads it for no reason
Anyone know what these are?
[2018.05.29-14.13.23:801][ 95]LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: NULL, Channel: 8```
How can i make sure the client has traveled correctly to prevent replicating actors before level transitions are done, etc. Both if (NetDriver->IsLevelInitializedForActor(this, NetDriver->ClientConnections[i])) and if (NetDriver->ClientConnections[i]->ClientWorldPackageName == GetWorld()->GetOutermost()->GetFName() && NetDriver->ClientConnections[i]->ClientHasInitializedLevelFor(this)) are private functions
Found it GetClientWorldPackageName() . Dunno how i missed that :/
is there a way to change the way client updates the character's location when it was changed on the server?
it just abruptly teleports them
when launched, for example
heres launching a character simulating 150 ping
https://gyazo.com/bf4156c5e85afb49754c05d1be43b76a
is it possible to make that more like quake live where it does essentially the same thing but smooths it out?
https://gyazo.com/af7995d10ff380fb8907f3ebc700b57c
both gifs are 150 ping
quake goes through whatever movement you missed while the server was moving your character and plays through it really fast
makes it a lot less jarring
only solution ive found so far is to have the client launch itself whenever it gets the RPC saying it was hit and tell the server to launch the character with it
but then you have the problem of shooting a player and then the knockback being delayed by their ping
i wonder if disabling movement replication and doing it manually via an RPC called on tick would be a solution, that way i can control how it gets updated
Is
GetOwner() == UGameplayStatics::GetPlayerController(GetWorld(), 0)
the best way to tell who the owner of an actor is?
that compares the owner to the first playercontroller in the game. If you are on the client, this is usually fine. But if you have a multiplayer game, on the server you will have multiple playercontrollers, so comparing against the first one may not be correct
@carmine frost Thanks! Would you happen to know how it sends messages over for things like the default BallController or FlyingController since there appears to be no owners at all from checking this way on client or server?
No, I'm not sure what those are
Any of the default controllers seems to operate with no owners. It's weird.
I mean, like ballController or ThirdPersonController, those are PlayerControllers?
They seem to be pawns, sorry about my terminology.
Are you sure it's called ThirdPersonController, not ThirdPersonCharacter?
It probably is a Character. It's definitely just a pawn at least. Weird that they have no owners though.
only pawns that have been possessed have owners. then only on the server or owning client
SetOwner() is being possesed?
because controllers exist only on the server and owning client (i.e. on your client, you won't have controllers for remote players)
no, in the process of possessing a pawn, the controller calls SetOwner on the pawn
and when a controller's pawn is replicated, it sets itself as the owner on the owning client
Default spawning with the pawn doesn't have an owner though and still somehow sends it's network messages over.
it won't have an owner right away
i assume you're checking in someplace like BeginPlay
Hi, Does anyone know if it is possible to have a session with multiple maps on each session?
but it won't have an owner, because the owner isn't set until the controller's "Pawn" property is replicated down. Which will happen very quickly, but some time will pass (a few ticks, maybe) before that happens
@carmine frost No, I'm checking in Tick() and (GetOwner() == UGameplayStatics::GetPlayerController(GetWorld(), 0)) is not true on server or client ever.
Just using the Default FlyingCharacter scene right now.
then you must be checking something other than the primary controller's pawn
in game, just open the console and type 'getall pawn owner'
and it should show you all the pawns and their owner
then you can compare that list against the result of 'getall pawn controller'
@carmine frost Where should the list show up?
open the console by pressing the console key (`) twice
i don't get anything
which would make sense
Since that is what the code is telling me.
I'm just checking the default Character that gets placed in all of these example scenes when you load into it. Then if you go to Number of Players: 2. Then it replicates movement and everything all fine and accepts input but there is no owner.
I guess I'd need to try out that sample to understand what it's doing. The fact that you have no pawns, but you're still "driving" something is odd
or at least, unexpected
Good, that's what I thought too.
I thought I was going crazy.
I'm making a plugin that replicates movement across the network for client owned or server owned objects but there just is no owner to base it off of when people spawn like this.
I'm trying to figure out how Unreal even knows who the owner is when there is literally no owner.
im currently trying to test my game project wich port does unreal have and wich do i need to forward ?
@lean hornet i set this up some time ago to work with multi testing. here is my setup.
@twin juniper thank you
imma try that
Locally it worked all fine just connecting over network doesnt wrok
yeah. i am moving to full dedicated soon. gonna be using amazon aws ec2. excited ๐
someone on here actually gave me advice on how to do it lol. full circle man.
Nice ^^
Hey, guys. I've got a question... I followed this guide for setting up a dedicated server for me 'n others to play around
I got the log 'n everything running. The level was loaded, etc.
but when I start my project 'n load in as a player, it doesn't show me joining in the log
when I start up a second, they can't see one another
so I feel like the server setup isn't correct, but I have no idea why ๐ญ
are you sure the dedicated server build and client builds match? If they differ, there is a kind of crc check to make sure that basically stops it connecting
@tropic fjord go to (path to your engine build)\UnrealEngine-4.19.2-release\Engine\Binaries\Win64
try running UE4Editor.exe "U:\UnrealProjects\MyProject\MyProject.uproject" -server -game -log with commandline
to see if you are able to create the dedicated server properly and that you are able to join locally. i used this same setup and it worked for me when i tried it a few months ago.
make sure to use an open level node on the client you are connecting to the main IP with, and don't forget to setup port forwarding for 7777 (i posted a pic about this above). those steps are in the guide though. so just thoroughly follow all guide steps. should work.
@twin juniper Thanks, it's working โค
welcome
Kind of messing around with multiplayer functionality. I want to make the player pawn movement server based.
What would the "target" pin be?
Anyone know why
GetOwner() == UGameplayStatics::GetPlayerController(GetWorld(), 0)
is always false when putting it on the pawn in any of the default scenes and having it replicate?
Is that not how you check ownership?
Does anyone know how to get servertravel to work in multiplayer in 4.19?
it works in 4.18 but in 4.19 I can only get it to work in single player
@bitter lintel that will return different results on clients and server
or at least, might, on client PlayerController[0] is the only PC - local one
on server tho... its unlikely to be the same one
Yeah, I know about server and client ownership, it's not owner on either.
PlayerController[1] is also not an owner of anything.
what is the context of that line of code, which class is it in?
an actor component I put on the default pawn
which makes the Pawn the component's Owner
i just check in TickComponent() every frame
try GetOwner()->GetController()
GetInstigatorController()?
with all appropriate null pointer checks, because that is likely to crash if it runs early enough
I don't see GetControlelr as an option
ah yes, you'll also need to cast the owner to Pawn
Ah, ok
so Cast<APawn>(GetOwner())->GetController()
mind you that is AController reference so its good for checking if it is a PlayerController[0] for example, but not for accessing any PC specific functionality
How would I go about replicating the action my widget preforms to everyone?
@mystic field, most of the pawn movement works out of the box in network scenarios
you just need to ConsumeInput, and the engine will take care of the rest
@winged badger It works! Thanks a ton.
@hollow pulsar any actions from user input, along with the any interaction with the UI is executed on client
you can use anything attached to the PlayerController to send a Server RPC
from most Widgets it is easy to grab a PC reference with GetOwningPlayer or Pawn with GetOwningPlayerPawn, or HUD
those can all run a Server RPC, however widget can't since there is no equivalent of it on the server, UI is local only
So I need to call an event inside the player controller instead of from my widget?
so your ButtonClick->(Get a PC and run a Server replicated event/function on it)->Whatever is on the other end of that event/function executes on server
and i suspect you can take it from here
PC in the example is player controller right?
yes
Alright I'll see if this helps! ๐
it doesn't have to be the best place for it
use your best judgement, plenty of stuff that can run it (Pawn, HUD, PlayerState)
but it will work
actually, correction
HUD exists only locally as well, so it can't be used for RPCs
Ok well how would you suggest I replicate this action?
not sure WeaponItemReference index will have any meaning on the server
but that depends on the setup you have, which i do not know
but basically
you make a custom event in the PlayerController, for example
you make it Replicated to Server
you add inputs to it for any information you have to transfer
and then you just call it with PlayerController target directly from OnButtonClicked
whoops delayed ๐
Ok so UI cant exist on server right?
if its a listen server
it will exist for that particular player only
there are quite a few things that are not shared over network, Erebel posted a picture with Game Framework classes and how they interact, and its pinned on this channel
@winged badger i am getting the hang of this ability system in UE4, still a lot i don't know but i am getting there ๐
I need help
Server can fire and client will see it too, but when client fires server cannot see it
because all input actions are executed locally
you need input action fire -> Server RPC fire
im relatively new, can you elaborate
server has no way of knowing you're holding down your RMB
only your local machine knows that
and you set those as input actions in ProjectSettings->Input
How would i execute on the server
that lets you use the InputActionFire node from objects that have access to your InputComponent
namely, your PlayerController and its possessed Pawn
@bold ravine also you need to decide how much you want to run on the client and the server, if you want pure safety, then run the whole Fire routine on the server, if you don't you can only run the parts you need to on the server to replicate it, like muzzle effects, etc
That way the client cant see its own firing
so, simplest solution (mind you, far from optimized one) is to RPC it to server first, then Multicast from there
@winged badger Do you know of a way I can check ownership more generally. I can't seem to dip out of this <Pawn> casting early enough for it to not NULL out on me when it's not a Pawn.
Never heard of RPC before, how would i do that?
as long as component is attached to a Pawn, it will not be null
Yeah, I'm just trying to make a general component. I might have to do some checking if it's a pawn or not a pawn probably?
@bold ravine i recommend reading the Cedric's networkign bible, its pinned on this channel
@bold ravine ^
Its a very good read
wait
you won't get too far without a more broad understanding of networking
Thanks
@winged badger Sorry if you saw this and were just trying to stop helping people, lol.
I'm just trying to make a general actor component that gets the owner. Are you saying I'll have a bunch of different ways to tell who the owner is based on if it's a Pawn, or a child Actor, or a regular Actor, or some other thing I'm probably missing?
why do you need the Controller?
I'm trying to tell who the owner is.
I'm making an actor component plugin that syncs transforms across the network based on who the owner is.
GetOwner() will return an AActor reference
however, only Actors that can be possessed by your PlayerController are also Pawns
so if that cast fails, its not possessed by the PC to begin with
https://blueprintue.com/blueprint/hputhm_8/ So this is how Im calling the weapon ref index
there is also a Pawn function IsLocallyControlled which will check if there is a PlayerController AND if its a local one (it will return false if a listen server host querries a PlayerCharacter that is not its own)
Can't you just place a ball in a level that's replicated and that's not controlled by anyone (but is actually owned by the server) and have it roll around?
all actors spawned without a controller and set to replicated will be replicated
if the server spawns them
But how do you check the owner?
I'm having difficulties checking the owner of an object I place an actor component on.
i never needed to find an Owner for a generic Actor
nor have i
Thanks both of you. I learned a bit for sure!
if you still insist on it, if your Cast to Pawn fails
its not a PlayerControlled Actor
and if it succeeds then you can check the Controller
It's nulling out on me, I can't seem to get out early enough.
(GetOwner() && Cast<APawn>(GetOwner())->GetController() &&
Cast<APawn>(GetOwner())->GetController() == UGameplayStatics::GetPlayerController(GetWorld(), 0))
Which makes the whole editor crash.
that's a big if call
you are accessing GetController without checking Pawn for null first
oh and @hollow pulsar - DO NOT Multicast from a PlayerController
just figured you might be going in that direction, ignore me if you weren't
it would disconnect every client that doesn't have its own't copy of the PlayerController you are multicasting from
yeah PlayerController only exists on owning client and server, no other client can see anyone else's PlayerController
bad times be had ๐
so only scenario in which Multicast from PC wouldn't break anything is if you had server + 1 client, and client was initiating the Multicast
brb restarting pc ๐
How do I get the local pawn????? Please give me a simple way to get the local pawn in a multiplayer game. @wide chasm
you can get the LocalPlayerController via GameInstance
and take it from there
if you already have a Pawn reference and want to know if its local tho - Pawn function IsLocallyControlled will do the trick
I can't find that function, its weird
Wait
Nvm ty, I found it when turned of content sensitive
Hi everyone! I need some help to make a win system for when a player has collided with a collision box in another player's bp for a certain amount of times. If you know how to help me with this, please PM me
anything done locally would be sensitive to cheats @copper portal
so you have to count your collisions on server only
if you are displaying scores as the game goes along, PlayerState would be a good place to store that information
I dont understand
you probably do not want your clients to report to server that they collided with the target box
because that information could be hacked
so how would I setup a collision event?
so OnTargetBoxBeginOverlap, you do HasAuthority check
Is there a way to test 'OnPostLogin' events in editor?
and if its server, you add a point to OtherActor's PlayerState
there is a PlayerState class
you can set it from either a GameMode or PlayerController, don't recall exactly
should I create a custom one?
yes, and create variable to keep the score, and make it replicate
you can access the PlayerState from Pawn, or PC with just GetPlayerState (you will need a cast to access your custom functionality here)
it replicates by default
and GameState, which also replicates by default holds an array of PlayerStates
so you can easily access them from anywhere
the purpose of the PlayerState class is to hold publicly available information about your players and/or Pawns with enough significance to warrant having one
so everyone can read it
ok so I casted to my player state and I created a variable thats replicated so now I just need to ++?
when overlap happens, yes, and only if it happens on server
k
type Authority into your context menu, and you will see one switch there
with outputs for Client and Server
I have game modes for the amount of wins and im wondering where to check if the minimum amount of collisions it takes to win the game has been exceeded. should it be after the switch has authority or before?
you create a function in your PlayerState, ideally
it increments the Points variable
and it checks if number of points are sufficient to win
if I do a custom event does it have to be run on server?
so you have say, ScorePoint function in PlayerState that adds a point and checks for a win
or multicast and then run on server
is replicated?
and only on server
ty
when you are a client, there isn't just one PlayerPawn for you
server has one, and all other clients have it too
and those are separate object that share the same NetID
allowing them to be referenced via network
How do I get the owner of an actor that is already in the level and replicated? Would it automatically have an owner?
so when your Overlap event happens, Switch has authority will ensure whatever comes after executes only on server copy of that Pawn
what for @bitter lintel ?
I place a sphere in a level, I have an actor component on it and I want to get the owner.
and Owner of the component is the Sphere
GetOwner()->GetOwner() gets me the player controller then?
no, it gets you the Sphere Actor
How do I check the owner of the sphere actor?
I'm basically making a replacement of Replicates Movement, but I'm having a big problem with who owns what, lol.
I want to either send out an RPC or not based on if it's the owner.
if its the client version of the Sphere
you can't send a RPC unless its attached to your PlayerController
it can be possessed by it, attached to something in its chain
actor attached to possessed Pawn could send a RPC
or any of their components
I don't use BP.
then that should work
Should work for what?
anything attached to a PC will have GetNetRole() == ROLE_AutonomousProxy
on clients
anything not attached will have ROLE_SimulatedProxy
To the client PC?
and anything on server will have ROLE_Authority
regardless of what its attached to
But I need to find the owner. No?
i'd have to read the GetNetRole() to answer that
but i think it should work out of the box
something is not working @winged badger
it seems like its not adding anything to the score
PrintString everything along the execution path
yeah ik
and see where it breaks
it breaks on the event
oh I see where it breaks
its not finding the session property
oh I see y
I think it works now
How can I get the name of the player that won? @winged badger
My dudes. Can anyone recommend a good starter tutorial for setting up multiplayer games (C++) I feel like I have a decent background but I'm still a bit weak on replication. Also, how would I go about testing? Do I have to package up and run it locally every time? Or is it more dynamic than that, allowing me to make small changes and try something new? Thanks!!!
you can run the editor as a listen server or a dedicated server
@warped trail there's a really good one i know about on the unreal youtube channel - if you search in youtube for "multiplayer unreal" it's the first result. it's mostly BP based, but you can extend it to CPP if you like.
i used this tutorial for my 6dof game.
Awesome! Thanks! And that's really helpful! Thanks so much guys, I feel like if I get on the right track, I'll do okay!
@warped trail the tutorial also features steam integration - which will be really useful to add to your game.
so that way, if you decide to publish later, you can actually profit from it. it's a great starting point. you won't need to have the game ON steam to test, you can use a local app id, add a few lines to defaultengine.ini
so basically what you do, after you make your game locally, you would test it on two separate machines if you use steam - you can circumvent buying a second machine if you put it on steam first and test it that way, or if you test using a dedicated server. one final thing i will mention - great shortcut to making a dedicated server : use UE4Editor.exe "U:\UnrealProjects\MyProject\MyProject.uproject" -server -game -log where UE4editor.exe is the path to your game engine binary. and point the uproject path to where your game is.
so if you don't end up using steam, you can still test on dedicated. most businesses use dedicated servers because they are hosted on a high bandwidth connection, and someone on this very channel gave me advice how to set up an AWS ec2 dedicated server (cost for this server is about $40/mo).
so just keep that in mind - you'll be going from local testing -> dedicated.
Oh that's great! I have an AWS account so I think I can host there for now. I'm working on a small area for now, getting all the features up.
Hey thanks man, that's a lot of good info, I'm definitely going to save it. I'll get started tonight!!
great! good luck with your project 
Hey @twin juniper Could you help a smidge?
hi
My guns are firing on the server but not for the client
Yeah its been a toughin
so what you got going on with the guns, do they have like a muzzle flash, and static mesh blueprints for projectiles? somethin like that? that's what i do
ok
that thing isn't showing me if it's run on server or run multicast but i am assuming you set that up right
ok and you say not firing on client
Correct
there's one step you are missing, in the paradigm for how i did it in my game
but you have the first part right for Fire1
if you go to the Fire function, and look at it
you need to set that to multicast, and reliable
because that function will be executing on all players. so what we want is - we want to always force the server to BEGIN exec. so we have that. once we do that, we need to then tell the server (which has the exec flow) to broadcast to all users.
so wait ill show you an example
holdon
Oki
this is gonna be a little blurred but bear with me ill add captions ๐
brb making pic
okay so here's how i do it.
@meager spade i multicast the firing because exec flow is on server when it reaches the call
so that way all users see a version of the spawned bp
if he is using a projectile, but you only replicate the projectile, muzzle flash, etc through multicast
not the whole firing of the gun
so in my version here i have a multicast firing, and then i create a muzzle flash particle (attached to the point of the gun barrel) and then you can spawn it in.
i did mine different to that, but if it works, it works
did you set your projectiles to replicated?
really? dang i didnt think that worked haha
cool
i thought you always had to multicast spawn events ๐
all you need to do is spawn the projectile on the server, as replicated
so basically, Client->Asks server to fire->Server fires the gun, spawns the projectile, the muzzle flash is multicasted from the server, the projectile hits the client and deals damage
let me quickly mock up a test
So it should like this?
ok in my current setup - i have the projectiles set to replicates on, but not replicates movement. so i think if you turn on replicates movement you can do it that way, without using a multicast call.
again FireAll is being multicasted
and It shouldnt be?
Olin you can leave it without that, and replicate the projectile as an alternative
let me just do an example based on the Blueprint FPS template
here's what he's saying
imagine for a moment my shield is a projectile
i have replicates and replicates movement on
in taht case, when you spawn it from a server exec flow like you have right before fire all
you can do it that way instead.
it's very similar ๐
either way.
so you can turn fire all into a normal custom event.
since server already has that exec line
and then just spawn in your bp, make sure you set velocity on it, and everything
and then in your BP, set the replicate settings as above
Ok well does it matter im drawing a line trace and not using a projectile?
Or is the logic the saem
why you doing a trace? because line traces are local to the player
you are testing if the player is in view or something?
No my firing is just a line trace for hit detection
you can do the trace with server exec flow and just print out using multicast as a test for that
well
if you are gonna do hit detection
what do you mean hit detection?
like you are gonna fire a missile if its in view or something?
I mean the line trace tells me if it hits an actor if it does apply damage to said actor
here let me show you
you can use an interface to affect health of the hit target. from the output of break hit from the line trace.
or you can use apply damage or whatever that native node is - but i havent used it.
Thats what im doing
if you have native actors in your game - make sure to add a tag to your hit actor
to check if its the right type for receiving damage
you can use does implement interface or actor has tag
as a check there
you know whaat im saying right?
to test what actor you hit
Not sure how to use a tag
ok you go to the actor bp, and you add in tags that way
i use tags a lot
there on bottom right
ah there you go
same principle if you are doing hitscan
Kaos particles have to be multicast right?
yeah
ok
i might be sending slightly more data if i multicast the entire function i think
i might switch mine over to that. cool
would have to multicast the sound aswell
if you have sounds
according to @winged badger you can just do https://gyazo.com/b96fdd98c28fbaaa4bf840997d292c1a
and it works i just tested it
@hollow pulsar do you want me to give you a hand on teamviewer quickly
Yes please
I created a matchmaking script for a game of mine a while ago with the Steam subprocess, and appId 480
but when I sent it to my friend after exporting, we couldn't play together
can someone please help?
are you using advanced sessions plugin or normal. because if you use that plugin you can have custom servernames. just to let u know.
Does anyone know how I can create a player name tag that shows for everyone in a 2D game?
advanced
I think
lemme check
can't you create widgets that display in the actual game? @copper portal
im using a text render in the character bp
you should be able to drag a widget display into the PC
@twin juniper I'm using advanced
what do you mean
and online subsystem steam
spaghety. i use same, it works for me. you're just using a listen server and not dedicated right?
no, not dedicated
oh, right I forgot about how you need to open a level with the listen property right?
is that it?
(when you're creating a server)
yupper
hold on
ill get an example
thats how i do it
thanks
maybe I'll use advanced sessions
right now I was just using them to get steam names
you should migrate your code to advanced sessions.. i know the dev he's a good guy
that's how you'd use find session advanced.
they have a version out for 4.19.2
you know the advanced sessions dev?
all you gotta do is get the code plugin, put it into your Plugins folder
gen project files, build it in vs
and you're good. just enable plugin.
not personally, just on forums
I already have the plugin
ok
yeah it's a great tool i use it all the time
is there a playtesting section of this discord?
would you post that here?
noper i just looked in #more-resources
and yeah the only reason i switched to advanced was to get servernames ๐
what does it mean by "allow to join via prescene"?
does that mean steam friends can join?
presence is for listen servers
and then disabling those flags would make it work for dedicated
then how do you set up the "join game" thing
ok holdon
why is there a timer?
so you basically use find sessions advanced or find sessions if you arent using adv
then you get the session array. if youre testing only and not in a production envoronment you can just get the first of the find sessions array
then what you do is you join session on that - ignore timer sorry that was debug code i had in there.
my bad haha
its ok
i was doing a check to see if the loading screen stayed up for too long
and if it was up (network latency bug) i destroyed session caller and tried again or cancelled the attempt
but just ignore that
...
Anyone using Gamesparks? I can't find something I swear they should have added in by now, especially since I made a freaking tutorial for them to do it...
Steam Session Ticket
https://www.youtube.com/watch?v=4CgeAxiS19s
It must be called something strange
This tutorial is for those that use a backend service (usually a plugin), such as GameSparks or PlayFab and want to get Steam Authentication working in Bluep...
I guess AdvancedSessions has
Anyone know how I can have a player tag that shows for everyone with their names on a text render?
Hello. Is there any way to force some variable change to run on server, even if the variable isn't changing? I have a OnRep Struct variable that can be toggled and OnRep checks that if the variable has changed. Now I have some extra node that I constantly Toggle On and Off so the OnRep will run everytime
I have for example this. IF the laser mode happens to be same the server won't update struct and clients don't get anything. Now I just Flipflop so one value is constantly changing and get the update. Surely there is some way to bypass this?
Guys, what if I need to rotate character from client with inputs but without controller rotation? Does it mean I have to send RPC event to the server?
Anyone know how to force return full lobbies/servers in a server browser as currently steam doesn't return any server if its slots are full. I looked into the c++ and found FOnlineAsyncTaskSteamFindLobbiesBase::CreateQuery. This causes by default not to return servers which are full. I am currently using advanced sessions. Anyone got a solution to this?
Hi all, does someone know if I join a session do I always travel to a new map? I'm trying to understand the OnlineBeacon system
So for example if I want to create a party on the main menu of my game, I cannot just create a PartySession and invite friends since they will have to actually travel to a new map, instead I think I could use a beacon and replicate the session data to all connected players without joining the partysession and travelling to a new map, am I correct?
beacons can be used for connecting on the same map (main menu map for example)
without travelling
i havent gone too far into session but i think beacon session are different to gamesessions
@hollow pulsar what actually returns 0,0,0?
for what I have read a beacon is not a session, it replicates a session, so you can create one, place a beacon and replicate without joining?
Aren't beacons used for games that use a queue system for when joining the server. So if the session is full you join and wait in a queue before you actually join the session?
@plain flume you should use a byte for this, rather than flipping a flag
with a flag, if you end up marking the struct for replication twice in a single frame, it wouldn't replicate because the value is the same as it was the last time it was replicated
@vocal dagger The BP node "JoinSession" is hard-coded to travel. The C++ equivalent usually doesn't do that. The BP node's name is a bit misleading: one would think it just calls JoinSession(), but instead it does something like this:
if (OnJoinSessionSuccessful)
{
GetConnectString();
TravelToTheString();
}```
I don't know the details on how beacons work, but a high-level overview would be this: they create and manage a separate NetDriver (than the one used by actual client-server connections), which listens for specific beacon connections and replicates RPCs and properties between client and host beacons.
A while ago, I sent a PM to a gentleman called Josh, who was (or is) working with Epic. He was kind enough to offer this comprehensive response, as well add it to AnswerHub: https://answers.unrealengine.com/questions/467973/what-are-online-beacons-and-how-do-they-work.html
@twin juniper Yes, beacons can be used for queues as well. Theoretically, they can use any data that you wish to replicate (or RPCs) without actually travelling.
I doubt beacons support NAT traversal though. They would also need some for of master server to advertise themselves. On LAN, this is trivial: a beacon just broadcasts on all sockets and listens on one, but over the internet, 2 beacons (client + host) have no way of interacting with each other unless they know where they're at, hence: an external master server of some sort.
How would I use "Get player character" in multiplayer? with this function
branch -> if OtherActor (Cast to Pawn) IsLocallyControlled -> do stuff
if you want it to react local only
Its reacting locally the problem is in my branch to check if the colliding actor is player only works for player index 0.
because it checks Player[0] by checking the Pawn of Controller[0]
you don't have other controllers available locally
if you want to check for any Player try Pawn->IsPlayerControlled
Do you know the blueprint version of that?
What do I connect to my cast to get any no hmd character in the server?
Looks like you want to iterate through all NoHMDCharacter actors and compare against each one
My goal is if no hmd character collides with the weapon attach weapon to that no hmd character
Yea no you don't want to iterate then, you want to use actor tags
Check if the hit actor has the specific tag
Then attach if that's true
So the logic is like this (Collision Event) (Check for Tag)(Branch if Tag is right)(Attach)?
Yep
How do I check for tags Ive got no clue tbh
ActorHasTag
Yeah but now I still need a reference to NoHMDCharacter to attach to.
Check if the Other Actor has the player tag, then cast it to NoHMDCharacter
On success, attach it
But how will it know which NoHMDCharacter to attach to?
The OtherActor is the character you want to attach it to. You just have to cast it so you can access the specific members you need such as the Mesh
@hollow pulsar hey! did you get your Fire1 function working from yesterday?
what, if anything, would throttle the rate a number of actors would be replicated to clients?
I'm seeing a delay from when a bunch of actors get spawned to them showing up on clients, and I was wondering if anyone knew of places that would throttle this
Does anyone know how I can make player name tags that shows for everyone?
@copper portal i do that using an array of text variables in my game state
but how would I make it so that it displays on say a text render
that replicates to everyone @twin juniper
@gleaming vector Do you know if you're hitting your max bandwidth on spawn? That'll do it.
that's what I thought, but I ran the netprofiler and it doesn't appear so
I've done the basic assumption checking... yeah they are set to replicate, yes they are spawning on the server, yes they are being marked as dirty for replication
but they take their sweet time being replicated
it's a strange behavior
@copper portal sorry, was chatting away in the main chat. I believe you can use a RPC run on owning client with the game state text var depending on which player controller it is.
@gleaming vector I imagine the packets that represent the newly spawned actors aren't high priority and other packets are getting onto the wire instead. I'm not sure how you'd be able to increase the priority of just spawn packets without increasing the net priority of the entire actor though
that's what I'm thinking
what is rpc @twin juniper
either that or something else is throttling, like osme kind of priority problem
here is the base of the logic - you can use run on owning client there
i would actually put it in the pawn character.
so the character bp?
and reference to game state by using get game state, or reference to player controller by get player controller ->cast to gameplaypc or whatever pc you have active
yep
the main one u possessed and move with
dont need unless you have the need for it.
you usually want a custom player controller for added functionality though
i use playercontroller for things like - input actions / chat messages / join messages for when clients join my multiplayer game.
for the thing you talked about earlier?
the tag thing?
yeah you store the text array in game state (that's how i did it)
yeah what I want to do is create a name tag for every person that everyone can see and change the text to the player's username
then you access it from your main pawn using a run on owning client RPC.
im confused on how I would set the names
would I do like a for each loop and create the name tags and set the text or each of em?
so are the IDs for players or items in the game like powerups?
players
I want to get player names
and make a name tag for each player with their name
that everyone can see
๐
ok so
you'll probably want a player controller for this
so create a player controller, name it GameplayPC
remember, each time a client logs in to your game, a player controller for that client is made.
it's instantiated.
per player.
get that?
yeah but do I need to set it as default in every level?
once you make the player controller, you go to beginplay the custom event
yep you set it in world settings
and in project settings if you like if you want a global default
but world settings sets it per map
so here's the logic
if you look at "Add Info" custom event there
it runs on server
add info adds to a text array of player names
you have to figure out the logic for how you'll get the player ID. so you will probably need them to enter it in when the launch the game or something like that. you want them to have their own IDs.
but my logic adds that into a "GameState text array"
that text array stores the player names.
you can then call the names via PlayerName -> Get -> (Index) keeping in mind the indices start at 0
I get the player name with get player state and then get player name
so how would I add that to the array of player names?
thats in the second pic
the most recent i sent
you add it to the array in that way by using add from a server RPC call
ik
so they get added like this. player names (0) : Bob. player nems (1) : Judy. so on
bob joins first, judy joins second.
but how do I get the names of everyone that has joined the game?
you want to display them all? you have to use a for loop
like that foreach on the bottom there
foreach loop, get it from the array there.
wait
that print should print out all names.
what I am asking is how do I get the names
from the player state and then get player name?
you access the names from where you store them. i recommended to use game state to store the text array
thats not what i mean. How do I add the names from player state > get player name like in the screenshot above
to the array of player names
yes that's in my pic
you use add and add to array.
they get added in order. and if you call the add function from your player controller beginplay, they will be added in order of login.
im confused af
yeah you have to use get game state -> cast to your active game state -> and get the array ref as above.
then use add, and pass in your reference in to there.
just try it out. should work.
that's howi did it.
does your lobby map have a custom player controller?
if not open the lobby map, set it in world settings first
then from beginplay on the lobbyPC, you can get the name
hey olin!
๐
@twin juniper Ive got my firing working and I can kill the AI and it replicates perfectly ๐
nice
did you end up using multicast for the entire fire custom event or just for the spawn and particle / sound
haha
I rewrote my fire event and it works now
@twin juniper https://gyazo.com/d04bb35cd9a3dab0e1c064cc6e854b0a thats for my add info event but where would I call it if I want to get the username of a joined player?
you have to add a variable in your game state for player names
thats how i did it anyway
the game state is global for all players
so create a custom game state
add the playe rnames array text var in there
and get game state -> cast to custom game state -> get player names
game state worked for me
i didnt use player state
so not sure on that. sorry.
game state will work though
ill just try it on player state
xD
ok and then what do I do after I created the var?
Hey Gothic do you know how I'd add score to the player who killed a zombie?
@copper portal here is what i can recommend to you because there are a lot of small technical details here. please go to youtube, type multiplayer unreal. the first result that pops up will help you. after you try that tutorial out, if you have any questions, maybe you can let me know? is that okay?
yup
so you have score vars per player, so store the int var in your pawn char
have an interface call, when the zombie dies, you interface to your pawn bp, increment the score val by that amt
@twin juniper but that wont help me make the player tags
typicalegg - its in the tut i promise you. the player id stuff is in there
just please look at it k? Unreal Engine Published on Jul 14, 2016 tutorial Blueprint Multiplayer: Project Overview | 01 | v4.11 Tutorial Series | Unreal Engine is the desc
here is an example of what he does egg. his name is wes bun, really talented epic dev. he made the tut. he adds player names too. if you go thru it for a while it'll really help you out.
I dont think it would help me tho.
Cuz it doesnt mention player name tags and thats what I am after
@hollow pulsar here is how i did that score thing
so i have an affect health interface, if the health of enemy = 0, then it dies, it calls a death function, passes in the attacking player object (in case you have mult players in coop)
so it goes in thru there
Is there a way I can draw affecting player from EventAnyDamage?
yes
you get the attacking player from either the instigated by or damage causer pins
try both
im gonna be adding any damage to my pawns soon.. so they can be affected by radial missiles
so i'm glad you brought that up ๐
@hollow pulsar are you able to use anydamage?
does the damage actually cause damage to your enemy ai? edit think i see how it works now. i guess i will have to call apply damage from teh pawn that does damage, and event any damage for pawns that recv damage. can correct me if i'm wrong. i might try to shift my damage stuff from my interface calls to event anydamage / apply damage fairly soon (mainly so i can get radial damage done to my chars). we'll see.
@gleaming vector how much time is "their sweet time" ?
I'm currently digging there
they aren't being considered
which gives me a lead
i know its a "bit of a spam" but running with log lognet (very)verbose might provide a clue as well
i did that
it's how I got to the fact that they are missing the boat on the consider list
it also is telling me that they aren't being delayed due to saturation
is ActorChannel created for them in timely manner?
i dont know
do they trickle in, or do they all appear at the same time?
all at the same time
my best guess is that engine is missing an ensure somewhere
I have a few leads
like if you try to subscribe same function to a delegate twice
it will hang for quite a while, then continue
the actors are being added to the consider list
but they aren't surviving it
so, I've breakpointed all of the places where the server throws out items out of the consider list and lets see what pops off
there are, thankfully, only 3 conditions where that would happen
{
// If the level this actor belongs to isn't loaded on client, don't bother sending
continue;
}
if (!IsActorRelevantToConnection(Actor, ConnectionViewers))
{
// If not relevant (and we don't have a channel), skip
continue;
}```
if ( PriorityConnection == nullptr )
{
// Not owned by this connection, if we have a channel, close it, and continue
// NOTE - We won't close the channel if any connection has a NULL view target.
// This is to give all connections a chance to own it
if ( !bHasNullViewTarget && Channel != NULL && Time - Channel->RelevantTime >= RelevantTimeout )
{
Channel->Close();
}
// This connection doesn't own this actor
continue;
}```
Relevancy seems the most likely culprit there
agreed
unless you altered IsNetRelevantFor for those Actors heavily, it would have to be distance based
alternative would be the level they are spawning in (it would have to be a streaming level) is not visible to clients for some reason
(they would still see the Actors in it loaded from the package, but it would not be the same level as on Server, in any way that matters for networking iirc)
I think I figured it out
for some reason, all these objects have a location of 0,0,0
(which I probably should have checked)
and that's out of the bubble
i was going to ask if you have a PC controlling the AI Controller next which possesses the Pawns
that also creates some weird NetRelavancy results
yeah
works if you call SetPawn from the PC tho
oh, I think I know what is going on
and it has to do with level streaming
I'm spawning the items really early on, so their spawn points are 0,0,0
when I get around to spawning them again, the levels are fully loaded
SpawnDeferred() then FinishSpawning() when you need them?
takes a new FTransform
unlikely to be relevant to this, but there is also a bug with level Visibility of StreamingLevels that are set to AlwaysLoaded on clients, workaround being loading them manually
i am off to bed, gl and gn
How can I make sure this shows up online, right now it shows the servers name on all players or clients name on all players
Its a widget that needs to grab the players name
this works on server but client still sees their name on everybody
can try using has auth, keep same behavior for serverside, and use diff behavior for client.
to get the exact logic would have to test i think
you mean if you exec it from server, and set the vars to replicate? maybe
I'll try it
for that you would do something like this - where you can replace the multicast call at the end with a normal call to do what you wanted.
so if on has auth, it's the client, the client still tells the server to exec it
you're def right to store it in game state though. that's where i store a text array of playernames.
On my begin play event in my character bp, I have this code https://gyazo.com/abdf0af6f60bdf4a17a52d42e21abc59 which sets the text of a tag for the user's name and it works fine on the host's side but if you look at the client's side, it shows the same name as the host. How do I fix this @twin juniper
egg, player controllers are unique per possessed pawn
so if you move that stuff over to your player controller, you'll have unique IDs for each one
did you watch that multiplayer tutorial i linked? because it's in there
no because if you have the answer, I dont need to watch anything
Server seems to work fine with that auth logic but client still doesn't maybe I should set the widget component to replicate
@copper portal so the way i do it in my game is very similar to the multipalyer tut i linked. it's complicated so i wanted you to look at that fot the details. basically what i do is i use a player settings struct that's loaded for each player on login. that player settings struct has a text var that is the player name, and that's added to an array of player names in my game state.
each player needs a way of having their own text ID. and to do that you need to load the info in somehow
once you have your player text id, you can break apart the player settings struct like this and get the player id that way
Maybe I should multicast on server auth
@agile lotus how are you getting the client player ID?
are you sure it's unique from server's?
when you pass it in?
Yeah it works on server screen
every client has unique name
client doesnt show anyones name
@twin juniper I put the code in player controller but it doesnt do anything
still the same problem
@agile lotus if it works on server, and it's properly setting something,. all you need to do is exec on server event that sets something in your game state. since the game state is global, it will read on clients too.
you guys are having a similar issue.. hmmm
I display names everywhere else just fine
egg you gotta make sure the player text id is unique for the client. prazon said his is already unique per all players but only shows up for server
transferring it into a widget component is the only one not working
are you trying to transfer it into a 3d widget or something lik ethat?
wym @twin juniper
yeah
not sure how those work in terms of replicatrion but i believe it's similar to using something like a timeline, there may be some settign in there where you have to turn on replication to get it to work for clients
i only use one for VR
egg so if you are always passing in the same text value, say you pass in bob for server and bob for client, then it will always display same
so you gotta first make sure you pass in unique player names
once u are sure that is working then u just gotta set the values in the game state player array.
if I put it in the player controller, it shows no names on server side but only server name in client and no name for the client
but wym by the unique player names
i just expaliend it.. you gotta make sure you properly pass in the names.. so you don't always pass in the same ones. so if you pass in Bob for server, Bob for client 1 , bob for client 2 , there may be some error in how you are passing in your player names.
so how do I not make that happen?
because you're using for each loop you're not defining which player state you are grabbing I think
so I have a player index number that I assign each player
I make sure the name I grab matches with the player index I 've assigned
so how do I make the index?
the way i did it is by using a struct of player settings. that gets loaded for each client when they start the game and login to my game. then the info gets added automatically when they enter into a lobby.
where are you storing your player names?
its just set arbitrarily?
its kind of complicated for my method but
OnPostLogin I find an open index from 1-4 (0-3)
im not storing anything this is my code and thats all I have: https://gyazo.com/abdf0af6f60bdf4a17a52d42e21abc59
^You're grabbing every player state that exists and trying to set all the names at once
I grab only one player state, that is matched with its index number
so how do I set the player index?
I have a struct
which is a table of data
when a player logins or joins
I find the next empty number
i have a struct too.
and assign their unique Net ID to that number
how do I make the struct then
you have to add a var.
so what vars? just a int?
add new -> blueprints -> structure.
yep. here's the one i use for my player names
@copper portal https://www.youtube.com/watch?v=abmzWUWxy1U here you go
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main M...
that's the one i was talking about. please watch that.
it goes thru the player id stuff.
So when my players are going through PostLogin I save their unique ID, and Index to a struct. Then when I PostLogin or SpawnDefaultPawnFor on the actual gameplay mode and map I can reiterate through those player states in the player array. Using the index and unique ID I saved I make sure their characters are brought over the map travel
When I first used structs they were complicated to setup
but they are a huge life saver
so I understand the frustration when first learning about them
OnPostLogin
ye
Maybe grab the length of PlayerArray during post login and set their index to that value
k
but how do I set it in the struct
I made a var for it but I dont know how to use it
@agile lotus @twin juniper
you have to break the struct to access elements inside it.
k
again please watch that multiplayer blueprint tutorial man. that has all the info you need to get started with the player ID structure stuff and i swear to you it's all in there.
you sure? He created the structure and then moved onto main menu
could you give me the exact episode?
nvm I figured out how to set it
For some reason when I try to test my game, it crashes
instantly
i mean if it works on everything but..
your code works, just the extension is wrong somehow. so you'd have to look at the details on that. you can probably get it to work in a 3d widget if it's referenced properly. maybe the 3d widget needs to be spawned from server, or set to be replicated.
i only use one localized 3d widget per player for a hud type thing.. so
i dont have any references to other players in my 3d widgets.
@twin juniper I think I did it with the struct but the problem where it works on server only is still occuring
@copper portal i will try to help in a few moments - i am currently working on a texturing thing right now.
im getting off soon so if its not possible to do it rn, you will have to help me tomorrow @twin juniper
will probably be on tomorrow
if someone else is here they can help too, i will try to though, i like helping.
okay now the client was able to see server name but it showed up on client pawn
lmao
disconnected the switch to experiment
which is how I got that result
what exactly are you doing? like an indicator for enemy ships that shows up on a hud?
because i have a player UI that shows all names, as well as a hud indicator.. mine does work..
ahh
and you as prazon see awhbek correctly and your name correctly
got it
here's how i do it in mine if that helps any..
i have a custom array in my game state
and
what i do
is i have an actor component in my main pawn
see the comp track in radar component there on left?
Yes
it is a way to id it
You're using a widget on your HUD right?
yeah hold on
ill show you how it looks so you see it. its a HUD object
here is the BP for it if ur curious https://forums.unrealengine.com/community/community-content-tools-and-tutorials/116732-free-radar-blueprint-track-enemies-friends-pickups-and-more
UPDATE - I just released a new version of the radar template that uses UMG Widgets instead of a custom HUD class! See below for download link!
they have links there
but gimme a sec ill post a pic
so see how they both have little blips
it matches with their color
way i did that is by using actor components
the radar is an on scren radar, lil hard to see
but the indicators are there in the middle of the screen, with the tiny blips
if ur in game its easier to recognize, i made the alpha fade a bit
Ah I see
i manually add to each player controller's hud with the actor itself.
once you do thata, each actor component will have a diff id
i probably did this the long way lol
if i used the default player names arr like you did the code would be simpler
but i had issues with the name not printing just like you did
if you turn on component replicates, for the actor component you have the ID for
i know it should work both ways, client -> server and server -> client
if i were you though i would keep debugging, it seems like you are probably close with it
heres the function where i add the array
and what i do is i add it to all HUDs in every player controller
@twin juniper did you change your multicast
hi
nope i have been busy doing level design for multi
i wrote it down in a list of task changes tho in my notepad
good news is level design is almost done ๐
just adding player starts and spawn points rn
Did something change in terms of Destroying Sessions in the last few versions?
I was always able to destroy a session in the MainMenu when coming from a match
And then being able to host again
Now it tells me it can't destroy the session, however it also tells me the session already exists when trying to host again
:/
Even calling Destroy session when actually hitting "ToMainMenu" in the match doesn't destroy it
LogOnline: Warning: OSS: Can't destroy a null online session (GameSession)
LogTemp: Creating Session with ServerName , GameModeName: Deathmatch and MapName Atrium.
LogOnline: Warning: OSS: Cannot create session 'GameSession': session already exists.
Hmm
Guess it's a PIE bug
Hello
What might be cheaper, in terms of optimization>
Vector Net Quant or a Vector2D ?
(I only need X and Y from an actor location)
@reef tinsel You can still quantize the Vector2d no?
Quantize it, and only use X/Y at least
I'm setting up Steam achievements, and I've done it before but can't remember this problem I'm having: I can see achievments in the steam overlay, and I can unlock them, but when I click "show all achievements" in the steam client for the app, it just takes me to the community page?
This is problematic because I need to test stat progress, but I can't see the progress without going to that page
I'm wondering if it's something that only becomes available once the app has been released...
Nah
I was using acheivements/stats prior to the Demo Launch
Just make sure on Steamworks it's active
It is active, and I can see the achievements (I've even unlocked one), but selecting "show all achievements" so that I can see what my stats are, just brings me to the community page
There doesn't seem to be a "all achievements" page for this appID @wary willow
why is my client lagging so much?
it updates like once 10 seconds
when i call "SetActorLocation" on server it happens instantly but client teleports to that position only after maybe 5 seconds
@granite jolt hey u there?
usually yeah