#multiplayer
1 messages · Page 241 of 1
This is coming straight from the ontick
what im wondering is how any of this is coming from the server, those are blueprintnativeeventns, which can't be server anyway
This is on the GameItem
GameItem is the actor type
and you do IsLocallyControlled check?
you don't want to run the logic on copy of Player's 2 character in Player's 1 world
or any other players for that matter
I mean that's not gonna make your problem go away
But its a good start
I assumed the server stuff was coming from this parent call on the player character
But I wired it straight from the event tick node without the parent and it was still happening
Actually that surprisingly did just fix the whole issue 😭
Thank you for your help 🙏
No server stuff
you are just running the logic on other character copies
Server client communication only possible through RPC
Ah ok ok
I think I was screwing around with an RPC earlier because I was seeing a Sever: xyz log in the debug pritns
print will Prints the instance of the machine doing the logging.
if Print string is called by Client instance, it will says the Client_number
if server it will says Server:
Yep
and I was seeing Server logs
Idk what the hell was happening, but thats another bridge to cross when I get back there 😭
because the node runs on the server instance.
even if you play as 2 client, it just means there is a dedicated server
so 1 server and 2 clients
The server will have the 2 players in it's world.
The player 1 computer will also have 2 player in it's world.
So is the player 2.
Whats the "right" way to Update WidgetBlueprints in MP? e.g. a health bar.
What I have thought of so far:
1.
Do I make a bind from the widget to the replicated HealthVariable? I know this basically uses a "tick" function to do so-> so it would update very often and set "health=100" like billions of times for no reason(given i am in a town or so,HP doesnt need to be updated)
Make the variable OnRep
But this means it would also try to execute this code on the server, that wouldnt need to do it as it doesnt have a UI for the player?
Is there a "right" way? is any of my 2 ways "the right way" or is there a 3rd way I have not thought of yet? 🙂
Binding it directly isn't inherently bad as long as it's not running any expensive functions or trying to pull it from somewhere else, for just a healthbar it makes nearly no difference on performance.
Updating the progress bar in OnRep is a bit more mindful as it won't be running every tick, so if you're concerned about best practices it's the better way of doing it
But it's mostly personal preference imo
My concern was "its not the only variable to replicate".... but now that I think about it... Not every variable I need for a UserInterface needs to instantly update. I was thinking like "yo, what if i have hundreds of items,spells,whatever all of that would be "ticking" 24/7"...but thats not true, as inventory only would update if i show it... and the stuff that I want to show is not much...Playername,Class,Experience,Mana/energy and thats it, maybe 20-30variables, thats not much.
Yeah by "right way" i meant best practice 🙂
use an OnRep
and have it broadcast a multicast delegate
if you do it in c++ the OnRep will only get called when it's actually sent over network, so only ever on clients
Nah, I am blueprint only for now, still new 🙂
I can program in c#...just cant get my head around c++ yet...
using c++ in unreal is fairly similar to c# IMO as long as you stay within the framework
I wouldn't worry about the OnRep also triggering on the server. If you don't bind anything to it, it's performance impact won't be meaningful
Maybe for you 😄 all these Something::Something else, doesnt make sense to me, but tbf i didnt give it much time yet 🙂 Wanna go as far as i can with blueprints and then well see about learning c++ ^^
In a complex project you need a hybrid of both, so having a good grasp of blueprints first before diving into C++ can make it easier
agree
bp didn't really click for me until I started using c++ and understood how they were exposed to one another
OnRep doesn't automatically get called on the server in C++ just fyi
i stated that but yeah this is true
Binding is fine if you don't have a billion of them and you expect them to change often, otherwise you can bind to a dispatcher/delegate in the thing and then it can fire that in the RepNotify or whatever else is the initiating thing that says that the value has changed.
oh mb I didn't read up 😄
Hey @grand kestrel first off huge thanks for the predicted movement plugin, it is fantastic already. I was about to start working on some additions but looking over the github it looks like some of what I want is already coming in 2.0.0 so I will wait for you to do your magic. Can you ping me on release? Reading through the feature set I am super excited lol.
Hello, i'm having a big problem, my camera client jitter with camera lag enabled while on a moving platform, is anyone know something about this ?
howdy. I'm having issues with a blueprint and multiuser. I made a thing that changes a material's texture on the press of a button, it changes on the local computer, btu not on the other three (virtual production setup..) any ideas? im not sure what to google even, i usually solve these stuff on my own but i have zero ideas on what to do now
It's likely your platform that's jittering
How do you move it up?
How are you communicating that change out to other clients?
I tried to move it by interp in blueprint, or with an interp component, i also tried move component to, set location with timeline, always the same result.
How do you handle its networking?
i usually don't need to communicate stuff i change materials, run seqeuncers and such, and it just happens
Can you show its code
Hello
The basic configurations that we add to DefaultEngine.ini, like this one for example
[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=480
SteamAppId=480
[OnlineSubsystem]
DefaultPlatformService=Steam
Do we need to add this to DefaultGame.ini, for things to work in a packaged game?
To DefaultGame.ini
Yes, do we need to add those things there too?
Nvm my answer I misread the question
Yes you do need to add it to your DefaultGame.ini
Add in a new line at the bottom
You also need the steam_appid.txt
in the package
Sounds like you need to go over multiplayer fundamentals then.https://www.youtube.com/watch?v=JOJP0CvpB8w
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
like this
Your delays are not syned up with the server
Client loads this platform a little later the server spawns it
The random float node is pulling the same numbers probably because they use the same seed in the background
But since the delay at the start is running at different times in the server and the client there is a mismatch on what you see and what the server sees
That may be causing the jitter you're seeing as the server is correcting your character's position
Didn't know about this. Could you please link some documentation? All I could find about steam_appid.txt, is that it is generated by the editor, but I can't find that file.
let's see if i remove the delay
It's not the delay itself that's causing the problem, it's the begin plays are running at different times
Alright but how do you call the logic at the same time in this kind of case then ?
Watch this
You need to use RPCs
Since everything is behind an Authority check it's only running on the server, except for when you get to the point of running the timelines - since the timelines are replicated, they will run on clients and the server, so then the server is setting the location, but then clients are also setting the location since it's a replicated timeline, so jittery motion is introduced there. Disable the timelines being replicated and it'll probably look fine, but clients will always be slightly behind the server.
If a client joins at a later time it will break completely though
If it's a replicated actor, the server will replicate the current position when the client joins (or rather, when the actor becomes relevant to that client)
Wait the timelines are replicated yeah true
Either way you don't need to have those timelines set to replicate at all, just need a multicast rpc
Shouldn't need a multicast either. Location is something that is replicated automatically for replicated actors when set on the server.
Yeah but he is changing the relative component location not the actor location
Would still work without the multicast though since the characters would be updated very well, the overlaps should fire at the same time in both the server and the clients
Okay i'll watch this, caus still, i don't get how to make this work even with your very clear explanations :p
oh I didnt see the auth check lol, Im going blind
Can someone link a proper documentation on how should I package my game for the Steam Multiplayer functionality to work.
All I have done so far, is configure the DefaultEngine.ini. I haven't touched DefaultGame.ini, and have no idea what steam_appid.txt is, where is it found, and how should it be configured.
Using a different plugin, their funcionality is better but the documentations is practically non-existent
If it works with Steam it should be the same
The steam_appid.txt just needs to exist in the package, and steam should be running in the background for it to work (For testing simply putting ''480'' in it will work, it just holds the game id)
The steam_appid.txt file works like this:
- If you have your own Game on Steam, whenever someone downloads it via Steam, Steam will put that file into the root folder of your application. That's why Epic/UE doesn't generate the file when packing for Shipping (which is what you'd choose for the final version that is delivered to your players).
- Outside of Steam and Shipping, Epic/UE generates the txt file for you automatically when you package with Steam enabled iirc.
In other words, the only important point to know is that if you package for Shipping, the file won't be generated and if you don't distribute your game via Steam then, you won't be able to test properly without manually adding the txt file to the Shipping build.
All it contains is a single line with the AppID that Steam gives you when you set up your own game.
As Spynora said, 480 can be used as a test AppID in the meantime, but you can't distribute the game via Steam with it.
And you potentially run into a bunch of annoying issues with 480, such as it being overused by developers all around the world, so you might get Session results returned from other games or even game engines which UE then filters, making it look like you didn't find any games.
So if you are sure to actually release the game via Steam, get yourself your own ID.
Packaging it as Development Build, but through Tools -> ProjectLauncher. Could this be an issue?
I have my own page on Steam and using it's AppID.
Testing on 2 different devices with 2 different Steam Accounts (both have access to the game on Steam)
I have also, as per instructions of the plugin I am using, added bunch of lines to DefaultEngine. Should I add all those lines to DefaultGame before packaging?
Lines like these:
[OnlineSubsystemSteam]
SteamDevAppId=480
SteamAppId=480
bVACEnabled=True
bEnabled=True
bUseSteamNetworking=True
[OnlineSubsystem]
DefaultPlatformService=Steam
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="SteamSockets.SteamSocketsNetConnection"
[/Script/SteamCoreWeb.SteamCoreWebSettings]
DevSteamID=480
You would need to, yes.
Not all, but some of them.
And the ID has to be your own of course.
How do I know which ones Not to add? 😄
Yes, just changed it when pasting here, to not leak the ID
IpNetDriver is the default NetDriver that is used if you wouldn't use Steam.
Not sure you need those lines, at least not for the general connection.
Leaking the ID does nothing. Everyone can look IDs up.
Somewhere in there should also be the lines that add the SteamSocketsNetDriver to the NetDriverDefinitions arraz
Not sure you need the SteamCoreWebSettings. Don't even know what that is.
Here's the full lines I added to DefaultEngine
[URL]
GameName=GameName
Port=7777
[OnlineSubsystemSteam]
SteamDevAppId=480
SteamAppId=480
bVACEnabled=True
bEnabled=True
bUseSteamNetworking=True
[OnlineSubsystem]
DefaultPlatformService=Steam
[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="SteamSockets.SteamSocketsNetConnection"
Changed the AppIDs, other than that haven't changed anything
Yeah I guess that is fine.
Let me try to add these to DefaultGame, and try packaging again.
If you start your Game after packaging it for Development and having Steam active, does it show the Steam Overlay in the Game?
It does, there is a different issue.
I can create a Steam session, and I can find that Steam Session, but I can't join it. In the logs couldn't find any related error. Print String connected to Failed output confirms that it fails to join, but no idea why
5.5?
Yes
Seems like a lot of people have issues lately with Joining Sessions.
It's difficult to help with these, especially without logs that have additional logging enabled.
How do I enable additional logging? My launch is close, and the whole game is ready, including the multiplayer gameplay, except for the Creating and Joining Sessions/Lobbies functionality. Had left this as last, because knew would need to package the game bunch of times.
For your packaging settings you should only need to make sure that you have all levels included. But if one client can host and open the level then the other one will have the map just fine I guess.
Side note: One usually packages their game very often during development, because Play In Editor works differently.
Wait...you haven't tested sessions???
My dude - that is one of the earlier things you want to test.
Additional logging I would need to check
I have tested multiplayer gameplay. I haven't tested Steam Session joining before this.
Yeah Duro means the Session stuff
That's not really something for last minute 😅
If you develop Multiplayer games you usually should have a setup with some sort of Automation, Build Machine and upload to Steam. So you can regularly test the game.
Including Sessions.
Packaged Connection via Sessions can break a bunch of stuff too fwiw.
So once you get taht working you might look at a pile of bugs.
But I guess that's for the future.
That is always like..the 2nd thing I get going. First being basic gameplay working locally.
So I need to publish to Steam to test the multiplayer, but to publish to Steam, the game needs to have multiplayer
Steam doesn't require MP
Catch 22
The game page says it's multiplayer. The Steamworks page says that uploaded build must have all advertised functionality.
You can still upload builds to test with
Upload build, give people access. Store still isn't published.
This is possible.
Logs you could raise the level of are:
- LogOnline
- LogOnlineSession
- LogNet
- LogOnlineServices
- LogGameSession
- LogGlobalStatus
And you could potentially add the TravelFailure and ConnectionFailure, or whatever they are called, events in your BP GameInstance and print the Reason on them.
Yeah as Duro says, you seem to have totally skipped the part where Steam allows you to upload builds and test them within your development team without actively releasing the game to the public.
You can create some temporary keys for some QA peeps or pre-release reviews and what not.
Or Demos, Alpha/Beta tests, etc.
The Store page can remain prepared and private for the entire time.
Or even unprepared fwiw.
You can make different "Beta Branches" to upload different builds too.
As to how to raise those levels, I think you have to add some lines to the DefaultEngine.ini. Have to check how that owrks again
[Core.Log]
; This section can be used in DefaultEngine.ini to override the display level for different log categories, using lines like the following:
; LogTemp=warning
E.g.
[Core.Log]
LogOnline=VeryVerbose
LogNet=VeryVerbose
Guys, what is the correct way to create a loading screen in a multiplayer project (blueprint)? Something that really loads the level for everyone beforehand in some way. Everywhere I look, it's just a "workaround" of placing a widget for a certain amount of time and then removing it. But often I won't know exactly how long it will take for someone's machine to load, it's very variable.
Load the map into memory beforehand for each client, this won't open the map
When all clients report they've completed then open the new map
fwiw, the "proper" way to do a Loading Screen requires C++ and Slate.
Or a Plugin if one exists.
Yeah this is a blueprint workaround
The Engine has a MoviePlayer module, which does actually take care of playing "loading screen movies".
Or, optionally, also simply display Slate Widgets.
So one usually tell the MoviePlayer to show a Slate Widget when the Map Starts loading, and tells it to stop when it's done.
Iirc there are two CoreDelegates for when either of those two events happen.
The setup is quite simple, but yeah, C++ and Slate.
Thanks for the excellent and comprehensive response, guys. I will take a look at all of this🤘
Have a look at Lyra common loading screen plugin. It’s cpp, but I think it can be used purely in blueprints. But not sure, I use in cpp
Pretty sure that thing does the exact thing I said.
Good to know there is a plugin. Sad to know it's in Lyra and not in the Engine.
Oh, that's good to know, I'll take a look there, thanks!
Wild to me how, of all the systems UE provides, a basic loading screen isn't one.
I know there is a plugin on the marketplace as well.
That's what surprised me too, being something so "basic" that exists in any game
It's even funnier that the MoviePlayer can also lock up the game if you do it wrong
The MoviePlayer manually ticks the GameThread. If you start open the Loading screen via the MoviePlayer by hand before doing, e.g., a Steam related event, like updating session info, you are in for a ride.
Cause the Steam stuff runs on a different thread and remains blocked until the MoviePlayer is done.
So if loading the level is set up to start after steam calls back, you managed to soft lock the game.
And I'm totally not speaking out of experience
It’s pretty easy to get it out of there, but yeah. I guess they just leave the fun of making loading screen to fellow devs
im using the steam advanced sessions plugin for multiplayer, im using ID 480 for the steam dev servers. Is it true you have to be in the same state as the other person to connect?
tbf you only need slate if you want the preload screen that shows basically directly after the splash screen, otherwise on movie player u can just use a umg widget
can just do take widget on user widget and skip slate entirely
but problem is that for preload screen the game instance hasn't initialized yet, so there's no UMG available
i have wondered for a while if there's a way to actually cache slate widgets from UMG and package it with the game to be used for preload so you just dont have to fuck with slate at all
0o I haven't yoink Lyra plugin yet but I will need the loading screen.
So if I don't need instant loading screen at the start of the game I can stay away from slate?
Working with slate is kind of a nightmare for me.
Need something that I can drag and drop like umg widget but not in game thread.
Sure
Add me to that please lol
Does the plugin support setting player rotation to a rotator (around a planet surface, etc) and handle physics interactions?
Wasn't it also that the UMG Slate Widget doesn't tick properly and thus can't have animations or moving parts basically?
It is untested with custom gravity
Eventually I'll need it for my own purposes, so will add it when I get to that point
I don't have much time to work on it atm, and it has 1 difficult issue remaining before I can release it
And finishing another plugin is a slightly higher priority
when using the same class,
could the instance of that class have replicated variables,
and another instance not have replicated variables?
That's something that is controlled on the instance (actor) level.
Simply tick or untick replicates
perfect thank you very much
There are other ways to optimise them. Dormancy, relevancy, etc. I personally never go that far yet but if network bandwidth at stake then consider those options.
yeah, I was intending on using them and have a "bad network" case where I assume the player has an unplayable ping so might aswell remove them from replication
Has anyone got or know of a conclusive guide to setting up Steam Dedicated Servers? Struggling to piece together what i actually need to get it up and visible. I have the Server packaging and launching but steam is failing to load on it, im not sure if i need a GameInstance Class to create a session etc and register the server
For anyone having Session Joining issues in 5.5, the reason is an incredibly dumb engine bug, that uses bUseLobbiesIfAvailable to false. It creates a mismatch with bUsePresence, which is the cause of the problem.
AdvancedSessionsPlugin seems to have implemented a fix, so just use their functionality.
Leaving this here, so that anyone having the same problem doesn't have to break the wall with their head for 2 days.
if you dont wanna use advanced sessions, you can also manually set those variables in the FOnlineSessionSearchResult object returned by the search
which is what i believe advanced sessions does for their fix
same server region yes. you need to have steam distributing the builds so they are version controlled (ensure users are using same build)
Alright,multilayered question:
I have my PlayerSave variables(Name of player,Health,level,etc) in an ActorComponent(PlayerData) attached to my PlayerController
-
Is that the correct Controller/area to place it?
-
On my PlayerCharacter I have an ActorComponent (lets say its health for example sake) with a variable currentHealt
Now I would like to set currentHealth in BeginPlay on that component, but I cant. Because BeginPlay on the ActorComponent is being fired BEFORE PlayerCharacter is even "spawned" (see screenshot 1)
So I clearly am doing something wrong here, my current "fix"(screenshot2) is to put a delay right after the parent call of BeginPlay with 0.2 seconds wich makes it so that the PlayerCharacter actually exists,so I can cast to it, but I highly doubt this is how I am supposed to do this 🙂
Im pretty new, so any help would be appreciated
Hello, bSetGamePaused doesnt works for clients when I run it on GameState. I tried to run them in clients PlayerController seperately but same, just server pauses but clients not 🤔 what should be problem here?
Are you sure it's the character that doesn't exist? Chances are way higher that the Controller is invalid. BeginPlay, for one, calls on everyone, while you would probably want to limit that to the server. And then BeginPlay is also potentially too early as the Character doesn't get possessed until after spawning.
Oh, would have to test,but I think it was the Player, I did that yesterday and maybe I mixed them up 🙂
what would I do instead of BeginPlay?
and youre correct sir, its the PC not the PlayerCharacter 🙂
There is no event in a Component for this by default.
Your Pawn/Character has a function it can override called Possessed, that's Server only.
Or OnControllerChangedEvent, which is Server and OwningClient
Given the PC only exists locally and on the server, so it's null for other players.
I see, given that you have way more experience than I do.... How do you load player saves and distribute it to your clients? Just simple stuff like A player chosen name or the health/level a player "logged out with"?
Depends a bit on how you identify the player. Assuming you have a way to link the save game to the player, and you only want to store it on the server, I would probably load it on the PlayerController and then assign it to the PlayerState and Pawn when needed.
My approach would be like ARK.
You connect to a server and on said server(lets assume you could have more than 1 character on ark) you would get a screen with the characters to chose from or,if non exist, you would create one and after creation you go to the character selection screen and chose from there.
And yes, savegames shall be stored only on the server.
So Its correct what I did...I have an Actor Component on the PlayerController wich shall handle the loading of the saves.
"assigning it to the playerstate/pawn when needed".... well this is literally where i am stuck at 😄 I cannot load the PlayerController as we have established earlier ^^
if you use movie player to tick it and not GT then it’s fine
and second question, I finally included push-model to my project. If I mark variable as dirty and there is same value (no change), OnRep shouldbe called on clients?
no
push model is just a suggestion
Server still won't send a property to a client if it thinks it has it, client won't call an onrep if the local value matches servers value
So I must just manually call OnRep on client? Or there is way to force replication if value of variable is the same
You can force it in with the DOREPLIFETIME stuff
how exactly?
I don't have the engine open atm. Search for NotifyAlways and you should find something
oh thanks, I didn't know how to search for it, tried googling but it failed
Since this is a MP channel, is there any people here that knows the details of how security rings works ?
Also, as i first asked there (#programmer-hangout message) im trying to find articles about why kernel r0 is the preferred anti cheat solution, and what are other studied/tested/searched solutions
with BlueprintAuthorityOnly ufunction tag must I do hasauthority check when function is executed from c++? And for sanity check: in blueprints it is only executed with authority, right?
Heya, networking related question:
I have my Character with CMC, and my Character has weapon, when I start shooting and walking simultaneously I get client movement corrected.
Weapon firing is handled using GAS ability. I know that CMC is using RPCs to update movement, and GAS uses RPC for activating abilities(3 RPCs in worst scenario to activate 1 ability)
Its obviously that too many RPC cause drops or delays.
But, how to counter it?
I mean, it's the same actor channel, same connection that wants to send simultaneously updates about movement and fire weapon.
Not 100% on this, but it's probably not about too many RPCs going through, rather, you have conflicting movement data that needs to be handled. Like, you may be moving your character using a montage with root motion, but still allowing the inputs to the CMC to go through, so then the character is ending up in the wrong spot according to what the CMC thinks it should be and you end up with corrections from the CMC.
are ur rpcs reliable?
and do any of the abilities affect movement
If you are shooting actor projectiles could it be that the character is colliding with the projectile?
I have a very serious problem, passing an actor reference from the server to the clients returns the wrong reference to the clients.
Display name can be different on clients. The reference, if it is a replicated actor, will be associated to the correct actor.
They are replicated actors, I tested using a line trace, the server and client are swapped.
If this bit of code is called on the server (which it should be if you're trying to multicast) will return the first Player Character that the server has.
If you run that same code on a client, it may not necessarily return the same Character on the client.
Yes in the first picture, the nodes are called only on the server.
FUll print
You are getting a reference on the server. You are passing that reference through the multicast. All clients including the server would execute that multicast, and while the name may be different on different clients, it is 100% a reference to the same actor on all clients and the server.
Does anybody know how can i make multiplayer compatible graphic settings ( when someone changes settings it need to only affect him not everyone)
Usually graphics settings would only be changed on the local machine.
Hello, does calling a server RPC from another server RPC lead to additional calculations and is bad or not? For example, a Server RPC function that adds an item to the inventory, which is sometimes called by the clients through UI, and also by a Server RPC function that picks up an item.
So when I use the line trace event to get the location of the actor for the reference, the server has one result and the client another @sinful tree
I'm trying to build a simple rollback networking system ala the Overwatch architecture but had a philosophical question
I understand that the client simulates ahead of the server so that the server can buffer its input frames. and I understand that how far ahead the client is can fluctuate
what I don't understand is what the client displays during those frames. if the server is on frame 14 and I'm simulating frame 17, I might only have data up to frame 12 for the stuff around me (other players, etc.)
how do I determine which frames to show for other entities? the most recently received frame (frame 12)? should I buffer received frames on the client, too?
i am currenty doing it with game user settings
It's usually not a good idea to have a server RPC call into another server RPC as that can potentially be a means of exploiting something as your clients could bypass the first RPC.
and it affects everybody
How are you doing your line trace?
In an actual online multiplayer game, it would only be changing locally.
i am testing it on listen server
Are you using other machines to connect to that listen server, or just doing PIE?
*All actors replicate their own location
So just through PIE.... Which is by default the same game instance, so any change to one would change others. In a real world scenario, where you have a separate machine, the game settings are only going to change on that instance unless you specifically make your game communicate those changes out to others.
So this here should trace from self (the NPC Pawn) and trace to a single character (the one you've replicated down from the server). Do you have a screenshot of the trace in action?
If you want to simulate separate game instances, in the dropdown instead of using Play In Editor, you can do Play Standalone, then I believe it will actually have separate game instances running in which case you should see the settings only changing on the individual instance on the same machine while they are running.
okey i'll try that
thank you for the help
Unfortunately I do not have authorization from my team to show screenshots of the game.
In default networking and using the Character class with the Character Movement Component, clients are allowed to freely move and it will display their location based on the values they have set within their local copy of the CMC. This allows for client predicted movement as the CMC sends the moves it is making to the server and the server then plays back those moves to see if they are valid based on the values it has for that CMC, and if not, it will send a correction, in which case the correction attempts to adjust the position on the client to the last valid location the server had and the server keeps the location of the actor at that last valid location until a new valid location is received.
The client is always running on what ever current information it currently has, which will be out of date on the server when they send a movement, and in which case if there is a conflict, the client would still see their movement working up until the point the server disagrees (as an example, to characters running towards the same spot) and then pushes whichever client was last to that spot back to its last valid location.
Ok... Technically, you should be seeing only one line trace happening based on the code you've shown.
Or at the very least, if you can see two, they should both be going from the NPC to the one Target Actor.
show your code for how you're doing it
Might be an artifact of testing in PIE
i tested it it was about not testing it on standalone
thanks again for the help
@sinful tree And also i wanted to ask do you happen to know a detailed graphic settings tutorial or a way to do it detailed
i mean my graphic settings are okay but i feel like it does not affect much
it's like this rn
Sorry it's not something I've messed around with very much myself. I know there's tons of console commands, and that the blueprintable Game User Settings doesn't fully cover everything one could do with graphical settings.
alright thanks i'll keep looking
Just to clarify.
Its a vehicle with the turret.
No anim montages are played when performing firing.
No abilities affect movement.
Ability activation is by default Reliable RPC in GAS.
I found out it is related to RPC after testing firing. I ability is local - all good, as soon as ability is local predicted or server - issue is present.
You can also reproduce it in Lyra with any weapon with high RPM
Weapon is a hitscan, no collision conflicts
Are you using a rapid trigger on the input action to activate the ability?
Yep, since weapon firing is an ability .
For example 600 RPM - 600 ability activations per minute each one is 3 RPCs since I'm using Lyra - ability activation, generating target data and ability ending
I discovered the bug, the custom "Root" component had the same name in the "NPC" actor and the Character, this was causing some kind of redundancy inside the engine's black box and was making the reference come swapped in the client, I just refactored the root component of the character with a different name and it went back to normal.
weird
So when I got the actor reference it was correct on both sides, but the reference to the root component's location was swapped on the client side.
Ye, thats what I thought too, weapon firing logic needs refactoring, probably ability batching is appliable in this case.
I wonder how it works in Fortnite, because Epic said that they use 1 ability activation for each shot.
One more thing to mention is that issue is still present with low RPM, but if I lower down NetUpdaeFreq of the vehicle problem is almost absent, which is funny
I don't quite understand relationship between NetUpdateFreq, RPC sending and variable replication
NetUpdateFrequency is how often the server would check if any replicated variables need to be sent/checking for relevancy/sending rotation & location updates of the actor or scene component, etc. RPCs if I remember right are always sent immediately regardless of what the update frequency is.
Since you've mentioned vehicle here.... Do you happen to have a character that you're placing into the vehicle? If so, maybe you could try disabling their CMC when they enter the vehicle if you haven't already done so?
Yes, Character is attached to the vehicle, but CMC is not ticking and not replicated when sitting in vehicle to prevent client side correction, just letting the vehicle be responsible for movement basically.
Initially Character is not a problem in this case, I'm sure for like 95%.
So I have a rounds based multiplayer game where the map should reset (without server travel) back to some starting condition at the end of each round, what is the best approach to implement the map reset? Will the save object system do the trick in a multiplayer server?
You can call AGameModeBase::ResetLevel
Oh, interesting! I'll read up on it, ty
Something to watch out for with ResetLevel is that its only called on the Server (since its a GameMode function).
All it really does is call AActor::Reset on all Actors in the Level. Except for a select few.
Its on you to do what needs to be done for Actors that care about a Reset.
Meaning, they need to Override their Reset function and roll back any properties or state to defualt.
Its an Opt In system
Very interesting, I had no idea the notion of resets even existed
Its primary purpose back in the day would have been to facilitate Round restarting in UT
Is my guess.
perfect fit, you saved me days, potentially, thanks again 😍
@fossil spoke any chance you would be able to assist me ?
It helps everyone if you explain in as much detail as possible what the issue is.
Just saying "this isnt working, how fix" helps no one.
Please elaborate on your issue.
so i have a closet that i can open and close that reports a noise event
the ai seems to hear it for the server but not for clients
well you didn't explain what calls this RPC, a multicast to control AI behaviour also seems pretty suspect
show code
starting from the triggering event
Why does the client need to respond to the noise event? AI processes on the server.
also why does this matter, sensing should just have to happen on server
Yeah you don't need clients to execute AI at all
i see
The server can run the AI, and the clients would see the AI move
Totally not your problem but if you want to have instigator be "who caused that sound", it should be the character that opened the door, not the hosts character
does it need an instigator ?
idk
depends probably
if you wanted to filter by team etc so zombies don't investigate their brethren etc
It's just there so you can have a generic "who's fault is this?" parameter
yea it seems it doesnt work if there is no instigator
so thats the problem then its cause im using get player character, its only the host triggering it
also to call a server RPC as a client, you need ownership of the actor
whoever did the interaction, presumably
Yes, you should bake WhoIsDoingTheThing into the very beginning of your interaction chain
useful for Press Button To Kill Self or Interact To Aquire Item
this is why your run of the mill interaction tutorial on youtube ain't gonna cut it for multiplayer
the interaction will need to be proxied through something the client actually owns, for example their pawn (or an actor component within the pawn)
server RPCs sent from anyone but the actor owner will be ignored, apart from the server, because they're... the server
I am actually having a similar issue.
Currently I have the health variable in the character blueprint. When the health goes below 0, then I am trying to Set "Is Downed?" bool in that characters Animation Blueprint, which makes them go into a crawling state, and I would like to replicate that to the other clients.
I get the error "Has no owning connection" on my character and then it doesnt call "Downed on Server" .
How could I fix this?
You'd only need to replicate the health variable, clients can just check the health and set is downed themselves
how would I get the out packet size of a NetSerialize?
I tried
size_t PriorSize = Ar.TotalSize();
Ar << HealthStruct;
size_t SentSize = Ar.TotalSize() - PriorSize;
but that doesn't work at all
i am serializing my health struct in a special way and It would be nice if I could just log the size for testing
I know insights kind of would help but I want to log it here
@opal pulsar Thats more of a general #cpp question, you might have better luck getting the answer you need there.
You can't get the true packet size from there, only the size of the archive
The bunches for an actor may be split into multiple packets and assembled as they are received.
packet size was the wrong term, I want to know how much data I am serializing and log it
Is it a good practice to add authority while logging to know if the log has been called from the server or client in the editor?
The print string already comes with identifier of the caller
Look at ukismetsystemlibrary::printstring if you need to know which machine does the logging.
There is also GetDebugStringForWorld() in case you want to append the same on your UE_LOG messages
Whether it is a good practice or not might depend on the context of the log or if you actually need it or not though
Thank you! Is there any way to get the previous value of an onrep variable from a simulated proxy? I'm using this but it doesn't seem to work for simulated proxies. // Signature to pass const reference UFUNCTION() void OnRep_ConstRef(const int32& LastHealthValue);
Should work but why is it a reference?
Well, I'm using it to replicate a FGameplayTag but when the actor becomes relevant and Onrep gets called, if the actor is a simulated proxy the result on my client is None.
UFUNCTION()
void OnRep_StateChanged(const FGameplayTag& OldStateTag);```
Actually, my issue isn't that it doesnt' replicate. My issue is it doesn't have a previous value when going in and out of the relevancy distance.
if both players are within relevancy range, variable replicates just fine but if I go out and back in again, it still replicates fine but there is no more previous value.l
That's normal behavior - unless it is a map loaded actor, there won't be any value but the default value when the actor spawns from replication
Map loaded actors are different since they don't get destroyed outside relevancy range
They just stop updating
How stupid is using online beacons to create a friends system, if it's possible? 🤔 I'm using EOS with connect interface, so I don't have EAS functions like crossplatform friends and presence. Would it be theoretically possible to just save friend id's to cloud file, then try to either connect that id's beacon as client or wait for it to connect local host beacon to achieve "Hey your friend is online" kind of a thing?
I'd use them for parties, probably not friends though..
that seems like more of a backend feature to me
It is, EOS subsystem provides that covering cross platforms as well, only if you use EAS and show extra login screen on the game startup. I'm trying to see if it's possible to find a workaround for not using EAS
Which apparently is possible, according to June, from Redpoint
They achieved cross platform friends on their subsystem plugin, with the connect interface, instead of EAS
@chrome bay you around?
you remember to to serialize array of ustruct inside netserialize?
{
FGameplayAbilityTargetData_SingleTargetHit::NetSerialize(Ar, Map, bOutSuccess);
//So it can be sent over the network
Ar << SelectedMana;
SafeNetSerializeTArray_Default<10>(Ar, SelectedGems);
Ar << ArtifactName;
return true;
}``` its complaining SelectedGames doesnt have or cant find the << operator
i tried FArchive& operator<<(FArchive& Ar, FArtifactForgeSlot& Slot) { Ar << Slot.AssociatedSpell; Ar << Slot.SelectedLevel; Ar << Slot.ManaCost; return Ar; } but its sayng its malformed
Maybe I should just have a nrtserislize function on it and be done
I think you need the non-slot version of <<
Though I don't know tbh..
yeah that would make sense actually, I don't think the net archives are slotted ones
whatever slotted archives even are 😄
idk Kaos if your struct has anything special but i dont remember having any issues with using NetSerialize on USTRUCTS
my primary use case was for atomicity
Hello! Has anyone had experience with network physics and physics prediction in games? I’m trying to figure out the Unreal Network Prediction Plugin, but there is very little information, and almost no templates. The task: synchronization of two cars in a racing game with high speeds
We used smooth sync before but it very depend on ping. Now try find another way to sync players
I just finished my own physics prediction system I posted here https://discord.com/channels/187217643009212416/1343789405340700814
As far as I know the Network Prediction Plugin is deprecated and isn't supported anymore
Unreal's built-in physics is not deterministic, meaning it will produce different results each time even if the initial conditions are the same
So you need to add a deterministic physics engine to Unreal to do proper physics prediction
I use Bullet Physics Engine in my project, it's deterministic and really easy to install and set up
You'd still have to make the prediction and rollback correction yourself, but take a look at the Rocket League GDC talk about networking, they explain it very well and it's straight forward to implement by yourself
Smooth Sync won't produce good results if you need fast speeds and constant acceleration, there is always gonna be some lag on what the clients see, and is ping dependent as you said
While I wouldn't suggest using it, I don't think it's deprecated 😅
I remember reading somewhere that the person in charge of developing it left, not sure if it's still under development
Guys, I'm being kinda slow. I have an actor that is owned by the server, I mean server spawns it. It replicates. On click event I want to call server RPC on it, but it doesn't work, I guess it's because it's not attached to particular connection. I wonder how can I make it work without getting logic, that is only related to that actor somewhere outside?
If you are a client and want to call a server RPC on an actor you have to be the owner of it
Check the Output Log and see if that's the issue, it should fire a warning
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_Tutorial_CorpseInACell_C_0. Function CheckAndAddItemsIfNeeded will not be processed.
yea this is exactly it
You can't use on click events on this instance since it will be called on the actor you're interacting with.
Instead you can make an interaction system, make the interact event a Server RPC
Damn it, I don't want to route everything through PC
So the interaction would run on the server, but you'd be calling from the player and you own the player
You can make the interaction system an actor component to keep it tidy
Put it in your player controller or the player actor, since you own them it would work with RPCs
it's kinda boiler plate to solve this every time you need it like this. Could be solved more elegant I guess. Like picking connection of current local player automatically..
I wonder why not
I have a scene with hundreds of moving balls. They need overlap events in some contexts, but most of the time they dont need them. Whats a good way to toggle them that is cheaper than leaving them on overlap all the time?
I already have this system in place, but it's kinda annoying to add this code that doesn't add any value over and over again implementing those interfaces
You can use the same interaction system and the interface for all kinds of interactions, you need to do it only once?
Well, yea. Okay. Who said it will be easy, right? 🙂 I just don't understand why it can't use current player connection to get thing done with this particular actor, even if it's not owned by current connection
It could have been handled automatically, right?
I guess it's pretty common use case and everybody does this same interaction system to do it 🙂
Because it would cause conflicts, when you restrict a client to own an actor to call a server RPC you're making sure only that client call that event on the server
Otherwise all clients could call the same server rpcs and would likely cause some race condition issues
How it's different if everybody will do the same through their PCs?
It's not very rare when all players can interact with some object that server owns
Because then it's the server that's in charge of handling interactions on that actor, the server decides which to execute first
It eliminates ambiguity due to latency, that gets handled beforehand in the PC that you own, that only your client can call RPCs on
There are probably more in depth reasons I don't know of
It's to optimize and keep networking stable
It's also better because the client simply tells the server what it wants to do, and the server handles and executes it. Instead of client directly dictating which gameplay logic to execute on the server
It would make it easy to cheat otherwise
I found something on forums related to that reason 🙂
it wasn't that bad after all, looks clean, at least here 🙂
After trying for a solid week to see if chatgpt would be able to help me learn shit, I've found it's completely useless.
What's a good example project that I can buy from the UE5 store to study?
Hi I have a question about networked Character Movement and Pawn Movement. Which is better for network lagging? I m currently using "characters" for Aimove based creatures but it should be changes to pawn, are they better for network health? Listen server based by the way.
NPP has wacky issues with being framerate dependent in fixed tick, which is required for physics, at least with Mover, when I tested it.
I'm trying to generate some sort of unique ID for all (or maybe just some) gameplay effects, and map it to effect classes, at compile time (before the game starts, or PIE, or whatever), and have it be accessible across all characters. This is because I'm using a proxy struct to replicate the ability system component's state without replicating the full ASC to remote clients.
Any suggestions?
I will be eternally grateful for any help
look at the free ones Epic released
what do you need to learn about?
i've been testing removing instances of a building (basically a simpel "destruction") and i notice that when a player is to join later or be far away from a destruction, the repnotify will fire but it wont remove the instance, but the server still has removed it but the client doesn't actually get it. is this an hism thing ? or perhaps could it be something else ?
Anybody ever had an issue with Channel Name serialization?
Setup is 2 packaged clients, one is a listen server. And they start receiving what seems like corrupted packet after a while.
Client gets kicked because of the following error. Every time, this error is the same, with control channel receiving a matrix
[2025.02.26-21.08.23:993][ 84]LogNet: Error: Existing channel at index 0 with type "Control" differs from the incoming bunch's expected channel type, "Matrix".
[2025.02.26-21.08.23:993][ 84]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 76561199817674649:7777, Name: SteamNetConnection_2147473130, Driver: GameNetDriver SteamNetDriver_2147478850, IsServer: YES, PC: BP_PlayerController_Gameplay_C_2147472908, Owner: BP_PlayerController_Gameplay_C_2147472908, UniqueId: STEAM:XXXXXX [0x11000016EB5CF99], Channels: 200, Time: 2025.02.26-21.08.23
[2025.02.26-21.08.23:993][ 84]LogNet: UNetConnection::SendCloseReason:
[2025.02.26-21.08.23:993][ 84]LogNet: - Result=BunchWrongChannelType, ErrorContext="BunchWrongChannelType"
The main error is I see that seems to happen earlier in every log
[2025.02.26-21.07.51:492][663]LogCore: Error: String is too large (Size: 925311904, Max: 16777216, String: )
[2025.02.26-21.07.51:492][663]LogNet: Warning: Channel name serialization failed.
It seems to happen randomly, and it happens pretty quickly on I'd say 1/3 of our internal team.
Any tips on how to approach debugging this? Is there a way to mark packets reliably so I could track packets from clients to server?
Smooth sync is also client-authoritative on pawns. So not a fantastic approach
@north jacinth just trying to figure out RPC's and how to get the client to communicate their variables. Starting out with just sharing the username for a lobby. Both players enter their own names and when connected, both players can see each others names.
tbh I know nothing about OSS/lobbies, but I do know a bit about RPCs (been learning about them myself recently)
basically, server RPC runs on server, client RPC runs on owning client (client that "owns" the object that function is a member of), netmulticast runs on everything. Based on my limited understanding you'd want some multicast rpc to share the username, or a server rpc that validates it and then calls multicast if it is valid. Or you could have the username be a replicated property on an actor or something
This means bIgnoreClientMovementErrorChecksAndCorrection can be switched on/off at runtime to omit server corrections?
You can do this by calling a Server RPC (Run on Server) to pass the username from the client player controller when it joins the game.
The client has access to the username, the server doesn't, so you pass it to the server with the Server RPC, then the server can broadcast this username with a Multicast (or a replicated variable, ideally in a Player State)
It can only be changed during Runtime, its marked Transient meaning its state will never be serialized.
Its crazy how difficult this has been for me to understand and implement.
Ok thanks
Either multiplayer is way too complicated and/or I'm just an idiot
Multiplayer will be 1 of my 13 reasons why.
Multiplayer is one of the hardest things to learn in gamedev, it takes a lot of time.
do hism's have an issue when it comes to removing isntances ? i am removing them on a repnotify but it seems to not update the hism when you're far away. it will fire the repnotify but the instance remains on the client, and you could walk through it despite beinga ble to see it
Sounds more like a relevancy problem to me
Check the ''always relevant'' checkbox in your hism actor to verify if it is a relevancy problem
You can but if you turn it off and turn it back on, if there are correction to be made then the actor will snap to the corrected position
Have you tried the pinned material? Read that 14 times, practice and repeat.
RPC is arguably one the easier side when it comes to multiplayer.
I think this is the case but the event doing the removing is a rep notify so I had assumed when you come back into relevancy to the player would receive that updated version of the building with whatever instance(s) were removed
The repnotify actually does fire on the server but the instance doesn’t get removed on the client. That’s the thing that confuses me. It’s like it doesn’t replicate the removal back to clients but only if the client was far enough west from the initial event. Or joins later
Is the actor set to replicate?
Yes lol
It’s a building bp made up of HISMs
The RepNotify should still get called on the client when they're in range again, try checking if it's getting called at all
Maybe it doesn't get called on the client at all
I know it gets called cause I’ll see the VFX that is there as well. But the removal of that instance just doesn’t happen. I’m actually thinking through it rn and I have a thoguht that might be the issue.
I think it’s because the server has the instances and when the client goes to remove that instance on the client it’s getting the server indexes and that index is actually gone so the client doesn’t have it removed because the server already removes it and when it gets to the clien there is nothing left to remove but the client never actually removes it
Idk if that’s why but it would make sense kinda
The components? No. And I don’t think they should be or need to be
yeah they shouldn't
But doesn't the client have its own copy of the indexes? Removing an instance in the server shouldn't be affecting the client's list of instance indexes
Since the client wouldn't have it removed yet
How are you handling the removal?
Yea you’re right on that. It genuinely feels like a bug. And keep in mind everything works fine until the player is super far away from the event and then comes back to that spot
I repnotify the impact location and do the logic there
wait, so each removal changes the same variable?
Ah
Yes
So more than one would result in it not destroying
Other parts
Yea?
Then the player will only get the last removal not the all of the removed indexes (when they join late or become relevant again)
yes
Makes perfect sense. Going to need to test that specifically to ensure that is the issue but that would make sense
Curious just how I would be able to ensure that all the destruction gets repnotify’d then. Cause would def not want to have to store all of the destruction in an array or somethingg that would seem a bit extreme.
I’ll have to think through that when I text it
Test*
An integer array wouldn't be that of a problem, just replicate the indexes that's it
Yea legit was just typing something along those lines. I like it
Basically just add each destroyed index
yeah
no worries
so I'm sort of confused on how abilities are or aren't replicated on mixed mode
abilities?
with GAS
https://discord.com/channels/187217643009212416/307697678278590465
Probably want to ask here too
Did not see the channel, thanks
any idea why the velocity is not being applied to the movement component? It prints out correct value but it has no effect. I commented out velocity += acceleration * dt to check if there will be effect and there was.
want to apply additional push forces from world and CalcVelocity override seems to be good place to do it, maybe not in acceleration segmenet but I was checking things
ok it works, I was applying force onto Z only and it propably was overriden by gravity calculations
soo, I assume I should add it to all physwalking, physfalling etc
ok I put this into UpdateCharacterStateBeforeMovement, seems working
Not sure what you are doing, but if you modify acceleration and velocity, wouldn't it make more sense to do that in the CalcVelocity function?
Also, your for loop is copying each element of the CurrentTriggerPushProps array.
I know, I must fix it
ty anyway
but
as I said CalcVelocity is called before gravity calculations
so applying force to Z axis is not working
Hm hm
and as I mentioned I think I should put it into PhysWalking, Falling funcs
You probably have to do this in the Falling Velocity Calc too then?
I think yes
Yeah I know, just trying to be careful, cause CMC is very specific about what stuff hapepns where.
If it works in UpdateBeforeMovement, then that's fine i guess.
Yeah those things are maintained via Overlaps?
Yeah then you wouldn't even need to add that to the CMC tbh
That's the neat thing about Overlaps.
Client and Server will step into it at the same "timeframe", so the prediction is basically coming "for free".
But since you have multiple of those that can affect the player at the same time, it's of course totally fine to have it in the CMC.
Only wrote this to make clear why you shouldn't expect Corrections anyway.
yes I took into account situation where will be applied more forces than one
Yeah I set this up the same way for Bang on Balls
They also add Water and Wind volumes that affecte the player.
yeah, thats the thing I learned about CMC movement
But no idea anymore where I placed it
swimming I have handled in PhysSwimming func, there is no need for custom ones
and
why volumes?
those are brushes
or you mean by that just box components
I just meant some Actor with a BoxComponent that adds its info to the CMC's array on overlap.
Hello everyone, i've been learning UE & CPP for about 7 months and finally started working on my own project. I'd previously learnt how to do Matchmaking with Steam, but for my Project i want to use Dedicated Servers.
I have the Dedicated Server Building and Launching correctly with the 480 App ID.
However i cant seem to join from a client, im getting a timeout message. Here is where i am so far:
- Dedicated Server running on a Server elsewhere on the network.
- Ports Forwarded Correctly Etc.
- Cannot join from a client either using local IP or WAN IP.
Im really struggling to find current information about what i need to do be doing in terms of Game Instances and Game Sessions.
I setup a BP Game Instance and set it to Create and Start a Session, however this fails because there is no Player Controller on a Dedicated Server. I read some information which was more recent that says this is redundant as the server now does this itself on boot up.
I read some more info on needing to Register the Server when it loads, RegisterServer() is in the Source Files in GameSession.cpp but its currently empty.
Do i need to override this in my project? If so what do i need in there?
Any help on just the general logistics about all of this (Steam Dedicated Servers) and specifics on getting it appearing in the Server List etc would be great.
I would use a game mode class, not game instance
But eventually i will want the Server to change maps at the match end etc, so i thought Game Instacne would handle that and be future proofed for when i want to implement it
Only thing comes to my mind is if the firewall is blocking the connection
Changing maps is the Game Mode's job
Ok thanks, this is kind of what im struggling with a bit, understanding the hierachy
Do you know anything about Registering the Server?
Servers don't create sessions automatically
You need to create the session for the Dedicated Server. You can do that in the RegisterServer function you mentioned if you want to. Otherwise you can do it in e.g. the current GameMode if no session already exists
GameSession class is handled by the GameMode anyway, so the lifetime should be the same as whatever you would do with RegisterServer override
Sessions have nothing to do with the direct IP connection though.
@thin stratusthanks for taking the time to try and help i appreciate it. Basically i have some existing code from a Stephen Ulibarry course i did which handled SteamOSS Match Making. I was trying to integrate into this the RegisterServer() Function, however the main difference is that in the course the session functionality was built into a Child class of GameInstanceSubsystem, which i think is still ok to do here
I think im most of the way there but currently i have some issues with it not resolving external references to steam_gameserver.h
void UMultiplayerSessionsSubsystem::RegisterServer()
{
if (!IsRunningDedicatedServer()) // Prevents clients from registering
{
UE_LOG(LogTemp, Warning, TEXT("Not a dedicated server, skipping RegisterServer()"));
return;
}
if (!SteamGameServer())
{
UE_LOG(LogTemp, Warning, TEXT("SteamGameServer() is not initialized!"));
return;
}
// Set Steam Game Server Properties
SteamGameServer()->SetProduct("spacewar");
SteamGameServer()->SetGameDescription("Spacewar");
//SteamGameServer()->SetModDir("yourmod");
SteamGameServer()->SetDedicatedServer(true);
// Log the server into Steam anonymously
SteamGameServer()->LogOnAnonymous();
// Set the game type and map name
SteamGameServer()->SetMaxPlayerCount(16); // Max players
SteamGameServer()->SetServerName("TUE Game Server");
SteamGameServer()->SetMapName("YourMap");
UE_LOG(LogTemp, Log, TEXT("Steam Dedicated Server Registered Successfully!"));
}
Then in GameInstance:
void UTGameInstance::Init()
{
Super::Init();
UMultiplayerSessionsSubsystem* SessionSubsystem = UGameInstance::GetSubsystem<UMultiplayerSessionsSubsystem>();
if (SessionSubsystem)
{
SessionSubsystem->RegisterServer();
}
}
Hey everyone, I created a new project and using default pawn. I set number of players to 2 and as listen server. In client screen server is moving but in server screen client is not moving . I have also checked all the replicates checkboxes but still it's not. Default Pawn does not replicates as the Default character does ?
All the code for networked movement lives in Character Movement Component.
if you are using pawn you will have to handle the replication your self.
not worth the stress even if you can do it.
Ok, so does that mean even for default pawn I have to write networked movement code right ?
Actually, I need a spectator pawn. So for that, should I use character also ?
use character for your player character and AI
I never touched spectator pawn at all, but if the idea is just flying ball but it needs to be visible to other player.
Then replicating the position and rotation is easy enough. Im just gonna assumed collision will be turned off so that's not much work at all.
but if you don't need spectator pawn to see each other, then there's no need to replicate it?
Pretty sure the Server code is not needed.
At least for most of the settings you are setting.
UE already does that for you.
OnlineSessionAsyncServerSteam.cpp Line 399
I have one button in only Host player screen, I want if host player presses that button then all the client players specator pawn should move to the host player location.
As long as your CreateSession call does pass in false for bUseLAN and bUseLobbiesIfAvailable, it should run the code I linked.
At the end it should call UpdatePublishedSettings
Which will then set the MaxPlayerCount etc.
There is really no reason to manually Register the Server via SteamAPI. You "just" need to use the Session Interface and ensure Steam Subsystem is enabled.
Can the players see each other spectators pawn?
Not the mesh
Then you can just make server tell every single spec pawn to move to w.e location you like.
You can achieve this by getting the ref to all the spec pawn and do a client rpc, teleport
Passing the location as the parameter
I already did that but clients are not being moved to host location after he presses the button
Well I can't see your code or what you did.
Gtg to bed, hopefully you can debug it or someone else come along.
At the end of the day you just need the client to run a function when the host click the button. Nothing fancy.
Holy cow im really over thinking this thanks for your help
ill try get that implmented and see how it goes
am i wrong to see event begin play as a sort of "repnotify" when it comes to a player losing and regaining an actor's* relevancy ?
quick update, so i've discovred a solution that works by making small struct to keep track of the destroyed hisms and the indexes that have been destoryed. it seems like a bit much but im not sure , cause it works perfectly now, just not sure how deadly it would become having a struct array that is going to get filled up, and it would be doing that loop on each one, but ultimatley should ignore the function after the first time casue it would probalby not be valid the second time , unless it was updated then yea should be good, but still not sure if i should remove those instances from that struct like immeditatley for the clients or if keeping it like that for now wouldn't give much issue.
the rep notify is called where i wouldnormally just remove the instance but instead i just add unique to the array if it hits and destorys said hism
ok maybe this doesn't work like i htought, it irnoicaly is doing the opposite now, where it's removing them correclty and updating for clients, but now it's not removing the mesh on the server
really am quite baffled, it really seems i can't get one or the other to work in tandem. and i notice when i make arrays repnotify, they simply don't seem to fire on the server at all? it really makes no sense to me
final update for now: i just set the buildings to "always relavant" and that works , but not an ideal solution , not even sure if there is one tho
I tried this and even reverted back to using the UGameSession to call it but it error'd out line 473 of that same file:
ISteamGameServer* SteamGameServerPtr = SteamGameServer();
check(SteamGameServerPtr);
Looking grate, nice plugin but you use character... in our project we use pawn with custom movement logic and physics based movement. Soo we need some sort of network physics prediction. By far our realization not work at all... or npp not work as we expected
Do you have the Steam stuff properly set up for your Server?
Does the log say that it properly inits steam?
Give me a second and ill attach log and show what engine config i did
DefaultEngine.ini:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
.uproject
{
"FileVersion": 3,
"EngineAssociation": "{0D3D9D3F-4786-2D6D-678A-908E2F4FE673}",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "TUE",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine",
"UMG"
]
}
],
"Plugins": [
{
"Name": "ModelingToolsEditorMode",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "ElectronicNodes",
"Enabled": true,
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/5cb2a394d0c04e73891762be4cbd7216"
},
{
"Name": "OnlineSubsystemSteam",
"Enabled": true
},
{
"Name": "AdvancedSessions",
"Enabled": true
},
{
"Name": "AdvancedSteamSessions",
"Enabled": true
}
]
}
Build.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class TUE : ModuleRules
{
public TUE(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "Slate", "SlateCore", "OnlineSubsystem", "OnlineSubsystemUtils" });
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "AdvancedSessions", "AdvancedSteamSessions"});
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
}
}
Server.Target.cs:
using UnrealBuildTool;
using System.Collections.Generic;
public class TUEServerTarget : TargetRules
{
public TUEServerTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V5;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_4;
ExtraModuleNames.Add("TUE");
GlobalDefinitions.Add("UE_PROJECT_STEAMPRODUCTNAME=\"480\"");
GlobalDefinitions.Add("UE_PROJECT_STEAMGAMEDIR=\"spacewar\"");
GlobalDefinitions.Add("UE_PROJECT_STEAMGAMEDESC=\"Spacewar\"");
GlobalDefinitions.Add("UE_PROJECT_STEAMSHIPPINGID=\"480\"");
}
}
As far as i could tell that SHOULD be it covered? :\
and as you say just pretty much launch the dedi and connect
Launch args are: MapName -log
I did also try forcing -steam -port=7777 etc
Hi guys whenever I run my game in editor with 2 players as either a listen server or client I get these errors: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetLocalPlayerSubSystemFromPlayerController_ReturnValue". Node: AddMappingContext Graph: EventGraph Function: Execute Ubergraph BP First Person Character Blueprint: BP_FirstPersonCharacter
I use the prediction for the ships, not the characters. Ships are physics simulated
For physics prediction you need deterministic physics, Bullet plugin achieves that.
You'd still need to make the Prediction & Rollback Correction logic yourself
I know that for engine Internal replication, Owner is traced all the way up the chain.
But is it the same for == comparison?
If Actor1 owns Actor2, and Actor2 owns Actor3,
Will Actor3->GetOwner == Actor1 be true?
And if not what alternatives are there for this comparison?
it doesn't appear to be doing any internal checks for that
it simply returns an actor reference pointing to the immediate owner
So it would probably return false
I think the only way is to just loop through the chain of owners to see if your query actor ever appears
Shame, Thanks!
@hexed path Owner just holds a pointer to Actor2. It will just fail the == check for Actor1 cause it's. well, not Actor1.
The == operator can't be magically overloaded or overridden for just the Owner variable. It is type based.
Unless, of course, Owner would be a custom type :P, which it isn't.
Hi does anyone have any info on setting up client side prediction for inputs in chaos vehicles?
I'm having an issue where when an event that is called that destroys an actor crashes my editor. If the event is either multicast or executed on the server, then the Player 1 (aka the server) causes the event, the editor crashes. The editor however does not crash if both players are a client
Show us the event that crashes the editor
Is the player controller still the most reliable way to track a player on the server? Even after a disconnect? Looking at the implementation of AGameMode::Logout() they even check the validity of the PlayerController pointer.
Dealing with a team that has not really built their game systems around APlayerController or pawns, making things that much harder.
Is it possible to replicate simulated physics for skeletal mesh? like replicate ragdolled character position?
PlayerState is generally the best way to track a specific player, including after disconnect as PlayerStates can be made inactive when there is a disconnect and you can reassociate a playercontroller to that playerstate and make it active again.
I don't think we have a reason to make the PlayerState active again. What I'm worried about here is PlayerState being destroyed, and not being able to associate it with a player inside of our game simulation. APlayerController seems like it's more persistent, but I'm not sure about guarentees during calls to function like AGameMode::Logout().
If I had my choice of things, the game would have been built around APlayerController and APlayerState.. but it simply wasn't
Player Controller gets destroyed on logout, but you can make the PlayerState persist
These are the relevant functions that cause the PlayerState to go away.
void AController::Destroyed()
{
if (GetLocalRole() == ROLE_Authority && PlayerState != NULL)
{
// if we are a player, log out
AGameModeBase* const GameMode = GetWorld()->GetAuthGameMode();
if (GameMode)
{
GameMode->Logout(this);
}
CleanupPlayerState();
}
UnPossess();
GetWorld()->RemoveController( this );
Super::Destroyed();
}
void APlayerController::CleanupPlayerState()
{
if (PlayerState)
{
// By default this destroys it, but games can override
PlayerState->OnDeactivated();
}
SetPlayerState(NULL);
}
Default PlayerState implementation:
void APlayerState::OnDeactivated()
{
// By default we duplicate the inactive player state and destroy the old one
Destroy();
}
So you need to modify both player controller and playerstate to make playerstate persist?
Well I guess looking at this code you can just modify playerstate. Wondering if that's a good idea 🤔
What happens when a player disconnects and then rejoins later? If there's 2 player states now with the same uniquenetid it definitely could lead to problems. Looks like there would be much more work involved fixing other things.
https://wizardcell.com/unreal/persistent-data/#3-playerstate
This might help a bit.
Ok this is actually useful info I was looking for
Ah we are using AGameModeBase and not AGameMode though 🤔
too scary of a change to make at this point
GameMode inherits from GameModeBase
It just adds more functionality
Yes but this article mentions functionality that is only in GameMode that is not in GameModeBase, which could have unintended consequences if we switch now.
It really shouldn't matter..... Yes, there is extended things in AGameMode, but likely nothing in this document would have anything to do with those extended AGameMode functions and properties. They likely used AGameMode just for examples. Everything should work just fine on AGameModeBase game modes.
you could just copy those functions
Hey, here's what I did, On button click I called a normal event to Start Teleport, then It called server RPC and then it called Multicast RPC and in that teleportation logic and it working fine now. Thank you very much for your time 🤝 .
Just to be on the safe side I won't be doing this 2 weeks out from shipping Cert
realistically can a dedicated server get more perf with > 1 core?
GameModeBase is not meant for multiplayer btw.
It was originally one and the same class, and they created the Base version for games that needed less, such as Singleplayer games.
Sure, if you're game thread bound. Usually servers are bottlenecked by things that aren't threadable, such as replication time
Good information to know
For simulated proxies, to replicate the "trail effect" of hit-scan shots (in the specific case of shotguns, which shoot multiple bullets at once but have a predictable scatter), should i:
- a) multicast an array of position vectors for the end points of the traces
- b) multicast the aim transform (world space of the client crosshair that was passed to the server) and compute the traces on the proxies themselves
- c) something else?
Always compute on clients whenever you can get away with it
Preferably the server shouldn't have to multicast on every shot either
Unless your game really requires it
It would butcher the network pretty fast if you multicasted each shot of an smg or a minigun etc
What I like to do is to just replicate inputs, multicast only when the player starts and stops shooting
All kinds of trail effects, sounds, impact effects etc can just be computed on the client
The server would have the final say by lowering the enemy health if hit, which would already be replicated by its own means
Unreliable Multicast would be fine probably, but presumably you already have a method to get sounds and muzzle flashes to those clients, so you will likely want to do it in tandem with that.
It'd be very noticable if a few of those multicasts get dropped though
I'm using your burst counter method to replicate the shots, which would work fine for projectile weapons, but needs extra informations for hitscan.
So i guess i either i multicast the aim location, and use control rotation as aim rotation, or i replicate the aim location that is sent to server
The problem you have is by the time the multicast reaches the client, everything you shot at will have moved anyway, so it'll never be perfectly accurate to what happened on the server unless you send specific start/end locations - but whether you really need to care about that, I don't know.
It's also the same downside as trying to reproduce the effect on the client, you won't be able to do it with perfect accuracy.
Yeah i know, but i feel like it would be confusing to see someone shoot at you and missing everything bullet by a meter, and still taking damage
It is yeah
speaking from experience 🥲
There's not really much you can do about it though in practice. You're ahead of the server locally, everything else is behind. You might try to "adjust" things on the local client to make it look more convincing that the other player actually hit you but there can be plenty of false positives.
The easy option is not showing bullet trails 😄
I feel that by just replicating the start location of the trace, it would not look right unless i replicate it atomically with the burst counter struct.
But then still for high rpm weapons idk what to do... maybe i can catch up with the shots fired interpolating the start location from the old one
Yeah makes sense, as soon as you lag a bit, all trails would still be off
Thing is, you've then got the problem of trails not originating from the gun barrel
Which looks equally as jarring
Oh no, the start location would just be to calculate the trace end, then the trace would go from barrel to end points
Right yeah, in that case just the aim transform and the "seed" that was used to spawn all the shots might be enough
and perhaps, you don't use the burst in that case, and use unreliable multicast instead
Unreliable Multicast goes down the same path as property replication so they might get dropped occasionally, but only if you're already saturated, which in most cases you shouldn't be
Ok so multicast it is, thanks!
It's also basically exacrly what gameplay cues do, and you'd be amazed how much crap you can pipe through that nowadays
imo it's always "what could make this look weird"
I'm once again gonna dive into gas code... at this rate my project is gonna become a "we have gas at home" lol
I feel like GAS cues can exist outside of the asc to an extent
but It's really just
- turn vfx into one atomic asset
- it has tags
- it has rules that describe if it shows up and how it looks
you might not really need this much extra stuff going on
but turning it into distinct asset is really just plain nice from an organization standpoint for most things
They can. At work we've separated cues and prediction from GAS with no real difficulty
I just hate cues, but apparently I'm alone on that hill
Epic just has no interest in making GAS less of a monlith sadly
I think people tend to make two broad kinds of cue assets
- play a niagara system
- change 200 different material parameters, make them tied to a timeline and spawn 20 different other vfx things from the cue bp graph with
and I think cues are fine for both but I wish the second one was less spaghetti in practice
I have had to make a lot of stuff to help with the latter that doesn't come with the engine (unless I missed it... I never know)
and yeah I am a bit of a GAS hater but for the ways it forces design... when it fits it really is nice
I think their plans of breaking it up a bit sound perfect (if they ever do)
yeah.. big if 😄
Is there anyway to smooth clients animations from the host's point of view?
what does animations mean here
you also haven't really described why they are jittering in the first place
or if that's even what is happening
hello guys, quick question is there's really any difference between packaging the dedicated server through visual studio vs doing it through unreal engine itself? knowing that in both cases it's a source built engine. I tried both and they both work the same
well one difference i know of off the top of my head is when you build through VS it doesn't cook content (at least i dont think it does)
Yeah, all you're doing is build there, you're not packaging it
so do I need to Build every time before I package or do I build once then package without touching VS?
if you package through the editor, it will build it before packaging it
no need to build through VS if you dont want to
cool then why almost every guide tells me to build through VS? 🤔
oh.. maybe dedicated servers need to be built at least once in VS to show up on the package list in the editor.. not 100% sure on that
ah maybe that's what I thought as well
Nah, I hate them too.
Hello
Is there a better channel to ask questions about Local Multiplayer?
I have a card game, that already has fully coded Singleplayer, and Online Multiplayer modes. Trying to add Local Multiplayer to it.
Since it's a Turn-Based Card game, split-screen is very much Not appropriate for it. So I disabled it in project settings.
How I want it to work:
Whenever it's player's turn, the camera of that player's pawn is used. When the turn changes, the camera of the other player's pawn is used.
Currently when changing the turn I do this:
- Get the player controller who's turn it is Not. Disable input, set tick enabled to false, get pawn, deactivate camera and spring arm.
- Get the player controller who's turn it Is, do the opposite. Enable input, set tick enabled to true, get pawn, activate camera and spring arm.
As far as I can tell, everything above works, but the problem is, the viewport stays at the deactivated camera.
How can I transition to the other pawn's camera, essentially transition to controlling the other player controller?
I really want to avoid using a Single camera, or single player controller setup, since the LOT of logic coded relies on having 2 of each.
Hi ,
If I want to create a sharding , Zoning or Meshing
From where should I start ?
Thanks In Advance
Unreal out of the box only supports 1 world running at a time, so this generally means you need to spin up a separate server instance for each zone or location you want to have exist independently. This would need to be handled by something external to Unreal that would spin up instances for you as needed. Your instances would communicate back to some kind of manager system when they're coming up or going offline/becoming available for reuse. This can also mean having to create some additional higher layer server that can facilitate communication between multiple servers for you if they need to know about one another or have things like cross-server chat. This method requires hard travels to each server, so there is always going to be a loading screen whenever you move to a new area. GameLift is an example service from AWS that can be used to spin up additional servers for you based on loads and the like. There are plenty of other BaaS (backend as a service) out there with varying features and capabilities that can help facilitate creating a mesh/zone/shard based server system for your games.
An alternative approach is building networked multi-world support into Unreal, but that is likely a huge undertaking and would likely require many major engine edits to accomplish. If you did so, you could technically have one physical server running many zones, and the Unreal server itself managing anything it controls, but I imagine this can only scale so far as well since you'd likely be limited to the resources available on that one particular server. A third approach is ditching Unreal's networking system altogether and again relying on some other means of communicating gamestate to your clients so they can represent the world. You'd effectively have to rewrite the networking system entirely to facilitate either of these options, but would allow you to have seamless travel between different zones (no loading screens).
Yes sorry, you are right. It seems to hitter while playing montages and movement animations in general.
Top listen server, bottom two clients
Thank you for this clarification ..
I have ability to create Server management to control servers launching and terminating ..
And Websocket to keep player info in sync .
But the question i couldnt find an answe yet ..
How can I merge all instances under Master server if i have server meshing ?
Like players can see each other while they are in different instances
I solved the camera issue by using SetViewTargetWithBlend.
But the problem is, the controller is still the same. Is there a way to switch between Player Controllers? Something alike of Possessing, but Possessing a Player Controller, not a pawn.
Because Interactions rely on owning player controllers. For example a player can interact with a card, if that card is owned by their player controller.
That's not answerable within the context of Unreal Engine. How you do that depends entirely on what you're using to facilitate network communication. The end result is if you need to have something shown to other players that exists on some other server, then you need to communicate that to the clients that need to know about it. So if you're using a websocket, you'd likely need to keep track of coordinates and where players are in relation to borders so you can determine what a player should be able to see, get any relevant actors and send their data through the websocket so the client can reconstruct it and see it.
Ok I will try to do my best xD and see what i will acheive ..
Many thanks for informations
@odd iron Just to add on to this - UE6 is likely to support this stuff. As they are actively working on it right now and it is a part of their vision for the metaverse (🤮)
Nice but when the planned release after how many years xD ?
Who knows
Since I need to make something like this in near future ( 3 months) xD
Definitely not that soon
Yea
I don't fully grok this section of the Editor Preferences. What does it mean for only the Server, Client or Both to be an Emulation Target? Does that mean emulation will only be applied to that particular part of the network, and the other game instances will operate normally?
Also, when the menu says min/max latency on incoming or outgoing traffic, is that simply the editor adding a delay to those packets, making them potentially skip a tick or more before they're sent out?
It sets which side of the communication to apply the latency to
If you set it to client only, then the latency will only apply to client-to-server comms
Set it to both for realistic emulation
And yes it's just an artificial delay, and packet loss percentage will simply drop the packets at random
There’s only one game thread right? Or do I have some wrong assumptions
Are there any good resources for understanding how movement is replicated by default?
The source code is going to be the best resource.
Yes, one game thread
There is one audio thread, one render thread
Maybe others that i forgot
The rest is miscs and called worker threads
I'm finding that if I uncheck "run in one process", everything goes to hell for the client (lots of desync) -- I'm not finding this when running in one process or when we do actual playtests and are connecting on separate machines. Is that.... normal?
(listen server, 2 clients)
anyone know of a session based game that has crash recovery/actor persistence?
I suspect there aren’t many if at all, not worth the effort
I have an actor in my level, how do I get Begin Play to call on the client? I just want to do some UI stuff
it already does
begin play is called independently for server and all clients
Begin play calls on everyone.
You sound like you think the game is running under one instance, it is not.
Everyone is running their own application, when the game starts for you, the begin play of your actor will be called.
So a listen server host, it would have call begin play for him self.
When a client join 20 seconds later, the client will call begin play on it's machine.
Nothing is networked / communicated unless with RPC.
you can create your widget on your HUD begin play.
Should you want to use character for what ever reason, make sure that only the character that you OWNS run the widget. Otherwise when you receive a copy of other player's character in your world, their begin play will be called and you will end up with duplicate widgets.
So what you can do if you want to use the player character is as follows.
BeginPlay-> IsLocallyControlled -> CreateWidget
need context
some entities not copied to client (replicated)
e.g. game mode
game instance
yada2
Read the pinned material if you haven't
It's just an actor I dragged into the level
Listen Server
with how many players?
Just one
then there's no client wouldn't it?
you are playing as the host (which is the server)
set the number of players to 2
True but I'm using Wait Gameplay Event and it doesn't call
then you will have 1 server and 1 client
well that's got nothing to do with begin play?
or even multiplayer so to speak
All codes run locally to each machine. Only things communicated is through RPC
Has anybody here ever tried shipping a dedicated-server-less game where instead of it running the host player as a listen-server, the same machine that the game starts on runs 1. a dedicated server 2. a client connecting to the dedicated server right away locally ont he same host (think along the lines of what the editor does in Client mode) ?
The player launching the game that way wouldn't really need to know anything about this internal implementation, that they're not a listen-server, but from a developer's perspective it would standardize the logic for every player in the game, treating them all like clients, instead of most players being clients and one of them being special, having direct access to the authoritative game state.
I need some opinions. I'm thinking about creating an energy system that refills over time. I want it to be server authoritative to prevent cheating but I'm worried that it might have to send too many float values over the network in a short period of time. I WAS thinking about interpolation however I don't know if that's the right answer still. My game is going to be a rather large MMO type setting with maybe 50 to 100 connections at a time. Do you think sending a float values over the network every couple of ms is a good idea or should I explore other alternatives.
I like to simplify the thinking of it as a constantly changing value
every couple of ms would mean you are sending updates at 500hz
I feel like you mean something a bit less
assuming a couple means two of course
Well I was thinking of trying to get away with as much refreshes as I can without introducing lag or other issues
I think the default is 60 updates per second but so doubt I even need 30
But it is an important value
a few things
- you might not need an entire 32 bit float... if the maximum range of values isn't huge you can probably send something smaller or just netquantize it a bit down to not have as much accuracy
- if this has to smoothly go up and down perfectly replication will simply not do that on its own. Property replication is effectively random in the timings of when things arrive for distinct objects and you will either have to smooth it or simulate some of the changes to its visuals/value locally
- unreal networking scales a bit poorly CPU-wise as the server handles things per-connection and you will likely have to take advange of things like RepGraph (old networking) or Iris filters (new experimental stuff that you should not use if you are not willing to fix engine bugs) (I would bench first to see what happens though)
for example: for players near by to your connection's viewpoint you probably care more about their energy values as opposed to players on the other side of the map
Yeah I considered using an integer for it. This value is going to have allot of algorithms mutating it so predictability is a slight issue for me. I was thinking about some sort of last value pass "which would be one or 2 refreshes behind" and lepring the 2 values for a smooth change.
I was worried about sending too many refreshes at once over the network but maybe this isn't something I should even be concerned with. The value would only be relevant to the owning client and server so I won't be repnotifying it.
have you ever done a bandwidth profile?
also you should probably not leave out that this is just for the owner :U
No it would be my first time. I'll definitely study that
Well mega you might be right. I might actually need to replicate this value to other clients MAYBE
I considered using visual cues instead of passing the actual data which would be a different function
yeah that will work nice. I am encrypting network traffic and I might be able to see how long it takes for the traffic to be decrypted with this
yeah I know 😆
but would that be replicated out of the box or do I need some custom logic
Multiplayer physics like that is going to be extremely janky unless you spend thousands of hours redesigning how it works correctly. Well, from what I gather.
(plus I may be exaggerating)
Hello there !
I'd really like to allow my players to smoothly move their friends with their trolley.
Here are 3 videos demonstrating the issue :
In the first one, you can see the other player seems perfectly smooth moving on its own. (video fps is lower than actual fps, so trust my words : it is smooth)
in the second and third videos, when bumping on top of the red part (the only one with collisions - moved away for testing purposes). The whole environment gets shaky for the player being carried.
The game is using Listen Server.
The movement is client-authoritative.
The trolley is replicated but not its movement.
The trolley is **attached **to the carrier on both server and clients.
Yop that's interpretation of clients on listenserver
Although in theory this should be fine
Counts as based movement
Do you have the same issue the other way round?
Hi eXi ! Thanks for helping out ! 😁
Yes, exactly the same issue when the server is the one driving ^^'
Is the trolley attached to the capsule or the mesh?
not exactly. It' is attached to a SceneComponent attached to the character.
But I have the same results if I attach the actor directly.
Point is that you might want to attach to the mesh
At least trying it fwiw
The mesh is the smoothed thing at least on the client
Not sure anymore if CMC smoothed mesh or capsule for sim proxies
Okay, I'll attach to it and check the result. Thanks!
Other than that, do you get any errors about based movement in the logs/output?
In theory this shouldn't matter unless the actual trolley is lagging which you might not be able to spot without standing on it
WOW! In fact this is a lot better !
Huge thanks for that one eXi!
Wow and when I change the network emulation profile from bad to average it gets perfect !
@thin stratus By solving my issue, you just made my day ! 🥳
No worries. The whole mesh vs capsule thing is easy to miss. In most server auth setups (you said yours is client auth), people forget about smoothing and attach visual things, like VFX,other meshes and what not, to the capsule and then it's often very jittery
so the CMC smooths well the capsule AND the mesh ? or only the mesh
At least for the local player when it gets corrections only the mesh
But I would expect the same for sim proxies
Would need to read the code
by local player you mean the automous proxy ?
Yeah
Why would the server still override client position when replicate movement is turned off?
There are no movement components or manual overrides, but the client still rubberbands to server position
I need the client to be able to desync positionally, while still being replicated
@dire cradle Turn off correction?
don't turn off replicate movement
look for the bool in CMC, something along the lines of Client ignore correction
I'm not using CMC
It's a pawn
I solved my issue with another way though it's ok now
Using a non-replicated actor for representing the pawn. I needed it for movement prediction and interpolation
I couldn't get the actual pawn position to not get constantly overriden by the server, even with replicate movement off
It's was so stubborn to rubberband into the server position
ticking order can matter here too
but attaching will make the other pawn move when the base moves too
I'm using fixed time steps, Im not attaching them either
I just make the client control the actor that represents the pawn (at the same time sending inputs to the server), as that is not replicated I can make that client authorititive. And that actor interpolates to the actual pawn's position to sync up based on distance
are you interpolating between fixed timesteps?
Yeah it seems to works well up to 300ms
More than that I dont really care if it works well anyway
300ms is quite a lot
interpolation happens on the client side so it probably doesnt matter if it's fixed steps
but I still use fixed for simplicity
I also use a fixed scheme but I also kind of replace most of the game framework
fixed ticking is nice but I try to make camera rotation run at full rate
but gameplay takes the rotations only once every fixed tick of course
Fun fact: ms don't matter for prediction.
Yeah, that's not my point
and if they have a cap it might be hitting that
but yeah in theory it should not matter
but every implementation has sensible limits I find
Sure, if you have some limit that breaks the system above x ms, then it matters.
For physics objects I use full prediction and those can have several seconds of latency with no real impact unless there is player input.
But beyond that, if movement works on 30ms, it will on 300ms.
The important part is if the movement handles corrections and dropped packages well.
For characters I do semi-prediction, player doesn't wait for the server to move but interpolates to the server position at the same time
have you found any?
Do servers have garbage collection? Like if I would create many objects and replicate them and after a little stop using them and also stop replicating them will they get garbage collected inside the server or do I need to do that manually?
They'll be garbage collected once nothing references them
So just assign nullptr to whatever UPROPERTY() holds the UObject
I knew that. But does the server do garbage collection too?
the server is also your unreal engine game... so yes
What I did was call the RemoveReplicatedSubObject() function to remove the object from replication and then call ConditionalBeginDestroy() using the object I removed replication from
Ok cool. But does removereplicatedsubobject remove the reference of the object inside the server so that the server could garbage collect it?
is that the only thing referencing it?
Uhh... Like the replicated subobject list?
or something
It's an object not an actor so maybe?
I have no idea 
is it stored in a uobject pointer that is a strong referenced pointer (uproperty on a regular pointer for example) or added in AddReferencedObjects?
you can also just print object refs if you know the name of the object
How do I do that?
.
This would make it easier to see if I removed all references from the object or not
looks like they are stored as weak pointers by default in the old replicated subobject list
reading the source code to just see what is happening is worth doing here instead of guessing
ok
I think you would have to store a reference to these yourself somewhere else
in your game's code
Reference Viewer
an example of obj refs
Should i create my systems like Inventory that is going to be replicated, in C++? I already created the system in BP but since i want to replicate it, I can convert into C++.
I heard BP is also available for multiplayer but limited, so i dont want to think about if i am going to encounter with obstacles in blueprint side, and then try to convert everyting into C++. 😄
Yeah, when tackling Multiplayer you are better of creating most of the core logic in C++.
You have access to more functions and variables of existing classes that aren't available in Blueprints.
There are also a lot of general concepts and "ways of doing things" that are not possible with Blueprints.
Especially your Inventory is usually done via "FastArraySerializer" stuff (which is rather complex for beginners), which won't ever be a thing for Blueprints (at least not natively).
you don't have to use c++, especially if you aren't going crazy with your game
but I'd make an inventory system in c++ anyway
I though I understand replication, but it seems I can't move my actor on client 
I wont, it will be typical inventory, craft & a little bit combat and thats all.
Yeah sure. I will transfer it to C++. Its not very much deal for me, I am just scared about C++ & UI relationship. Never done that. Since All the code is inside C++. Maybe i should serialize the array etc.
C++ and UI relationship?
That's actually rather easy
You can make C++ classes of UUserWidget and code everything you need there. And if you need a "link" to the actual visual thing, like a Textblock, and Image, etc., you can create variables that bind to those if they are added later.
E.g.
UPROPERTY(meta = (BindWidget))
TObjectPtr<UTextBlock> StackCountText = nullptr;
If you then make a Widget Blueprint based on that C++ UUserWidget, you'll get told that the widget needs a Textblock with the name StackCountText.
Can also be made optional via BindWidgetOptional.
That way you can freely design the widget, place the Textblock and what not where you need it, but use it in C++ just fine.
Just make sure you check if the pointer is valid. 😅
It should support all existing UWidgets as well as UUserWidgets. So you can also require things like VerticalBox, or even your own classes.
Or a generic parent fwiw. Like if you want to support either vertical or horizontal box, but don't want to decide it c++, you can use the parent class.
It's quite flexible. And having a c++ class of your inventory, slot, entry etc widgets, is very useful if you want to reference them, create them from c++ etc.
Hmm, that sounds easy actually. And to reference to that widget, for example when player clicks "I" button, should PlayerController create Inventory widget and then access to its methods for binding etc, to create slots for example.
Ah, you can do that, it depends on what Context your Inventory should exist in.
If your Inventory exists on the PlayerController as Component, then that's fine.
If it exists only on your Pawn/Character, then the PlayerController makes less sense.
Cause you would be able to open the Inventory (or try) even when the Pawn is invalid.
On top of that, I would probably have an InputMappingContext and InputAction for the Inventory, and then have the InventoryComponent bind that stuff directly.
That way everything is nicely contained and you can expose a TSubclassOf<UYourInventoryWidget> variable in the Component and set that to the Blueprint Widget child class, so the Component can spawn it.
That way you can also have stuff like Chests spawns a different widget fwiw.
For binding the Input, if the InventoryComponent is in fact on your Pawn, the easiest way would be to override SetupPlayerInputComponent on said Pawn, and then getting the InventoryComponent and calling a custom function that passes the InputComponent along. Fwiw already casted to EnhancedInputComponent, cause you gonna be using that in most cases anyway.
Then the InventoryComponent can push the IMC and bind to the InputAction (you can expose both also to Blueprints so you can set them in the Editor).
There is also a way to do that via the WorldSubsystem of EnhancedInput, I believe, at least I saw some code for doing it for "stuff" that doens't have an owning player.
But I would argue that a Component on a Pawn that has an owning Player does not fall into that category.
Seems a bit weird, wrong and redundant 🤔
void APlayerCameraPawn::MoveActor(const FVector& forward)
{
/// some code with logic...
this->SetActorLocation(this->GetActorLocation() + moveVector);
ServerActorLocation(this->GetActorLocation() + moveVector);
}
void APlayerCameraPawn::ServerActorLocation_Implementation(const FVector& newLoc)
{
this->SetActorLocation(newLoc);
}
Thank you very much for detailed explanation! ❤️
One thing confused me is, I created simple Interaction system with BPI_Interactable. Inside Player, I press E, and call ServerRPC, then Multicast and call the Interact method of the target object.
I thought i made it right, to test things out, Other client didnt see the object disappeared. Is this because Player only destroyed its own instance even if its sending RPC? Should that interactables also be replicated? What was wrong here?
Here is my method, i think i am kinda confused about local and etc. Now by looking, i also check for all clients to active interactable etc, which causing "zero" since they dont have any active interactable. Hmm. Thats kinda... well. I just only want to destroy the object on the other clients, which actually "Interact" method do.
Multicast is probably wrong here either way. For starters it should be enough for the server to handle everything
Yeah, just testing things out to sync for a moment.
You can later add some form of prediction and handle some things locally first, but unless specifically needed, Multicast doesn't seem needed
I simply go on a rock with server, then interact, and send rpc.
So that other clients should check. But i can see now, they will also call that method, which causing "active interactable to be zero". right.
Then how would you create that system with your solution?
A character interact with something. -> Custom logic to add item to inventory then destroy object.
- Other clients will see the interacted object is destroyed.
Thanks for your time mate!
I am just trying to find a way of doing things without "multicasting" to share data other clients with "states". Disappearing objects, changing world state etc.
BTW, I read your docs, its really written well and basic. It makes much more sense to all those stuffs.
@remote tusk Are you using a ListenServer or DedicatedServer?
ListenServer being a Player is the Host.
DedicatedServer being a headless Server process.
I am using Listener server, so i am both server and client.
I am inside an empty project, and testing things out like, creating widget for local users.
At the end of the line, I add widget, because thats the earliest one that i can detect if Is Locally Controlled working.
All the tutorials are shown in Youtube for replication interaction system, is using ServerRPC and Multicast 
So i cant find another way.
Thats muhc more scalable. So that everyone can have their own widget, storage etc.
Yeah it's in theory fine to add some main stuff there.
But in C++ would then better, cause you can't get that Widger ref otherwise, but let's stick to BPs.
What helps me a bit is visualizing the World as seperate copies of one another.
In 2D they would just be squares, next to each other, but invisible to each other.
One square is the ListenServer, the other is the Client.
For ListenServer stuff, you don't have to think about an RPC, as you are already the Server.
You will still let the ListenServer run through the same code, as ServerRPCs will automatically be handled as a normal function call for them.
Now if you picture these two squares being empty despite a blue circle and a gray triangle.
The Blue Circle is the Pawn, the Gray Triangle is your stone.
If the Client modifies the Triangle to be pink instead of gray (so changing it state), it will work, but only for the Client.
The other square, the Server in this case, won't get an update. If you add another world as a square next to it, for another Client, that also wouldn't get the update, cause replication only goes Server -> Client (dispite the ServerRPC).
So, you gotta ServerRPC in the Pawn/Blue Square in this simple example, as that's the only thing owned by the player here.
The ServerRPC can be pictured as the invisible connection over to the other square. Its code will execute in the Server's blue circle. If you then multicast, you'd bridge the gap between the Server's square and the Client (clients if there are multiple). At least in theory that is.
Now the color is a state though, so multicasting is wrong. You'd instead set a replicated variable, such as a color, and mark it as RepNotify. The Server changes it, the change gets replicated to the Client squares, and the OnRep will get called when the value changed and arrived (in BP also for the Server, in C++ not). Then the OnRep can use the color variable and change the color of the triangle.
That concept works for all your interaction stuff in theory.
@remote tusk
I hope that somewhat helps for your Inteaction stuff.
And also might explain why you don't really need that Multicast RPC.
You did, however, ask something that I forgot to answer:
Should that interactables also be replicated?
In most cases: Yes.
Otherwise, you can't have the State replicated down to the Clients.
If you want to do the example of interacting with the Stone and destroying the Actor, then you'd need to mark it as Replicated as well. Calling DestroyActor on the Server will automatically replicate then. No need for an RPC or ReplicatedVariable/OnRepVariable
All you'd need to do is:
- ServerRPC in your InteractionComponent (or Pawn, whatever you example currently has).
- Determine the Interactable on the Server. That's a key-point, because the Client shouldn't send a pointer to the interactable to the Server. That would mean it can cheat and tell the Server it interacts with something out of reach. If you want to interact via a LineTrace, you should do the LineTrace on the Server (too).
- Call the Interact Interface Function on the Interactable (e.g. HitActor of the LineTrace).
- In the Stone, where you implement the Interact Interface Function, simply call "Destroy Actor" or whatever the BP node is called.
btw, if you want to test "Late Connecting" clients for Multicast vs OnRep, you can enable the Late Join feature (experimental) in your Editor Preferences iirc.
Should be in most UE5 versions. That will add a new button at the top when you are playing as a server that will add a new client.
Hello,
Do dedicated servers using steam network should have port 7777 forwarded?
I tested with spacewar and I can see my dedicated server as a LAN server, but not on "internet"
LogNet: Display: SteamNetDriver_2147482492 bound to port 7777
LogNet: Name:GameNetDriver Def:GameNetDriver SteamNetDriver_2147482492 IpNetDriver listening on port 7777
For Steam, try port forwarding TCP and UDP 27015 (https://help.steampowered.com/en/faqs/view/2EA8-4D75-DA21-31EB). Might have to add those as Inbound rules in your firewall as well.
Alright, I'll give it a try on my vps
I'm very appreciated on your effort on that! ❤️ Its much much more clear for me.
Shouldnt this work only for the server side? For example, If client clicks I (i mean the client that is not the server, not host.) nothing will happen right? Thats what i assumed, because its only executed on Server.. But since the client is not the server, how MY UI is also activated in second client?
I think i completely misunderstood Run On Client RPC, I thought Server would execute this only. Even client can call it. But isnt the same as calling it locally? Whats the difference than calling it locally, or calling owning client? If i do it locally, both client will open Inventory, is that the reasonn? So its like checking; IsLocallyControlled, then calling local function?
This is also working.. IDK why i made owning client RPC. Watching a tutorial. I thought this one would cause an issue of opening UI on both side. Since we didnt check locally controlled etc since we click on I. Is this because Enhanced Input action has some differences?
If you didn't do anything wrong with binding input events, then this should only lead to the Server calling the event in itself, so as a normal event.
ClientRPC is just Server -> Owning Client
It's the inverse of a ServerRPC
Yes, but how second client call that, since its not the server
On the first setup, if I click "I" on the second client, which is not host or server, it still opens the UI
Client calling a ClientRPC will simply run it as a normal event.
Again, inverse of the ServerRPC.
Alright, that is much more clear, so we dont have to check "IsLocallyControlled" because its already working on owner. not on the others. I liked that actually.
You would only use that RPC if you want to tell the Client to do something as the Server.
Not to gate execution.
RPCs are generally not meant to gate execution.
Your usecase for the ClientRPC is bascially the most redundant one.
Because both ListenServer and Client only execute input locally.
So the ClientRPC will, in both cases, only run on their Machine.
If the Server would get the Pawn of the Client and then call a ClientRPC, then it would call on that client.
I think thats the info I needed, I thought that if i click "I" in first client, that would also occur in second, because we didnt check Ownership or smth.
When you said, "normal event". is it really a normal one, i mean sudden sync on the owner?
When client calls clientRpc.
Got it, IDK why tutorial instructor went that way to open inventory UI for locally.
A random setup to try the ClientRPC:
- Put a ClientRPC into the Pawn that opens/closes the UI.
- When IA_Inventory triggers, use "GetAllActorsOfClass" and put the Pawn class into the input
- Loop over the returned Array (optionally cast to your Pawn class if it's not already), check "IsLocallyControlled", and if that returns false, call the ClientRPC
And then see what either of them do.
Hmm, good idea to debug actually. Thank you man, going to try this out
The result would probably be that:
- If Server presses it, it will open the UI on the Client.
- If Client presses it, it will try to open the UI on the Client, but via the Pawn of the Server, and that is probably not having a valid RootLayout reference, and simply do nothing (or rather report accessed none upon stopping play).
Yeah not sure, that would only be needed if they want the server to tell the Client to open the UI. Which is often a strange idea.
Here are the two tables for the RPC Invoked from the/a Server/Client
Anyway, I gotta log out for now.
Thank you for your time sir. Have a good day.
I think for the actual connection, 7777 is correct. But you are having issues with the "advertising" of the server on steam's end, and that's 27015 I believe. Also called Query Port.
(just to double down on the suggestion)
I opened both 7777 / 27015 on udp and I can connect only using session id. (open steam.90261081941983260)
since i can't search & find my dedicated server
Probably I have to set the server as "secure" or something else. (My DefaultEngine.ini )
*not a big deal, I'll figure it out later, thanks for helping
any chance 2.0 will have support for changing the rotation rate dynamically?
Your question doesn't make sense in the given context
Will need to be more specific about what you want it to do
i would like to force the player to rotate more slowly when a certain status is applied, somethign like the turn speed cap in mordhau while swinging
Oh I see. Yeah that's easy enough for me to add. I will include it in the 1.3.0 update
@rose pollen Just btw, turn in place is typically disabled under root motion, so I don't think it will do what you want
its not turn in place I'm concerned with, its the allowed rotation speed on the character capsule
I see. Then I can't help with that 🙂
the rotation rate cap does exactly what I want already, it just client/server staying in sync and not triggering any rotation corrections if the cap changes that I am concerned about, is smoothly handling changes to the rotation rate fundamentally different than changing the move speed?
Oh. Wait. You're talking about predicted movement, not my turn in place plugin
Got my wires crossed
You can just override the functions where it applies the rotation rate lol, you don't need my plugin to do anything
what is correct way to implement moving replication in unreal engine? I am not using move component thus I am making my own.
I am thinking about 2 concepts:
- Send RPC to server wait for updated position.
- Move actor locally, send update to server. In this case I don't understand why pawns are also updated in all clients except current player. Is cpp RPC different?
How do I properly predict local changes? 😛
You're going to go through hell if you try to make your own
this explains a lot about how it works
im making simple one, with no collision so not really :d
I asked more about repolication