#multiplayer
1 messages ยท Page 311 of 1
- It does not work for client, when I try to restart with client it just crashes engine (probably because only server has access to GameMode)
2. When I spam respawn button while turning camera around, FPS goes down significantly even to single digits EDIT: found out that this has to do with player 2 spawning incorrectly
@verbal slate - heres a RESPAWN request setup inside of the GAME MODE - called from PLAYER CHARACTER class from a SERVER RPC function -
Thank you, I'll check it out
this obviously uses PLAYER STARTS array that is setup at PostLogin event inside of gamemode of the SERVER client.....
found here:
http://puu.sh/u1Pmz/1a485c9286.jpg
you'll definitely want an AUTH branch - because this fires for any connected client
actually to more correctly put it - this fires for every client that connects to a NON-SEAMLESS travel
QUESTION - through docs reading, various tutorials & examples... they claim that GameState class is known to all connected clients.....
Well why do i have a replicated variable that never is replicated to client - but server sees it just fine in GameState class? Gamemode is setup to use this gamestate, the replication fo teh variable is set to REPLICATED. But this timer function i'm doing to pump the variable just to test, is sitting at 0 on clients, but increments on server.....
Is there a better way to do a TIMECLOCK function ?
either one displays 0 (default) on clients
Instead of trying to access this variable from each client - should i push this variable TO the client from the game mode? I can easily do that.... i guess it woul dbe 0 difference in bandwidth no?
So it doesn't get replicated?
I mean, the GameMode itself does not exist on the Clients
So having a replicated Variable in him makes no sense
The GameState on the other side should work
Can you should me how and where you are actually setting the variable?
@worthy wasp
Hi all! Just looking for some guidance on getting RPCs working properly. Building a multiplayer proejct in which two pawns play their own version of game side by side. I have one of the players set as a listen server at the moment, and for that player, all of my RPCs seem to be working properly and replicating to the other client. I'm having issues however running any RPCs on my client. Just getting the no owning connection for this actor warning. I tried setting the owner of any blueprint with this issue to the playerController of the client's pawn but still no dice. Am I missing something with how that needs to be setup? Thanks so much ๐
I'm guessing you're trying to call a server RPC on another actor from your client?
You unfortunately can't do that. It's basically a way to prevent clients from calling their own authoritative calls onto an actor that they don't own, which means you have to work around it
Setting the owner of an object to allow it to call server RPCs on is a solution that really won't work if it's a replicated actor to everyone, as you will only enable one client to call onto it
@brittle sinew Thanks for that clarification, much easier to understand than some of the documentation! What is the best approach then for calling server RPCs from a client, or rather asking the server to call them itself? Sounds like Set Owner is definitely not helpful >.<
The only real way to do that is routing the RPC call through something your client owns, like its PlayerController. It is a bit of an inconvenience, though it makes for a much more robust set of things the client can and can't do
Okay I will try that instead. By routing the RPC you mean having each actor receive an event / function call from the client's PlayerController, rather than calling those RPC's within the actors themselves correct? The events within those actors wouldn't need to replicate then, right? Thanks again for the help by the way, it is much appreciated!
@chrome fable Are you trying to do something like OriginalSin?
Also
You don't have to use PlayerController to do RPC calls to the server or receive them
If you wanted specific stuff to happen to specific players, use their playerstate
Or to keep track of stuff for each player
But you can make Server RPC calls anywhere you want, as long as you know why you are doing it
I think what you are looking for is Is Locally Controlled
For the other stuff
I don't believe you can just make server RPC calls on unowned objects? Or at least I haven't as long as I've been doing MP, and the docs say that as well
Not to receive, obviously
What do you mean by "unowned objects" ?
An actor that a client doesn't own
I still don't have all the MP lingo down
Do you mean the client's version of the server object?
Or like some actor in the world, that is just hanging free?
I mean some random replicated actor, owned by the server or another player, you can't call server RPCs onto
By design
So, you're saying that I can't call a Server RPC from a player or whatever event caused the Server RPC call, to that random replicated actor?
Yes.
Are you sure about that?
You own your PlayerController and consequently your pawn, so you can call events on them
Designating function replication across the network
There's a table midway down, that shows what occurs
If you're the server you can do whatever, just because you're the server, so I'm guessing that's why their server worked but not client
Ah, so you mean that the client version of the server object will not do anything
Well, not really, the RPC call will not occur at all
Hmm
Why not? It should
If there's a replicated actor in the world
That means the server created one
And if the clients can see it, that means they have one as well
Yes, but they don't own that actor unless you manually set them to
The RPC call should still occur, but it wouldn't be translated to the clients
Yeah, looking at the chart now
?
If you call a server RPC from a non-owning client, the call doesn't occur
I am looking at this
Yes, from the server being the keyword
Ah you mean calling it from
I thought I asked that earlier though
And you said calling it to
Yes, I meant to earlier
Ah
Main rule of thumb is if you're the server you can do pretty much anything, if you're on a client you have to follow the owning rules
shameless repost from general thread:
Is it okay to call unreliable RPC in a game loop? How does it affect what is sent? Will it pack all the calls into 1 big compressed packet to send? Thanks for any info. I wish I had more time to closely study sources. ๐ฆ
for server calls, pretty sure you can't call them from clients if they're not part of the same class
So if the client actor is unowned, and say that actor calls another actor to perform a certain action on the server, it won't fire
Was wrestling with this in BPs
yeah I see what you mean, but it's not a problem here, because I do it from a possesed character
In my case I have to manually spawn anything anyway since I want everything to respawn once in a while
question is it a good/okay practice to call unreliable rpc every loop tick
and what does it do
in the end
why do you think so, it could pack it into big packet and compress it
or drop it entirely
due to being unreliable
What are you trying to call anyway
I want to send float every loop cycle via server rpc call
if it's on server, pretty sure UE4 optimizes it that only if the float has been changed it will replicate to clients
client sends it
UFUNCTION(Server, Unreliable, WithValidation)
void ServerSetVar(float Var);
to be precise
even if you make it send only on change
float changes pretty fast due to fractions
What is the float exactly
floating point variable
Yes, but what does it do in your game logic requiring it to be sent to the server constantly
sorry I don't see how its helping right now
even if I said that I have custom input that changes constantly it won't make a difference
Your input would drive your character to do something and that replicates
Pretty sure it's not the input itself that would replicate
yeah but it does not move it, it just affects it in a way its harder for player to control him in real life
anyway, if u want even more details
its an elliptical trainer connected via aruduino to pc from which we gather input and want to affect gameplay by making it harder to run on the trainer. The variable that affects current level of difficulty to "run" is on the server
you could argue to move everything to client
but thats besides the point
Hhmm
And this is happening on network?
Like how many people should thattrainer support at the same time
we could always change approach, but what I'm interested to know is how UE4 operates under the hood without taking much time to stroll the sources
yeah, currently up to 4, but more ofc is possible
If it's not many you can probably just stick with what you have in mind
And the difficulty is shared?
Can you see eachother's difficulty
no
So I'm assuming you're having an array of float variables for each player's progress
the only reason it is on the server is that server can control it and act on it by spawning mobs or anything else
not really
well, it will take a long time to describe everything
Well whatever you have that tracks the player's progress, that doesn't have to replicate
Only the server needs to know that information
the point is trainers are not connected to server
they act as input device
you need to know their input on the server
but thanks I got to the idea
that I could just get movement speed of the character that is already "replicated" from client
Hhmm alright
it wont help for every situation, so the question remains, but it works for now
ah no I can't
lol
player stands still at this moment, anyway, I'll figure it out I guess
Link to my Multiplayer Network Compendium to get started with Multiplayer in Unreal Engine.
Also houses some additional resources at the end of the compendium, as well as additional tutorials, such as C++ Sessions.
https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium
Make sure to also check the additional resources linked here:
https://cedric-neukirchen.net/docs/multiplayer-compendium/additional-resources
Aaand it's back online
wow) nice) always good to learn something new
re-routed my point of attention to Romero Blueprints Tutroial cause Network Compendum recommended me to do that
@thin stratus Is there a better way of doing this?
I need to spawn a replicated action (so server-side) then pass it back to client since InputActionHandler is not replicated.
Yes
Basically can I do something when the Actor (ActionSkill) is finished replicating
without doing a repnotify?
cause I will need to spawn multiple ActionSkills in a sequence
Well, the BeginPlay of that Actor calls when it's spawned
If you limit that to the owning client
Then you have a call for when it's ready
Aha
You then only need to handle that enum differently
I mean
You would remove the delay and rpc call
And then you would use the BeginPlay of the Skill
Do something like "SwitchHasAuthority->REMOTE->Branch(IsLocallyControlled)"
And after that you get the owner (or just PlayerController0) and call the "AddAction"
Which then would be just a normal event
Idk what the enum does though
Yes, though would work I guess
Yeah got that, was more like how you actually set it
cause in the image you hardcoded passed it
But yeah, you might be able to just pass it as a "ExposeOnSpawn" variable
Ok thx I'll give it a shot
No biggie
Sounds like it should work ๐
@thin stratus Worked perfectly ๐
awesome
I'm trying to access other players PlayerState variables in a UI.... so i can have PARTY HP bars.... unfortunately the variables are coming up default values.... which is weird because i can go to the PlayerState, print string the variables on tick and watch them go down as I take damage.... but this is all on the server thats printing it...
How do i access other's playerstates so that I have access to their variables inside? My current attempt was to GetGameState()->GetPlayerArray->ForEach(CastToPlayerstate()->GetVariables())
even as the SERVER - this is coming up as default variable values (currently 0).... but like i said - as i print string INSIDE the playerstate class, the SERVER prints out the variables appropriately
For RPCs, is it the event or the call to the event that needs to take place on an owned actor?
@chrome fable - i'm a bit novice (at best) for networking - but all my functionality happens within the same class - therefore all calls AND events happen in the same actor for me....
could you give an example where it would be different?
Sure, if you could imagine a set of two playerCharacters in a scene with an actor Blueprint containing a cube. Player one calls an event on that blueprint that changes it to the color blue. That event could be set to replicate, allowing player two to potentially see the change as well. Hope that makes sense ๐
Server RPCs can only be called from a client on an actor it owns, client or multicast RPCs from the server work fine on a client that doesn't own the object
And it must be called onto an object it owns, I don't think I answered that part
But, once you're on the server, you can do anything you want to any object that the server has access to
oh hey again @brittle sinew thanks again for the help yesterday! So you're saying that the call to the server RPC must happen on an owned actor, but additionally, the event itself must also exist on an owned actor?
Yes, the rule wouldn't have much use otherwise, as the client always has an owned actor in their PlayerController anyways ๐
I think I may be doubling my server RPCs out of confusion. I was trying to route them through a playerController or SetOwner on relevant BP Actors but still experiencing that ownership warning
Basically, you need to run the server RPC from your client PlayerController onto your server PlayerController, and set things from there
And this could also be done from the player's character since it is by proxy also owned by the client?
I believe the player's pawn is owned by the player, yes
so if i have logic that i want to run on the server and other code i want to run on the client i use the auth switch, when the server is in listen mode remote doesnt fire. So should i instead of checking for auth be checking for dedicated server so that a listen server can do both remote and server stuff?
@brittle sinew Structurally, would you recommend avoiding setting ownership on actors then?
and simply always route RPCs through a client PlayerController?
If a single client shouldn't have ownership over something, just in a "looking at the purpose of the actor" way, then no, you shouldn't set ownership on it
If you have an actor that corresponds to each player and needs to be used by that player solely, that might be a different situation
If I have a replicated actor that I run a server RPC on to change say its color, won't that replicate to clients? I guess I'm starting to get confused about the purpose of multicasting
If the component is replicated, then setting a variable on it probably won't have to be multicasted, no
But take a situation where you want a sound effect or explosion or something else that isn't a variable change, that might be better with a multicast
Ahh I see
any experienced multiplayer devs here? got some basic questions on the concept of a dedicated server in unreal. answering those wont take long i think ๐
a PM would be appreciated ๐
i did, doesnt really help me with understanding where which parts of the code go
@somber lava what code are you interested in exactly?
thank you so much for having Network Compendium link handy ๐
Pinned
Does actor ownership replicate if set on the server? For example if I set owner on a player's character, does that need to be multicast, or can it be run on the server alone?
@chrome fable read last night's msgs
Between me and lethal
There is a cheat sheet you can use
hey @wary willow, I did read those, thank you! I guess I was curious about ownership specifically, if that was something that needed to be set on a multicast or if setting on server is okay? It seems like the owner of my of characters doesn't get set properly on client but does get set on server.
Server is God
If you read that cheat sheet it will answer your question though
We were specifically talking about this last night and pulled docs
When a pawn is possessed, does its owner change to the playerController possessing it?
Yes.
@fossil spoke Thank you!
For something like health regen for a multiplayer title, obviously on the server i have a variable which is the regeneration rate, normally for a single player title there's no issue doing this on tick (multiplied by delta time obviously). however for a multiplayer title this would be sending replicated data every tick to the client(s). would i be better off say implementing a timer on the server and doing regen every 0.1s? or a longer timer?
as a follow up to that, if i'm going to do it on say a 1 second timer, am i better off syncing this for all players, so the game state will call a "regenHealth" function, that will tell every actor that needs to do so to do it on the same tick, therefore the replication will be a single packet per second (although with alot more data)
or am i overthinking things here? considering position data is already being sent every network tick anyway?
If an optimisation to the network is easy to implement, then why not just implement it, every packet that you dont have to send can be used for something else more important.
I would implement the regen as an Timer that loops with a RegenRate on the Server, the client would only be asking for the updated value of their Health variable via variable replication. The engine does low level optimisations for variables as well, so if the Health isnt changing the Engine wont needlessly continue to send the same data.
Variable replication is only ever made when the value of that variable changes, so if your Timer is running from RegenRate every 1 second for example, your only updating that variable once a second and its only sending packets for that variable when it is updated.
@fossil spoke - done, thanks for the advice ๐
Why would I have to delay after spawning an actor before attaching it to a component
๐ค
Like a delay of 2 seconds it attaches correctly
No delay is spawns in africa
ยฏ_(ใ)_/ยฏ
Question: why doesn't my rocket do any radial damage unless it hits an actor?
@orchid cairn I actually just did health and shield regen, figured it's best done in character
@slim holly - correct, or create an actor component for it. when i say it's on the server, i should have specified i have a variable stored on the server authorative version of my pawn where the logic is performed, with the result being replicated to the clients
I mean, you could set up a custom tick chain to update the values on desired intervals
like gameplay every tick, stats every 5th tick
but I'd rather rely on default replication and network priority when it comes to health, since it's kinda important value AND it's part of the hud
@raven holly - sounds like replication "lag" - are you spawning both the actor and components on the server?
Indeed I am
AI spawns, then begin play initates the spawn gun
All happens on server
spawn the gun, put a delay of 0 (basically it's a 1 tick delay) then try the attach?
Delays arent really reliable for this sort of thing tbh
hmm ๐ค
nope
@raven holly try checking is the component valid before attaching
But that wont fix it lol
It'll just throw invalid and never attach if it's not valid
The component is valid
yea but if it's invalid, you can set a delay of 1 frame and try again
there's nothing in the construction script of the component that might be messing you up?
it looks like an infinite loop
delay frames?
wwell technically dalay of delta world time
but I have function library addon for that
check out the LowEntry plugin for stuff like that also
yea that one
and with that code, you dont need a reference to the PC in the PS... or vice versa
you already have them
but back to the topic, it can't loop indefinetly because the component is generated on build(I assume) and it will be eventually valid unless the pawn build fails -> no loop
but if you're really worried about that, use Do-N gate
and set it to 1000 or something, so it wont try more than 1000 times before giving up
oh and if you do add >1frame delay, it can't crash the engine
it no longer considers it as infinite loop
arbitrary time delays are bad mmkay
I know.
the loop I showed you can be debugged tho
BP debugging, the execution pins light up
Cool.
Now I need to do this for my player ๐
Multiplayer is fucking hard sometimes.
SPAGGETI MONSTER
Time to tidy this up.
Structs always get messy ๐
you should see my level editor, that's a god damn spaghetti kraken
right, I need to figure out why the radial damage isn't working outside spawn room
o.o
or more like, it isn't triggering unless the rocket hits an actor
all that just to update one structure in struct array
because you can't directly set single values inside struct variable array
it did occur to me
this applydamage is suppose to happen in the damaged actor
which makes no sense
huh, it works on static mesh tho
but not on bsp brush
BSPs dont take damage i dont think
yea but neither do staticmeshes
hmm
so it has something to do with collision channels
ยฏ_(ใ)_/ยฏ
nope, mesh damage is off by default
actually
ahh I see
so the radial damage was set to trigger at impact point, setting it to trace hit location fixed it
so it was indeed a collision issue
reading through the network compendium atm. just wondering, do i need to include checks for authority in the gamemode? since it is only executed on the server i shouldnt need that, do i?
GameMode not exists in the clients, so you cannot call any function from clients. If you try to access GameMode in client, you will just get NULL.
well you rarely need to check authority anyway
how so? i thought this prevents cheating?
mostly, gamemode usually contains rules for the match
it's not impossible to exchange data with gamemode as client, but it takes the extra step always
you need to do event on client side, send it to server side which then looks up the game mode
or use GameState to exchange data @somber lava
only time I actually work with gamemode is when player requests a new character
You'll work more with it when you have different game modes and/or use the OptionsString a bit more
Other than that you can technically do a lot in all other classes.
hmm, my weapon child actor doesn't appear to replicate always
Reading through the shootergame mostly showed that a lot of stuff just gets rerooted to the gamemode which could also been done on the gamestate /shrug
That's probably why they split it into gamemodebase and gamemode
yo cedric, you know does radial damage ignore damage source intentionally?
Not using it often enough, sorry no idea
as in can't shoot myself with it
I doubt that
Radial dmg is also explosion
And that depending on the game can hurt you
So i guess you would need to filter that in the players Damage event
(DamageCauser ! = self) or so
mkay
@slim holly, you can override the receive damage function and add your own logic for your Damage source
yea but I had plans to use destructive enviroment
C++ or BP?
bp
Doesn't seem like there is anything in place
The calls are mostly empty
They are passing the DamageCauser on
but I don't see anything using it
Only thing I see is that it's not broadcasting the events if the Damage is 0
Seems like there is an event in BPs for "ReceiveRadialDamage"
But "ReceiveAnyDamage" or "TakeAnyDamage" what ever it's called in BPs is called anyway
as long as the dmg is != 0
log only prints client taking damage when server fired
but when I plug out the causer...
Oh yeah
So
the Documentation says your stuff is correct
DamageCauser: Actor that actually caused the damage (e.g. the grenade that exploded). This actor will not be damaged and it will not block damage.
huh
You can still get who caused the damage by using the Instigator though
So no worry
It's even a better way to do that
The DamageCauser is normally the Grenade
and not the Player
Or the bullet/gun
I actually pass the pawn along with the bullet
Yeah you would use the actual thing that deals damage
not the player
the player should be passed as the PlayerController in Instigator
ye I should probably use that more
hi everyone. I'm currently not quite sure, but the client who started the session with a map including the option "listen" becomes the server and therefore has the authority right?
yes
okay thanks
@thin stratus deleted the discord share now that you have site up again, just making sure that people don't use outdated guide if that's what they find on discord search etc
are these variables public?
i want to recreate them, but cant access them when they are private. do i miss something or do they belong public?
They are public afaik
But you can't set them
Only get
at least some of them
PlayerName for example can be set by using "ChangeName" function of the GameMode and passing it hte PlayerController of the player
Spectator and AIBot is probably somewhat set by outside events
Haven't found a way to set Score yet, though haven't really searched for it either
so when recreating them i have to make them public too?
You can't recreate all of them
awesome script btw, well done.
Ping is set somewhere in C++
Spectator and AI is probably also used in C++ and I would not recreate them
only ones you could recreate are PlayerName or Score
And I would make them public or at least private+getter otherwise you can't really use them outside of the class
And thanks :P
" or at least private+getter"
sadly i am a BP noob. i wanted to code c++ until i realized how different it is to java ๐
Well then I can only advise you to learn about C++ a bit more
regarding the script, the only thing that you might want to change is the backgroudcolor of the code snippets. i always have the feeling that i marked it ๐
private: only the class itself can access the variable/function
protected (no idea if exists in BPs): only the class and its children can access the variable/function
public: every can access the variable/function
yes i definitly want to. but i think its smarter to learn the basics of ue4 + game dev first
And getter: A const public function that returns a private variable
Also used to have some more control about how the variable is returned
i am familiar with java so i know the concepts, i just wanted to point out that i cant use accessors with BP. at least to my knowledge
The variables have settings for that
working more or less like you expect them to do
VictorBurgos told me about some Replication Bug(s) according to VR HMD and/od Motion Controllers. Are those still a thing?
And if a client is connected to a server, does the server always move the client after the client made it's input?
Or is this more like a paradigm for multiplayer?
@twin juniper By default the client moves as soon as he gets input (on client-side)
There's no way for the server to move the client as soon as the client makes it's input
Since it needs to recieve the inputs
I mean, you sorta can, but it will not be concurrent for all players
In source engine, the server will run players inputs in the past (so the effects are propagated until present time)
But that is only for players interacting with world, not with other players (which would be physically impossible as noted above)
Can one playercontroller make an other playercontroller kind of โunpossessโ it's pawn by overriding the possession?
if server allows it
Oh, do I need to run every action as โexecutes on serverโ to make it happen correctly? Multiplayer sure is confusing at first
server is the only one who can assign possesses
but finding the right controller references is gonna be tricky
@slim holly, @twin juniper, no you simply need GameState class, and you use the PlayerArray (an Playerstate array) from PlayerState you can get the player controller
Client : I made something
Server : Oh ok you need to possess this player, let me check the player array
I was kinda pointing out the procedure of converting local actor references to server references for possessions
I already use the gamestate and playerarray
Amazing screenshot, install gyazo or lightshot ๐
or dont install anything and use snipping tool ๐
Had gyazo installed and it broke somehow. I'm also testing vr multiplayer in a local network so no internet connection
Therefor, camera xD
you can do local testing while connected to internet
just do manual open ip.add.res.s
Maybe but I'm not doing that right now
VR multiplayer frustrates me. I tested the multiplayer shootout on vr and it worked, but copying all the relevant code doesn't help me in my project :/
And I'm not even testing the motion controllers. The widget interaction just doesn't work properly, because the second player is somehow blocking the first player, but can't do anything but looking around... if the second player leaves, then the first one can use widgets again...
where can i download the shootout project?
everyone is talking about it but i cant find it
You can download the project inside of the launcher
Launcher
Also, @somber lava if you need help, please post it here, so everyone can try to help.
You are free to tag someone if you want, so they can look at it once they have time
ok will do thanks
I would love to know why the widget interaction breaks when a second vr player joins the session ๐
3d Widgets?
i remember seeing something about assigning controllers for those
didn't look into it tho since I don't own a headset
Yeah 3D Widgets
no @rare cloud it's an widget interaction component issue Morpho is having
@Morpho aka VizualTek did you get your answer? Because yes the bug is still there.
You have to manually replicate the components if you don't want the listen server to move clients in VR
I want a listen server who moves his own pawn and interacts with 3d widgets. The second player should join as a client and move and interact on it's own. I'm currently testing without motion controllers, just gaze based
Right. Sometimes the HMD will work accordingly. But I wouldn't count on it doing that all the time. The motion controllers definitely do not work
If you don't manually replicate the components the listen server player will have control of all hand components
One day Epic will fix it....One day...
In the mean time. You can do it via tick, plugin, or source code change.
I save the motion controller issue for an other day. First I only want those two players to move and interact on themselves. The first player can still move but not use widgets when the second player comes in. The second player can only look, but both use the same pawn. The second player can at least see the first player moving around in space.
So I have to replicate the widget interaction or the hmd pawn manually? I'm really confused right now.... working on that for nearly 8 hours today
They even should have different pointer index each, so that shouldn't be a concern...
So now I have internet at the pc again.... @wary willow how do I manually replicate these? Is there any tutorial or manual for that?
In blueprint or in c++?
I'm just guessing but are you talking about this plugin? https://forums.unrealengine.com/showthread.php?116782-VR-(OpenVR)-Expansion-Plugin
i have looked through the shootoutproject + many tutorials now, but still cant find an answer. as i understand it the gameinstance is on the client and survives throughout level changes and so on. seemed like the natural place to store playername, playerclass and others for me. the playerstate is used during a game session to save playerscore and stuff for each client. but how do i communicate the playername/class from the gameinstance to the playerstate? i tried to fill the playerstate on "Event BeginPlay" but that never gets called, neither does the Construction Script. how do i communicate this data?
I guess you could tell the playerstate when the player joins the match with the "PostLogin"-Event which starts in the gamemode each time a new player is joining
Morpho thats my plugin, and it handles replicating the controllers and HMD, but if a plugin throws you off you can do it manually in blueprint and get it working currently
It doesn't throw me off, but I would like to understand this issue and solve it on my own ^^ Because it boggles my mind ^^
unless they recently reverted the ownership fix they applied that is. My controllers aren't derived from theirs so I haven't tested them in awhile. But they did specifically "path" ownership awhile back.
"patch"
motion tracking is client side, so the controllers movements must be client side as well in order to retain 1:1 tracking parity. The engine doesn't currently automatically replicate the client side movement to the server. So you'll have to manually RPC the locations up to the server and then from the server to all other non owning clients.
Like I said before. I used VR and HMD in the Multiplayer Shootout and it worked. I was able to play with those two Players. But in my project, the second player somehow breaks the first one, and I don't even use motion controllers right now
its just widget interaction you have issues with then?
currently yes. I have a hmd mesh which teleports to the actual position but is not rotating correctly (I would like to fix that afterwards)
did you set "Virtual User Index"
for the widget interaction component
or only finger index
virtual user is what you need
Pointer Index is finger for that players hand
virtual user is what player
hmm okay, maybe that's the trick for me then. I'm building my project and will test it
At least I think that the hmd pawn is modified (virtual user index) after I let them get possessed in the gamemode.
I believe that PlayerState->PlayerNetID is exposed in blueprint now
should just be able to set virtual user index to that
to avoid conflicts
PlayerState -> PlayerID is exposed. I think that's what you are talking about or is PlayerNetID something different?
Nope, still breaks it like before
Are you setting it both client and server? pretty sure interaction widgets are client side only
I did this in the gamemode, so the upper player is the listen server and the lower one is the second player/client
The virtual user index gets the playerid of the player
print out the virtual user index at the end there
see what the client vs the server says
@somber lava You need to access the GameInstance locally
To get the actual players name
If you store the name in the PlayerState, you can simply use the PlayerState's BeginPlay, limit it to the owning client (SwitchHasAuthorty + getting Controller for example)
Print somehow doesnt work right now xD
@somber lava Then you are sure that you're on the client, here you can get GameInstance, get the PlayerName and then call a SERVER RPC where you pass the server version of that PlayerState the name
That SERVER RPC then simply sets your replicated PlayerName variable
And that's it
Are you sure you are using that gamemode then
then you are going to need to break and step through and see why its never reaching your print node
Also the second player spawns at the correct location which is set in this gamemode
then how are you setting the virtual user index on the client? like I mentioned that you needed to
Do you even printscreen?
otherwise the client will have the wrong values
@twin juniper https://getsharex.com/
images + gifs
Currently having no internet, therefor smartphone
I know how to screen capture
And yes it is set to print to screen
@heady merlin I start at the โspawn meโ event inside of my gamemode. The game mode then spawns the hmd pawn and let player one or two possess it. After letting them possess the pawn I set the virtual user index to different values like I showed in the previous โscreenshotโ
you are setting them on the server only though
I just checked to make sure I wasn't going foot in mouth, but nothing in the widget interaction component is replicated
so you need to do everything client side as well
I would set it in the character honestly
since that is where the component is
but its up to you
begin play would be enough
but I run most of my init in OnPossessed
But how? I need to get the player count for that don't I? Or I need some other parameter so the two characters do not get the same value
you can still get the player state from the controller
and set the user index to the netid
on possessed also means that if you unpossess / repossess it uses the current player , so its future safe if you change a mechanic
hmm will try that tomorrow. For today my concentration is gone xD
But thanks for the advices
@thin stratus i did my best to follow your recommendations
is this anything like you meant?
also how did you mean to use the player controller in combination with the switch?
it's pretty easy to cheat with this system @somber lava
on your gamemode you can normally override function to login
or when player is construct
server fill playerstate and character and replicate to client
not the opposite ๐
with BP you can override OnPostLogin
i just want to select the class in the main menu and have my character spawn with it ingame
i am working on this for 4 hours now
everyone tells me different approaches
ok you only want to prototype
yes
just want to be able to spawn to work on the actual prototype itself
nothing more ๐
but i cant even get that to work
pretty dissappointing
this is the PlayerState
ok
in the options menu the player can chose his class, which then is saved into the gameinstance
i now need a solution to tell the server which class the client has chosen and spawn with that class
after reading the network compendium twice i figure playerstate is the BP used for this
I work with C++, but normally you can send arguments to server when you log in
because you need to make a GameMode for an offline menu
where you choose you class
and name
i only got one gamemode atm
since my menu doesnt use the gamemode at all
i didnt bother to create a second one
and once you made you choice of class and name
you simply use the command open IP arg1 arg2
like open 127.0.0.1 Bob Warrior
and normally server can read this
i use a listen server and sessions
the first client opens a listen server
the second searches the session and joins
oh ok
I have any experience with sessions
only dedicated server sorry
but normally you can use the same idea
i looked into dedicated servers a bit earlier today, but listen server + sessions seemed way faster and easier accessable for a fast prototype / first project
there is a tutorial playlist on Unreal Engine youtube channel
and there is any function that you can override with blueprint to use the system that I describe above sadly :/
The way I described it is working for his purpose
There is no place the data is saved before the Player joins
He selects his name before he spawns and needs to tell the server this name
Steam would allow the server to get the name by the unique ID
but without he needs to go the annoying way
And that tutorial series teaches a lot of wrong things
I would not recommened to use it
@thin stratus We are still waiting for your tutorial series though
They are planning on fixing it after GDC
@wary willow Such a tutorial series takes tons of time. No way i'm doing that for free
oh god Epic did something wrong ?! Is it possible ? ๐
:P
@somber lava https://puu.sh/u4E11/e5258926ef.png
That should work
Or something like this to avoid the Server calling a ServerRPC (which doesn't matter that much but /shrug)
https://puu.sh/u4Efp/4c4df4ab1b
but steam overwrites the name by default, yes?
@thin stratus thank you very much, trying this atm.
the first question that popped into my head is something unrelated, why did you use get game instance and a cast? in the tutorial from epic they always used a variable with a reference to it
depends do you need to call it often
whast the way to get OTHER clients playerstates? i tried the below setup - which i thought theoretically should work.... but its returning default values for the nodes (except PlayerName - which is an engine default node)
http://puu.sh/u4DBg/37de20d4f1.jpg
i even tried setting their values INSIDE of the playerstate like this:
http://puu.sh/u4DHI/a9c3825088.jpg
iirc GameState has array of all player states
I switched the SetHPEvent (in playerstate) to SERVER - neither have the desired effect....
o.0
@slim holly Where?
http://puu.sh/u4Hk5/0f7dd9b92c.png
player array
mm nope I just tuned in
its in the above image - the one you replied to
oh right
CastGameState -> GetPlayerArray() -> ForEachLoop -> CastToPlayerState()->GetVariables
this returns (even on server) default values
yet i can print string from playerstate TICK function....
well player 0 only works for local copy of the playerstate
right, you need your own playerstate
dude
get reference to your controller -> get playerstate
your not folliwing me and your not understanding my goal
sec ill start the engine
simply put - i want to access OTHER PEOPLES playerstates
i'm not concerned about my own
@thin stratus i was wondering why your script didnt do a thing and put some breakpoints in debug mode. it never enters the Event BeginPlay isnt that/shouldnt that get called automatically? or did i forget to call it somewhere?
ok so you want to modify health values @worthy wasp ?
@somber lava I used GameInstance and casted it because I need to?
I don't have this casted reference saved in the PlayerState. If you have it already casted somewhere, then feel free to save it to a reference.
@somber lava You only have like two weeks experience in Unreal Engine 4 right?
I know I suggested taking a little break from Multiplayer and understanding the basic framework first, but maybe you forgot
I'll suggest it one more time though
Kinda true
First 3-6months are not really something for diving into multiplayer if you are new to programming adn the engine
If it never calls the beginplay, then you probably didn't set the GameMode to your level and/or didn't set the your PlayerState class as the default one in that GameMode
If, however, you DID set both and you are 100% sure that it's properly set, then please restart the Editor
me and my gf had problems with projects not using the set gamemode/default classes until editor restart
@worthy wasp WHen is this called?
Could it be that the values aren't yet replicated?
If you want to display the Values in your UI, why not just passing the PlayerState reference
And binding the values by using that reference
Instead of only passing the values of it
Your images don't give much information
as they are only a small cut from the whole graph/logic
No idea when or where you call stuff and what yo udo with these variables
If the PlayerState itself shows the correct values on tick, then I would say it takes time for them to replicate properly and you access them too early?
@Cedric - i'm binding event to when damage is receieved to update all players HP bars of MY CHARACTER (its a team based game)
i just found that my event isnt triggering - i have to debug this
@thin stratus i restarded it since everything was set correctly and now after restarting i always get a blank screen on startup and no methods/events are called at all
i gotta resolve this problem first before trying anything else, still thanks for your time!
@worthy wasp Fair enough
@somber lava That sounds odd :D
Are you sure you are on the right map?
Editor Startup map doesn't need to be your last used one
@thin stratus i fixed the widget communications - but my clients cant see server pstate variables - my server can see clients....
clients always get default variable values
When are you getting them?
on update of damage being applied
You said you bound an event when damage is recived
yes
Damage is applied on the Server
yes, that was the first thing i looked after. main menu map
CharacterClass -> EventDamageReceived()->CastToPlayerstate->SetVariables
@somber lava Welp, easiest way would be to check what SHOULD happen and see if something is broken at that point
e.g. UI should show up? -> Check the part where the UI stuff is getting called
IN PLAYERSTATE:
this IS running on server AND clients (print string always says Server:...)
inside the GMode - i do do this:
http://puu.sh/u4IWp/ec04955100.jpg
because gamemode has access to all pcontrollers
no?
Well yeah
And no
The Server has
You can call that "GetAllActorsOfClass" everywhere as long as you are on the Server
correct - so is there a better method/approach to replicating HP to all other connected clients?
(might also be worth just using PostLogin and Logout to fill an Array of PlayerController, cause GetAllActorsOfClass is only bad workaround)
The other thing is
You are getting all PlayerController
And then the UI
And calling update on the UI
Do you realise that this is never getting executed on teh clients?
ServerRPC means you are on the Server
Being able to use the GameMode means even more you are on the Server
but i'm trying to force an update on all clients
Getting all PlayerController in the GameMode means you have all Server Versions of the PlayerController
only way i've ever done that successfully is to iterate all pcontrollers -> Run Function
Despite the PlayerController of the Server, these PlayerController shouldn't even have a valid UI
These are PlayerControllers ON the Server. If each of the mhas a UI, then your Server has multiple layers of UI
What you want to do is creating a CLIENT RPC inside of your PlayerController
That then gets the UI and calls UPDATE
And you call this CLIENT RPC in your Broadcast function
cause you want to go to the Client version
The other thing is
This might still not work properly
@thin stratus i just put breakpoints onto the "Event BeginPlay" of the mainmenu level blueprint and they are not thrown even though i have the map selected when starting AND set as the map to go in settings
You set the Variables on the Server RIGHT before you call these functions
This does not mean that the REplication is already done when the clients call the update function
What yo uwant to do is either Pass the new values to the Client by using parameters on that CLIENT RPC
Or to bundle them in a STRUCT
and set that struct to be ON REP
i'll try passing values first
the OnRep would be taking place in the playerstate - how would i force a server RPC so i can call up to game mode?
@somber lava Woot, you are in the level MainMenu and the LevelBlueprints BeginPlay is not calling?
nvm - let me play with it... appreciate the help!
@worthy wasp Why would you need that
thinking ahead (maybe too much)
yes, even after several restarts
Player gets damage (happens on server) -> Getting PlayerState (still server) -> passing the new values for the Struct (still server) -> setting the OnRep Struct variable inside of the PlayerState (still server)
Replication happens -> OnRep calls some time in the future on everyone (now we are on all clients and server) -> In the onRep we get PlayerController -> Tell UI to update
@somber lava I'm really at a loss here :O
If you open your map (search it in the content browser), the LevelBlueprint should call once you've started the game
Assuming it's not the Editor Start up map
And if it is, then you obviously don't need to open it anymore after restarting
but still, the LevelBlueprint should call :O
If you play, what does the outliner on the top right say about what GameMode class is used?
level opened in editor
Assuming you even use a gamemode
I have no idea why that BeginPlay isn't calling lol
it doesnt need to
Shit's broken, yo
unless you override it
it will use project settings GM
so, depends on what you used
oh...
Yeah but it doens't show any he said
You changed GI in project settings?
Not even default
in the level, it doesn't need ot
to
I usually set GameplayGM as default
and override my mainmenu level with my MM GM
no override
I never use a GameMode in the MainMenu
I handle everything in UI and GameInstance
but depends on the project of course
BUT his problem is still weird
"I handle everything in UI and GameInstance"i did/do the same
Well yeah, the BeginPlay of the LevelBlueprint should call :O
I mean, can you print a string
Instead of using the breakpoint
just for sanity
nope
?
does not work
Did you try a new project?
Can you create a new map
In that old project
and check if that calls the begin play
maybe the maps broken
"map"
wat
i think my gamemode is broken
i chose gamemode override
with the default gameModeBase
and it works again
o.O
now i always spawn without a character/cant move
since the BeginPlay of PlayerState is never called
In the task bar at the top is an option to reinstance or recompile the class. Maybe give that a go. Either that or reparent your BP to GameMode and then back again.
@somber lava Yo I had this same bug and reported it
It is an engine bug
To fix this, I created a GameMode in a previous engine (4.12 for me), then migrated it over. This solved the issue of BeginPlay not firing (along with other very very strange behavior)
hm wow lots of code in shootergame for reloading
they use a server rpc, client rpc, and variable replication
seems like a lot
Can anyone confirm if steam voice is still dropping packets in 4.15?
@jolly siren Do you mean the Shootout 1v1 tutorial thing in the "Vault" or whatever?
@heady delta there is steam voice implementation on ue4?
@versed socket no, shootergame
@fierce birch yeah it's completely broken ootb, you get like 1 word to come across. I fixed it but I need to open a PR for it. They didn't touch it in 4.15 tho @heady delta
they backlogged the issue
What did you need to change for it?
I'll try and set aside some time to open a PR today, it really wasn't much code so hopefully epic will look at it
Hi guys, i can't seem to execute a Server RPC on an actor placed in the scene. It won't reach server. Even if i do Client RPC > Server RPC. Any tips ? ๐ค
is the actor replicated?
@supple musk Ownership
Clients can't call ServerRPCs on Actors that they don't own
Actors placed in the Level are Server owned
Client-owned Actors are such as PlayerController, possessed PlayerCharacter/Pawn, PlayerState
If you want the client to call an RPC on the scene actor you need to re-route that through one of the client-owned actors
Alright so i have to rethink my networking to not go through the scene actor but through the player interacting with them, thanks ๐
Okay, I created the voip fix PR
it's my first one, so lmk if you guys see any issues
@supple musk Good though of mind is right after the player presses his key, splitting client and server
So right htere you could make a ServerRPC
And let that also trace
Or what ever you do to interact with the scene actor
If the input is INSIDE of the scene actor, then you might really need to get the Playercontroller, call a serverRPC, pass the scene actor and then let the Server version of your Playercontroller call the function of the passed scene actor
@jolly siren Hope that gets pulled, someone else had one awhile ago to fix it and I think they pulled it in because voice worked again for 1 4.14 preview, then broke for every one after that so I assume it got reverted.
although, just restarting it as a fix probably isn't what they will end up with
right, yeah there is probably much better ways. but at least it works
I didn't know it was fixed in 4.14
I don't use the previews tho
ahh okay
anyone know why when i set my airship to movement mode falling on server it doesnt fall? it is in falling mode but it stays flying.... http://prntscr.com/e9n270
It falls on all the clients, but it will not fall on server.
I have single level with multiple courses and after all players finish course, they should be moved to another course
How should I manage spawn points?
Have spawn points for each cource or just one set of spawn points on first course and then move them around level to next courses?
also have this oddity http://prntscr.com/e9n4qu http://prntscr.com/e9n4yf
@chrome fable @thin stratus in case u might be interested i rewrote the whole project from scratch (gawd that takes ages with blueprints, time to learn some cpp) and now all the bugs are gone. begin play is called correctly now
thanks for your help
might also be that it wasnt a bug, but something stupid on my side. since im a bloody noob i cant tell ๐
So I have this snippet but when when the ROS command executes, the ISMC is null. How can that be when the cast has to succeed for it to execute?
Hi all I am working on an idea much like that of Dayz Mod PlotPole4Life If your famillar with it then you know it has its good and bad stuff. I am wondering how that works with in multiplayer side of the engine because if I place a a pole down and it says ok this 20 x 20 meter now belongs to say player BOB and say another Multiplayer trys to build in Bobs plot area the sytem says no your to close. Hopefully that makes sense thanks for reading and any reply
@heady merlin @jolly siren
I've had no issues w voip in 4.14
It was broken in preview but after release it was fine
that is surprising, I haven't seen it working in a long time and I'm pretty sure they haven't touched it in a long time either
what scenario have you tested?
Yeah it didn't work since 4.11 (that's when I started testing)
What scenario? I have a VR FPS game, and I call Start/Stop networked voice using mordentrals handy bp nodes
yeah your use case
I had the one sec bug earlier, but in 4.14 it's been consistenly great
Even between US-Europe
Doesn't drop between map travels and suc
So you're saying it's broken in 4.15 again? I can't convert until a couple plugins gets updated but I'll let you know
I skipped 4.14, but yeah let me know if you have better luck in 4.15
I don't use push to talk and test with a handful of people
I can tell you that it definitely works in 4.14
There is no push to talk, you fake it with start/stop. Same function calls
okay, yeah I don't use mordentrals stuff
He just exposed the functions, don't think he did much else to them
I implemented them around 4.12, left the code and after 4.14 we could hear each other
what subsystem are you using?
Steam
okay me too
lmk if it still works in 4.15
I'm not on 4.15 anymore because of all the tonemapper bs
Do any of you guys know if there's any way to start the dedicated server on one map and the client on another with PIE? I'm trying to test my mainmenu -> join server flow but I keep crashing.
@dark edge Play -> Advanced Settings, uncheck "use single process". Might work with a combination of command line arguments to force the client to load the menu and changing the editor multiplayer mode to listen server
or vice versa
I don't know if this is a weird question... but is there a way to spawn an authoritative projectile on the client and get simulated proxies on the server and the other players?
you would spawn your projectile on the server and have it replicate to clients would you not?
Yep... but then firing from the client while under lag would have a noticeable wait for server acknowledgement.
so I'm thinking that the client should have the auth copy and just force some sort of replay with delay compensation on the simulated copies... but I'm not sure if that's ideal either
you end up with a security hole i would think then
You just have the firing effect, sounds etc. on client
The actual projectile spawning on server
client authoritative damage sources are problematic on security.. :\
I'll go have a look at how UT does it for a bit
Pretty sure they just compensate the projectile's direction
Dunno how to compensate for velocity
But for rotation we just rotate the projectile to the player correctly
For location, it just spawns from the barrel location on server
I'm currently passing the initial rotation and direction... looks good on paper but there have been some very rare instances where the client and server do not show the same thing.
They never show the same thing
Because client is always behind
Unless you're in a LAN environment
I've been trying to get the Steam overlay working in 4.13-4.15 for three weeks now and I'm going insane. Is anyone able to help me debug the issue? I've tried using v132 of steam, also have updated to v139. I've reinstalled all the engines and steam multiple times. The DefautEngine.ini is configured correctly, and steam is running with me logged in, but I never get any overlay running in Standalone and steam doesn't say I'm playing Spacewar
I have
Document each step you do
@last depot and you have the steam overlay enabled on steam for other apps?
and you are using DX11 and not some newer api like DX12 or Vulkan?
I think I never got steam overlay on any game using DX12 (they could have fixed that since)
Well at least I think I'm using DX11
Haven't changed anything that I'd know would make it 12
I've done everything but reinstall windows
So desperate I might do that
I enable the steam plugin, change the .ini and run in standalone mode. Anything I'm missing? (It's pure blueprints. No C++)
@fierce birch That's checked. The problem is steam doesn't notice it at all. It doesn't say I'm playing any game
Both are run in admin mode, are on the same SSD, and are both open
So confused
It's worked before
But since 4.13 I haven't been able to do it
so you don't get the overlay for other games either?
The overlay isn't the issue I think. It works in steam games.
When I launch my UE4 project in Standalone mode, steam doesn't even recognize I launched the game. No overlay, no game change, like I'm not playing it at all.
I've also tried normal steam and the steam beta
@night jay I might have just never enabled the OnlineFramework plugin....will test after 4.15 downloads.
Thank you so much. ๐
All online crap was moved to plugins in 4.13
Sounds like that's why I've had issues since then.
Still need to change the ini file, right?
Probably, I just kept my ini the same but didn't bother trying it without the steam options
@last depot double check your .ini. At first I had this problem too, but I've realised that I had made a mistake in .ini (Note: Steam Mp IS working in Ue4.14)
Ugh it's still not working
@ebon siren You remember what plugins you enabled to get it to work?
I enabled OnlineFramework and SubsystemSteam but still getting nothing ๐ข
I have OSSNull enabled too
Forgot to copy dlls from the steam folder over. Did that and it still doesn't work ๐ข
I have no idea what's not setup correctly
did you alter your build.cs
And you don't need to copy DLLs from the steam folder
Your UE4 should already have them
@night jay Do I have a Build.cs if it's a blueprint project?
Should I make it a C++ project?
Make a C++ project with the same name as your project
Copy the source folder to you BP project
Make the changes as shown in the forum thread
package game
you can just add a dummy c++ file into your blueprint project
that will turn it into c++ project
@fierce birch That's what I did
I'll change the build.cs now
Hopefuly it fixes
@fierce birch @night jay Still nothing. What do I do after changing the Build.cs
is there any sample project around that is known to have working overlay?
I'd check something like that first
Do I rebuild my project or something
So confused
If there's a project with a working overlay and it still doesn't work on my pc...I'll just reinstall windows
I've given up any other ideas
it's always easier to compare working and nonworking solution as then you can compare the setup between them
it's not your windows if your steam games have overlay
I don't know what else it could be
I don't remember if you ever answered to my question if they do have
Yes. Everything works but UE4 projects
ah "The overlay isn't the issue I think. It works in steam games."
do you have some other project that's supposed to support steam overlay?
Downloaded a steam multiplayer tutorial project and that doesn't work either
@last depot did you follow through this? https://wiki.unrealengine.com/Steam,_Using_the_Steam_SDK_During_Development
Information specific to the Steam Online Subsystem
Step by step
