#multiplayer
1 messages ยท Page 722 of 1
Multicast
Replicate the flashbang BP
How?
I was so confused to why it was only working on the server lol
Lol, been there a long time ago
Your custom event is put on "Execute on Server"
Is that not right?
It is, if you want to replicate the object like this
That is right, if your gonna replicate
oh kk
I was answering why it was only on the server ๐
If it's just a 1time event you could also have a "Execute On Server" -> "Multicast" it will spawn it on all clients
Do I need to do that if there's going to be a host?
(Your first solution works, there is just multiple ways to do it)
And if you go that way, spawn one locally
Then on the server in the server rpc
then on the multicast, ignore the server and locally controlled character
And then you have it spawning on everyone
Yes ๐
Locally, including yourself
oh I see what you mean so if i only need to replicate once in the entire bp I can just call server and clients rather than just server with replication enabled on the bp
So if there is ping/net latency, your character won't notice it
Exactly
Got it
Im assuming that when replication is enabled whatever the server event is doing it does it on every other client
Yes but it takes time to send the req to the server and then time to send it back to you (And to others)
Doing from you to the server and then to others is right
But you should spawn one locally so it seems like there is no lag, then remove the one the server spawns on your machine
Bad assumption. Some nodes do replicate their effects, others don't. Eg. A "spawn actor" node doesn't itself replicate. If the actor that is spawning on the server is marked to replicate, then that actor would replicate after it was spawned on the server.
Got it
But ideally to stop hackers you'd want the server to know about it
Haha
Yes
Does replicate movement need to be enabled for the flashbang?
Depends
Its got a bit of network overhead
I sometimes leave it off, if your proxy projectiles are going to be for show, and they follow one arc, Then if there is a flashbang explosion, you could just let that happen on the flashbang bp, if your on the server (Has Authority node)
And multicast after that node
Huh so the actual flash effect doesnt work on the client everything else works
If this is referring to a flashbang effect like CS:GO has, there's not anything stopping you from as a client just ignoring that effect ๐
Lets see your BP
The flashbang effect is an interface
OnFlashbangApplied, Remove all updates from the server, OnFlashBang Complete start updating client again
Lmao
Yes, but no ๐
This was to start the flash
Hmm, I think do a multicast on the server flash bang bp
Then call that
Should I remove the interface?
Whats it for
Applying the flash to the player
I don't see the need for it, do it in the flash bang
Unless you have a specific workflow
Yeah probs
This alright?
You should apply the flashbang effect in the Flashbang BP (Or call it from there) using a multicast, If your the server
Can the server not apply widgets from a actor?
Only on a multicast
Oh
Or a client rpc
Widgets/UI are client side, they don't exist on the server.
Or well rather, they aren't networked.
Sending data through a "Instance editable" and "Show on spawn" doesn't replicate to clients?
Oh right I see because if it's a custom server event and you're creating a widget you're creating the widget on the servers view
So I just flashbanged a client player and the effect hit the server lmao
The var was not set to replicate, Trying that now
Does multicast effect the server player too in the same way?
Well assuming you use a Listen Server, I guess. But you can't call RPCs etc. from a widget. They don't have any netcode. So you need to call something else that is replicated and call for example a RPC on that to then create a new widget or whatever you want.
Yes
Got it
But remember time to send data to server then to send back to everyone
With some exceptions though, but generally yes.
would it be better then to create a custom event multicast with the create widget on the player and call that from the flashbang bp?
I've triple checked
I'm not an expert, but considering this isn't a 'state' issue because it only is relevant at the moment it happens I would just call an RPC on all player controllers and have that activate the flashbang effect.
everything is default, but I'm 100% certain "play as client" launches a listen server, even though my settings claim it's launching as a dedicated server
An easy workaround
Create a function on the character called apply flashbang effect
Then make it a client RPC, reliable
I'm learning guys ๐
Reliable is not needed IMO, for the reason that it should be at that moment in time.
Then on the flashbang explosion, make sure you use an "Switch has authority)
(It is in this case)
This is needed?
Then do the lintrace if you have authority
Cast the hit actor to your character
And call that function
You'd want the flash to definitely get applied so reliable is necessary
Hmm
It's not essential to the state of your game though. It doesn't matter too much if a laggy client will get it or not because at that point they will likely experience way more issues already. But I guess it's a difference in opinions. Feel free to choose whatever you think fits for the game ๐
That won't work
^^
You gotta break the hit result
Then cast the actor to the character
oh wait yea
Then have the function in the character using a client rpc
ysura, y'aint gonna believe what I found
Ye but in AAA games they use prediciton to avoid that stuf
so you'd generally use Reliable
the game is launching a dedicated server, but the client is launching as a listening server
If your going that route
Prediction does not magically make packets arrive and tell me I should apply a flashbang or even tell me that flashbang existed in the first place. If I lag in an AAA game they have the exact same issues.
For things like FX
You wouldn't use reliable
And in this case the FX is for doing something important like blocking view, so its reliable
Well think of it in the case of, Is this an FX or is it a Gameplay important function,
Is it weapon tracer FX, or is it Weapon damage>
It's not essential to your game state though, the game can run completely fine without that RPC ever arriving. So that makes it a choice to whoever designs the system if they want it reliable or unreliable ๐
You definitely wouldn't make your damage RPC not reliable?
I can't understand why doing it this way wouldn't work
Maybe there is a bug in UE5.0.2
But you its up to you
I'm talking about the flashbang effect.
wouldn't shock me. Also running "listen client" mode does the same thing. Launches both listen and dedicated servers
Erm
Get Flashed
This is not the case for me, I have a dedicated server and a client when I launch in client mode
Not totally sure
I'll verify my instal
I just run this
And imo, mark it as reliable
Just wondering would multicast work for this?
@magic yoke The server is dedicated and the client is client
No need for a multicast
I was running it in game mode: "print is server, print is dedicated server"
I'd see 2 sets of print. Truetrue, and truefalse
Would be a waste
so something's wrong with my install I guess?
Like thisยง
I have True True for the server and False False for the client
Can a local player destroy a local version of a replicated actor>
Without going through the server?
Yeah
I don't think so
Well I made the flash server sided
the server will just respawn it no?
But the effects client
Idk
you can, but it'll be respawned I believe
Ok
wtf
game mode only runs once, server side
Let me try on gamemode
?
Server to client
listen server gives me the same results
Saves on bandwidth im guessing?
no but why is it firing two times? Mine only once
like I said
the client it's launching is acting as a listen server
at least, that's the only explanation I can think of
it also explains why a lot of my text stops having "client" vs "server"
my friend noticed that a couple days ago
Test with launching with batch files, sec, i'll send them
Or rather, just launch, not PIE. See if it's different there.
err
pie?
oh
play in editor
this is pretty early on
I don't have the ability to specifically connect to a serve ryet
@magic yoke
launch looks like you need to launch dedicated server separately and then connect>?
Sure you do, hit tilde to get to console, and type "open IPADDRESS"
@dark edge attemption to launch the server gave a cook failed
choosing the variant "windowsserver"
launching it normally gave me a listen server
You got a bunch of unknown structures so I'd settle taht problem before moving on lol
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartController.CartController_C:Refactor Display Chunks to New Center:CallFunc_Get_Chunk_Chunk_Structs.CallFunc_Get_Chunk_Chunk_Structs'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:World Array.World Array'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:Get Chunk:Chunk Structs.Chunk Structs'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:Get Chunk:Tile Struct Array.Tile Struct Array'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:Get Chunk:K2Node_MakeStruct_CartTileStruct'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:Load World:Loaded World Array.Loaded World Array'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/CartGameState.CartGameState_C:ExecuteUbergraph_CartGameState:K2Node_CustomEvent_Loaded_World_Array.K2Node_CustomEvent_Loaded_World_Array'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/World/CartTile.CartTile_C:Tile Struct'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/World/CartTile.CartTile_C:Change Representing Tile:New Tile Struct'. Unknown structure.
LogInit: Display: LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/World/CartTile.CartTile_C:ExecuteUbergraph_CartTile:K2Node_CustomEvent_New_Tile_Struct'. Unknown structure.
LogInit: Display: LogClass: Warning: Property Tile Struct of Tile Struct has a struct type mismatch (tag STRUCT_REINST_CartTileStruct_29 != prop FallbackStruct) in package: /Game/World/CartTile. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display: LogClass: Warning: Property Tile Struct of Tile Struct has a struct type mismatch (tag FallbackStruct != prop CartTileStruct) in package: FObjectReader. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display: LogClass: Warning: Array Property World Array of World Array contains a struct type mismatch (tag FallbackStruct != prop CartTileStruct) in package: FObjectReader. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display:
LogInit: Display: Failure - 10 error(s), 3 warning(s)
they're all my custom fiels
files*
but the weird thing is that only happens if I run "by the book" mode
"cook on the fly" doesn't seem to care?
Yeah idk, I don't even cook for quick testing. Just fire up through those batch files and get on with it.
copied your .bat files, reworked them to be for my stuff instead
client launched in listen server again
the mismatches are apparently because it's angry I renamed structs
which I'm assuming is a bug, since the editor claims it'll handle that
but there's some C++ redirect code it wants that the editor didn't properly handle?
If you are printing "IsServer"
And that returns true
Then that doesn't mean you are a ListenServer
Have you fixed up redirectors?
I don't know how because that's C++ and I'm blueprint only
it prints that if you're listen or dedicated server right?
Wrong
It prints if you are not a client
And a freshly started game is Standalone
Which is not Client
Right click content folder, hit Clean Up Redirectors In Folder
Hmm something weird is happening
ok will do when I'm done verifying
I am passing in a vector, on a instance editable, show on spawn
But in the construction script of the BP it reads 0,0,0\
I'm certain my client is printing "is Server" though, game mode is also being run x2
Are you actually starting a Client that is connected to the Server?
Because if not, then IsServer returns true cause you are standalone
I was using PIE
And Standalone also has a GameMode
Show your PIE settings
This should print only once
yup, it prints twice
What Mode do you start in?
Doesn't it print twice because you start as a local player
No, what like PIE mode
I see those two prints lol
@magic yokeYou sure you don't have auto-connect to server turned off? Show your advanced PIE settings
that's what I remember it being
no it doesn't have a checkbox for it
not that I could find
since someone suggested
ok I gotta do something and this verify is gonna take 15 more minutes
will be back to bug once it's done, thanks for all the help <3
So im trying to make a thrown c4 land correctly upwards when it hits a surface
How can I do this?
I need it so it lands correctly on walls too
Is the C4 correctly rotated upwards in its BP?
Yes
Event Hit gives you the normal
Then you need the Surface Normal
If I get 2 output pins from a single node
The Hit usually give you that
Does it fire 2 times?
You can make a Rotation from that
Depends on what node we are talking about
Is it look rotation?
@quartz iris
Event Hit -> Self.rotation = MakeRotationFromUpVector(Hit.normal)
assuming the c4 is oriented such that up is away from the surface
Pure nodes can be a pitfall, yes
That should not be a pure node
Pure functions ONLY depend on their inputs
I mean, idk if it'll error out or not if you push the pureness of a BP pure function to its limits, but in C++ that wouldn't be a pure function.
I cant get it from event hit
I'm assuming BP makes the Camera an implicit parameter.
Break hit result
From normal?
Break the hit result struct, it gives you a ton of information. One of the fields is the hit normal
Also this isn't reeeeeaally multiplayer related :D
Z but move it to #blueprint
Would this work for all players?
Thanks for this link. I've heard the pure in BP can be problematic, but never dug into it ๐
Why does your c4 have a capsule collider?
The mesh collision is unreliiable
Why a capsule and not a sphere?
Anyway
Assuming the rest of your setup works, that should take care of orientation.
Would this work though for multiplayer?
How tf would we know, we don't know anything about the rest of your setup. We don't know if you're processing hits everywhere or only on server, if you're replicating movement or handling it some other way, none of that. I don't see anything that'd obviously make it NOT work.
@dark edge fix up redirectors did nothing to solve those red/yellow errors asking for redirects
@thin stratus
"C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "%CD%\Cart_and_Coin_Deluxe.uproject" Cart_and_Coin -game -log -nosteam
running this still causes me to run a GameMode
launching multiple clients causes multiple "listen server" clients to appear
I swear I was told that GameMode only runs server side
which explains some other bugs I've been having
Is it possible to have both local and online multiplayer together? So for example 2 PCs connected, but 2 controllers on each PC?
(so 4 total players in that example)
Yes, quite difficult to support though
Split-Screen multiplayer works in ShooterGame AFAIK
right, well my issue is I'm either launching multiple standalones or multiple listen clients
but either way, I'm not launching dedicated+client
or listen+clients
because launching listen mode puts up a bunch of standalones or something
Or they're being instantly kicked from the server
they would travel to the "default" map for your project, and run that world as if it was standalone
Should see the kick messages in logs
message longs?
logs*
I'm not seeing any errors along those lines
mind, when trying to launch a standalone server I'm getting bizarre errors
maybe the server's crashing due to this and the clients are left hanging?
Fixing errors should indeed be the first prio
no idea where to start with these
Realistically I don't think those Blueprints should even compile
Not sure what you mean
If the BP's don't compile properly, it stands to reason you'll get errors at game time
Oh ignore that, I'm just talking about in-editor
That's the cooker params, so irrelevant to in-editor testing
only place I find that is buried deep in cook logs
there aren't any errors in the blueprints named
Try resaving those BP's also to see if it goes away
that I can see
they're fine though?
Property 'StructProperty /Game/CartGameState.CartGameState_C:World Array.World Array'. Unknown structure.
LogInit: Display: LogClass: Warning: Property Tile Struct of Tile Struct has a struct type mismatch (tag STRUCT_REINST_CartTileStruct_29 != prop FallbackStruct) in package: /Game/World/CartTile. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display: LogClass: Warning: Property Tile Struct of Tile Struct has a struct type mismatch (tag FallbackStruct != prop CartTileStruct) in package: FObjectReader. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display: LogClass: Warning: Array Property World Array of World Array contains a struct type mismatch (tag FallbackStruct != prop CartTileStruct) in package: FObjectReader. If that struct got renamed, add an entry to ActiveStructRedirects.
LogInit: Display:
I think this is the issue
but I don't do any C++ coding
and if I did rename it's only through the editor
I guess maybe bug in renaming for the editor?
Hard to know exactly what's happened, but my guess is something was renamed and left a redirector behind, and now that redirector is gone and past refs to it are broken
Did you delete them in explorer or anything?
no, I've not done anything outside the editor since starting this project
my last project corrupted probably because I did something like that
so I've been strict about it
Accidental hot-reload or something?
Do you think it makes sense to use sql for inventory? Because I need to separate all the rows one by one and check if they are full or empty and add them to the inventory. I personally think that these processes will tire the computer and it will be very tiring in the blueprint. What should I use?
Ah yeah, probably then
What are the required modules/includes for creating a FastArraySerializer?
NetCore module I think
:| how do you avoid breaking things with reversions then lol
Well ideally, all the files affected by changes in a given revision are part of that changelist
SVN was supposed to save me, not hurt me T-T
But I expect some files that were dependant on changes to others did not get reverted in that process, or something.
ok
well whatever happened
do you know how to fix this?
would the best idea be to make new structs and replace references?
Probably re-create those properties that are causing the issues
is replace references safe?
You just need to make sure all files affected by changes are submitted in the same changelist, and the same when reverting
Hmm.. NetCore didn't work. :/ I have the following two includes already. And zero error highlights. Just a ton of unresolved external stuff.
#include "Net/UnrealNetwork.h"
#include "Net/Serialization/FastArraySerializer.h"
as far as I'm aware, I submit everything all at once
BP does tend to crap itself if you rename BP structs anyway, definitely seen that before but don't really know all the causes
sighs
shame, don't like working with "dangerous" things
but I need structs lol
well I did learn a lot here
I'll try to refactor away from the broken BPs
Hello, we have a big problem with our multiplayer, players host theirs own listen servers and for some reasons some servers have big replication issues (like things get very long to replicate, UI don't show up etc), we've tried everything we could, we've done profiling but we just don't understand what's going on..
(we use steam sockets for our netdriver)
oh and all players that report the issue have a low ping
DataTable if you want an in-engine solution.
Oh - you're asking about an inventory itself and not a database.
Uhh - I'd find it to be weird to have your inventory as sql personally. Can just be an array of structs.
Not unless you're making EVE Online
If you were making an EVE or a WoW? Sure you need a DB. If it's a basic game without millions of items, nah.
I started off by making my game singleplayer and now im going through the trouble of going through and changing it to multiplayer. I made a GameInstance class and I am trying to setup the widget system that has countdowns and displays. GameWidgets is a TMAP that contains the PC and a pointer to a the widget class.
Apart from that, my main guess is that for DisplayCountdown() I should keep the iterating through PCs in the GameModeBase and then to use the GameInstance to send a signal to the GameModeBase whenever necessary.
This is my first time trying to understand GameInstances and it's a little confusing for me currently so sorry in advance if everything is sloppy
Hi everybody!
I'm trying to make a healthbar for each party members (every player state on the game, it doesn't need to differentiate for anything else)
I want something like this
i'm thinking on add a new widget to every player locally when a new controller gets in and for each player state add a widget.
My problem is that i'm not sure on how to update the specific widget on each remote whenever some player state changes (let's say hp)
Do i make an array of Widgets on each PlayerState and when variable changes OnRep, i change the value of the widget?
how would you go about doing something like this?
Should a retriggerable delay's length be a replicated variable? I'm thinking it needs to be replicated for anti-cheat because its used to control fire rate of a weapon even though it never changes. Is that correct?
Least insane event/function that fires once on each actor on the server?
Beginplay is not it
Beginplay -> has authority (yes)
that will only fire once per actor spawn on the server
if you go the "No" route, you get the remote version
Why not?
Just seems like it will get triggered multiple times
Why would it? How many times does an actor begin play on the server?
I mean you could hook into event on destroyed if that's more your style
You would need that event yourself whenever health is changed. Until you have framework in, just tick it from the widget's playerstate pointer. Can always be made event driven later. Make it work first.
So the idea would be to subscribe the widget to a event dispatch? that was my first tought but i'm not sure how efficient that is.
I'm trying to create the widget OnBeginPlay of the playerstate, and add it to the HUD of all the players, then try to update that widget OnRep of player state desired variable. Having some troubles at the moment, not sure if this works : P
You are getting multipler triggers because you get one Actor on Server and one OnClient.
So if you put a "print" OnBeginPlay, you will get 2 prints. One for the client version and one for the server version.
You can filter by checking "Has Authority" and deciding where specifically you want to let that flow go
I know, it's just the preexisting code here sets a bool to ensure it only does this once
Hence my suspicion
I strongly recommend learning to separate UI from gameplay in a way that Gameplay doesn't enforce UI. The UI should be able to be be created at any time independent of whether the playerstate exists. The playerstate shouldn't do anything but exist in this context. GameState should have delegates that get called when a playerstate arrives and is removed from a client. The container holding your widgets can update and add or remove a widget from the list at that time. But the container should also have the ability to fully update itself for all current playerstates, etc. All the container should need to do is pass the playerstate associated with the newly created widget in it's CreateWidget call. The widget can then either tick to poll and update UI, or bind to whatever runs the health. If the Health is in a component in the pawn for example. The widget needs to be able to GetPawnPrivate->GetComponent->Bind. And that's assuming it's valid. If the pawn isn't valid yet, you also need the ability to wait until that Playerstate's pawn is valid, etc. It's a complex setup that can quickly get annoying with engineering changes to the project. Which is why I strongly recommend just ticking it in the widget that gets the playerstate passed to it. Eight widgets ticking a few checks isn't going to really be noticed in a profile since you're not invalidating very often, it'll work well and you can move on to other things. If the time comes to make it event driven, go for it. But in my personal opinion it's a waste of time to bother.
This makes more sense, UI doesn't have anything to do with the player state.
This setup works ->
PlayerState -(BeginPlay)-> Create Widget variable -> Tell Pc to update UI
PC -(update UI)-> Get all player states, fill wrap box with variable "UI" from the player states.
And on playerState health change (OnRep) just update the variable UI.
It's a mess already and it's only one widget.
I'm gonna go with something similar to your suggestion and let the PlayerState tell the PC to update the ui and there generate one widget for each playerstate and bind them to the PlayerStateEvent.
"Or Bind to whatever runs health" Is it posible to make a bind to a specific variable state? Like a RepNotify with a event dispatcher.
Maybe there's something like that by default already and i don't know.
There isn't anything like that by default. Anything like that would need to be your own implementation.
The event dispatcher is working fine on the server but not on the client, oh god don't tell me that you can't replicate Event Calls to clients
i'm trying to talk about some data assets over the network with server RPCs. data assets that derive directly from a C++ class work, but i have some that derive from a blueprint class that is derived from the C++ base class. those ones don't have RF_Loaded, so unreal doesn't think they have a stable name
any idea why that is?
Got it working and i can easily wrap my head around this setup in case i get some troubles later. This one is better than the one i was thinking before, thanks
i am professional game devloper
Does it make any sense that i'm geetting a delay of about 1 sec on the event dispatch call? the UI on the clients takes 1 sec to update. I don't have a delay node anywhere and the ping should be 0 since it's local
(I'm using steam session for matching the session)
Print strings to find out where the delay is.
My initial assumption with that would be that the first call didn't do anything. Called too early maybe. Maybe something else calls it after 1 second and runs it again?
I need help!
All of my gameplay logic is inside a widget, and everything needs to be โreliableโ (execution order is important) or else it will break the game.
Hereโs my setup:
Whenever a player executes [Mouse Button Double Click] (as one of many example) from a widget, I do Widget (perception only) > PlayerController (run on server, reliable #1) > GameState (multicast, reliable #2) > Widget (for the widget to execute the rest of the logic, all clients).
(Btw, do I need to check reliable 2 times up there?)
The problem is, when thereโs a latency (randomly simulated) on the network, itโs slow/lagging too much (other players need to wait for the commands to execute in order). Probably because of over-using โreliableโ.
isโt better to use variable repliction (not sure, but I think some people call this property replication)? Are they โreliableโ (and do they also execute in order, same as RPCs)? Should I pull all my blueprints & variables outside of the widget, and somehow put it on GameState or perhaps PlayerController?
This likely doesn't have anything to do with being Reliable. That won't really slow anything down unless you're spamming it thousands of times on tick. The issue is simple lag.
Not going to go into depth on reasoning unless you ask, but generally speaking I would strongly advise using other class types for gameplay logic. Widgets should do nothing but display the game class's state and allow input to them. The only complex logic in widgets should be their own functionality for layouts, visuals and such.
Replication is not promised in order. If you require perfect order, you have no choice but to wait for client to sent to server, and server to send back though RPCs. Replication is usually reliable in a sense that it will definitely arrive on client, but there are a lot of considerations for timing. Having said that, your logic does seem like a typical use case for property replication with an OnRep that runs a delegate. Widget click RPCs through controller. GameState does whatever, sets new state and the new state replicates to all clients. All clients run their delegate in their OnRep function. Widget has that delegate bound and does whatever you were doing in the multicast maybe. Though this shouldn't change anything with the latency. It still has to travel to server, and be sent to each client.
So, this.
I'm finding a few other problems with the event solution, so i'm just gonna tick.
Heh. I love event driven solutions. But sometimes, they're just not worth it. Those checks are insanely cheap anyhow. You would probably need a thousand widgets doing that check to notice anything.
You mentioned this "Eight widgets ticking a few checks isn't going to really be noticed in a profile since you're not invalidating very often"
does that mean that there's some sort of resource saver once the pointer to the object is set and the validation does not run anymore?
Mostly in UI, you just want to avoid constantly invalidating large sets of widgets all the time. Setting widgets attributes to the same value they're already at fails in their SetAttribute code. It won't invalidate if it's nearly equal the already set attribute.
If you set a ProgressBar's Percent to 0.5 percent in tick. It invalidates once. It won't invalidate again until you set it to something other than 0.5. Even 0.5001 would invalidate it, but feeding it the identical 0.5 will not. So the tick function basically ends at your code trying to set the 0.5 value over and over until health changes. No extra visual update code runs at all beyond that until the health changes.
oh that's nice
Quick question, does OnRep reliable (executes in perfect order) or only RPCs?
There is no reliable order for OnReps. They just run when the value arrives on client, and you can't really always promise whether that value will arrive before or after another one.
hi i am having desyncing issues, with multiplayer when players are sprinting. When I press space and jumps player jumps back into sync any fixes that people can suggest
I think the order is reliable under a single translation unit, i.e same class. Though as you said, one must not take that assumption
Okey so the 1 seg delay with the UI updated with the event dispatcher had nothing to do with the Event Setup.
I'm getting the same 1 seg delay when updating on "Tick" from UI.
It seems i'm having 1 seg lag on the variable replication even when running on the same pc, weird.
What's the update frequency of the actor performing replication?
Hi, anyone know why my code fires twice on the server in the first case but not the second?
Case 1: Character inputs key F to spawn an actor with "Run On Server". This spawned actor then takes the instigators' character movement component and with a custom event with "Run On Server" increases the Max Walk Speed by 2x, runs a delay for 3s and then halves it. This fires twice On the increase movspeed, but only fires once on the halven-movspeed.
Case 2: Character inputs key F to "Run On Server" set Max Walk Speed by 2x, runs a delay for 3s, and then halves it, in the character blueprint itself. This works as intended.
EDIT:
Solved it by Running Switch Has Authority on the first Case before Run On Server set Max Walk Speed
hello. I am making 4 coop game with listen server on Steam. I started to thinking about dedicated server on one of player's pc for better performance. one map will be open world 3x3 km and second map will be inside bigger building with many floors inside. it will contain level streaming somehow. is it worth to move to dedicated server or it will be no much gain from moving from listen server to dedicated server on player's pc
Hey so I am having an issue where my client players are becoming gradually desynced over time from the server and other players. This effect is quickened when running into a wall. The players report seeing that person in a different location than the actual player is. I assume there is some predictive thing going on that is moving the players on the server incorrectly, but the actual player position/state isnt being updated fully
Strangely, jumping will cause this desynced player to automatically teleport and resynchronize with their location according to the server
Any ideas? This is very frustrating
There's zero gain in using a dedicated server on one player's machine
ok, thank you. I thought so, but I heard from more experienced developer that this approach is better
Dedicated server is indeed a higher quality approach for competitive games that have anti-cheating facilities and a large player count
But it only makes sense if that server is hosted in a datacenter
It could also be useful if you want the network stuff to tick at a fixed rate though, or be totally independent from the hosting players' local game
e.g. remote players can sometimes look pretty weird on listen servers
guys can I ask is any way to store player state after quit game ? even I will run 5 clients of games on pc can I save after quiting it for all 5 ?
somehow ?
๐
I am not sure if it will working
I generated some sort of unique player id and I want it save so after running game i will see that he already has his unique id generated
I didn't quite understand what you're trying to achieve but did you check APlayerState::OverrideWith and APlayerState::CopyProperties? You should be able to get a reconnecting player's PlayerState from previous connection, where you can get data and set on the new PlayerState to make it look continuing from where it left. Would this help?
I want generate own unique id for player (this is done) and then save that unique id in string in player state ๐ and then if I close game and run it again i want have that saved id there
(but before connecting to server )
talking about in game menu or lobby or i dont know how to call it
just after running game
Where do you want to save this unique id, on client or on server? If you're going to save it on server you shouldn't be able to get it without connecting to server again or without having your own backend kind of a service. If you want to save it on client, you can, but it wouldn't be safe if you want to prevent cheating
just for now for testing I want save it for client before connecting to server and then via varest I will send it to my database where I can start matchmaking
with these ids
and then I will execute server with map
to start game
If that's the case you can use SaveGame to save your string on the local disk
okay and i can use this save game only for 1 client per 1 pc ?
or can run 4 clients and all 4 will be saved ?
4 clients in a single PC?
SaveGame basically creates a file with .sav extension and writes the variables that you have created under it. You can give SlotName parameter any string as you wish to name the file and distinguish for each player, by naming with the playername for example. There is also a UserIndex input that you can give that might work, which I never used before so don't know much about how or what it does
You can check here for more information, it explains for both BP and CPP: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/SaveGame/
why its not safe to have ids saved on clients pcs ?
how can they cheat with that
The string you saved can/might be changed with third party programs, to imitate another player or to break the game
If it's a coop game or running on a listen server, you don't need to care about this, because server itself is already running in the client PC. But if you're working with a dedicated server and it's important to prevent cheats then it's not an ideal case so save something on the client, that is required to match the player with data on the server
okey thank u
help me plssssss
guys any easy tip how to make something like really eassies matchmaking ? I will hit play and firt 4 players which it will find will join game ?
๐
well you always need some server that does this for you. Multiplayer is never "easy" and it the worst to start with to do games.
I think net subsystems like steam or epic are helpful on this, but I never used them, so dig into these ^^
Is there a way I could debug why my client can't connect to a dedicated server through open 127.0.0.1? The project uses CreateSessionCallbackProxy without issue but I need to be able to connect to the dedicated server
I'm doing this but now I'm getting "incompatible unique net ID"
any of you have tried server streaming with world partition?
Is there a way to differentiate between steam lobby callbacks for joining/leaving players and lobby data parameters? they both trigger the same callback from steam
how do I turn a FString to a FUniqueNetIdRepl?
Should GameSession->HandleMatchHasEnded(); be called before destroying a session?
If you intend on destroying it anyway after is there any reason to call this function?
It can let you propagate something like "host has left the session" if youre using listen servers
That way players are mad at host instead of your "crappy network code" ๐
If its steam i think its ConvertFromA
Or something similarly as bad
I remember some enum in the payload of the callback
@warped berry
Ah interesting! Though wouldn't a host disconnect kick the player from the session before firing that or does the session exist on the server and clients separately and they can call it themselves?
Ah it would only be if the host leaves via the menu and doesn't disconnect right? You'd then fire that line on the host and clients can react accordingly?
It would put clients in main menu, but without a message properly blaming host for the disconnect
that would be really helpful, I'll check for it
And this is the most important piece of the puzzle ๐
Hi everybody! i'm trying to set a "SaveGame" variable from the client to the server.
This works right for the server, but for the clients i get this error
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: SG_Character_C /Engine/Transient.SG_Character_C_21 NOT Supported.
I found little to none related documentation on how to make this actually be supported.
Does anyone have any idea on how to do it?
I'm adding -nosteam to my server but it seems like it's being ignored
It's probably because you're sending a local transient actor to the server via rpc - the server doesn't know about your object so it can't be sent.
Solution to that would be to create a struct with your character's properties, save that instead and send that to the server.
The ones you want to save, that is.
Or do some sort of convoluted system where the client asks the server to create a character (via rpc,) the server creates it and sends an rpc back with the new character, and then the client sets all the properties and sends it back to the server Shrug
Oh i see the problem now, i think i can work around it. Thanks!
Passing a ST instead of the Object did the work, just need to encapsulate all the variables of the SG into one ST.
Don't send the object, send the data in the object. What do you mean by ST?
St = Structure
Yeah, sending the data was the right way to do it
Hi! it's me again
Maybe i got something wrong about how the PlayerState is on server and on client.
that blueprint is only triggering on the Server
Is there an Amanda Huginkiss here?
But on the server version of the clients, it's not triggering the node "OnBeginPlay"
that's way too specific
What is the server version of the clients?
Take out your authority check?
The PS_BP on the server that replicates to the PS_BP on the client
And see what happens.
This only would trigger on the server as you have the Has Authority branch on there. The trouble being, if the playerstate hasn't replicated to the client yet, then that RPC on the client may be ignored.
it works, but i want to understand what am i missing here
Oh i see, that makes sense.
So i guess my logic with how the PS is presented for both client and server is okey, it's just a matter of timing
Would a reliable RPC eventually happen even if it doesnt exist on client yet?
Not even sure about that.
I really wish we had a couple built in "Everything is ready to go on server and client" events to hook into.
?que? What events?
I guess we can make a Event that triggers both on client and server and checks if both are ok, only than proceed.
hablas espaรฑol? se te escapo
Use begin play on both - each begin play runs the smae method and checks if they both exist and if they do, does your thing.
(on the client)
Playerstate is a bit of weird one. The client will have a "dummy" playerstate before the server replicates its copy. Any events and whatnot running on begin play from the client prior to the server's copy being replicated will not have appropriate values and may or may not run RPCs correctly as they've not established the unique net ID required to facilitate such communications.
Oh! I see.
In Vori's examples, they have the OnRep_playerState which would be the right place to run anything clientside.
It doesn't
the replicated playerstate
But yeah, use onrep then!
Just in case, i just tested if reliable RPC will handle the client not ready yet and it doesn't.
so onrep in the controller is the safe place to ensure the ps has the right vals
also... feel free to grab the ntp clock that is in there
lmao
it is more accurate that gamestate's one (except for the first 10 seconds)
If i'm right, your method is exclusive to C++ and not by BP.
Because you can't override the "OnRep PlayerState" by default unless you create a new variable on the PC for the PS and flag it OnRep.
so TLDR: add this on C++ create some k2s and you can have this exposed in BP's
you can even make the delegate BPable
but I don't recommend it
Yeah, i just wanted to confirm if it's possible on BP without exposing functionality with C++.
Thanks for the data, it's actually usefull
in BP's you have to do waiting loops ๐ฌ
so if for some reason you want to obtain the same functionality only using BP's
you could create functionality that synchronously waits for values to be valid in the client
FUniqueNetIdString NetID(SteamId);
Super::PreLogin(Options, Address, FUniqueNetIdRepl(NetID), ErrorMessage);
``` This is crashing, is it wrong?
it's on PreLogin, I'm also using -nosteam
I have no idea, but i think may be able to help if you tell me what your desired behavior is
Anyone have any idea what would make pending net game never getting cleared in PIE, but it gets cleared just fine when running outside of the editor?
Like even high level general things to check to give me some leads to chase down would be cool. I tried to pull up the references and the engine references it a bunch
Persists means you still have a game mode actor when you seamless travel, not that it's the same game mode. You seamless travel to a new level/map that has a new GameMode configured and hurray
I'm not sure what's the question here
This means that OnPostLogin will never be called after the connection to the server. If you want a OnPostLogin when a map changes you need to not use seamless travel.```
No. What you want instead is HandleSeamlessTravelPlayer or HandleStartingNewPlayer
Hello, I have a question. If I fire a server event from a client, this server event grabs the servers 'seed' or whatever. How would I go about running an event back on that original client? Do I need to send the client as a variable on the server event and then run the client event with that as the target? What would be the 'client' variable?
This isn't a character or anything, it's a seperate object in the word that needs a variable to be grabbed from the server version of itself on begin play
Also I'm working in blueprint
Exactly as it's written here
Simply send a Client RPC back?
It will execute on owning client
Oh, so if a client executes a server only event on an actor, and that server only event fires a client only event. That client only event will always fire on the client that called the server only event?
That client event will run on the owning client of that actor. Also the in order for the server RPC to be sent, the invoking client must own that actor
So the short answer is yes
Oh my, okay, I was thinking way too hard about that.... I'm brand new, hour 0 of replication n stuff as you can probably tell. I'll try it thank you ๐
It's okay, we're always here for help. Go for that grind!
I would also suggest you to read the compendium if you haven't done so
You'll find it in the pinned messages
Is player state the best way to "chose" a character? Eg. You have two player states one for the lobby and one for playing, the lobby one is where you chose the character and then when you connect to the server it reads that?
I like the sound of that, I will give that a go ๐
Even if you have different PlayerStates, you still have properties to copy over and for that you have inheritance. Both of your PlayerStates will inherit from their parent PlayerState which will have the Character property that you'll copy over. In that class you override APlayerState::CopyProperties and copy that property.
Gotcha, thank you! Seems pretty simple
How would an Unreal programmer handle dungeon โinstances/mapsโ in multiplayer? I.e. in an open world, some players in mage main map, some in dungeon instances (other maps).
Kind of like what Valheim has with its dumgeons in Unity.
My understanding is in MP you have to have everyone on the one map. So do I just load dungeons in as sub levels in some far away X,Y location and teleport the player there?
Is there a better way?
can't help but notice a lot of plurals there @woven basin
how many players were you planning on in total?
Over 9000
Like 4
Coop
Maybe even 2
and maybe "instance" is the wrong word - because there would only be one of each dungeon. I guess its more about how you would have dunegons in an open world style in multiplayer, where the dungeon is its own map.
The only way I can think of is the map is a sub-level loaded in far away in the main level.
well, its that or hard travel
but I cant do hard travel in that scenario can I? If you have a dedicated server, it needs the main map loaded at all times (Player A in main map, Player B in dunegon)?
dedicated server can start another instance to run the dungeon
but that means the players are effectively in different games? i.e. they couldnt talk to each other in that scenario could they?
The more I think about it, the more I think I just need to do "far away" dunegons - it probably avoids all this messy stuff huh?
they don't need to talk via unreal replication, but yes, they would be technically in a different game
I know that ARK:SE just hides their boss rooms under the main terrain. You can glitch out sometimes an see the boss healthbar from pretty far away when someone is doing a boss and you're in the main 'world'. ๐
haha - ok sick, thats good to know, because that was another reference concept - how ARK 'ports' you to a boss fight and back again.
Seems like hidden far away places is the answer. More importantly, there's not an obvious easy alternative I'm missing.
Thanks all.
they can be streamling levels
so they don't need to be loaded when nobody is doing them
Unreal tends to have a lot of hiding stuff under the main game world concepts. Small closed rooms for rendering stuff with lighting you don't want to affect elsewhere, etc. Is in a ton of their concept stuff.
But yeah, definitely stream them. Just make sure that unlike ARK, you don't load everything blocking. ๐ Entering caves and starting meteor storms with a 15 second game freeze isn't really cool.
yeah - agreed - thanks - I'll def do that
yeah - I love ARK, but I know what you are referring to. Hopefully ARK2 is much better ๐
that ARK is starting to sound like they did their networking in blueprints ๐
A big part of the game is in blueprints, including some networking
I have a question just for my brain to understand. Say you had something like an animal spawner, that is randomly generated on your terrain somewhere, and every 10 minutes or so it chucks out an animal.
If a client joined 10 minutes after the animal was spawned from said spawner, how would you go about making the client aware of the animal?
I'm just thinking if the client was there when it happened there would be a server and client side animal in sync
But if he joined after, there would only be the serverside animal
Purely trying to wrap my head around how this kind of thing works, day 0 multiplayer right now
I'm fairly sure alot of ARK is in Blueprints - based upon their config naming etc that all start with "BP_"
I used the SDK and saw so much in BP that I did not expect to find there
hey people, i wanted to ask, can i have a particle system in a replicated actor? or is that bad and i should have the particles in a separate actor that i spawn with multicast?
if the Animal was a Replicated Actor iot would do just that - replicate
If it is a replicated actor - that would occur.
So UE knowing that it's replicated it would just spawn itself for the client on the first update to the client?
you can, you might not always want to, it all depends
but separate actor spawned by multicast sounds a little bit red flaggy
whats your specific use case?
just a simple skill in a multiplayer game. the main actor of the skill is spawned on server and replicated, but i know you're not supposed to replicate particles and just spawn them locally so im trying to figure out whats the best way to do that
opening another ActorChannel just for particles would be crazy
you don't replicate particles, yes
ok, so whats the best practice here?
but you can, if its a fire and forget
multicast an event in that same Actor that will spawn a particle system
if its stateful, as in you interacted and activated a shield
then you need to replicate that state, and from OnRep, spawn a particle system
multicast will fail for stateful changed, for anyone that is outside relevancy range, as well as for late joiners
yeah thats what i've been doing till now. but the particle system basically just needs to spawn with the actor and disappear with the actor, so im trying to figure out if i can just add it as a component to the replicated actor or will that result in the engine trying to replicate the particles and big network overhead
when engine replicated an Actor
On a side note. If the skill is an actor itself, and you're spawning it, it's likely that the particle system should just be a part of it and auto activated?
both client and server create it from the Template - if the template has the PCS
they both have it on by default, no matter if the component is replicated or not
in your case, it sounds like you can put a PCS as a component on the Actor by default
and just Activate it on BeginPlay
as long as your particle system is tightly tied to the lifespan of the Actor itself - you do not need any additional information except for that Actor entered play, or got destroyed
ok cool. so i can have it just as a component, and the client will just spawn it himself when the actor is replicated to them, right?
actor spawns with all its default components, always
It would work identical to say a Static Mesh component.
okay. yeah i guess that makes sense. i thought for some reason it would try to replicate the particles over network if i did that but thats probably only if i would check replicate component, right?
not even then
It won't even do that if you replicate the component.
wait then why do people keep saying dont replicate particles?
it would replicate the Replicated UPROPERTYs declared on that component
if the engine doesnt even do that
which is unnecessary
Very likely just repeating something that they've heard. Or attempting to explain something in a very badly attempted manner.
Remember kids! Don't use tick! Set a timer from beginplay for 0.000001 seconds!
People say to MULTICAST a temp particle effect - because you only need to see the temp effect when it occurs. i.e. if an explosion occurs - you multicast the trigger for it,
Its like the age old Unreal saying: "If an Actor is not in the forest when the tree fell over, did it really play a sound"
(I just made that up - I like it - lol)
i think we have a single timer for execution order in the entire game
ahh, i see. so basically dont make an actor if i dont need to. but if im already making an actor for other reasons than i can just put the particles as a component. that makes sense. thank you.
replicated actors are not free
in fact, too many of those is the best way to murder your network performance
i see. is... is it bad that im doing two of them for every spell basically?
They also take too long. Multicasting an effect from a causing actor that is already replicated is much quicker than spawning a new actor for it.
i see
Depends on the spell though. Really one of those "it depends" areas.
i guess it was just easier to keep things tidy if i have one actor handle the cast time, chargeup effects, and a second one that is just the effector and actually does the work and can be moved around and resized by the first actor. but i guess im sacrificing network bandwidth to do that, huh?
Like. Simple firebolt. Would probably just fake it like a typical gun bullet. Large AoE effect that remains for a while? Definitely new actor for the effect. Buffs? Might not even do more than a multicast from the caster component that creates a UObject with some basic particle and animation logic with buff application.
There's not really a perfectly straight forward way to do them all in one way. Maybe if the game is incredible simple, it won't matter. The more complex the game gets, the more you have to cut each corner to save networking and gametime performance. So.. It depends. ๐
i see. thats really good to know. i think i need to consider network optimization more than just what looks nice and tidy in the code. i wasnt really doing that before. i guess i'll try to keep things in one actor unless i have a good reason for a second one
so if i need a part of a spell to be a mesh that gets moved around and resized, i should just dynamically spawn it as a component of the first spell actor and manipulate the component, instead of putting it in a separate actor and manipulating the whole second actor from the first actor?
Possibly. If you already have one actor for the spell, I wouldn't create a second just for a mesh visual.
i see. thank you.
ARPG multiplayer template (free on marketplace) has a really good start-up skill system ready for multiplayer
you can use that as a example on how to implement it
thanks
thank the guy who created it on the video later on, the amount on work that guy put on that template is unbelievable
had a system that does work but im trying to change it up
this is on the player blueprint it basically calls fire bullet on server and works
wanted to make guns on their own blueprint tho, not the player one just for modularity purposes
but for some reason this one on the client says click but does not run Server Fire Gun
whereas the original did run the fire bullet function on clients
ive tried replicating the gun to no avail
i could just do the opposite if i need to just like having variables on the gun
are you replicting the BP or Component? if you change the events, but don't replicate the actor, it's useless.
Also, maybe using interface would be a good idea (so you don't need to call a specific method for the weapon to fire, you just tell "hey, fire Generic" and the weapon handles it.
If you change the weapon it still works as long as it implements the same interface
eh maybe
Does the client own the actor this is running in?
probably not
taht did it
set owner
dont really know the best method overall but at least this kind of works
i basically want a scenario of ~6-12 players max and easily variable guns or some structure i can adapt easily
replicating the gun might be expensive tho idk
(on the server load)
This is a perfectly fine method. Clients cannot RPC to server from anything except actors that are directly or indirectly owned by their PlayerController. Ownership can only be set on Server. Normal ownership is a client's PlayerController and their possessed pawn.
6-12 guns being replicated is nothing. Call back when you start considering triple zeros in those numbers. ๐
๐ฌ
well im adjusting my game's ambitions to my own inexperience
mainly shooting for 6-12 players at once, each with 1 gun
The idea of understanding the concept is great, you may wanna check on the Lyra proyect. It's a multiplayer fps template made by epic
i might look at it at some point but ive done a lot of these so im just going with what i know
Generally speaking. Don't stress about problems until you run into them. Don't draw lines in the sand. You'll just hamper your development. The best way to learn is to find the actual problem and figure the way around it rather than avoiding running into the problem.
interactors would be nice for modularity but im too lazy atm
yeah i just want to at least have a reasonable goal
So you are saying a mmorpg?
just kidding, don't mind me.
I still need to look into Lyra stuff. UE5 has kind of scared me after checking out CommonUI. :/
will probs use the multiplayer w/ blueprints plugin
ive done steam connection like host / join games but this needs a server-client system with matchmaking
and databasing for stuff like inventory
If you're just making a basic shooter. You might be able to get away with blueprints only. Shooters are simple enough games in small settings.
I love blueprint. But it will really hamper game development in a lot of cases. I wouldn't even stick BP only for UI at this point.
im fine with BP i use some C++ in the form of my "custom plugins" when things get annoying
but something like matchmaking is a lot of code even for C++
i would bet there's already some free system out there for matchmaking, i'm a great proposal of not inventing the wheel when you are doing the work. Reinvent it when you already did the work and want to do it again better
Maybe epic subsystem, let me check
Multiplayer w/ Blueprints is the most popular one i could find
it uses AWS and some other services
hella expensive tho, could probably get a cracked version until i release something
This is from 2 years ago
so i'm guessing it should be free already, but i tried looking for it on epic online subsystem and i couldn't find any doc about it
there is a video for epic online subsystems and such but i need a lot more than host/join
also need a secure way to save player info
EOS should be able to save player info
oh it seems to have stuff like that
well ill look into it in a bit
hopefully there r some examples or walkthroughs
probably you got in contact with one of the features of the EOS, the amount of features that EOS have for free is quite big, really worth the time checking it
yeah i dont see it mentioning inventories or user data but it does store purchase info so probably can store other stuff
Is there an example or walkthrough or setting up EOS for sessions, lobbies, matchmaking, etc that anyone knows of?
I've watched a few that are supposed to be for that but they don't seem to be setting it up at all like the website explains or even using the SDK includes, so I think they're just using the online subsystem and not EOS
There might be some examples in Lyra?
If a component replicates as expected in Standalone and Listen but not Client, what's the most obvious reasoning?
that it's not actually replicating i guess, what is your setup?
Whatever you may be doing only happens server-side. In Standalone you are the server, so no problem. In Listen server, the first player is the server, so there's probably no problem for the server, but any clients may still be having trouble. When you're running as client, you're connecting to the server with all your PIE windows, so you don't see what happens at all on the server. That's my guess anyway...
Without seeing more of what you're attempting to replicate, best anyone can do is speculate.
I see that the GameMode and GameState are created before other actors, but do they BeginPlay before other actors?
...I meant to ask that in #cpp but I feel like it's relevant here too.
Well it's a bit long to explain. I took Lyra's health attribute and component and made Stamina versions. That's in c++. I then implemented them to the UI. The actual attributes work on Client. Just not the UI. Though their original works fine. I probably just need to comb through it.
Yes
If you want to see that in action see AGameStateBase::HandleBeginPlay
And GameState is spawned by the GameMode. Also this can help: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/GameFlow/
when I go into network mode client I cannot posses any of the players through the client windows. Is there a big part of multiplayer I don't understand and need to know?
You mean possess and detach(F8)? That can only be done using Selected Viewport and not any of the other configurations
Well it can be done using the other configurations/modes, but you can't float around with camera...
Hey guys, does anyone have experience using Unreal with websockets for turn based games?
Get Overlapping Actors doesn't seem to work properly when playing as Client on a dedicated server (array is empty). It works fine if it's a listen server though.
Also it works if I use a line or shape trace. But I need to be able to use the sword's hitbox
It looks like the array is correct for the client, but for the server it's empty. Is it because there's no visual animation for the dedicated server? Because it works fine when there's a listen server.
@dusky flicker it's correct that by default dedicated servers aren't ticking animations
If your whole thing there relies on an animation then you will have to change the setting on the skeletalmesh component
Not sure what it's called again though
Would it make sense to listen for PlayerControllr->OnDestroyed (AActor delegate) to understand if a player left to match or not?
iirc they are not get destroyed or something but I might confusing them with player states
PlayerStates stay around for a few minutes
PlayerControllers are destroyed
but there is also AGameMode:;Logout that will get tripped in the process
PlayerState remains for 5 minutes by defeult in InactivePlayers array
and gets reassigned to the PC if that player logs back in
Zlo beat me 2 it but you should read all of GameMode class, it's got a lot of nice flow pieces for MP
@here Have any of you worked multiplayer in the pawn class before? I have a few problems and I can't solve it. This is the plugin I use https://www.unrealengine.com/marketplace/en-US/product/photon-cloud-api-by-xixgames
I'm back again ๐
I have a voxel world generator inside of a blueprint, it's inside the world as standard, as I know, it's owned by the server? But there is a version of it on the client?
What I'm trying to do, is the listen server client sets a seed, when he loads, calls an event on the generator with the seed, to generate using the seed
And then when I client joins, get the seed, call the event to generate on his side.
I've tried repnotify seed variable on playercontroller, on repnotify it gets the generator blueprint and does the generator, this only runs on the server and the client can't see anything
I've tried repnotify seed variable on playercontroller, sending a RPC from the server playercontroller to the client character which then gets the generators and runs the code, but again, the client can't execute the code on from what I know is a serverside actor.
Everytime, the collision seems to kind of work clientside, when you jump you jump from where the terrain would be, but you fall through it afterwards.
I've sent myself into such a spiral and confused myself so badly I know I'm missing something so basic...
I'm basically trying to run an event clientside, from a variable that's set on the server, is the only way to do this setting the seed as server, repnotify the seed on the controller, from the controller pass it to the clientside character, the character then spawns their own generator blueprint actors in the right place and then run the code?
I've read through the compendium, and it helped alot with my other stuffs but I've just confused myself so badly on this I've lost my bearings completely (day 1 of network stuff)
An actor that is set to be dormant, no longer considers whether it needs to be destroyed on the client on grounds of being out of net relevancy range. It thus lingers around on the client and does not get destroyed/recreated when back in net relevancy range.
Is this something we can override or change?
(ForceNetUpdate does not fix it)
I've done something similar except on a smaller scale. I had a maze made out of cubes and planes but the concept was the exact same as you described in the first few sentences. What I did was that I had a replicated actor that would through an OnRep provide the seed to any joining client for that actor and would then spawn non-replicated actors as it's children wherever needed after calculating where everything should go.
Do note that you can totally call code on replicated actors from a client. You just have to make sure it doesn't collide with what the server tells it or make sure the server accepts that.
Some things I would check are:
- Is the voxel actor already there whenever the replicated variable was called on the PlayerController? Or for the RPC.
- Are there no errors in the first place? Have you actually made sure that the code gets called?
- You also mentioned falling through the map when it did work. Have you checked if the server world and the client world are the same? Maybe the seed is somehow wrong or perhaps the world generates differently because of an issue.
- Have you tried looking at the collision from within the editor to see how that is generated?
Can a client load and unload data layers (for only themselves) in a dedicated server?
sorry for not replying to your message I fell asleep, but when I play in the network mode it gives me the camera of the players but I cannot control them at all when I click the window
when I play standalone in the viewport I can control the players I put myself onto
This generally happens if you don't have a PlayerController class specified in your GameMode, though this should affect all network modes. With the info you provided I can't tell what's the issue
For multiplayer whats the best way to be assigning a team to a player
You prolly mean assign a player to a team. The easy and intuitive way is to have a property in the PlayerState that represents the team he's in.
The teams themselves can be defined in the GameMode
Just for reference if anyone else ever sees this. They send me a DM and we talked a bit. The problem was a "HasAuthority" issue somewhere in the code ๐
Hmmm, yeah I can't really explain much more than I see. I apologize I'm fairly new to this. I should learn more about multiplayer and how it works.
is there any reason to use replicate multicast over replicate server into a separate replicate owning client?
Most times I have tried using multicast it just causes weird issues which are resolved when I have it separated into two different events (one for server, one for owning client)
Well Multicast generally means "send to all players this actor is relevant for"
Multicast and Client RPC's have very different meanings
Client means "only send to the owning client of this actor"
hrm, I see
Hi everybody! this is something that someone gave a solution yesterday, but if posible i would like to not use that one in particular.
How do you handle spawning the UI widget for all party members when someone logs in?
Something like this, but as soon as a new controller pops in
i'm having troubles with sync between player controller and player state because the controller just spawned
Not sure if typo but a New Controller is irrelevant here. Only concern should be a PlayerState. For that you have two choices. If you're BP only, you tick the PlayerArray in GameState and cache it and == it to see when it changes. If you're using C++, subclass GameStateBase, and override AddPlayerState and RemovePlayerState and add a delegate broadcast. These are called on clients.
i'm doing something similar to that right now.
But when i pass the player states to the client to update the UI, they are invalid because the server didn't replicated to the client yet since spawn.
Never RPC to set up stateful UI. It relies on the state being on the client. Wait for the playerstate to replicate to the client. Which is when it's added to the PlayerArray and AddPlayerState and RemovePlayerState arre called. At that point you know the new state is valid.
I can just do a tick on the UI widget and wait for the playerstate to be ready with a "do once" node.
But it seems like a innecesary overkill, there has to be a simplier way that i don't know yet
You mean the arrays on my picture? If i check client side player state after adding to that PlayerState array, it's invalid on the client.
The issue with the RPC is that that RPC runs. What if the player instantly disconnects and stuff happens on the server that causes state never to be replicated? Now you have UI waiting on a playerstate that will never arrive. Generally speaking in terms of UI stuff, you'll almost never deal with RPCs. OnReps are your best friend.
Always, always, always display state that the client has and only the state the client has. If it doesn't exist on the client, you have a networking problem that needs sorted out. Server should never dictate this.
I did a OnRep from the playerState, but than i ran into the problem that the PC was not ready/replicated yet
hmm okey, let me rethink it with that in mind
Are you BP only?
At the moment yeah
In my game when players die they respawn as a dead version of the character. Where should I handle killing and respawning the new actor? I was thinking player state, but I am not sure.
I think gamemode should be the place for that kind of things
Anyone here familiar with connection setup?
You setup can be something as simple as this.
The RowWidget can use Construct or Tick on it's ContextPlayerState to update itself. This container widget that creates and holds them in it's vertical box handles checking the playerarray and removing widgets with invalid states and adding new ones. Then the RowWidget just has to do it's own visuals.
that tick checks looks really expensive
or because of invalidate it only checks when it changes?
It's not. Identical on array is surprisingly fast.
i was trying to avoid spawning the widget from the player state, but that could work.
Let me modify it a little bit
From player State?
This has nothing to do with the PlayerStates except that it's passing one into the widget that needs it for referencing. All of this is in a second widget that can just be added to your viewport.
oh i see, it's really easy if you just tick on the UI.
I was trying to avoid it but i don't want to waste any more time on this, i'll go with a setup like this and fix it later when i redo it on c++
It was just crazy to me all the workarounds that you need to do something like this on BP. All it's needed is to be able to override OnRep PlayerState on the PC or the GS (By default)
Steam server browser connections or matchmaking? Anyone?
i'm using advanced session plugin for the connections, it works with steam
what are you trying to do?
My problem with my game is that it would not end the connection after host terminates listen server. Sometimes it will leave trace behind forcing players to restart just to fix this.
I can show you on livestream if you wish.
Or you can download and test it with me via Playtest on the game's page.
To produce the same bug.
What about using GameMode and on PlayerController LogOut, check if it's listen server, if so, terminate the session of all the other ones conected?
Funny enough, functions like this don't even phase me. When you have to tick to update a list of strings, and tick over those strings to test names of people in your party/raidgroup, and handle getting stats via those strings and removing old UI via them. Then you're in badlands. Honestly, the above solution is incredibly clean. It just has the tick stigma, which people need to get over.
wait, i don't think you can do that if the server aut is out, the server is done after that.
Let me check it on my setup, i need to add this later on, i may as well just add it now
when I try to connect to a dedicated server through open 127.0.0.1 it works, but when I try to connect to a server hosted on AWS with open <aws IP> I cannot connect to it, I used a tool to check if the AWS server is receiving connections through the port 7777 and it is, am I doing something wrong?
i'm trying to replicate this on my setup but i cant.
I'm doing the following
*Create session
*Join that session with another client
*Open another map on the server
After that, all clients are kicked out and moved to the main menu.
I do have in my settup a session killer when you go to the main menu, so this may be ensuring that the host session gets down.
That setup looks like madness, why would someone do that o.o
Do you have any link to your projects that i can see? i got curious now
I don't have anything personal that is public. I work at Ironward on Red Solstice 2 though. ๐
And for the other question, WoW UI addons API coupled with some really terrible libraries.
Did you try to start a new server after terminating session? That is when the problem occurs.
What session killer?
Problem is it will work once (seemingly), and the problem surmises on second attempt to start a new server.
I just did and it works okey, i can do a new session agan and the old players can do a new session themself or join
Or the last session will not erase from browser.
I'm using advanced session pluggin and whenever i change to a map that is not supposed to have a session, i kill any living session just in case.
I will try that in the menu level.
Are you also using Advanced Steam Sessions as well?
Not just Advanced Sessions plugin?
I worked for a "solstice" company a few years ago, but probably not the same one. They are called kin and carta now
Will try that.
still need assistance with this
what tool, and what did it say
a tool that says "filtered" is telling you that it's a longer response than it should be, meaning that probably a firewall let's someone through
security rules are a firewall, so it might say that even if your local ip isnt authorized
Why even if i override prelogin i get this error on my server?
Debug and see what's getting executed?
My wild guess is that you're not using this GameMode
It is only happening on dedicated server, i can`t debug it
it is running on ARM64, then i removed EOS from server build but the unique_net_id does not match now
(EOS not works with ARM64)
I am because the "Login" is called

Unreal is hard
Welcome to the crying club!
is it hard for you too?
Is it not? I'm already in that club 
@fathom aspen i managed to make it work recompiling the project from scratch, it was some c++ cache
๐
Ah then there is still a piece of hope that it's not hard
the tool is called netcat and the result of the command nc -v -u -z -w 3 <IP> <Port> is Connection to <IP> <Port> secceeded
Duly noted, I can't believe I need steam libraries for the server to work q_q, but I can connect to it now
Just updated my pinned comment with another new article: How to replicate thousands of Actors efficiently. Some of you might be interested. Big thanks to Zlo and Jambax tbh
hah
I keep hearing that you have to set up multiplayer first in your project or else you'll have to rewrite the entire game. Do they mean before you do anything at all?
yes
Hey guys!
Does someone have a method for changing the player character (or default pawn class) to create a working character selection?
Kinda lost here, searched on every google result didn't found a solid one to work.
Thank you vori.
How can I make it so one button either creates a server if there's no players online, or joins any server with players in it
What tech is typically used to push notifications to a dedicated server from your cloud? For example, you have a custom party system that is available from the main menu screen. You want to receive notifications from your private cloud when a player sends an invite. Sure, you could poll a web service when on that screen every X seconds, but it seems like there should be a SignalR-like equivalent for this type of situation.
I guess I shouldn't have said dedicated server
I should have just said "game"
I wouldn't be using P2P though. This would be a custom system.
Why not?
I can't afford dedicated servers atm
And the max lobbies are 8
GTA servers are peer to peer and run 30 players
Not trying to sound rude, but you not being able to afford dedicated servers doesn't really apply to my question. I think you might be locking into the specific example I gave as "This is what I am exactly trying to do" when really I was just asking what tech stack is used for more real-time communication between your services and your game clients / servers
and I am not using lobbies
I don't know what a tech stack is
a "stack" of technologies in which are used to provide a solution to a problem
Ok
Out of curiosity. Why not simply find all sessions. Filter them and choose one randomly?
Hi, why i can't hover and click 3d widget on multiplayer? On server and on Client doesn't work, when i open 1 window then is ok, but when i run it on client and server then doesn't work
How can I do this?
Take the Found Sessions array you saved. Iterate over it to see if it has a session the player could join. If no, create a new session, if yes, join the session.
Did you find solution?
Is the gamemode already on the server?
It's been a while so I'm not too sure what I did but yes.
Apparently it's related to the pointer index, here's a post about it : https://forums.unrealengine.com/t/bug-widget-interaction-in-multiplayer/402548/4
Screen is how I implemented it in the player
How can I Iterate over it to see if it has a session the player could join?
Dunno. Depends on your restrictions. If game size is the only one, then your session struct needs that info and you need to check it.
I only need the max server player count
I don't have advanced sessions installed. Can you get that info out of the session struct?
@pallid mesa yea replication graph is cool and all but have you ascended to EnTT yet
There is a filter session results
more like #mass
oh is it
soonโข๏ธ
thought it was (m)ass
Dunno then. If the data isn't in the struct. You have to put it there somehow. Likely through a parameter string or array. If I recall advanced session has that option.
๐ง ass
How could I detect the amount of players
you'd still need to write a custom net driver to replicate more than 3 of those thicc 2kb actors tho
In the game that the session is in?
Yeah cus they i can kick them if they try to join and its at the max
If memory serves, Unreal has a player count in place already.
Maybe not. Can't remember.
not actors tho
entities with fragments are by design lightweighted so
This should be able to do it ?
300 bytes for a uobject in this economy? 
UScriptStructs
so underlying UObject
thx i will read..
No idea. Don't know what filters takes.
I need to ask this question again
How can I make it so one button either creates a server if there's no players online, or joins any server with players in it
But for Advanced Sessions
Is anyone and expert on this?
Do you know how to get active session?
No
Start with that, figuring out how to find sessions in action already
Should I be setting the player controller or player character to a character variable which holds their role
For example
When the gamemode starts
no
How well does the "Bad" network emulation profile for PIE approximate real life poor network conditions?
I tried doubling the latency and packet loss on "bad" and noticed player movement degrades much more rapidly than the stuff I'm replicating.
Is there anything additional I should use to validate I'm handling poor network conditions correctly?
live test on a packaged game ๐
you should not be using those at all
GetPlayerController[Index] i mean, they have a way of biting you in your arse when you don't know exactly what you're doing
Then what do i use?
None of what you just said is a thing.
@pallid mesa does this count as multiplayer https://github.com/cryptolok/BusAsM
How much performance are we loosing by increasing the PlayerState net update frequency? I would like to have my inventory and attributes stored on the PlayerState and not the PlayerCharacter for repawn purposes. My game is a listen server mode for maximum 5 people. I would like to increase it to something similar to the Character net update. Is this a bad idea?
(I am using the GameplayAbilitySystem and I am storing it on the player state)
it'll be fine as long as you delegate things to your pawn
ie: the gc system
you can cull cues using your pawn relevancy
since ps's are always relevant
but to be frankly the scope of your game is smol
so my main recommendation us to measure your performance before you take decisions that will require further engineering