#multiplayer
1 messages · Page 333 of 1
and honestly a lot of your questions are design questions
do you want the player to pick who they drop in as?
or they randomly get a person and can switch to the other if wanted. Or do you want a period of time where people can choose? if so what are they looking at and how are they represented?
All of that will differ on your solution unless you want to support both ways.
but basically the player connects -> Player Controller is created and the gamemode has default pawn class that it will create everyone as
tons of ways to do this but a simple way would be to just make a default pawn that displays a hud that lets you choose who you spawn in as
but this would do that for all players not just the coop connectors
another way could be having that default pawn as your playable class now and overriding the functions in gamemode for the newly connected
basically on the server you check to see if any other controllers exist or get the player controller index
so its not having a player controller always
just when they connect and destroyed when not connected
but the new player doesn't get a choice they just take control of next available member
the player state will determine which character information you are controlling?
I think I understand
got to research player states now
thanks
😄
no problem
and yeah player controllers aren't always around so when the player leaves, replace the pawn's controller with an AI controller. I think the default is to destroy the pawn with the player DC
I want the pawn to stick around regardless of player 2
it does go back to ai control
but I'm talking to another guy
and he says a way to do this is using a interface
to go through an array of my actors and just possess each
the interface will communicate with each actor and I just take control of each
but I have 0 experience with interface blueprints
I'm sure its similar but I don't know where to start
and I got so much other stuff I don't know if I'll end up just messing everything else up or what
I already spent the last 4 months trying to figure so much out and its never enough
I need ice cream and a break
ttyl
Wonder if you could just on un posesses have Gamemode spawn a ai controller and possess it
Depending on game might cause some issues haha..
can someone help me with replication?
Whats the issue?
i want to spawn a widget indiviually for each player, only appearing on their own screen, but when i create it and add to viewport it adds on all clients' (other players) screen
i tried run on owning client but doesnt work
Are you using splitscreen?
Use Add to Player screen instead
no i mean , im not using split screen
im running 4 instances at the same time, 4 different players, they dont share one screen
yes
How are you adding the widget? Is it via an hit event or begin play or something like that
begin play
Ok well you need to find an way to filter out your other clients and only allow the widget to be created for the client you want it to appear on
PlayerState has an unique ID for each client
GameState is used to track the progression of an Match and have that available to all clients.
how do i assign the player state to the actors
every actor in game belongs to the same class
PlayerStates are automatically created for each player
You can access PlayerStates in an number of ways
but how is the actor controlled
Not sure what you mean? Which Actor?
when i create the widget to be added on the viewport
how do i select the current client (player)
What Actor is creating the Widget?
So an Character Actor is creating it?
Do you know which Player you want to have the Widget appear on?
man
no
on the event begin play, the create widget must be called
all the player actors
belong to the same class
theres no way to know which one specifically is calling that
yes, i got the player id
now how do i make the widget spawn to that player id
to the player on theplayer id
If(MyID == ID) spawn widget
You need some sort of criteria for choosing the player
You have everything you need mate.
the problem
is that the widget keeps spawning on all clients' screen
shouldn't the owning player have a value?
on create widget
how do u explain that
Is GetAllActorsOfClass constrained to network relevency on servers as well as clients? If called from server, wouldnt it return all no matter what?
GetAllActors only returns the Actors that are instanced to that World. The server will only return the Actors it has in its World. Same for the Clients.
Anyone here looked through OnlineSubsystemSteam much?
@prisma shadow when do you want a widget to show up? I didn't read this whole thread but I might have some info for you
just when the player is spawned, on begin play
Usually is recommend ensuring then widget be spawned by the player controller.. So you want to find the right way to reference that and spawn it. For example.. Say you hop in a car and want a speedometer to show up. Well in the car pawn blue print. Event possessed gives you an opportunity to access the controller that just possessed it.. Then you can use that to create a widget and add it to that controllers viewport
Begin play depends on when that actor spawned not controller for example you join a server with people already playing your version of the other players pawns will spawn executing the begin play. Since to that client they just began play
What umg are you spawning that happens to everyone during begin play that you don't want?
it's a hud showing the hp, image and name of the player
So this is something specific to them as a character.
Perfect for possessed override.
So in your player controller. Create an event add HUD for example.
Write the logic to create add to view port etc
Then in the character blueprint. You can use the override possess. And when controller is valid cast to player controller class you are using and call the event
i cant access the default player controller
Let me see if unreal loads on this pos laptop.
It's modify slowly. Question what is the begin play in Thad starting this umg?
Third person character bp for example?
Good for thought. The character will be spawned before a controller possessed it. It's possible the event in begin play will end before its possessed meaning it's possible the hud is not added
Begin play starts when that class is spawned into world.
Still loading ...
@hasty adder so i create the widget inside the player controller?
its easier to maintain control that way, i'm missing something,
but you cant access the default player controller that comes with the project
do you understand about replication?
hey, does anyone know why "FindSessions" node would auto fail right when it runs?
Wish I coulda wrote more but was 2 am and sleep happened.
@prisma shadow to answer your question yes I will look into this more later when home again. Problem is some events are called from server and not client so controller is in accessible I can't remember what I did in this situation but I can assure you things like client HUD change and calling event to the client if controller == them are effective. But again need to visit, sorry 😃
Hey, guys, is it possible to set one variable to be always relevant?
I asked yesterday about variable, wich stops to replicate. I do not know the reason, but maybe relevancy will help me somehow
No, if the actor isn't relevant none of its variables will be replicated
At the same time though, if it is relevant there's nothing you have to worry about, its variables will always be replicated
Hey there.
Do you guys remember oldschool games like Zelda 3 or Lufia, where you travel from Map to Map?
I would like to do the same, but in Multiplayer.
What do I need to know to achieve this?
I tried the Open Level Node, but it resets everything...
Im guessing you would have to call server travel from the dedicated server
Oh. Blueprints have no functionality for that
I think you can use the console command
And what about additional Parameters for the Map?
@modern dome See if this is useful for you https://www.youtube.com/watch?v=_l0CbUjxVOw&
Here is a tutorial on how to save and load levels using blueprints. This may not apply to everyone but hopefully the concept can help you apply it to your ow...
When I call "Switch Has Authority", will a Listen Server call the Remote Branch?
Or do I have to do something like this?
"Has Authority" isn't about server or client.
It's about authority on the object the function is being called on
Yes, the server will have authority on all objects. But the client also has authority on their local PlayerController
@Raildex#6923 Authority means, you have the ability to change it. For example: A replicated variable, can only be changed by the server.
AGameMode has a function "PostSeamlessTravel" which is called after a Seamless Travel.
Is there a equivalent for Blueprints?
@modest elm because physics have too much time-sensitive data to be replicated
so what's the solution @slim holly ?
im making a very simplistic multiplayer game, is it that hard to just setup the physics?
technically yes
can you please just point me to the right direction?
sec I saw one panel talk about physics and networking
trying to find the link
it's long talk, but very informative about the issues and solutions
thanks a bunch
Is the GameState's Player array repopulated during level change?
GameState is generated each time an level is loaded. It will therefore get an new Player array
in multiplayer games everything must be replicated
except some things who are only shown to the specific player
how do i set everything to be replicated?
im stuck on that too @prisma shadow , all my physics are not in sync with server-client
people keep telling me i need to replicate it but i dont know what or how
Physics is extremely expensive to replicate.
When the Server sets a repnotify variable, will the notify be fired on the server, too?
Nop, only on clients and if server is listen server who actually client and server at same time repnotify will be not fired on listen server too
@modern dome in BP yes, in C++ no
It's a little odd, haha. In C++ you usually just manually call it if you need it
Can i use those match nodes between different game modes?
i have a game mode for the lobby and other for the actual game
wonder if it will work
Seamless Travel is cumbersome with BP -.-
So, it looks like there's a bug with Seamless Travel
I have an Actor which has Exposed String Values to determine to which map the Travel should go.
The Default Value is Entry (Standard UE map).
When I place this Actor onto the Map and change the Value to the same Map I am on, i can travel only once.
After the first travel, the Destination is "Entry"
it looks like the Edited Value is reset to the Default
Did you add the actor to the seamless travel list?
I am on BP 😂
...that doesn't change my question.
BP does not have that feature
If the actor isn't on the list, the same actor doesn't get brought into the new map
It's not a bug or anything like that
but the actor is there
it just has a default value
it is placed in the world like a static mesh
so it is automatically there
Okay, so you established why it's there when you travel
But it's not the same actor
It's a new actor that came about from being placed in the level
Like you said, Seamless Travel is cumbersome with BP. You're not wrong about that 😃
You still have to use its features to use it though, and if you want an actor to persist through a seamless travel you need to add it to the list
wait, why is it a different actor ?
It's just a new instance of that same actor that exists in the level
Each time you load a level, all of the actors placed in the level get a new instance.
Seamless travel doesn't change that out of the box.
That sounds wrong
when I load my Level on startup it has it's correct values. Why not on Seamless travel?
This implies I need to add every static Mesh to the Travel List, else they would lose their unique values
I think I misunderstood your question somewhat, thought you meant you were changing them at runtime, oops
Oh, ok. I didn't know how to rephrase it
Nah, looking back you explained it fine, I kinda just glossed over it
What I said about the list and stuff would still apply if you're changing it at runtime, haha. But this issue does seem weird
This is my "Travel Actor Blueprint"
Can you confirm the issue doesn't occur when seamless travel isn't on?
Hmm, magic
Exactly.
but my shared camera does not work after a travel 😦
Is PlayerController BeginPlay executed after a seamless travel?
Because that's where my Camera is spawned
No, that's part of the point of seamless travel
The PlayerController persists throughout it
If you need to know when a seamless travel occurs, use APlayerController::PostSeamlessTravel
Not exposed to BP, but don't know what to tell you
There are so many things I want to do before/after the Travel and nothing is really implementable in BP without any complications :/
Yeah, there comes a point where you might just have to consider biting the bullet and going for C++ in some capacity :p
Yo, quick question for you lot
Does anyone here happen to know of another networking solution for UE4?
Something I can just mash on top of the engine with C++?
@daring arch yup
oh? what is it?
Neat. Do you have any in mind?
But off the top, for "true_ MP experience, SpatialOS
GameSparks can be used also
Somewhat limited, depending on your exact needs. But doable.
I'm talking about something like Raknet
I just want something I can use to open two sockets and talk to another computer.
Well since it's open sourced
I want to avoid UE4's networking system.
You can probably do your own hooks into UE4
You could probably make some money off of it
Eh I'll keep looking. Thanks.
If you did it as a plugin
@daring arch what are the reasons that you want to avoid it?
I'm working on a multiplayer VR project and UE4's networking architecture is just plain balls for anything that isn't server-authoritative
ue4 has a xmpp implementation, so i'm sure it has a lower level socket layer too
yeah there is FSocket stuff https://wiki.unrealengine.com/TCP_Socket_Listener,_Receive_Binary_Data_From_an_IP/Port_Into_UE4,_(Full_Code_Sample)
gl
awesome. Thanks!
About Online Beacons: where should I spawn my AOnlineBeaconHostObject and AOnlineBeaconClient derived actors?
I understand that one is for the server and the other for the client, but where do I store and initialize em both?
Hmm, seems like I simply spawn it when needed
Hey guys, quick question, when I am updating variables in the Player State, must that be done on the server?
Because right now I'm doing a simple variable set in the playerstate when you click on a button in the hud, but the server is showing it as the default value when i try to access it later
Yes, replicated variables must be changed on the server
Okay, with a multicast call?
No, replicated variables are automatically replicated to clients
oh
It needs to be changed on the server though.
So if my HUD calls a function in my PlayerState, that's on the client. So how could i change it on the server? :?
I'm actually not sure either way if calling a server RPC on the PlayerState works
I know the PC owns the PlayerState so it seems like it should, but I've never tried it
ok so ill give it a shot i guess lol
Yeah it worked, had to do a super convoluted thing though. The function in Player State is being called by blueprint, which then calls a Server function which then calls a multicast function
If you're only setting a replicated variable, the multicast is unnecessary.
If it's not replicated, yes, you'll have to manually change it on all clients
ah i see
Can I do this?
UFUNCTION(BlueprintCallable, Category = "Team", Server, Reliable, WithValidation)
I don't see why not, is there an issue?
how do I cast to a custom player state class?
That "client first, approve later" method is what autonomous proxies are made for. I can't give you all the details of implementation as I haven't used it extensively personally, but I know that's the tool
That's how the CMC works, for example
@modern dome i mean what to put on the object reference genius
@prisma shadow ?
try creating a custom player state class and casting to it
no
it is the playerstate according to your GameMode
you have to cast it
from within Controller
Make sure your desired State is assigned in the GameMode
inside the player controlle?
yeah
only PlayerControllers (or the GameState where it is in an array) can access the PlayerState
pardon. That's not correct.
You need a controller reference to access the PlayerState
player controller -> playerstate -> cast to my custom player state class
exactly
i have done that, but it seems like it returns the default playerstate class
Is the PlayerState class set in your GameMode?
yes
is the GameMode used correctly?
i.e. is it assigned in your Project Defaults or in the World Settings?
set in the default game mode in project settings
then the PlayerState is set up correectly
oh yeah it worked now
thanks
the game state can only access the player state as an array?
The game state is not specific to a player, that's why
I mean, you should read eXi's compendium
to set the value of a player's variable inside a playerstate, it's player controller -> get player state -> cast to playerstate class -> set value?
because it changes only one player's variable and nullifies all the other ones
Does anyone know how does an online subsystem obtains a world context? My custom online subsystem should have a world associated but I'm not sure how to obtain one.
I'm tearing my hair out with replication issues, guys...does anyone know why I might be seeing these types of problems?
Make sure your traces are done on the server and not on the client. It looks like you trace on the client the shot was fired
if that's the case, why does it usually (but not always) display on both screens? Also, any ideas for the other strange behavior, where a player will die on one screen but not on the other? Or not die at all when they're clearly supposed to?
When shooting, execute a Run On Server Event which does the Tracing and Hit Detection.
why does this function only prints the caller player's name on the player state?
I'll try that Raildex; right now some of the logic is already on the server, but I'll try the rest there too
It's common Practice to do things like that (Tracing, Hit Detection, killing people) on the Server
The Clients only receive replications of these things
right, that makes sense; I just don't understand the inconsistency
every player has a different value in the Namez variable, but when i call that function, it prints the name of only the player who called it, and the other players' name appear as None
why is that?
@undone crane if you did the Hit Detection on the Client, the Location of Pawns can be different. Character Movement Component and the Movement Replication replicate only to a certaint degree
@prisma shadow Where are you calling this event?
on the character class
Is this event within the GameState?
yes
what is going wrong?
it appears only the client's name and the others as NoName
Did you set the player name through a client?
I think those bullet trails are sometimes not landing because the other player's aim might only be relevant when player 1 is looking at them? how do I adjust that setting?
Anyone had any luck sending an FArchive via an RPC?
Trying to get around the fact that structs don't really support polymorphism
Should my first game concept be multiplayer?
if you're up for the challenge
don't make it something that's going to rely on tons of players though, because chances are your first game will not have enough players to populate it
So..
I have to completely disagree
Even if he's up for challenge
Makes absolutely no sense
Start off small
When I spawn an Actor (A Camera) within GameMode, will it exist on all Clients?
If you try to bite off more than you can chew too soon, you might end up hating your game concept
Or game dev in general
Crash and burn is a high possibility
So, do a single player game
@viral mason
Get familiar with the framework better
All the ins and outs, as you will
And after at least one complete game, try mp
ok
It's just way too much to handle at once
lel
well it'll suck that I'll have to spend half a million dollars and 8 years making my game, but I'm going to do it, damn it!
xD
Hum, are you trying to call the multicast client-side?
ah, yes
Well, I couldn't say what's acceptable and what's not
but I notice this is somehow similar to a fake projectile implementation
I mean, the idea
i just spawn a projectile on both server and client, and replicate its movement for the smoothing
normally works fine af
if its homing u have to replicate target tho
oh shit sorry
i thought u ment physical projectile
erm u can actually
change the param's on the client
and have them update correctly from the server
on next replication
but then u might big issues
with high ping
peoples hp jumping up and down
oh
no idea then
no idea how your doing it but multi cast rpc does not sound like the way to go
but im no expert
If u want things to feel instant then u calc them on the client
and let the server override them
really?
i use FX
and i dont multi cast at all
ah i dont do that
Well, should be acceptable since its just cosmetic
i let the clients handle it
It's the same idea with the fake projectile
since the client projetile (the fake one) is just cosmetic
you could even look at the UT4 code which implements it, afaik
thats why i tend to replicate bools and stuff
instead of full fx and crap
i handle all fx on the client side depending on replicated conditions
u dont replicate the fx, u replicate conditional informationt
to have clients trigger it
thats what i do
example
If client has X weapon equiped
Yes, that's what we all do
and begins firing the weapon
Bool is flipped
client grabs the vfx information from a data table
and plays it
just a random example
nope
Replication notify
when the bool updates & do X thing
your stuffs ticking all the time anyway dont forget
btw im not saying your wrong im right, its just the way i handle it to reduce bandwidth as much as i can
depends what your playing
impact or weapon fire
It just depends what your doing and what game you are
I compress all my data down as much as possible
bandwidth = money
and peformance
I cant really say everyone does everything differently
Example if target is firing
Make target pawn weapon play VFX
1 simple bool
when they stop on the server it sets bool to off
bool gets replicated
stops playing on client
its just me personally
like
i compress all weapon information and data, mesh, vfx, etc everything
inside of two bytes
well i use too, i use fname and byte now
How do you compress the bool?
What's the size of a BP bool?
no idea
a normal bool is 1 byte
honestly eoinobroin i wouldnt worry about it too much
unless your making something mad with heavy traffic
Hum, at least you know
hm?
I thought you were going to say a bit
lmao
lol
I don't really have experience with NetDrivers. Any thoughts?
SetActiveLevelCollection attempted to use an out of date NetDriver: GameNetDriver
DefaultEngine.ini:
+NetDriverDefinitions=DefName="GameNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="BeaconNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
Anyone have an idea of why this is happening? Its only in a build, testing w/ 4 networked machines connected.
I get the NOT SUPPORTED errors for almost every element in the game, and I get the NOT PART OF ROOT CLUSTER error on a good chunk of them.
This is all new to this latest build, as I've been testing in multiplayer for days without an issue.
Warning: Object ParticleModuleLocationSpiral /Game/ParticleSystems/Bluetech/Panorama_XaviHouse/Blueprints/android_xavi_blue/xavi_emmiter/COL_BASE_XAVI_REVERB2.COL_BASE_XAVI_REVERB2:ParticleModuleLocationSpiral_2 (0x0000025565f6b8c0) from cluster ParticleSystem /Game/ParticleSystems/Bluetech/Panorama_XaviHouse/Blueprints/android_xavi_blue/xavi_emmiter/COL_BASE_XAVI_REVERB2.COL_BASE_XAVI_REVERB2 (0x0000025560fd3440 / 0x000002550f560f90) is referencing 0x000002550185a260 DistributionVectorUniform /Game/ParticleSystems/Bluetech/Panorama_XaviHouse/Blueprints/android_xavi_blue/xavi_emmiter/COL_BASE_XAVI_REVERB2.COL_BASE_XAVI_REVERB2:ParticleModuleLocationSpiral_2.DistributionStartLocation which is not part of root set or cluster.
FNetGUIDCache::SupportsObject: ParticleSystemComponent /Game/Maps/panorama_basedrop.panorama_basedrop:PersistentLevel.prettybits_Bluetech_Panorama_XaviHouse_Track16_C_1.ParticleSystemComponent_46 NOT Supported.
@inner iris well thats easy, there pawn's bool would replicate too all players, the second they confirm they are firing on the server all clients get a msg that triggers VFX
What are u spawning
Weapon fire
or bullet impact
Muzzle flash
ofc they would know where to fire the muzzle flash
on the end of the weapon
i mean where else is it gonna be
so?
because i assume
all muzzle flash
comes out the end of there gun
right?
well then
U should have a marker of some sort
like a socket
For that weapon
thats where it would be spawned
on the end of there gun
the client should already know where the end of the gun is
if your replicating that, its pretty stupid
Bool says you are firing weapon
Spawn VFX on the end of the weapon
dont turn it off until it stops
yup
they dont need to know
where the pawn it
If pawn A
is firing his weapon
Spawn VFX on the end of his weapon
his client will know where his weapon is
what
no
if the bool flips on
It will replicate too all clients in net distance
it would fire on every client
the bool gets sent to EVERY other client
its relevent information
easily tool
done*
when the bool is sent to every other client
every client says
Okay
Player 6 Is firing his gun
Lets spawn a VFX on Player 6 weapon, at the VFX Socket.
its not an issue they all have there own bools
Okay lets think of it like this
Let me pull an example up
We are just going to use the logic of health okay
Its the same thing as
When health changes
It gets replicated to every client right
But i need to update every clients HP bar for each other
so everyone knows how much every target has
so what happens is this
-whipping up bp-
So when a players health changes on the server
the pawns hp is replicated to each clients version of that pawn
now they have Health bars above there head
Since the state of there health has been updated
I need to update the visuals
I dont send a multi cast
This happens
It triggers an event
Each of the pawn
when there hp changes
Updates there own Hp bar
above there head
Same thing with weapon muzzle fire
U cant do this for everything obviously
But when player 4 fires his gun
His IsFiring gets replicated
It triggers a client sided event
to spawn muzzle flash on the end of his gun
So its the same as the hp pretty much
when state changes
update visuals.
So i have ships right
big flying ships
And when they fire there primary weapons that have muzzle flash
a bool called
IsFiring, is ticked on
and that pawn on every players client, starts firing Muzzle flash
It might fire for 0.2 seconds longer than it needs too
but it dosent not matter
its all smoke and mirrors
Plus here is another thing man
Not all RPC's will go through
Ul have too have all your VFX RPC's on reliable
and imo that is bad
veriables will be replicated through
even if they fail on the first tick
they will go through
the input comes from the bool
Every pawn on every client
has its own bool
that is replicated
They dont need the information
Think of it like this
If This replicated Pawn is Firing, Spawn a VFX on this Pawns Gun
something like this
@sweet spire is right, but maybe not explaining it the best. (love you buddy)
haha
The "is firing" bool doesn't exist on some magic static level.
When replication occurs, the engine uses NetIDs to resolve a reference to the same actor on clients.
Using this, it links up the server and client actor.
Think of that as your weapon
When this occurs, that RepNotify is called on the same instance of that actor, only on the client.
Your getting the location of where you would spawn the weapon
listen to lethal though, hes good with this stuff
omg its placee :d
i was doing a gud ol bad explain place as usual :p
tbh if you're casting to a specific thing from an external location instead of letting the class handle itself- you're doing something wrong here
Lethal's got you in the right direction- use RepNotify
If you can do the same thing with a replicated var, no don't use multicast
If its so static like the end of a players gun, you can just bool is firing
But you can also do a similar thing with multicast
Because the bool thats replicated, is owned by the instance of that client
Here, I'll walk you through a basic thought process of the engine
It has nothing to do with the other clients, its "there bool"
Might help
go lethal gooo
Its just that rather than do something like Cast<MyThing>(thing)->DoAction; Cast<OtherThing>(extraThing)->DoOtherAction(); you'd wanna do something with an interface/dispatcher
dw eoinobroin, this is me 24/7 asking shit lmao
That's not directly related though, so I'll let Lethal talk
When I change a replicated variable on a replicated actor on the server, I notice it has ID f7a0f.
(arbitrary)
dw lethal had to explain to me yesterday how to count a value when u drop below 0 in a math sum, i dun goof'd and was fired
tired*
I go to the client with this information, saying an actor with id f7a0f has a change on their bool variable.
The client finds this actor (if relevant), and applies the change onto that actor.
It doesn't occur on some singleton replication object or anything like that...the RepNotify occurs on the client's version of that same actor.
Which allows you to use self/this as a reference point to do what you need to with spawning and locating where to do that
You can think of the behind-the-scenes linking as magic if you want, for a lot of purposes that's fine, haha.
Just know that UE4 links the server and client versions of an actor, and allows them to be referred to across the network as the same actor.
A similar thing actually happens with multicasts/client funcs - basically there should never be a need to cast to do networking stuff
Unless you're doing weird things at a really low level - in which case you'll know what you're doing
U could actuallt go as far as this
If pawn is firing
On client do line trace and plat muzzle flare
If wall or static is hit
Draw bullet impact
Play*
Obviouslt u wouldnt wann do player impact as it can be slightly off it can be misleading
So world and static impact is fine
Fine
But thats just me everyone knows me in here as im a total hoe for maxium peformance
No need to multi just bool it :)
Yup
Ud fire the fx on loop similar to weapon rof
Then have it stop on re notify is firing false
Im comparrison yes
1 byte vs god knows how much
Not all rpcs go through
I think its 1 byte
No worries man we all here to help each other
If lethal ever leaves im fucked
wow I cannot get particles/sounds to show up in replays. I just tried spawning the sound and particles locally, via a client rpc, and via a multicast rpc within character. they spawn fine in game but aren't in the replay for some reason.
how to cast to the character owner of the player state?
If you're doing it at blueprint, just drag the PlayerState and there will be a Get Owner function inside it. Then you can cast it to your Character class or blueprint.
that didnt work
bi
no
I want to cast to the character that belongs to that player state inside that player state class
its a cast from inside the player state class
Is this what you meant?
In my PlayerStateBP, I added a child actor and set its class property to my NXCharacter. Then to cast it, I have to drag "Get Child Actor" from it then cast it to NXCharacter inside BP graph
Sorry if I still didn't understand your question as my English is not main language. Maybe a picture would help.
NXCharacter uses that player state class?
is that the player state set on the default game mode?
what i want is cast to the character that belongs to the player state
I think I understand what you want to do now
PlayerController / PlayerControllerID is what defines the owner of PlayerState and PlayerCharacter you are using
so by getting the playercontroller, you can get what it owns (PlayerState, PlayerCharacter, etc...)
PlayerControllerID of 0 is normally the main player
but it's not the current player
because its multiplayer
its the player Owner of the player state
sorry, what I posted was for "local" multiplayer only. I'll keep you advised.
ok thanks
I was able to make it work by doing this:
From PlayerState, I created my custom event that will be fired by a specific player:
And to trigger that, I call PlayerState.DoSomething from the Character I'm using:
Having 1 server, 2 clients: When I press Y on server, that character asks its PlayerState to DoSomething. Then that DoSomething inside PlayerState, find its owned character and perform Jump.
Then that owned character jumps as requested by the PlayerState.
Same happens on client1 and client2. They jump indenpendently.
Inside PlayerState, you can then cast the PlayerCharacter to your own as in this example:
Hey guys, was wondering if anyone could help point me in the right direction of how to destroy network players characters after they leave the game...currently I have an EventLogout on GameMode that grabs the controlled pawn from the passed playercontroller, but it doesnt get removed from the servers view...wondering if maybe the playercontroller is no longer controlling the pawn by this point? any ideas how to do this properly?
Can someone maybe help me with this 😁 ? https://answers.unrealengine.com/questions/675185/how-to-do-bp-movement-replication-server-reconcili.html
Hows the level streaming these days for multiplayer
I want to use it for a subway system
does it still require it to be loaded for everyone?
Is there a possibility to wait for every player in Seamless Travel before the Map is loaded?
Players can already move although not every play has travelled yet
Yes @Raildex#6923
You can have in your game mode a variable that determines this, and a function that goes thru all player controllers, checking to see if "loaded" is enabled. And that value can be sent from the client to the server, when they you know.. actually load the map.
I'm sure there's a simpler way, but that's how I would do it.
Is this a good way to check when damaging an actor other than the attacker in OnDamage method in cpp?
void OnDamage(...)
{
if (GetOwner() == OtherActor)
{
// We do not want to hurt ourself, that's so emo.
return;
}
}
uhm
how are u getting the other actor?
if its a linetrace
u should be able to set the trace to Ignore Self
My melee weapon had a collision box which I use to check for OnOverlapBegin and get OtherActor from that
Maybe I could use that linetrace to check what part of the body of that OtherActor got hit and do a flinch anim based on the body part got hit
Though I have more serious issue in my animation where client animation are twice as fast then the server for AnimSeq. Anyone encountered the same issue and how to deal with it?
Ok i have a bit of an issue
So I made a custom crouch movement system
If a client is the server.. that person can see others movement
If a client is not they cannot see the crouch movement
So if i have 3 clients.
Client 0(Acting as player & server) they can see client 2/3 movement fine
Client 1 Cannot see client 0 or 2's movement.
Client 2 Cannot see 0 or 1's movement
So to be clear, when I'm saying "cannot see movement" I mean.. they see it initiate.. then the movement stops immediately.
I'm guessing you are not using replication. When a client performs crouch, it is only performed in the client-side. the server does not know about it and can't tell other clients you performed it.
No I am
I'll get you a small video/gif
Instead of performing the full action, they start to... then stop on other clients
If so, then I think I've read somewhere with similar issue as yours "See it initiate, then movement stops immediately"
let me check on that
try to post the video, might be useful for us
You can see on the far right its just "shaking" or something
but the server (big window) can see it fine
I have a second monitor with the Client 2 which I'm doing the crouching on ^
This old forum post might be the same issue as yours?
The posts are not helpful until the end of the thread though
I'm just not sure what's the status of it now
Damn, back in 2014
Sorry for asking, but you did use Run on Server and NetMulticast to replicate the crouch on clients?
Can you try the one on this video?
https://www.youtube.com/watch?v=z7DI17JAGQM
Hey guys, this time we will: - replicate animations to clients and server ___________________________ As always leave a comment if anything is unclear ______...
ah, what node did you use for moving the char down??
I'm no expert at replication yet, just still learning it like you. But can you try changing your CrouchClient from "Execute on owning client" "Execute on all clients"?
Well
I have 2 events
CrouchClient & CrouchServer
If the client has authority (aka the server) then it'll run Crouch Server
If the client DOESNT... It'll run Crouch Client & Crouch Server
which might be my issue
cuz it's running twice.. and i have a player crouched boolean
I think that's just fine
But I'm assuming the "Execute on owning client" would only execute on the client that performs the crouch and would not replicate on other clients
So "Execute on all clients" might do the trick?
Sorry, I meant Multicast
I've tried Multicast for crouchclient event
Ah I think I Multicast fails because its being run on client (HasAuthority->Remote)
If it's multicast its working the same as when i do "CrouchClient on owning client & then call crouch server"
Can you try to disconnect the CrouchClient and...
sorry, no don't disconnect
But from the end for CrouchServer, call CrouchClient (Multicast)
And from your "Switch Has Authority", its backward
when Remote, pin it to CrouchServer
The reason is, if you're on client-side (Remote), that's where you want to call the Server event
Like this?
https://i.latouth.com/2017/fp5CcMbu.png
yes
Flickers the same way
then on at the end of CrouchServer, call CrouchClient so the event would be propagated to clients
Let me bring up my editor
Those 2 red nodes on the left side is crouch server & crouch client (below comments)
Yes, but right now the CrouchClient (Multicast) is being called on the client side because of the SwitchHasAuthority->Remote
that will be ignored since Multicast node has to be called from Server
I've tried it like that
You probably might have a deeper issue?
Such as?
Its working on my C++ code, though the client anim play rate is twice as the server though
I'm not sure, maybe the same issue from the forum I posted earlier?
Just an FYI
I made a little print string node for both authority & remote "has authority" switch
So if remote it would print "Remote perms"
if authority, it would print "Authority perms"
And the server came back as "Authority perms"
The clients came back as "Remote perms"
yes, that's expected
you have it backwards then
wait
Ok so i replicated what you did
so if authority, it bypasses others and goes straight to calling method and such
But if server crouches it doesnt seem to replicate on clients
So now..
Client 1 can see Client 2 crouch
yeah, sorry I was wrong about the authority
But client 1 can't see client 0 (server) crouch
both remote and authority should call CrouchServer
Authority -----> Server
Remote ------> Remote client (Remote from server)
I think i got it
if both call CrouchServer... Just call CrouchServer
I made remote call crouch me then call crouch server
then authority call crouch server
crouch me is the event for starting to crouch (the actual movement of it)
You can do what PlaceholderName just said, get rid of SwitchHasAuthority since both pins calls CrouchServer
So the takeaway I learned from that before is, Remote can't call "Run on owning client" and "Multicast" since they'll just be ignored
It has to go through the server
Remote calls "Run on Server"
"Run on Server" calls "Multicast" (or "Run on owning client")
then that will be replicated to server and clients
Time to cleanup the names 😄
"Crouch server" for both authority/remote 😦
I feel like I don't need an event to call the crouch movement
wait
Is "switch has authority" even needed if both Authority & Remote call "Crouch Server" @severe widget ?
Since regardless of authority it calls the same thing...
what I'm saying
Yeah you can get rid of that now (SwitchHasAuth)
I still have the issue where AnimSeq are playing on clients twice as fast from the server. Not sure what's causing it as DeltaSeconds, CustomTimeDillation, GlobalPlayRate are all the same for server and clients. AnimMontage play rate are fine though.
https://www.youtube.com/watch?v=b9HOfGOlaH0
UE4 AnimSeq on client plays twice as fast on Clients(mid and right) than Server(left). The Server anim play rate is the expected. Checking the DeltaSeconds, ...
I'm still going to keep a switch has authority so I can easily add a call in later when they crouched
on the playercontroller how do I initiate the GameMode to respawn my PC's pawn?
Is it just an event that's called on the PC from the Gamemode?
I suppose it's actually defined as the DefaultPawnClass.
Anyone know if sessions are able to be created and joined without having to open a new level straight after creating the session/client doesnt need to travel to the server's level? Trying to configure creating/joining a lobby from my menu
Following Scenario:
I have an Event. This Event should be called locally on my machine but also replicated to all other clients aswell. However I don't want my Machine to wait for the Multicast RPC but execute the Event separately.
Is it possible to exclude my machine from a Multicast?
just add an if in the multicast to not execute its logic if it is locally controlled
Just referencing Battlegrounds (a UE4 game) and it seems no matter what server region I was on, the gunshot sound, muzzle flash and trace / bullet impact FX are all called instantly on the client (of course the server would also have to also do the trace to verify if anything hit and actually deal damage).
This brings up the question of if on your client, you were perfectly on target and you see the bullet hitting where you were aiming (an enemy for example) but on the server, your aim or the enemy could have moved enough in the time it takes to call the logic on server and send the info back to the clients to have the shot miss.
Is this just general "desync" and considered better to give players instant feedback (calling all cosmetic cues of the shot locally instantly) even if the result is not the same as the server's version of the shot?
I know this is a common area of frustration with some games "where are my bullets going?", so I wonder if it's either a design choice to wait for the server to respond before firing but have a more consistent response when shooting or have the client fire locally instantly but deal with frustration where you see shots landing that didn't actually hit at all?
hey guys, ive been testing my multiplayer for a bit, with super smooth movement on all clients, then allof a sudden today, the clients are jerking in their movements...Any ideas what may be causing that sorta issue?
is tehre a reason onrep notify is a little slow? It seems to take about a full second
@inner iris, you are correct that its a design choice. You have decide whether you want a more accurate, more cheat proof but delayed response to the players specially on those with slower connection VS less accurate and less cheat proof but more responsive to players which gives better gameplay experience. All Lan/Online FPS games I've played decades ago doesn't have that kind of server check where players would experience and think "where did my bullets go?" so I can't say much about Battlegrounds.
@fossil silo, I'm experiencing the same issue. I'll let you know if I found something about it. Also, please let me know if you found what's causing it.
@dull yoke watching some GDC vaults (Fighting Latency on COD BO3) it seems that a lot is done on the client visually to give a smoother experience but with lots of super optimised prediction tricks to help iron out inconsistencies and issues. Really interesting stuff but since UE has its roots in shooters, it probably already has a lot of super optimised netcode.
Regarding the jerking movement question @fossil silo I recently had a similar issue- when doing any actions that weren't part of the character movement component like sprinting or crouching. I fixed it by calling the same sprint or crouch function instantly first on the client and then on the server- it made the movement feel super smooth with no choppiness. I guess before, the client had to wait on the server to apply the movement so it was super choppy. Not sure if you have the same case here but all movement is silky smooth since I did things on the client first (not sure if that is common practice)
interesting @inner iris thank you for the feedback
and yes @dull yoke ill letcha know 😃 and thanks
I fixed mine by fixing my other issue which was client AnimSequences plays twice as fast from the server (i.e., walk speed is normal but walk anim is twice as fast)
I don't know what's causing it though, tried to remove all BP nodes and recreated a simple Walk blendspace on my AnimBP but still clients' walk anim are still fast.
The fix was to completely recreate my AnimBP from scratch, copy my original nodes, recreated some AnimBP variables that got lost from copy-pasting and now anim speed are same for all server and clients.
@inner iris If you're referring to pubg by "Battlegrounds", all of the shooting logic is client side. For instance there is a bug that some players don't load buildings in some games, and are able to kill people through walls, etc. I disagree with having 0 server side checks, as movement is client side too (you can walk right through anything), but I also don't run a game with 400k concurrently active players so don't know how much more of a server strain it would put on it.
Alright.. question about ping
So usually this is how you calculate ping? But i dont actually think this is correct.
Anyone have some insight on this
When i use cmd it's like 30 less
Hello guys, i want to know on a Windows Server 2012 R2, do i need port forwarding to use open [IP] command to join dedicated server ? or i just need to add a rule in windows firewall ?
if you get it from a provider you dont need to port forward, just windows firewall @wet oriole
unless you use AWS
then you need to do their firewall rules
@raven holly Ok thanks, I think i should add that dedicated server to firewall rules and make all port available, right ? because i to run different instances from dedicated server .exe
@raven holly Isn't the Ping in the PlayerState already in ms?
I wonder why it's a byte and not an Int tho
you might aswell convert to Int before multiplying.
Yep, convert to Int before multiply
and you should get your ping
^
@reef berry Wow so PUBG lets the client decide if they hit something?? That's pretty crazy- seems like the one thing that is always a big no no to prevent cheating.
I guess it would work like this- client fires trace locally, if it hits enemy, run server RPC that deals damage after somehow confirming the hit or possibly just deals damage and doesn't even confirm?
There is an uncompressed float which holds your exact ping, but it's probably not accessible via bp
@modern dome yeah i get ping from player state but its inaccurate af
off by like 20ms
20-30
is that in player state?
yeah, but you probably need C++ to access it
link
that's your byte ping
divided by 4
The Ping you get from Player State = ((byte)(ExactPing/4))
@inner iris, all lan/online FPS games I've played (decade ago) always seems to use client-side to check if they hit something since server checks are very expensive so you they only do server checks for the most important things in the game. To compensate against cheaters, they install an agent on your computer that monitors if there are processes that tries to modify their game state in memory. Though of course, not everyone likes it.
@dull yoke I'd say a gunshot would warrant a server check since it determines if a player lives or dies, no? Would there be anything more important than that in a game?
If you do pass on the information from the client, would the server need a "snapshot" of the frame the client shoots (client + enemy position in the world to retrace to make sure the shot was possible)?
Lots of time traveling in MP logic it seems 😄
i send hit data to server re-do the trace to check if it hits a wall etc on server
But what if the target has moved enough in the time it takes for the server to run the trace that the shot misses?
A fast moving enemy for example
It wouldn't replicate the exact same positions that the client's shot took right?
if they hit it on their client, it should hit
this is what games mess up
they compromise for protection when really they fuck their players
It seems a few frames can make all the difference- the server, the client and the enemy all have a different idea of where they are currently
think about ping of both players
So for something moving fast, it could be something different for all of them and hit on the client but not on the server
youll end up with a h1z1 hit reg
Yeah exactly
when only 20% of bullets register
i trust my clients to send their hitscan to the server
server just checks for walls inbetween their hitscan
to prevent removing walls hack
aimbot can be detected through other means
hs ratio, distance to player
Ok so this eliminates a lot of the shots missing , but what if the client who is sending the hitscans is super laggy and is seeing players before they have moved behind cover, shooting them and then dealing damage
When from the enemy's perspective they were completely behind cover
but if you want a good PVP game you have to trust if the clients hit something, let them hit it
true
you can check a few things
check the actors distance from the hit location with some error allowance
e.g 2 metres
yep
i use that as well as the object checking
if either fails itll stop the calculation and it will use the servers trace instead
so itll still impact something
np man 😃 #powertoanticheating
It seems H1Z1 definitely doesn't have a lot of this kind of stuff properly implemented
Laggy players always have a big advantage
h1z1 is server side hit trace
so when you shoot, server does the trace not the client
Ah yeah, explains the delay for hitmarkers sometimes
They still fire the cosmetic stuff right away on the client though right?
yep
Just waits for the server to actually deal damage
Ah yeah but the actual traces are done by the server so the client is less accurate
This is an interesting read: https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
Thanks @dapper galleon !
always do some sort of check
Will do, super interesting stuff around this- interesting to see what exactly is left on the client for responsiveness etc all for the illusion of a smooth experience
and theres different things you can do, but depends on hitscan vs projectile
I'm using all hitscan right now to minimize pain 😄
yeah its a pain you bascially have to do everything 3 times
1: owning client, 2:server, 3: players around you
Ugh yeah sounds like a big pain
Yeah some things are much nicer as projectiles
What logic do you call on the players around you?
depends what kind of game
Do they also simulate the projectiles on their client?
what we talking about
I'll be implementing non hitscan weapons for grenades/rockets so will eventually be adding them
pubg?
So you wouldn't simulate the projectile on the client?
Or would you interp between the client's simulation and the servers sim?
well you would want to run away from a grenade right? lol
if you seen it coming
that would be a client authoritive grenade then
kinda bad
Yeah 😄 I mean would you spawn the actual projectile on the client and then on the server after or just on the server and deal with the slight input lag?
if the person who threw it was lagging the grenade could just randomly appear and boom
just the server and compensate for lag with throwing animations
Another amazing idea haha damn
So the client has a nice wind up anim when pressing the throw grenade button
so when you are pulling the pin, it spawns the actor on server, then when you throw away it goes
😉
Love these clever but simple tricks to hide the latency
The GDC talk on COD BO3 had some similar stuff where they'd have the head of the player offset in the direction they were running for more accurate hit detection
They saved something like 90ms of percieved latency that way
nice
Does someone have a lot of time and patience for me?
I actually want to implement something pretty easy:
Seamless Travel with fade in/ fade out.
But I can't make it work somehow
how are you trying to do it?
I want to have it the following way:
- Players play around in Map
- One Player touches special Actor that initiates the Seamless Map Travel(TravelActor has targetmap and location)
- Local Player fades to black and notifes everyone it wants to initiate a Travel
- If Server faded to black, wait for all clients to fade , too.
- If all faded to black including Server, do the actual "servertravel mapname"
- Server waits for everyone to finish travelling (World should not tick yet!)
- If everyone travelled (Use OnHandleStartingNewPlayer Event for this?) , begin world Tick and fade in everyone's screen
I tried using the GameState, but I have problems notifying the Server that everyone faded to black, because it said only one player is ready.
I then tried to communicate between PlayerControllers with RPCs, but that didn't work either
So your problem is how to know every client has ended the map travel?
both actually. I don't know how to notify the server that everyone did somethign
Did you notice GameMode::PostSeamlessTravel()?
is there a way
to limit a multicast to run on ALL - the local client who called it?
becaue im getting it called twice basically
for my chat box
its sending it on all clients, but then twice on the local client
run the function locally on the local client and then put an if statement in the multicast to not do anything on local client
IsLocallyControlled
ok ill try it
@jolly siren didnt work 😭
show code
o
ya
Rofl
lemme see
@jolly siren yeah so every time i send it
it sends the msg 4 times
i think i got it
i just changed it to use a repnotify
i created a repnotify variable called "Chat msg" on the character
Just wondering, has anyone tried hooking up their game with Wocommerce API?
For exanple, buying a digital item in Wocommerce unlocks thr asset in game. I want to use this as a main game mechanic but I'm not a coder
Just remembered I asked something similar a few years back https://forums.unrealengine.com/showthread.php?55112-Possible-methods-to-tie-in-game-currency-with-a-web-based-point-system
Should the client be able to call run on server rpc on the game state?
I think not
@slim holly Looks like it doesn't. Thanks.
Is it safe to put game win triggers inside PlayerState?
i.e. 10 kills to win, sort of thing?
The rules are generally defined in the GameMode and tracked by the GameState- PlayerState is per player and doesn't track global score. You can get an array of PlayerStates in the GameState and determine if a player has won there (please correct me if I'm wrong, also still learning)