#multiplayer
1 messages · Page 628 of 1
I hope i'm understanding it correctly.
So i should just use the (server) set function as initial call where it will call the (client) set function ?
I'm feeling really dumb rn(Probably cuz i am, but also cuz the lack of sleep >_<)
Is actual ping is Ping (playerstate variable) * 4? I remember Kaos mentioned it somewhere but couldn't find it
I'm working on a networked sailing game. It all seems to sync well except for this one thing that we can't figure out. A player is able to tip the ship, We thought it was physic interactions from the charactermovement component but we disable it and it's still happening. We then thought it was depenetration from desync, It happens less on the server-client than remote clients. We tried reducing the depenetration lengths on the character but that didnt help either. We would greatly appreciate a push in the right direction
Any idea why my boat location won't get replicated. https://gyazo.com/72c9069185f988e8fb92570025af9047
You have replicate movement checked and replicate physics?
Do all players spawn with a Spectator Pawn at beginning of game?
I'm doing a multicast event, it casts through my spec pawn but for some reason when I use print string after this cast it treats it like everyone passed the cast.
Hey I looked up a little and i found no video about voice chat . is there a way i can implement voice chat my mutliplayer game?
@winged badger So i still hope i understood you correctly(Now with enough sleep :D).
I've changed the code to this here now
void APlayerCharacter::TakeStamina(const float Stamina)
{
M_StaminaCurrent = FMath::Clamp(M_StaminaCurrent + Stamina, 0.f, M_StaminaMAX);
}
void APlayerCharacter::Server_TakeStamina_Implementation(const float Stamina)
{
TakeStamina(Stamina);
}
Where i'll only call Server_TakeStamina(SomeFloat) if i wanna add/remove stamina from the player.
So far it also seems to work for both, server client and just the player client
Hi everyone, I'm really stuck trying to get Seamless Travel to work. According to the UE4 documentation, all you need to do is set bUseSeamlessTravel = true in MasterGameMode, define a transition map, and then called GetWorld()->SeamlessTravel and it should all just work
But it doesn't work for me. The client is left behind in the previous map
I'm not sure how to debug this
ServerTravel works fine, but I have an issue where I need some client settings to persist during a level change, but of course with non-seamless they all get disconnected and reconnected, so it's impossible to track things like whether the player had admin privileges
I'm working with C++ by the way
For the most part bUseSeamlessTravel is enough really, IIRC there's a default transition map
Dunno what SeamlessTravel () does though, I just use ServerTravel for seamless
Ah, so it is enough to just set bUseSeamlessTravel, you don't even need to call seamless?
The doc doesn't even mention SeamlessTravel()
Oh my god I'm dumb. I just assumed you had to call SeamlessTravel() since, well, the function is there
I just removed the call to SeamlessTravel() and went back to ServerTravel, but with bUseSeamlessTravel = true and it works
Thanks!
Cool !
Hi guys, i'm having trouble with high framerate clients - server (listen). Networking seems to stabilize around 100fps but any higher like 120 is just drowning my networking, i have tried clamping network update rates to 30-60 fps enabling different values.
ConnectionTimeout=80.0 InitialConnectTimeout=120.0 MaxNetTickRate=60 NetServerMaxTickRate=60 LanServerMaxTickRate=60 NetClientTicksPerSecond=60 KeepAliveTime=2 MaxClientRate=100000 MaxInternetClientRate=100000 bClampListenServerTickRates=true UseAdaptiveNetUpdateFrequency=true
Any idea what else i can try ?
use the netprofiler is always a good move
you can see exactly what the drag is
theres some youtube material on it..
Does Unreal Insights do network stuff?
i dont remember
that might be another good avenue
the problem is clients will be sending RPC's in at say 120hz
listenserver needs to handle these
even at 60hz with 8 players it will be quite a lot for the listen server to process aswell as maintain its game thread for playing
@strong vapor I have already tried using the profiler to find out what the issue is, but i don't see anything odd.
@meager spade that is basically why i'm trying to limit the rate, but i can't seem to figure out what to do exactly
i have no multicasts on update and stupid stuff like that 😄 i have spent the last couple of days checking that kind of stuff
yes, cmc is the main offender
ofc
[/Script/Engine.GameNetworkManager]
TotalNetBandwidth=200000
MaxDynamicBandwidth=40000
MinDynamicBandwidth=20000
ClientAuthorativePosition=false
ClientErrorUpdateRateLimit=0.015f
MAXCLIENTUPDATEINTERVAL=0.25f
MAXPOSITIONERRORSQUARED=6.f
MaxClientForcedUpdateDuration=0.60f
ServerForcedUpdateHitchThreshold=0.150f
ServerForcedUpdateHitchCooldown=0.100f
MaxMoveDeltaTime=0.125f
ClientNetSendMoveDeltaTime=0.0166f
ClientNetSendMoveDeltaTimeThrottled=0.0222f
ClientNetSendMoveDeltaTimeStationary=0.0166f
ClientNetSendMoveThrottleAtNetSpeed=10000
ClientNetSendMoveThrottleOverPlayerCount=24
bMovementTimeDiscrepancyDetection=false
bMovementTimeDiscrepancyResolution=false
MovementTimeDiscrepancyMaxTimeMargin=0.25f
MovementTimeDiscrepancyMinTimeMargin=-0.25f
MovementTimeDiscrepancyResolutionRate=1.0f
MovementTimeDiscrepancyDriftAllowance=0.05f
bMovementTimeDiscrepancyForceCorrectionsDuringResolution=true
ClientNetCamUpdateDeltaTime=0.066f
;If ping goes over this value, we have bad ping. Value is milliseconds.
BadPingThreshold=200
;If ping goes over this value, we have severe ping. Value is milliseconds.
SeverePingThreshold=500
;If packet loss goes over this value, we have bad packet loss. Value is from 0-1.
BadPacketLossThreshold=0.05
;If packet loss goes over this threshold, we have severe packet loss. Value is from 0-1.
SeverePacketLossThreshold=0.15``` put this in your DefaultGame.ini
i think i have something pretty similar, but i will try with your values
MaxMoveDeltaTime=0.125f ClientNetSendMoveDeltaTime=0.0166f ClientNetSendMoveDeltaTimeThrottled=0.0222f ClientNetSendMoveDeltaTimeStationary=0.0166f ClientNetSendMoveThrottleAtNetSpeed=10000 ClientNetSendMoveThrottleOverPlayerCount=24
this part is basically the same on my part
yeah
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection
bNeverApplyNetworkEmulationSettings=true
MaxClientRate=25000
MaxInternetClientRate=25000
bClampListenServerTickRate=true
NetServerMaxTickRate=30
MaxNetTickRate=30
[/Script/Engine.Player]
ConfiguredInternetSpeed=25000
ConfiguredLanSpeed=25000``` also these values
obvs if your not using steam, this should be your current net driver
that is 8 clients config btw
[/Script/OnlineSubsystemSteam.SteamNetDriver] NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection" ;[PacketHandlerComponents] ;+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface ConnectionTimeout=80.0 InitialConnectTimeout=120.0 MaxNetTickRate=60 NetServerMaxTickRate=60 LanServerMaxTickRate=60 NetClientTicksPerSecond=60 KeepAliveTime=2 MaxClientRate=10000 MaxInternetClientRate=10000 bClampListenServerTickRates=true UseAdaptiveNetUpdateFrequency=true
I have this
should i bump it ? to say 20 ?
we have ours at 25k
k, i will bump it and try again
also sort your network actors priority and update frequencies
those can kill your networking and cause a heavy load on the listen server
yes i already had a nice chat about that with @winged badger :3
when our blueprint people played with net priorities
ouch
basically, actors are replicated in order of priority
when they are passed in an evaluation pass, their net priority increases a little
takes ages to get panick past a 100
our short lived actors like grenades and projectiles wouldn't even live long enough to replicate once
Hi, does anyone know why FindSessionsAdvanced always finds all sessions ignoring wheater the session is LAN or not?
Using which OSS ?
only the default one?
Assuming that's NULL, it only does LAN anyway
mmm i have a bunch of oss enabled, but i don´t know which one is running. Should i disable them all?
You only have one running
The one set in DefaultEngine.ini
"DefaultPlatformService"
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_BlankBP",NewGameName="/Script/FANLab")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_BlankBP",NewGameName="/Script/FANLab")
[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/MainMenu.MainMenu
GameDefaultMap=/Game/Maps/MainMenu.MainMenu
TransitionMap=/Game/Maps/Transition.Transition
ServerDefaultMap=/Game/Maps/MainMenu.MainMenu
GameInstanceClass=/Game/Blueprints/AllLevels/GameInfoInstance.GameInfoInstance_C
[Internationalization]
+LocalizationPaths=%GAMEDIR%Content/Localization/Traduccion
[/Script/Engine.PhysicsSettings]
MinContactOffset=0.000100
MaxContactOffset=0.001000
ContactOffsetMultiplier=0.001000
DefaultTerminalVelocity=7600.000000
MaxAngularVelocity=10000.000000
It's NULL, then
So, i have no one?
The one that's LAN only
Mhhh so it will only create and find lan sessions?
Yes
And how can i create online sessions without steam?
By using another store's service, or building your own service
Does epic have one?
Last I checked it was less "enable" and more "write the UE4 integration" or "buy an expensive plugin that does it"
And it's not like you can sell on EGS right now, so I'd suggest working on supporting multiple stores - Steam works out of the box with no setup
what is EGS?
Oh so i would need to find the subsystem to use based on the player preferences?
Not really
It's more like you'll have a Steam build, maybe a GOG build or EGS build if either platform does a deal with you
But i´m not trying to make a deal with a platform
If i need my game to be hosted online but not making deals with those platforms i would need my own service?
Can i use only an Epic service to do it?
Or there is no such a thing
As far as I know EOS is the only one that explicitly doesn't want you to sell through their store to use their services, at least for now
With the caveat that most players will take a dim view of creating an EOS account to play your game
But most players will take a dim view of not buying on Steam, in the first place
So I guess you're fine
Is it possible to ignore everything expect the own player with it's attached components when using USceneCaptureComponent2D ?
Currently I'm able to just capture the player, but it would also capture other players
it takes in an array of ignored actors right?
so you can grab all players and add them that is not you
UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category=SceneCapture)
TArray<AActor*> HiddenActors;```
this just needs to hold all players that is not the local player.

Thanks, seems like i read too fast so that i didn't even saw that in the source code
Oh actually, it seems like this isn't inside of USceneCaptureComponent2D, but USceneCaptureComponent then
Hey, I made a widget with a crosshair and if it over an enemy it should go to red. this is my line trace that cast to the widget and change a boolean. If the function non-replicatedt, the croshair for the server goes red,but not for the client that target the enemy and if the server target someone nothing happens, if its multicast all go to red if 1 client target something,but nithing happen on server. if the function server or owning client, nothing happen anyway. so i read a little and try a way where the tracing for all only go on server an the server send via player id check the boolean to clients but it doesnt work. have anyone some ideas or inspiration, tipps how i can solve it so, that wenn the server target a enemy it goes red for server and if the client target something ot goes red for the client. I programming not so long for multiplayer so this might be easiere than i think , but io stuck actually and turn around over this problem 😩
now i replicated the widget var, and if the server got a target the client one goes res und ist the client target one the server goes red.... i realy dont now what goining on
@rain ledge so i dont maybe have the right context for your question by your screen shots cause i dont know what script they're being called in BUTTT... i can tell you that widgets dont have any replication.. they're owned BY the client.. so the server never sees any of it... thats a dedicated server atleast.. listen server's still have Widgets but its still not good architecture to try to put replicated variables in widgets or something
also just a general suggestion for debugging is to start throwing Print statements off all those "cast failed"s and "isvalid"s
so you know where its going wrong or whats missing
thanks for the input, its an interesting fact about widgets
hey, I am trying to convert the vanilla SocketIO c++ client to using unreal systems (notably unreal websockets). In that regard, I want an unreal replacement for the asio library. What would be the best thing to use here?
anyone knows why move to actor from server makes the player who controls it lag? I guess its the sync between the two but not sure how to solve this
I solved my Problem, i need to make a branche with "is locally Controlled" befor the widget spawns, with out this, ther was more than one widget 🤦
Hell;o guys i have a short warning but its in real its a error:
Hey thanks for your quick answer but i fix now. but i have this now only
yeah no idea without know what is happening
clearly its trying to find an invalid object
hmm strange
How difficulty would it be to migrate from listen servers to dedicated servers late in a project's development cycle?
I am trying to prototype and get something out, but the requirements to get a dedicated server properly tested seem a bit much for a project in the prototyping stage
It's not especially hard, just test what you have developed headless every once in awhile to make sure the thing doesn't die
Perfect, so I just need to make sure it isn't throwing exceptions and I should be golden
(not showing UIs, playing sounds, etc.)
Quite a few games actually use both styles in the same game. Ark is a great example. It's very heavily dedicated server oriented, but it also has the ability for people to play listenserver style for coop with friends. In reality your server code should almost always be written like it's going to run independent from a client. So that style ends up leading to it not mattering if the server has a player as well, or if it's on a dedicated instance.
will is controlled be valid on client?
@shrewd tinsel Only for the local player's character.
The call gets the pawn's Controller, and casts it to APlayerController. But controller won't be valid on the client unless it's the client's controller, which would be controlling the client's pawn.
Yes strangely it still doesn't work. I might try a diff approach now. I will simply posses the boat then control that boat from boat bp.
Anyone knows how to fix the lag when server calls move to actor and you control the character moving?
Yeah, don't do that
Instead, move the character locally, tell the server your input, simulate deterministically on both, and reconcile server commands accounting for lag
I have a widget thats suppose to say either active or inactive when I press a button, its showing up on the server but not on the client , what do I need to do to make it show up on the client?
@bitter oriole No I dont want to do iinput, player can already move locally, its just that the server needs to also assign him a move to actor, thats the only thing im missing right now, I know the concept for all the multiplayer stuff quite well already but seems like when server says to move to, the client sync stuff from the movement component makes it jerky for the owning client
Its like a MOBA game where you cna also move with WASD
Pretty sure the "move to" stuff isn't really meant for client-driven multiplayer
But okay
I could just not possess it but that wouldnt be an option due to direct input
Yeah thats what I miss, I tried calling on server/client/server and client at the same time, all were jerky
I mean it probably completely bypasses client synchronization
Yeah thats what I thought, is there a way not to?
Directly giving directional input wouldnt work either since I need pathfinding, unless I make some logic for it on the client, but there has to be a better way
Not a big character expert here so I don't know, dig into the ACharacter code to see if there's a code path for a moveto that doesn't rollback clients
I can maybe try unpossesing and possessing the character on input as well
Can someone suggest how to properly replicate the grabbing of objects in a VR game? It doesn't work out of the box
same way you replicate any complex mechanic - based movement in CharacterMovementComponent might give you some inspiration. No cliff notes on that one, afaik.
it's not an easy answer and you're going to need some foundational study
@cyan crane use the Vrexpansion plugin its already there
can someone help? For some reason my text binding is not showing up on my client widget, its suppose to say if its active or inactive, but its not showing on the client, how can I make it work so the client see it
cast failed?
Like to write things like this as CastWorked && Condition so if the cast fails it explicitly does the false case (because either way doesn't use the character state beyond asking for the yes/no.)
Anyone know why this is happening?
Linux Dedicated Server on Development - Works
Linux Dedicated Server on Shipping - Works
Windows Dedicated Server on Development - Works
Windows Dedicated Server on Shipping - Doesn't work
STEAM: Failed to initialize Steam, this could be due to a Steam server and client running on the same machine. Try running with -NOSTEAM on the cmdline to disable.
For Linux Shipping to work, I had to put steamclient.so adjecent to the server exe, I see no mention of this anywhere when it comes to Windows though, is it maybe something like that?
I don't even understand this error anyway, it's completely lying when it comes to dedicated servers. I've had multiple servers, plus a game instance running on the same machine fine, as long as the ports are different. Just not on Windows Shipping.
@lament cloak ive had the same issue before do you have your own steam app id?
cause i get that error when i use 480 dev app id
also are your ports open on your modem
cause my mistake was opening them on the router and not the actual modem
I got it working. I needed steamclient.dll and steam_appid.txt adjecent to the server's exe. So it was the exact same problem with Linux and Shipping. Getting real tired of these undocumented, unexpected behaviors.
ok
thanks for trying Spooky!
np just speaking from my experience 🙂
Im definitely going to document the 100 "gotchas" i've had with steam dedicated servers and UE4 lol
so I need some help with networking. I basically need to set the weapon child actor class to the one in the game instance, and make sure that both the server and the client have the right weapon class before executing the rest of the "begin play" events.
It doesnt seem to be working on the client. all of the weapons from the players on the client are not properly initializes
the code to replicate the initialization is the second pic, which I know for sure works
Quick question, was going to work on building the dedicated server and was wondering if anyone has any experince with utilizing a config for things such as server name, player count, etc.
When you posses and unposses do they only have to happen on server RPC/
@summer tide they only happen on the server that's correct
can someone help? I have created a widget HUD in my player controller but it will only show up on a button press on my character, if I connect it to the begin play of my character it wont show up. does anyone know why?
So my character slides as the possed char moves as well.
right
@halcyon totem have you tried a slight delay yet?
if it fixes it. that doesnt mean its the best solution.. but it atleast lets you know the problem
Why do I have that multicast,it's already exist and visible?why u need to set it twice?
Is there a way to join a session without a level change? I have a menu which requires players to ready-up etc. before actually travelling to a map, and when joining that session it kicks the clients to the home screen since it reloads the whole thing.
Worst case scenario I can do logic in construct to build it differently if already in a session, but the animated menu elements would both freeze and start from the beginning no matter what this way.
Is it possible to have a config for the server and a config for the game client?
I know it's possible per platform, but wondering if doable per build target
It's not I don't think, the same question came up a week or so ago
Hello all, I am looking for someone to help with a small project. I will pay money for time/services.
Sorry if this is in the wrong channel, as I could not find a specific one for private projects
Any idea what could be causing steam session to not appear in search result and not be joinable after 2 players have joined the game? I have set the NumPublicConnections to 10 when trying to test it but the session allows only 1 more player in addition to the host
You may have to enable to uber-verbose logging to get any reasonable info.
LogOnline is the category I think
also worth making sure that you didn't incorrectly modify a session manually when you detected a player joining
like instead of putting "there are 2 players in the session" in the session data
Hmm my bAllowJoinInProgress was false. I try to set it to true
capping the connections to 2
i'd assume session is considered started when there is at least 2 players?
IIRC the default implementation marks it as "Started" once the gamemode match state changes to "In Progress"
So it's up to the game really
I don't know if steam even cares about that flag tbh
without custom code to control it that happens as soon as the server opens the level though
Hey guys, can someone help me understand, I am working on TP Multiplayer and I have my custom camera which is spawned as separate actor and then set as player camera with node SetViewTargetWithBlend, Camera is following player by it self. It works fine in single player mode but I have problem in multiplayer. I have situation where camera is ok on Host machine but on clients doesn't work. I was trying a lot of things, currently I am trying in Character Actor class on start to spawn camera if it is localyControlled it looks like it is there on both but for some reason unreal doesn't want to blend to the camera , I guess because actor has not authority over camera. I am confused how should I handle this situation.
Thanks in advance guys
The problem was caused because of the bAllowJoinInProgress being false
@random nymph oh what is bAllowJoinInProgress about? I am looking for a way to stop people from joining the game while it is on certain levels, but allow them to join when it is in a Lobby level
It is a boolean in online game session settings. If it is false and the game has started the game cannot be found or joined with SearchSessions
And I comped through engine code and it looked like gamemode StartPlay setted it true
Ok that might work for me. I also need to block join by people opening the IP address in a LAN game
(This is using online subsystem NULL)
Can I do all that from blueprint or will i need to expose some functions?
Why when i try to setup a multiplayer, it look like the 2 player plays on 2 different game? (if player 1 move, i can't see him moving on player2's screen) P.S and both of us move the same character
Where do you guys usually place this override ?
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
Currently i feel like it belongs below the ctor
You might need c++ or advanced sessions plugn
Alright, just wanna know the usual case in case that i'll have to share my project with others.
Cuz i don't think ppl are used to have it somewhere in the middle or smth like that xD
Any chance that you can send the link without having much of an effort ? xD
Seems like it doesn't really show it there
Alright, i'll stuck to below the ctor then
I dont get it why will my widget only show if I press a button, how do I get my widget to show on event begin play? I tried adding a delay but it still wont show
I have created a widget HUD in my player controller but it will only show up on a button press on my character, if I connect it to the begin play of my character it wont show up. does anyone know why?
because you hide it
yeah because I dont want that HUD going to every player
I just want it on 1 team, so everyone who joins that team will have that HUD. if I am doing it wrong how am I suppose to do it?
Listen server or dedicated server @wheat magnet ?
WOuld this work in multiplayer/ https://gyazo.com/ddddf7169d10cdfd1e99b3efef053ca3
dedicated server, but can you explain what is diff between dedicated and listen server in better words
i already compiled the dedicated server with source unreal
if that run on server is on an actor owned by that client, sure
and how i can build listen server?
@summer tide
Listen server means one play is server and also player, dedicated server is what it says just a server with no player.
if you want matchmaking etc, you have Steam or EOS
but you will have to host the dedicated servers somewhere if you choose dedicated server, and that costs a lot of money
so it mean that i don't need to host the game on gamelift or amazon servers etc in case of listen servers?
correct, one player is the host
how it could possible over internet
? why did you ping me? I had diff question?
you asked if that code will run right @summer tide and i said if that run on server is on an actor owned by that client, sure
forgot to ping you on the answer sorry
So I've a character BP and a Boat BP. I posses the boat on interaction.
@meager spade Great, so can you explain how i can do stuff with listen server
It has to work on hosted project, 2 clients and 1 host
does EOS ready for production?
@summer tide where is that run on server event?
because it doesn't authenticate each client ( it only authenticate the user who have setup their EOS account details ), this is still experimental feature
I'ts in the screenshot above the server event
yes
but what Actor is that
@wheat magnet i would recommend steam, its simple to setup and does listen server just fine
there are plugins for EOS, should i use the plugin ( like blueprint API ), or should i use pure EOS C++ SDK?
and just one fee of $99 to register
EOS requires a lot of setup
and i have not used it
can you post the reference link, from where i can start for steam
did you mean steam provide us listen server, or matchmaker?
I've a player component attached to my player. It's being called from there via the Event Interact interface.
so it should work fine
@meager spade can you guide me from where i can start with steam 99$, so you can provide link and guide so i can setup
and what is the requirements for that, i mean does the project need to upload on steam as well?
like steam depots stuff
yes it has to be on steam
but steam need to approve the game before we test?
or we can do without steam verification
you can test using the test app id
because i think this is very long process to upload game on steam
30days roughly
they ask lot of requirements and information
but for testing purpose, can i start work immediately( without 30 days verifier )?
The player won't move with the boat in 2 clients setup, 1 host.
like multiple users testing from different countries
The possess works since I can control the boat.
Beside possessing if I also attach the player to the boat. The host replicated fine but the client's boat works but the player slides as the boat moves.
Has anyone experimented with zerotier or nebula for multiplayer networking?
Hey guys! I had a project in UE 4.20 and upgraded it to 4.25. I fixed the includes and some other API errors and now I realised that the multiplayer doesn't work anymore. Any idea on what's going on?
nope
Things I have tried:
-went to the bathroom
-did 10 pushups
-jumped in the air and tapped my hills 3 times
🔮 shows nothing
maybe should have asked the question once you have the details 😄
cause you asking what could be going on is a bit "wild"
lol, I meant if there were any known issues or something
I can tell u that what I did was find and replace "Role" in every file with GetLocalRole()
if u have visual assist u can select the word "Role" in one of ur cpp files and then go to VA and select rename and I renamed it to GetLocalRole
anyway, there is no error or warning, it just broke
renaming Role to GetLocalRole() in your code will not break anything
GetLocalRole just return Role
Alright, the video is being uploaded to youtube
dude nothing is working right
i was playing an animation and after a few loops the editor crashes with no info
tf is going on hya
aight look: https://youtu.be/hY2EZPA7dwc
I need help Please to Setup the OWS vplugin for openworld multiplayer dedicated server
has someone a tuto for 4.26.1?
I have alrdeady setup and launched the TestStart version but i don't know how to launch my own map
what file to edit and how to launch my own map on the dedicated server
so i wanna do sprinting but the current client prediction/correction prevents me from sprinting if there is any sort of packet lag this video explains what my issue it but his solution i cant get to work in 4.26 so how can i add sprinting and have it work with the network prediction
Many of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidschannel
Discord: https://discord.gg/PdvudWx
You asked for it so here it is! This is my Networked Character Movement Tutorial complete with a full download to the pr...
You need to go into C++ to do it right
In my PIE, multiplayer/listen server setup, I am seeing extra actors get spawned and am trying to track them down. However, when I select them (when ejected), they don't show up in the World Outlier. Is there a way from that view to see everything in play?
yeah i think so
the easy way is to disable server correction but i would like to keep that on
Anyone? please
@lost dune might want to contact the author if you have an issue with a plugin
not sure many people here would have used it
ok
i know the author used to be on this server
But many people does multiplayer dedicated server i think? what do you use for it?
The doc says i have to make my project BP to C++
could i use BP however? in a c++ project?
ofc
ok
What branch have i to clone? 4.26.1?
my project is 4.26.1
i have clones master
cloned
ok
Because it's complex and you need time to go over the fine print
In a way, I get what you are saying, but in terms of engagement I think it would be more convenient to divide the topic onto primitives
maybe the title is not the most convenient, because it goes over networking basic concepts all the way up to prediction/interpolation/compensation
So I guess that it's so technical that is hard to assume previous knowledge
right?
Because to be fair, I wouldn't explain what a sim proxy is in a net compensation tutorial
I'd just use the terminology
😄
Yeah sure
Is there any way to call a function on a replicated actor once it's spawned on the client? I have an actor that is replicated, that contains an array of "instructions". Once the actor is spawned and the instructions have been replicated I want to run a function to do stuff with the instructions
Have you tried looking at the character movement component in the Unreal Tournament code on Epics Github?
That along with this,
https://www.youtube.com/watch?v=Of8SGBa3WvU
Helped me out. Takes a little patience, though
In this video I show the proper way to make movement abilities for your characters. This is done by creating a Custom CharacterMovementComponent.
We start from scratch with a third person BP project, but here is the completed project you can copy code from: https://drive.google.com/open?id=1w9mMlKlcFhTrr8wsf1_76h_4v_k2ysei
When you look through CMC examples on the net it seems like everyone is copy/pasting from the unreal tournament source code
Does anyone know what is going on here? I reckon it's a replication issue, but I don't understand how so.
I only have one directional light acting as the sun together with SkyAtmosphere.
Angle is correct for everyone, but the clients' version of the world seem almost unlit, whereas server/standalone is completely dark, as it should be.
It's only really visible at dark. At noon both Server and Client looks pretty much alike.
that looks like the skylight isn't updating
you have a sky light right?
Yea, my constructor looks like this,
SkyLight = CreateDefaultSubobject<USkyLightComponent>(TEXT("Sky Light"));
SkyLight->SetIsReplicated(true);
VolumetricClouds = CreateDefaultSubobject<UVolumetricCloudComponent>(TEXT("Volumetric Clouds"));
Sun = CreateDefaultSubobject<UDirectionalLightComponent>(TEXT("Sun"));
Sun->SetAtmosphereSunLight(true);
Sun->SetIsReplicated(true);
Sun->SetWorldRotation(FRotator{ 0, 0, 0 });
Didn't do SkyLight->SetIsReplicated(true); until you mentioned the sky light though
But other than that I don't touch the skylight whatsoever
do you know where the character movement component is located
You mean in their repo? Not specifically. I would simply search for CharacterMovementComponent
Are you connected to Epic Games on github?
yeah i use a source buid of UE on linux
Alright. I can't remember how it found it, but I'm pretty sure you'll be able to find it by simply searching for one of the functions SabreDart writes out in his vid as they are pretty much very alike - as I remember at least
The old wiki also had sample code from it
so i guess it should have some networked sprinting code
It's been a while, but as I remember it allows you to change movement speed over networked games, which is otherwise impaired on MP.
Nevertheless, I don't have any trouble over network myself anymore
https://github.com/EpicGames/UnrealTournament/blob/3bf4b43c329ce041b4e33c9deb2ca66d78518b29/UnrealTournament/Source/UnrealTournament/Private/UTCharacterMovement.cpp
https://github.com/EpicGames/UnrealTournament/blob/3bf4b43c329ce041b4e33c9deb2ca66d78518b29/UnrealTournament/Source/UnrealTournament/Public/UTCharacterMovement.h
These should be it
could i just drop these files into a unreal project
Probably not, there's a lot of functionality that you wouldn't use at least. I'd still recommend go through sabredarts video. The only thing I would be wary about is his check()'s, as I remember they don't really work with listen servers
Hey guys, I am currently trying to figure out an issue with replication I am having. I just solved a separate issue where the aim rotation of the client wasn't being replicated. However, now I have an issue where my component's position is not being replicated client-side (isn't taking my aim rotation into account, as is seen in this image:
Does anyone have any idea why the server wouldn't replicate the positions of these objects with my aim rotation?
If I'm correct, his check in GetPredictionData_Client() was the issue.
I replaced his check with
// Should only be called on client or listen server (for remote clients) in network games
checkSlow(CharacterOwner != nullptr);
checkSlow(CharacterOwner->GetLocalRole() < ROLE_Authority || (CharacterOwner->GetRemoteRole() == ROLE_AutonomousProxy && GetNetMode() == NM_ListenServer));
checkSlow(GetNetMode() == NM_Client || GetNetMode() == NM_ListenServer);
Which is then again a copy/paste from what I think was the UT code
My issue seems to be related to dedicated servers. Do dedicated servers ignore any logic run in the AnimGraph?
Ah! I found it
Skeletal mesh needed Always Tick Pose and Refresh Bones
Hey guys! I should start with implementing the multiplayer system. Could someone tell me which is the best between Aws and PlayFab? 🙂
can someone tell me, what do I need to do to make a widget show up on different players in multiplayer? I made an created a widget , made a varible in the player controller now in the character blueprint I try to add to view port but it wont show up what am I missing?
im facing weird problem, i try to setactorrotation from server, but i dont know why it wont replicate on owning client, the other client have correct rotation, but not on the owning client
there is a plugin for Gamelift, Incognito, DynamoDB, etc. exposure to Blueprints but it is fairly expensive and not made by Amazon themselves
its not the plugin you linked, its a different one called multiplayer with blueprints, this one looks like it hasn't been updated for 4.26 (or even before that)
ah i see
if you dont want to go with the plugin but know c++, there's a 15+ hour tutorial on Flopperam's youtube channel on setting up GameLift without the plugin
it seems like a TON of work though
Anyone has any idea on what's going on here? I just updated the engine from 4
20 to 25, switched the "Role" with "GetLocalRole()" which is the same basically and fixed all the include issues, but I haven't changed anything multiplayer related.. Did anybody else experience this?
is the Nakama Plugin available as blueprints, im not really familiar with cpp
is there any tutorial i can follow for learning Nakama throught cpp?
Why when a player joins the session every vars from server gamemode/game instance sets to none?
where should i persist my data once i connect or host a multiplayer session
*or to be more precise, before i host or connect a multiplayer session
I am trying to wrap my head around authority with child objects. So my players are spawning at NetworkPlayerStart locations normally and they posses items they carry along with them. These are separate actors that are spawned, then attached at begin play. Where all do I need a hasauthority check for this? If I create it in the constructor should it be there when they are created and a separate check as they are attached at beginplay?
Make the rotation a variable thats rep notify, set the rotation using the rep notify for that variable
does anyone have any recommended learning resources for aws connection
set desired rotation using rep notify, then interpolate towards it
much smoother
so ive followed this tutorial on getting sprinting and doing to work in multiplayer https://www.youtube.com/watch?v=Of8SGBa3WvU&t=1873s but a always end up with a ton of errors i cant seem to fix so is there any way to add custom movement to my character in multiplayer with out server correction interfering
In this video I show the proper way to make movement abilities for your characters. This is done by creating a Custom CharacterMovementComponent.
We start from scratch with a third person BP project, but here is the completed project you can copy code from: https://drive.google.com/open?id=1w9mMlKlcFhTrr8wsf1_76h_4v_k2ysei
Hello, I do something like this to pan the mesh to be at the bottom of the capsule (Since the capsule starts at -helfHeight instead of 0)
It works fine but on client, for some reason something (animations? IDK) seems to overwrite this value
Is there a better a way to do this ?
(or a way for this to work on client)
@twin juniper local data in GameInstance persists for the lifetime of the instance of the app running on your local machine, but it cannot be replicated over network, so I send it to the server to share with the other players by adding server RPCs to other classes that can own a network connection such as PlayerController. That actor tells the server and then the server can replicate to everyone.
Gameinstance is one of the few things that survive opening a level. If using c++ you can add to the list of things to carry over during travel.
Also playerstate has two event handlers in blueprint that carry info over info but only during seamless travel. You have to implement them to have any effect. I think they are called copyproperties and overrideproperties or something like that.
Game modes have a checkbox to tell them whether to use seamless travel. Before 4.24 i think that lived in the project settings.
what would I call when a team wins the game?
like I just want to change map to the UI lobby
or does the steam plugin can handle lobbies?
I see that Epic Online Services could work for this case
Steam/EOS are somewhat unrelated to lobbies
Both provide sessions, whether players in the sessions are connected to a server, playing on a lobby map or a main map, it doesn't matter
how do you replicate vehicle movement ?
With immense difficulty
Assuming your vehicle has entirely custom movement with no physics at all, it's somewhat easy to implement rollback/replay - send the server your input, apply the input locally, have the server apply the input, send you the result with the timestamp of the inputs used, and reconcile the result accounting for lag
ok idk anything about the last two, where should I start ?
This course is quite good and explains the entire thing : https://www.gamedev.tv/p/unrealmultiplayer/?product_id=1500305&coupon_code=JOINUS
thanks
Code for the relevant part is here : https://github.com/UnrealMultiplayer/4_Krazy_Karts
(ref: KK_UEM) http://gdev.tv/uemgithub. Contribute to UnrealMultiplayer/4_Krazy_Karts development by creating an account on GitHub.
lol the price
It's stupid good value for what it is, and it's on sale at 90% off half the time anyway
But I linked the code for a reason
True 😊 but get it working before juicing it
I am using the above Udemy course, and I have a question: it appears that when I use World->ServerTravel("URL?listen"); and then join a session via GetResolvedConnectString() I am seeing the correct IP but "Port 0"
however, if I force the join on 127.0.0.1:7777 with command line, I can get in
I'm curious where this Port 0 is coming from
I just saw in the code that the third parameter GetResolvedConnectString() is expecting is the PortType, which is by default set to NAME_GamePort...wondering if that course is outdated, as apparently this FName macro has been set to 0 somewhere to append to my Address
hunting this macro down...
nevermind, this is not the problem; if someone could chime in on this, I would greatly appreciate it
anyone have experience with ios/multiplayer? (made a very simple "join via open: ip" multiplayer, and it crashes on IOS only) last thing I see in logs on IOS is: [2021.04.01-18.05.28:422][169]LogOnlineSession: Display: OSS: FOnlineSessionIOS::RegisterPlayer - not implemented
My only experience with the engine so far is open world dedicated server. Not match joining. Ios just logs in like all the other clients. (app store is another story)
Sounds like you need to add code specific to iOS. Is it possible that you have checked the box to implement the GameCenter (player stats) and not written code to handle that?
nope
using null subsystem
it joins, I see the player show up on the host, but then ios immediately crashes
Ok so, if not using subsystem=iOS, you need to tell the device that
I read about it but thats over my head
im pretty sure its set to null already
[2021.04.01-19.33.38:356][117]LogIOS: FSocketSubsystemIOS::InternalBSDSocketFactory
[2021.04.01-19.33.38:363][117]LogOnline: OSS: Creating online subsystem instance for: NULL
[2021.04.01-19.33.38:364][117]LogOnlineSession: Display: OSS: FOnlineSessionIOS::RegisterPlayer - not implemented
[2021.04.01-19.33.38:364][117]LogOutputDevice: Warning:
Script Stack (1 frames):
PlayerState.OnRep_UniqueId
and frmo the ios ips dump
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 8
Thread 8 Crashed:
0 libsystem_kernel.dylib 0x00000001bfc8e414 0x1bfc66000 + 164884
1 libsystem_pthread.dylib 0x00000001dd7e8b50 0x1dd7e6000 + 11088
2 libsystem_c.dylib 0x000000019b167b74 0x19b0f1000 + 486260
3 UE4Game 0x0000000103ad7ee0 0x102a64000 + 17252064
4 UE4Game 0x0000000103bc7418 0x102a64000 + 18232344
5 UE4Game 0x0000000103c74220 0x102a64000 + 18940448
my next test is gonna be to try to launch via xcode so I can get more debug info
Its having trouble retrieving the device id (and/or) translating it to a valid player id.
This value on a windows computer is = the pc name
If you can find that part of the code on the iOS client it may point you in the right direction
Did you develop the server in windows and client on mac?
no windows
this is what im seeing on the host side after a ios joins:
LogNet: NotifyAcceptingConnection accepted from: 192.168.1.1:60854
LogHandshake: SendConnectChallenge. Timestamp: 4.962889, Cookie: 176238079188013145192110152099205221159148152120045100226235
LogNet: NotifyAcceptingConnection accepted from: 192.168.1.1:60854
LogHandshake: SendChallengeAck. InCookie: 176238079188013145192110152099205221159148152120045100226235
LogNet: Server accepting post-challenge connection from: 192.168.1.1:60854
PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
LogNet: NotifyAcceptedConnection: Name: FpsTest, TimeStamp: 04/01/21 15:54:12, [UNetConnection] RemoteAddr: 192.168.1.1:60854, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_4, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
LogNet: AddClientConnection: Added client connection: [UNetConnection] RemoteAddr: 192.168.1.1:60854, Name: IpConnection_4, Driver: GameNetDriver IpNetDriver_4, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
LogNet: NotifyAcceptingChannel Control 0 server World /Game/Maps/UEDPIE_0_FpsTest.FpsTest: Accepted
LogNet: Remote platform little endian=1
LogNet: This platform little endian=1
LogNet: Login request: ?Name=Unknown userId: UNKNOWN platform: IOS
LogNet: Client netspeed is 10000
LogNet: Join request: /Game/Maps/Menu?Name=Unknown?SplitscreenCount=1
LogBlueprintUserMessages: [LaserWeapon_GEN_VARIABLE_Laser_C_CAT_1] Server: WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
LogBlueprintUserMessages: [FirstPersonCharacter_C_1] Server: BEGINPLAY FIRSTPERSONCHARACTER
LogNet: Join succeeded: Unknown
so, how is that set?
On mac its hex full registry, on windows its ‘referenced’
But because of the memory incompatibility issues... it cannot translate the name. I’m not sure how many different options there may be, but i believe i have seen this name redirected from another memory that IS referenced. Such as the appld ID or GameCenter name
I’m not sure what my guys did to bypass that error, i think mine is logging the interface adapter (MAC)
MAC address or whatever
just tested with android, and it also has UniqueId: INVALID
BUT it has a valid hostname
LogNet: Login request: ?Name=localhost-0005DE3508D8F4F3E70A88A2CC1EFAA7 userId: NULL:localhost-0005DE3508D8F4F3E70A88A2CC1EFAA7 platform: NULL
Are you logging in through the respective subsystem on each device?
just done via open ip console command
A lot of that is auto detect by default
You may have to find that piece of code
Where its pulling in the device namr
open {host}
Thats where the problem is. UE cant read it
Np!
i develop game for almost 3 years and never try make one multiplayer....can anyone introduce me different types (simple, hard, free or not ecc...)
I wanna mention, I solved my own problem: it was a "Seamless Travel" enabled issue where the client was loading the wrong level (thus Port 0)
@twin juniper Different types of what? Games?
If I have a widget component in an actor. And I only want it to be shown on certain clients, can I just set bHiddenInGame to false for the clients to which I want to show it to?
can you have like a 3d text widget that everyone can interact with and use for chat for example?
new to multiplayer.is there something wrong with this code? right now the pawns are only rotating client side, not on the server.
Whoah...yeah. Don't do that.
On tick, send rotation (calculate however you want) to server
yeah, i am not sure i quite understand that? why shouldn't i do this? and how do you mean send rotation to server? i think what i have now is mostly useless, because logic is actually running on client. but even if i set the event to run on server, clients still do not properly rotate. there must be something i am missing
You want the sever to handle stuff like that cause you can't trust the client to
If you run it on client most likely the server will try to correct it making you go back to the initial state making you basically stutter while everyone else sees you doing nothing
Use a RepNotify on Rot
OnRep SetActorRotation
and never replicate the rotation back to owning client
@harsh lintel so the best way i have found to do that was make a HUD bp for what you want to display, then on your interact event (either broadcast or direct cast) reference the player character, the hud, then create widget(whatever HUD you made for that).
managing WidgetComponents from HUD is a bit unwieldy
especially since it needs more code to connect it to the HUD then what you usually need to manage it
I just made a client RPC on the player controller that changes bHiddenInGame on the component of the appropriate actor. But thanks
@twin juniper your not really going to defend against ESP without also defending against other forms of cheating with anticheats like EAC/battleye that just make it a pain to write cheats for in general without emulating the anticheat or some other bypass which is no easy task. if you dont have a hard strong wall up to make it difficult for anyone to just grab the needed addresses and offsets and do whatever they want with them (think VAC), then it would be quite effortless for anyone to find and loop through your games entity list for coordinates, find their own view matrix, and draw to the screen the players locations. same goes for aimbot which is also on the same topic of you cant really prevent it without the above. you can make some very believable smoothing functions for your aimbot, heck mine lasted 700 hours in csgo with no one suspecting a thing because it acted more like an aim assist. people that are legit cheaters are the hardest to catch as often they try to just get subtle advantages which makes things like reviewing worthless for them. long story short, unless you invest in a good third party anticheat, theres not going to be much you can do against esp and aimbot, you can however prevent most other forms of cheating by how you handle them in game
thats smart. ill end up looking into implementing some form of that for testing. did they say why they wouldnt let you use their anticheat? wouldnt they get paid all the same lol
I solved esp by using the engine's occlusion culling system on the server side to decide when to send the player position information *to each player
Occlusion culling and most of the rendering pipeline is stripped away from the dedicated server build
Also it doesn't make much sense checking on the server, it would show what's culled from the server's (listen server) POV
This data can then be used to detect aim-bots at real time, there will always be false positives but if the system will be efficient enough and learn as the player base grows by retraining data from best players, testers and hackers themselves whom got caught on the process.
There is a reason no one does this, it would result in so many false positives, just look at some of the ESport players, it gets difficult for a human eye to recognize what's aimbot and what's a pro player
The occlusion idea could work with a custom built system, adding all obstacles into an octree grid and using it for fast lookup for example
isnt that what vacnet (if thats what its called) is trying to do? thought they had some kind of neural net for something
referring to ai and aimbot detection
I know there were some that tried that but all of the implementations ended up being utter garbage, either it will end up detecting legit players or it won't detect anything
If you actually try it you will see how flawed both the AI detection and occlusion ideas are
You need to understand first what occlusion culling is and how it works to understand that checking if something is visible from the server won't work, if it's not rendered by the server it's gonna see it as occluded
and any AI can easily be tricked by not having the aimbot be 100% perfect, it's easy to simulate human error to make it seem real
^ like mine, just an aim assist on steroids that was never locked and still had some random movements that were not a smooth curve and not linear to whichever bone was targeted and that bone can easily be changed if the player moved their mouse along with when it overshoots the bone (goes to far past the bone). its just like normal mouse movement from a human, odds are AI wont be able to detect that and if you had very tight tolerances then theres alot more false positives that are going to be occuring. plus people who create cheats for sale will most likely spend alot more time trying to perfect this as well so it doesnt get picked up. i dont know much regarding this subject but thats just what seems correct in my head
depends on the aimbot. if its loose enough enemies can still walk out of it to where its no longer tracking, and the setup you trained on will most likely be different from the end result of the cheat maker as well. dont forget most of the time you wont be targeting the head anyways, an aimbot that just aims for the head is just asking to get caught and called out
Any AI system will always be too unreliable, look at the pro players for example, their crosshair is 98% of the time on the enemy's head, that's instantly gonna get marked as false positive
I still found a way to do that somehow
Must be magic then 🤷♀️
and their tracking skills are unbelievable as well
if (HasCheats())
{
Ban();
}
where the $100
making one now
posting repo to git
this is reminding me of
and one final sarcasm
since you only know C#, heres the C++ version
if (HasCheats())
{
Ban();
}
and heres your new C# version rewritten
if (HasCheats())
{
Ban();
}
oooo well played sir, but to counteract that what about a version written in C to prove that im a low level dev
if (HasCheats())
{
Ban();
}
The Epic Coding standards does not recommend that.
I have a "checkpoint" button players stand on that returns them to that location if they die, I want each client to have to step on their own versions of the checkpoints. I'm trying to use Instigator but that doesnt seem to be working as I expected
It is not mandatory. Im just pointing out that its not recommended.
Also please move back ontopic.
I guess I dont understand what instigator controller is
I think just checking if the Other Actor is currently overlapping will work after typing it out and thinking about it more
ya thats what Im trying to do, storing the transform on the controller
Im doing something wrong and still am now
so a crap ton of UE_LOG lol
huh now it works
not sure why though lol
well thanks
owe you one
so basically I had it right before and was really close but I was using Owning Client because Im new to this multiplayer thing and dont really understand it yet, but using Server was the answer
what do you mean by that
well this is just me expanding on some multiplayer tutorial I did, but I will be eventually be working on a listen server coop game
ya for sure, not going to be going for dedicated and only 4-6 players
I got steam working already, havent looked into EOS yet
ya I had an idea of what you meant, just wanted ot be sure
ya its pretty bad
ue4 doesn't support p2p networking model, you are confusing it with a listen server, listen server is still a server and all the communication is routed through it the same way it is with a dedicated server
Just so we're clear, neither Steam or EOS play any role in players acting as servers. That's an UE4 feature.
alright so, once again I didn't actually get it working, but I did figure out why it isn't working. The respawning is being called on the server's version of the player controller because I'm using Event On Unpossess when the pawn gets destroyed. What would be a better way to call the respawn so that the client's version is calling the respawn?
I can only think of making it so you have to press a button to respawn and I can use that input to call a spawn and send a transform with that function
is there a more elegant solution?
They don't have anything to do
You don't need to use Steam for listen servers (P2P doesn't exist in UE4)
Or EOS
It's just not a feature
I don't know where you got that information from...
That's simply not true
Jesus christ 🤦
So let's make it simple : you have listen server functionality without using Steam or EOS (or any other subsystem)
Yeah, quite a few games do it really. Just not UE4
StarCraft2 does it for example IIRC
Most fighting games too ?
I just assumed p2p meant listen
You are sharing misleading information and presenting it as facts...
Ue4 doesn't support p2p networking, all of ue4 is built around server-client model, there is a dedicated server and a listen server which is at the same time a player, this is still server client model, there is 1 central server that's handling everything
P2p simply doesn't exist in UE4, doesn't matter which subsystem you use, authority concept ue4 is based on wouldn't work in p2p scenario
The other misinformation there is the very common misconception that Steam or EOS are required to play an active role during gameplay, while in reality they just don't do that much past matchmaking.
Hell, IIRC the UT4 alpha still used an internal matchmaking system and didn't have any support for Steam ?
This^
A networking subsystem is nothing else than a way to talk to you network backend, matchmaking and similar
(Though in the particular case of Steam, most UE4 documentation have you enable the net driver that tunnels traffic through Steam's network)
(But AFAIK that's optional ?)
But still doesn't affect gameplay and networking in ue4 in any way
do player controllers exist only on server, or is there always only the local player controller in each machine?
i cant make pawns rotate based on mouse and i think the problem is how i am writing logic
is your pawn set to replicate
I guess pawns are default replicate
The problem is likely something like the movement being done on the local client instead of on the server
the client is not does not rotate on client right now
most likely
in the player controlled, i set a target point running on tick. on the RepNotify i pass the target and set the pawn rotation
pretty sure its that get hit result under cursor
on the server side its not getting a result
I dunno what the solution is, I just started doing multiplayer stuff
Replicated variables can only be set on the server.
if the server has all player controllers, does that mean that the mouse position on a client is the same as the mouse position on the server?
The mouse position does not exist on the server
You need to tell the server the client's mouse position, through a server event
And that event is where you'll change the pawn state
different methods of creating a multiplayer game
Gonna need to explain more than that
How you create a multiplayer game depends mostly on what kind of game you're doing
for example a third person multiplayer game
Which kind of third person multiplayer game
Is it a competitive game, is it fast paced or turn based, is cheating a concern, how many players
max 20 players (team of 10)
it's not competitive
i tried the launch system for the players but i doesn't work on multiplayer
it*
with that many players, you shouldnt be using listen server so you need dedicated
imagine 1 single pc having to be the server for 20 players. yikes
oh ok
The short answer is that the only thing you really need to learn to start doing Multiplayer is RPC and Replication, and the difference between the two of them.
The much more involved answer is that those two simple things are going to dramatically change the way you handle the simplest logics. Want a player to change their color? Single player game makes one call and boom. Multiplayer the client needs to RPC to server, server has to check if they can, save it, set it, then replicate that change to all clients, and then all clients set it. And this is just gameplay logic difference. Like Stranger was pointing out, your game style determines delivery. Competitive requires dedicated servers and a personal hosting solution. Otherwise you can do most things listenserver style if the server doesn't need to be dedicated for performance or uptime reasons.
That also depends on the game style. If the map isn't very big and there's not actually a lot of necessary replication, 20 players on a listenserver won't be that different than 4 in a large open world.
Thanks @kindred widget very clean explanation
By the way you should stick to listen server and tone down the player count. Dedicated servers are hard.
3 players max with one server having to replicate players+AI seems already a bit taxing but doable
attack on titan is the one with the naked giant running around no?
That's just a listen server + sessions
ahahahaha yes lol
Using Stean and the advanced sessions plugin for example
ok ok...but a dynamical ip can work? or it has to be static?
what do you mean?
Doubt it matters
you use steam to connect
oh ok...thank you so much guys
how do i pass information from client to server?
Run on Server?
the get hit result under cursor is returning false. how come?
Cause Server doesn't know about your cursor
how do i properly tell the server to move me to a location i clicked to?
i thought the server had all player controllers in it? so why wouldn't it know about each mouse coords?
It's important to understand that just because an Actor is replicated, does not mean its entire state is. Far from it.
Like I said earlier, mouse location is definitely not replicated. It's a local property of your client that the server has no business knowing.
So your code needs to 1) obtain that location on the client, 2) tell it to the server, using a "run on server" event and 3) have the server-side player controller do something about it
And then you'll probably find that the local player can observe latency in real conditions - you'll have a 50-100ms delay between mouse actions and their result, so you'll likely need to introduce more logic at that stage to process things locally, AND tell the server, AND (the hard part) detect when the server replicates back, which version to keep
Most multiplayer features in your game will look like that.
right, so now the client is able to move. i still dont know how to pass information from client to server thought. right now the V3 has a value of 0 on all axis, which means the server has no idea about the cursor position
also, moving yourself using pathfollowing on client is a fun fun problem
you can get it to move you locally, and CMC interpreting pathfollowing as a move input
you do get the benefit of predictive movement and character reacting instantly
you can't do it in blueprints though, not even close
The location needs to be a parameter of the event.
requires significant alterations to CMC, PlayerController and manually setting Roles
on tick, when i press left click, i get the impact point under the player controller's cursor, pass the vector to an event which runs on server(making all parameters replicate by default, correct?) then i run a simple move to Location with the location set as the goal. this works fine on the server, but on client the pawn only move to the location, without rotating to face the direction
(This process should likely be done on an action event mapped to left click)
As to the rotation, don't know - like Zlo explained you're going to have larger issues with this approach anyway
Tricky stuff indeed, seems like client doesn't know about its own rotation, not sure how you have that set up to rotate atm
Hey all, I'm having an issue when turning down this characters movement speed, it causes jitter on the camera. The movement is perfectly smooth to the other players in the lobby, but this characters cam behaves like this. It works completely fine at high speed
You're probably only setting the new speed or the client or server
should i be multicasting when setting the movement speed?
It's definitely being set properly, all the movement replicates fine with sprinting speeds and dashes, it's just at very low speeds we get camera jitter
i've made some changes, and they seem to be working more or less. the only real problem is that since on left click being held, i call this event, and moveservercharacter uses an AI Move To function. that means that while i held down left mouse, the character stays still, and when i release he'll move along each individual mouse location
heres a video to better understand
That feeling when you're Shroud and you get banned for being the human aimbot 🤣 (regarding the anti-cheat stuff above)
How do i make this multiplayer? I try to Make a custom event (Run on server)...It works only for the first player but the second one nope
Hope it's more clear
You need to review whether that feature already support multiplayer replication, and if it doesn't, implement it yourself
How can i implement myself?
In this case it's probably enough to simply call LaunchCharacter on server
Because I assume the feature supports multiplayer
If it doesn't it's likely C++ time and some weeks of work
oof
Blueprint multiplayer is only really possible for as long as you use ACharacter features
At least as far as pawn stuff goes
ok thanks
wasn't that like 4 digit number per platform for a license?
Oh haha, it's worded as if it's just part of the engine now, but that figures
do you still need to cash out a license or not
pretty much only relevant thing about it
Judging by the last paragraph maybe you do indeed need to be a licensee:
If you’re an existing Oodle licensee, your workflow and support will remain the same. If you’re a new user who would like to try Oodle in your Unreal Engine project right away, you can turn it on by updating to 4.27 via Unreal Engine GitHub.
I think I m missing something here.. I was under impression that it was enabled by default, since this same oddle plugin was used in Paragon..
And second thing it says is it is available in 4.27, but where is 4.27 i can't find it.
Does this mean that the game chunks created using chunk manager will be smaller now???
This is more of a OSS feature.
how do you deal with unowned actors that need to call server rpcs ?
Oss?
i mean. if you know how the setup a game to work up until that point, you'll know how to make invites work...also pretty sure the advanced sessions plugin comes with a invite friend event
Yes, but how do you use it with UI?
Guys, is there any way to synchronise client instance of UObject or AActor with server one using replication?
What I'm looking is the opposite function to TearOff.
Such functionality exists for actors, which are on the level, but I need this for UObject, components and other actors.
PIE: Error: Only Local Player Controllers can be assigned to widgets. PlayerController_C_1 is not a Local Player Controller.
Who is the widget owner on a listen server if the host PlayerController is 'not local' ... ?
Sounds like you're assigning a remote PC to a widget on your server
yay I figured it out, I was so close so many times, I just didn't combine all the right things together until now... on the checkpoint I had to check if the pawn was being locally controlled and then I had to update the server's version of the player controller's spawn transform variable and then call the respawn on the server also. I was trying to fight the server and trying to spawn from the client
Does anyone know if the OnRep/RepNotify gets called on joining a match? If not, how are you meant to setup state?
What makes you say that? There's many types of multiplayer games you could make without C++. Although if it involves prediction or high speed action you'll want it in C++ for sure.
Basically what I'm saying is, if you want a non-character pawn in a MP game you can say goodbye to Blueprint
Sure, it's not impossible in Blueprint, but implementing rollback in Blueprint is not going to be any fun
Adding features to ACharacter makes it literally impossible
Oh yeah as long as you need rollback or prediction, it's a bad idea. But anything a little bit more slower paces like a civilization or RTS or turn based game would be super easy.
These hardly even need pawn anyway
On the topic of prediction, does anyone here know if the upcoming NetworkPrediction plugin is movement-specific or more general? It seems like there would be a demand for a highly generalized prediction model. After all, any prediction is basically an effect, a context, and dependencies.
Position, movement, and collision are basically the same thing as health, healing, and maxhealth logically.
I'd expect it to be more general... CMC already covers movement-specific stuff and I don't know why they'd rewrite it just to end up doing the exact same thing.
I wouldn't think about it too much though, no one knows when the plugin will be ready.
Github barely has any activity for it, I wouldn't expect it anytime soon
unless it's being held back for UE5
Yeah I hope it's more general, imagine trying to integrate CMC movement, physics movement, and GAS prediction systems. It'd be a mess.
from what's there you can tell it's meant to be a somewhat general framework - they even have a physics prediction component in the source tree iirc
but it's all built on top of that general framework
which of course isn't ready...
I'm sort of waiting on it for one of my projects that's heavily physics driven, but I might end up just having to abandon prediction all together on it. It involves systems that are very chaotic and non-deterministic, so that might just be more trouble than it's worth.
let's say I want to make coop game on mobile phones with UE4
would there be any difference in performance whether it's going to be p2p vs client-server architecture ?
(mobile hardware would be top of the line, like Qualcomm XR2 SoC)
as a reference point the game would be something like Doom 3 (except with baked lighting)
2-10 players
You're confusing P2P with listen server.
But yes, there will be a performance difference. How much of one there is depends on your game and other factors.
You are telling me you got Unreal engine to work in a P2P context?
nah, I am not into MP ... yet. Just trying to get the brad picture for future references
there are a ton of middleware for UE4 to do p2p multiplayer
(maybe not a ton, but some)
that's what I hear from some devs
Yeah it would be a shitshow. Even if there is middleware, I guarantee you was not trivial. If you're having to ask the question, I would just do server client architecture. That's how the engine is built from the ground up.
I think Oculus offers p2p in their Platform SDK
Describes how you can enable users to connect and share data with the Peer-to-Peer networking features.
That looks like it's just peer-to-peer networking, there is still very much a host and clients.
But running a multiplayer game and Unreal engine with no one client acting as the authority, that sounds like quite the workload
are there any examples out in the wild of UE4 games with p2p (peer-2-peer) networking or all of UE4 games are client-server ?
The problem with using p2p, in Unreal’s case, one player also acts as the server for all the rest. This consumes a lot of that players resources and can only sustain a small number of linked clients. Simply running as listen server and trying it will teach you a lot.
@dark edge - yes it is quite a workload. Especially with very little helpful documentation.
That's not p2p
Well not strictly. That's just your plain old listen server which is doable but not a good idea for anything super competitive or large scale.
Dedicated server provides a much more reliable and consistent user experience. Imagine a large p2p group, and the 2 users on the far ends.
@gilded vapor vars for state, multicast for one-shot events.
@chrome bay thanks, for states such as "is_sprinting" would you consider them 1-shot events?
For some reason I've been using multicasts for everything game related (due to legacy misunderstandings haha)
@gilded vapor if you use multicasts for stateful changes
you'll find yourself in a situation where client walks into an area from otuside the relevancy range
sees open doors as closed, sees walls that have been destroyed in pristine condition
same thing applies to late joiners
someone that hopped into a game already in progress
Yeah I read that somewhere and thats whats prompting my change
Time for the beeg ol refactor
there is an approach that mixes multicasts with onreps
example of which would be you OnRep bool bEnemyDead
but you MC the PlayDyingMontage
prevents enemies to get up on their feet just to play you a dying montage if you walk into relevancy range
i personally prefer to have OnRep float EnemyTimeOfDeath
and synced network clock
-1,f meaning enemy is alive, > 0 meaning the second it died
and then play dying montages and effects only if the death was recent enough
one thing with property replication is increases server cost
so the more replicated props, the more it costs to replicate so it can be a balancing act
Replicated properties should be stateful
So multicasting is cheaper?
Multicasts should be one off things
like explosion effects
but something being dead should be a replicated property
like monsters in our game, they play the dead animation via a replicated tag
once this tag is removed, any late joiners see them just in the dead state
Gameplay tags can reduce the amount of replicated properties aswell
like just replicating a single gameplay tag container, can handle 20 different bools, which you would need to replicate individually.
or you can go old school and use a single property and use bits
Tag containers are bit-flags correct?
no
its an array, but its compressed for networking
20 tags is 20bits
bytes*
same as 20 bools
but its a single replicated property and cheaper for server time
I'm targeting my game for P2P but assuming all these principles still apply
the biggest cost with property replication is the server needs to go over all actors, consider them for replication by checking if they have any changed properties, then replicate them
this costs time in ms
if your not running dedicated server, your listen server will feel a bit of a hit
as it has to do that work on the game thread
If I have at most 8 players 8 AIs (all same character subclass) do you know a rough estimate on how many replicated variables I can support before eating away framerate
(assuming average hardware)
we run 8 players 150 AI
still need to optimize a little
but generally it runs fine
How many variables are you replicating though?
(Slash how big are your tag containers)
can't say i've counted
but we do have a custom push model
around 2000 interactable actors are not replicated themselves, but instead replicated via network managers
What kind of game are you making/working on?
Do variables in the AnimBP properly replicate? Running into an issue where client -> server works fine, but server -> client does not. I even set all variables in that deal with the scenario to be replicated.
@winged badger just curious would you be willing to talk about what push model you use?
(I have a stack for pushing/popping states currently, was just curious if you have a better model)
Are there any callbacks to detect when an actor becomes network-relevant
when an actor become relevant, it will run begin play on the client
any non relevant actors get destroyed
Would updating the state when an actor becomes relevant (and multicasting out state) sound like a valid alternative to ReplicatingVariables or does that just sound like madness
So I'm not sure what else to do here. I'm trying to sync up my aim offset throughout my players. I have the pitch working, but looking left and right, doesn't appear to be working and I'm not sure where the issue exists.
I am currently using Get Base Aim Rotation to achieve this as I've read that it contains the values that are already replicated and was exposed back in 4.5 specifically for this. This does work locally still. This is from my AnimBP. I know it is local, but I thought that was the point of the Get Base Aim Rotation and it does work for up and down.
Can anyone spot anything that I'm doing incorrectly? I've seen solutions that create a custom variable that replicates these values in tick, but I'm pretty sure there is a better solution, just not sure.
Madness
And almost definitely very error-prone.
Rip time to refactor
Z-Axis isn't replicated. You have to replicate the Rotation yourself (or just the Z) if you want to replicate the looking direction
I have some blob like this:
{
aiming_rotation = character->GetBaseAimRotation();
}
and than rep-lifetime the aiming_rotation (with skip owner)
Well - that seems kinda lame. I thought Z was pitch though, no? (ignore this question, I'm a clutz)
RemoteViewPitch is around the 'Y' axis
And is automatically replicated already by the Pawn class.
X = Roll, Y = Pitch, Z = Yaw
oh whoops my bad got confused
I was tryin' to find the remote view pitch - but I couldn't find it in BP.
GetBaseAimRotation will give you it
Pitch isn't replicated not Z
GetBaseAimRotation will apply RemoteViewPitch to the pawns' rotation.
which one isn't
Most of the time the characters' yaw and roll is the same direction they are aiming in, the only one that isn't is pitch.
I thought xyz were replicated through GetBaseAimRotation personally.
noop
They're not
The actors' rotation is already replicated.
So all you need, most of the time, is the pitch offset - which GetBaseAimRotation() applies for you
The solution I posted is a valid work around, I had to solve this same problem for my game
I'm trying to avoid doing C++ for this particular project.
You can do it in blueprints too
That's an ask in Multiplayer tbh 😄
Start running into walls or less-than-optimal approaches to problems pretty quickly.
Yeah - I know. I'm just tryin' to do a super small MP game in BP
Non-commercial or anything like that.
So you have a Yaw offset as well as pitch? I would just replicate a yaw var too (skip owner), and create your own GetBaseAimRotation function that adds that value to yaw if Controller == null
and than just set AimingRotation on tick to GetBaseAimRotation (if the actor is not Simulated)
Yeah - I was trying to avoid tick. I found some solutions on the interwebs that did just that and I was just looking to avoid it.
I think this falls under one of those things you have to do on tick
Yeah - maybe. Probably won't be so bad. Only going to have like 2-3 players anyway.
yeah you definitely don't have to worry than
sigh everyone wants to avoid tick 😄
the dumb ue4memes twitter perpetuates the "avoid tick at all costs" thing, it's pretty much the only material they have
there are valid applications for it
what have i messed up here? I have health set as UPROPERTY(ReplicatedUsing=OnRepHealth) which is
void OnRepHealth(float InHealth){
Health = InHealth;
}
@dull lance ok? so then do i have to call that if we are the autority to run onrep health?
check cpp's answer
Ok I see that then what happens if it's only marked as replicated, will the value automatically update?
then what's the point of just using Replicated instead of ReplicatedUsing
why does the keyword exist if it doesn't just do the update for you
ReplicatedUsing for cpp means that for server, you have to call onRep on server
the clients will get the update
but the server won't run that function
unless you run it yourself
if it's a blueprint replicated using variable, this happens automatically
no function is ran on update
so then circle back
why does it exist if it just doesn't do anything when the value is updated
why would you ever use it?
Replicated will replicate the variable so that clients can see changes in its value.
ReplicatedUsing will also fire off an additional function on clients (the OnRep) if you want something to happen every time the value is updated.
If you want that OnRep function to fire on the Server, you have to call it manually in c++ (in Blueprints the OnRep will run on the server automatically).
the OnRepHealth function you wrote doesn't actually do anything
well, actually it sets the health value back to its previous value i think
the onrep parameter is the previous value of that variable (the new value is already set before the onrep is called)
wouldn't this result in a forever ending loop (every check rather) of it trying to correct itself?
Lel
no, because in cpp setting the variable in the onrep wont call the onrep
if you did this in blueprints, yes
ah, nvm; it'll just correct itself next net check
in blueprints OnRep will fire if you change a variable on the client
yeah, if you try to do client prediction it can be helpful if you know its going to do that
but its kind of a trap
like if you tie your "on variable changed" logic to the onrep, then you do client prediction of a variable changing, you'll get that logic to fire, but you have to know that since its predicted it might not be real
also i dont remember if onrep fires in BP if the previous and new value are the same
it shouldn't?
so i always put in a check (if i already predicted this value, dont fire the logic again)
at least in cpp it doesn't
well i mean, on the server the variable would change, but then the client would receive that change and his value would already reflect the new value
so i dunno if it calls the function in that case
either way its a mess, and if you wanna do something like that I usually just make a second variable (Health and DisplayHealth) where DisplayHealth is the one that can be predicted and is updated when Health replicates
so since i need to call OnRep on the server what should I be putting in an OnRep function?
OnRep is only if you need additional functionality
since the server RPC will handle the changing of the health anyway
like "every time my health drops i want a floating damage number to appear", you would put spawning the damage number widget in your OnRep
or if you want to update your health bar widget, you'd probably do that in the OnRep too
usually its stuff that the client needs like UI updates or effects
or just firing off a delegate of some kind
I usually have/prefer to have local variables to keep track of onrep functions
and have the on rep Functions just be void Myfunction()
ok but usually you use it for cosmetic things that happen on the client
Well at least in my cases, not necessarily ** (I can't type today)
you can do whatever you want in the OnRep, but yeah I think the most common use case is client visuals, which is probably why it doesnt auto-fire on the server
server doesnt care about UI/effects unless its a listen server
ok that makes sense
but yeah, moral of the story is the variable itself will be set behind the scenes if its set to replicate, OnRep is just for if you want to do ADDITIONAL stuff after the variable is replicated
ok so for example if I wanted to add scripting hooks so that someone else could extend this without needing to inherit from my class directly I could use OnRep to fire a delegate that could be listened to and would fire on all the clients but not the server by default
yeah i do that kind of thing a lot
where my OnRep will literally just fire a multicast delegate
do you also create a server delegate that only fires on the server too?
my stats system is set up that way
I usually manually fire the server delegate in the function that i use to set the variable
like a prechange and a postchange
so if I have a SetHealth function, it would also call HealthDelegate.Broadcast(), and then OnRep_Health would call HealthDelegate.Broadcast() as well for clients
and i'd have SetHealth not be callable without authority so it can only ever happen on the server
ahh ok and then in bound function you would just redo the authority check to see if it ran on the server?
yeah if you need to
yeah i would just use one delegate
ok
and you can always check if you're authority or not if you're trying to do something only the server or only the client wants
it gets a little confusing because really there's a ton of options for how to do stuff
but OnRep is a good tool if you know exactly where and when its going to fire
HALP! My brain is melting. 😱 I've created a Project based on this Epic tutorial https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ.
It works fine via internet. 🥳 MY QUESTION IS. Where (physically) list of created sessions is stored? 🤔 To be precise. Let's say I've shared my Project with 5 of my friends.
Everybody launched Project (or it could be even build version, but I'm pretty sure that doesn't matter) on their computers. 3 of them hosted game. So I may join 3 of them.
But from what place my GameInstance picked up this list? Is it from some Steam server? lol 🧐
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some server options such as changing the map or match time as well as the abili...
if you're using 480 to test you pretty much will have to use advanced sessions
you want to be able to filter by an attribute
I've got a question concerning custom USTRUCTs and server-client functions with structs as parameters... Seems that they fall under the category of UObjects not replicating, so I get a null struct. This is correct, yes? Is there a decent up to date documentation on net serialization for custom structs if I wanted to be able to send them over RPCs? Or am I misunderstanding something.
Essentially, I have a struct containing the info of a server (name, current player count, etc) and want to send it from Game Mode to PlayerController so they can update their UI.
C++ I might add. Not Blueprints.
Wouldn't that belong in GameState?
Well, same question, regardless of where it's stored. Structs seem to come up null when I'm trying to get the data over to the client to access for UI.
Hello, can I ask a quick question?
The information is server side. I just want to get it to the client. And it seems that a custom struct is null when sent as a parameter in a function.
Any idea why Cross-Compiler isn't downloading for me?
@night tartan There's only two ways to send data. RPC or Replication. Only two things can do this by default. Actors or ActorComponents. They'll be sent by value either through RPC or Replication. Pointers sent need to point to a replicated object spawned by the server to not be null on clients. The only thing that structs change with this is the ability to set properties to NOT replicate specifically. Otherwise the entire struct should be the same from one side of the RPC or replication to the other.
Hmmm
Name should probably go in PlayerState since it's directly player related.. PlayerCount should probably go in Gamestate since it's full game related.
Did you mark all the properties as UPROPERTY?
Simple replicated properties that server can set and all clients can just use.
Yeah, I'm going to move these things to the States. My issue with PlayerState is that it doesn't seem to exist for a bit upon the joining of the game.
That won't matter for UI. UI shouldn't exist before the GameState.
So in Blueprints when I was prototyping, I had to literally make a while delay loop to wait for it before proceeding. This felt nasty for me.
Okay
Regardless of whether this specific case is a good idea, there shouldn’t be issues replicating a struct or RPCing it
I will double check the UPROPERTIES, this is another thing I was thinking about. I am semi-following / modifying a Udemy course and I have come across multiple things that have been "wrong" that I've had to correct.
Thanks so much for the advice. I will work through all of these and see if I can get it to send the data over.
If you want a struct property to replicate or be sent via RPC it needs to be UPROPERTY, you shouldn’t need to do anything on the serialization side unless you have something custom going on
Okay, thanks. That makes sense.
Bear in mind that courses can be a bad way to learn in a shifting development environment. By the time that course is written, published, and followed, half of the stuff from it can be outdated. I personally find that you'll get a lot more milage by just doing and learning what you need in the moment.
This Udemy course didn't have Super::Logout, for example, so I was banging my head against a wall for a while til I realized that.
Yeah, I don't follow step by step. I got off the tutorial treadmill. I use them to quickly Jumpstart stuff then I modify with the API.
Great example is people still using GENERATED_USTRUCT_BODY(), cause their two year old tutorial said to. Everything uses simple GENERATED_BODY() now.
Yes, I don't do that haha
I read the source and avoid deprecated stuff. Thanks so much, guys. I will look further at the UPROPERTIES and move my variables to better locations and hopefully solve this Lobby UI headache :)
But yeah. If you have a struct of two integers for instance.
USTRUCT(BlueprintType)
struct FMyTwoIntStruct
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite, EditAnywhere)
int32 FirstInt = 0;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
int32 SecondInt = 0;
};
This struct should automatically be able to be used in an RPC and Replication without issue in C++ or Blueprint.
This makes sense. And I could have sworn I'd successfully passed structs before in the past. I think it totally is the lack of a UPROPERTY macro and I spaced on adding that when stealing the other code.
Not at my PC currently, but I'll make this fix later. I think you solved my headache. Much appreciated.
May want to add a constructor or two to the struct too, but yeah.
if i am playing the game as a listen server with 2 players(one being the server), who does the third player represent? this still confuses me.
a bug in your logic
could it be related to how i spawn the players?
spawning on server. this runs inside the player controller
that does not look right
you should be doing it via GameMode
client should also not spawn there own character
they should be replicated, and only spawned on server
@faint pawn top pinned message on this channel contains a link to network compendium
i suggest you download and read it a few times
UFUNCTION(BlueprintPure, Category="Properties")
float GetHealth() const { return Health; }
UFUNCTION(BlueprintCallable, Category="Properties")
void SetHealth(float inHealth);
UFUNCTION(Server, Reliable, WithValidation, Category="Props")
void Server_SetHealth(float inHealth);
UFUNCTION()
void OnRepHealth(float inHealth);
is there any reason to have SetHealth if the only thing it does is call the server's set health if it's not run on the server? couldn't I just remove it and make Server_SetHealth just SetHealth since it will run on the server anyway?
i'll just call SetHealth on server, and also from OnRep
i'd never have a version of your Server_SetHealth function
as client has no business setting the health of anything directly
ok so your set health would be something like
UFUNCTION(Server, Reliable)
void SetHealth(float inHealth) {
if(GetLocalRole() == Role_Authority) {
Health = inHealth
}
}
no
i'd never have it as an RPC
if you're doing damage, it will be Server_ResolveShot(payload) which will cause the server to DealDamage then that will call SetHealth
if you're healing, it will be Server_ActivateAbility, which will call Heal, which will call SetHealth
ok so you would just have the check to make sure you are the authority but getting to the server would have to happen in some other function to prevent the client from changing their health directly
client has no business setting that stuff directly
ok that makes sense
so my SetHealth is basically at least 2 functions removed from server RPC
that causes health to be changed
Are RPCs batched like replicated variables?
Or are they actually executed when called
sorry for the late reply. i am running logic on the client's player controller because its easier to get my references from there. should i switch to interfaces and handle it that way?
@gilded vapor they are sent the next frame
to further along a question from earlier...I am using GameState and PlayerState, and the PlayerArray on the GameState is spitting out 0 when I access it; shouldn't this be a replicated variable?
I am trying to print a current player count in the UI...and PlayerArray.Num() is returning 0
I know UMG is client-side only, but I was under the impression the GameState is the Server/Client object where this kind of information should be stored and accessed for networking
yes but you need to wait for it to be set
you are likely trying to access it too early
Yay...I did "delays" in Blueprints when prototyping for this problem
so in C++ what's the safe way to handle this?
I really don't like the idea of having to stick hiccups in my code
it isn't a delay issue, I just made another LAN client and added them
PlayerArray.Num() is returning 0 on all connections, no matter what
if it were a delay issue, I'd be 1 off as I join more clients
@night tartan doing anything custom in the login flow?
no
no warnings